From 72f03b4f9da27a0faf2be26f0aba39c85cff04dc Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 13 Jul 2015 12:15:34 -0400 Subject: [PATCH] CRM-16354 - Update editor_id setting to be human readable --- CRM/Admin/Form/Preferences/Display.php | 6 +----- CRM/Core/Resources.php | 5 +---- settings/Core.setting.php | 4 ++-- templates/CRM/Admin/Form/Preferences/Display.tpl | 2 +- xml/templates/civicrm_navigation.tpl | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index 0c79ba3e63..c046ebf261 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -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); diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 67034a9e6e..e422547419 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -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"; diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 143cee55cb..472756ba62 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -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, diff --git a/templates/CRM/Admin/Form/Preferences/Display.tpl b/templates/CRM/Admin/Form/Preferences/Display.tpl index ff515f7ed5..bde5cdfcb7 100644 --- a/templates/CRM/Admin/Form/Preferences/Display.tpl +++ b/templates/CRM/Admin/Form/Preferences/Display.tpl @@ -237,7 +237,7 @@ }); 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); }); diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 857f694af4..60fed5aca1 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -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}' ), -- 2.25.1