further comment fixes
[civicrm-core.git] / CRM / Admin / Form / Preferences / Display.php
index 599272b50b69217f8838d7909bd0f41f879113c1..b164585e704e143705d258c81c71e5ae3a5aa032 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: Display.php 45499 2013-02-08 12:31:05Z kurund $
- *
  */
 
 /**
@@ -114,9 +112,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;
     }
@@ -129,20 +124,18 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
 
   /**
    * Build the form object.
-   *
-   * @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);
+    $this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor'));
 
     $editOptions = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0');
     $this->assign('editOptions', $editOptions);
@@ -163,9 +156,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action == CRM_Core_Action::VIEW) {
@@ -188,6 +178,15 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
     $this->_config->editor_id = $this->_params['editor_id'];
 
     $this->postProcessCommon();
+
+    // If "Configure CKEditor" button was clicked
+    if (!empty($this->_params['ckeditor_config'])) {
+      // Suppress the "Saved" status message and redirect to the CKEditor Config page
+      $session = CRM_Core_Session::singleton();
+      $session->getStatus(TRUE);
+      $url = CRM_Utils_System::url('civicrm/admin/ckeditor', 'reset=1');
+      $session->pushUserContext($url);
+    }
   }
 
 }