CRM-16354 - Update editor_id setting to be human readable
authorColeman Watts <coleman@civicrm.org>
Mon, 13 Jul 2015 16:15:34 +0000 (12:15 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 13 Jul 2015 16:15:34 +0000 (12:15 -0400)
CRM/Admin/Form/Preferences/Display.php
CRM/Core/Resources.php
settings/Core.setting.php
templates/CRM/Admin/Form/Preferences/Display.tpl
xml/templates/civicrm_navigation.tpl

index 0c79ba3e630d7e0f0fbac293d9d221082a1fba09..c046ebf2614066bb72786dd9c60cea066b0b2ac0 100644 (file)
@@ -114,9 +114,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
     $defaults = parent::setDefaultValues();
     parent::cbsDefaultValues($defaults);
 
-    if ($this->_config->editor_id) {
-      $defaults['editor_id'] = $this->_config->editor_id;
-    }
     if ($this->_config->display_name_format) {
       $defaults['display_name_format'] = $this->_config->display_name_format;
     }
@@ -133,13 +130,12 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
    * @return void
    */
   public function buildQuickForm() {
-    $wysiwyg_options = CRM_Core_OptionGroup::values('wysiwyg_editor');
+    $wysiwyg_options = CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name');
 
     //changes for freezing the invoices/credit notes checkbox if invoicing is uncheck
     $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
     $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
     $this->assign('invoicing', $invoicing);
-    $config = CRM_Core_Config::singleton();
     $extra = array();
 
     $this->addElement('select', 'editor_id', ts('WYSIWYG Editor'), $wysiwyg_options, $extra);
index 67034a9e6ec247adc10895ed5cfb3f88765d983f..e422547419b3e99b7e9b212affa459593cfee42b 100644 (file)
@@ -712,10 +712,7 @@ class CRM_Core_Resources {
       "js/crm.ajax.js",
     );
     // add wysiwyg editor
-    $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
-    $editor = CRM_Utils_Array::value($editorID,
-      CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'name')
-    );
+    $editor = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
     $items[] = "js/wysiwyg/crm.wysiwyg.js";
     if ($editor == "CKEditor") {
       $items[] = "bower_components/ckeditor/ckeditor.js";
index 143cee55cb148ea81102c6e8aa08716eda788aae..472756ba62fb2bf5757b54b4496d057b48f1bb39 100644 (file)
@@ -181,8 +181,8 @@ return array(
     'group' => 'core',
     'name' => 'editor_id',
     'type' => 'String',
-    'html_type' => 'Text',
-    'default' => NULL,
+    'html_type' => 'Select',
+    'default' => 'CKEditor',
     'add' => '4.1',
     'title' => 'Wysiwig Editor',
     'is_domain' => 1,
index ff515f7ed5979d0db4fff89982ba1c6689d80ac4..bde5cdfcb7435852cedbac8b5fa7bbb02040d355 100644 (file)
         });
 
         function showCKEditorConfig() {
-          $('.crm-preferences-display-form-block-editor_id .crm-button').toggle($(this).val() == '2');
+          $('.crm-preferences-display-form-block-editor_id .crm-button').toggle($(this).val() == 'CKEditor');
         }
         $('select[name=editor_id]').each(showCKEditorConfig).change(showCKEditorConfig);
       });
index 857f694af4e35ddac75d38017082d96395bc1bc6..60fed5aca1524177f6a50c901cedc8a8f03aae09 100644 (file)
@@ -54,7 +54,7 @@ VALUES
 {contact.country}{/literal}{/serialize}' ),
   ( @domainID, NULL, 1, 'CiviCRM Preferences', 'display_name_format', '{serialize}{literal}{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}{/literal}{/serialize}' ),
   ( @domainID, NULL, 1, 'CiviCRM Preferences', 'sort_name_format', '{serialize}{literal}{contact.last_name}{, }{contact.first_name}{/literal}{/serialize}' ),
-  ( @domainID, NULL, 1, 'CiviCRM Preferences', 'editor_id', '{serialize}2{/serialize}' ),
+  ( @domainID, NULL, 1, 'CiviCRM Preferences', 'editor_id', '{serialize}CKEditor{/serialize}' ),
   ( @domainID, NULL, 1, 'CiviCRM Preferences', 'contact_ajax_check_similar', '{serialize}1{/serialize}' ),
   ( @domainID, NULL, 1, 'CiviCRM Preferences', 'activity_assignee_notification', '{serialize}1{/serialize}' ),
   ( @domainID, NULL, 1, 'CiviCRM Preferences', 'activity_assignee_notification_ics', '{serialize}0{/serialize}' ),