Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added max length info next to 'count' text boxes and flash notificati…

…ons upon settings update success.
  • Loading branch information...
commit 4c66613409d07f321af2b735c2505eb95f2d9915 1 parent 233abd3
benjamin authored
View
14 EE2/system/expressionengine/third_party/md_character_count/ext.md_character_count.php
@@ -171,7 +171,7 @@ public function settings_form($current)
$settings = $this->_get_settings();
- $query = $this->EE->db->query("SELECT c.field_id, g.group_name, c.field_label, c.site_id FROM exp_channel_fields c, exp_field_groups g WHERE c.site_id = ".
+ $query = $this->EE->db->query("SELECT c.field_id, g.group_name, c.field_label, c.field_maxl, c.site_id FROM exp_channel_fields c, exp_field_groups g WHERE c.site_id = ".
$this->EE->config->item('site_id')." AND c.group_id = g.group_id AND field_type IN ( 'textarea', 'text', 'markitup' ) ORDER BY g.group_id, c.field_order");
$channel_fields = $query->result();
@@ -193,7 +193,8 @@ public function settings_form($current)
'lang_ct_count_type' => $this->EE->lang->line('coltitle_count_type'),
'lang_ct_count_format' => $this->EE->lang->line('coltitle_count_format'),
'lang_css_title' => $this->EE->lang->line('css_title'),
- 'lang_css_info' => $this->EE->lang->line('css_info')
+ 'lang_css_info' => $this->EE->lang->line('css_info'),
+ 'lang_max' => $this->EE->lang->line('maximum_label')
);
return $this->EE->load->view('settings_form', $values, TRUE);
@@ -239,7 +240,11 @@ public function save_settings()
);
*/
$ext_class = __CLASS__;
- $query = $this->EE->db->update('exp_extensions', array('settings'=>serialize($this->settings)), "class = '$ext_class'");
+ if ($this->EE->db->update('exp_extensions', array('settings'=>serialize($this->settings)), "class = '$ext_class'"))
+ $this->EE->session->set_flashdata('message_success', $this->EE->lang->line('preferences_updated'));
+ else
+ $this->EE->session->set_flashdata('message_error', 'Update Failed');
+
}
// ----------------------------------------------------------------------
@@ -258,8 +263,7 @@ public function activate_extension()
{
// Setup custom settings in this array.
$default_settings = $this->_build_default_settings();
-
-
+
// get the list of installed sites
$query = $this->EE->db->get("exp_sites");
// if there are sites - we know there will be at least one but do it anyway
View
3  EE2/system/expressionengine/third_party/md_character_count/language/english/md_character_count_lang.php
@@ -39,12 +39,15 @@
'coltitle_count' => 'Count',
'coltitle_count_type' => 'Count Type',
'coltitle_count_format' => 'Count Format',
+'maximum_label' => 'Max',
'check_for_updates_title' => 'Check for updates?',
'check_for_updates_info' => 'MD Character Count can call home (<a href="http://masugadesign.com/">http://masugadesign.com</a>) and check for recent updates. <em>(Requires the <a href="http://leevigraham.com/cms-customisation/expressionengine/lg-addon-updater/">LG Addon Updater</a> Extension)</em>',
'check_for_updates_error' => 'Your php ini must have <code>allow_url_fopen</code> enabled to use this feature.',
'check_for_updates_label' => 'Would you like this extension to check for updates and display them on your CP homepage?',
'cache_refresh_label' => 'How many minutes you like the update check cached for?',
+'settings_update_success' => 'Settings updated successfully.',
+'settings_update_failure' => 'Settings update failed.',
// END
''=>''
View
8 EE2/system/expressionengine/third_party/md_character_count/views/settings_form.php
@@ -73,9 +73,9 @@
$i = 0; $group_name = null;
foreach($channel_fields as $row)
{
- $count_max = @$ext_settings['field_defaults'][$row->field_id]['count_max'];
- $count_type = @$ext_settings['field_defaults'][$row->field_id]['count_type'];
- $count_format = @$ext_settings['field_defaults'][$row->field_id]['count_format'];
+ $count_max = @$ext_settings['field_defaults'][$row->field_id]['count_max'];
+ $count_type = @$ext_settings['field_defaults'][$row->field_id]['count_type'];
+ $count_format = @$ext_settings['field_defaults'][$row->field_id]['count_format'];
$row_class = ($i++ % 2) ? 'odd' : 'even';
if ($group_name != $row->group_name)
@@ -95,7 +95,7 @@
echo '<tr>'
.' <td>'.$row->field_label.'</td>'
- .' <td>'.form_input(array('name' => 'field_defaults['.$row->field_id.'][count_max]', 'value' => $count_max, "style" => "width:80px")).'</td>'
+ .' <td>'.form_input(array('name' => 'field_defaults['.$row->field_id.'][count_max]', 'value' => $count_max, "style" => "width:80px")).'&nbsp; ('.$lang_max.': '.$row->field_maxl.')</td>'
.' <td>'.form_dropdown('field_defaults['.$row->field_id.'][count_type]', array('true' => 'Soft', 'false' => 'Hard'), $count_type).'</td>'
.' <td>'.form_input(array('name' => 'field_defaults['.$row->field_id.'][count_format]', 'value' => $count_format, "style" => "width: 200px")).'</td>'
.'</tr>';
Please sign in to comment.
Something went wrong with that request. Please try again.