Commit 719eda4a authored by eileen's avatar eileen

Convert final settings on the Display form

parent a9ab14a3
......@@ -39,80 +39,32 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
protected $_settings = array(
'contact_view_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_smart_group_display' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_edit_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'advanced_search_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'user_dashboard_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_ajax_check_similar' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'activity_assignee_notification' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'activity_assignee_notification_ics' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'do_not_notify_assignees_for' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'preserve_activity_tab_filter' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'editor_id' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'ajaxPopupsEnabled' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'display_name_format' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'sort_name_format' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);
public function preProcess() {
CRM_Utils_System::setTitle(ts('Settings - Display Preferences'));
$optionValues = CRM_Activity_BAO_Activity::buildOptions('activity_type_id');
$this->_varNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'contact_edit_options' => array(
'html_type' => 'checkboxes',
'title' => ts('Editing Contacts'),
'weight' => 3,
),
'contact_ajax_check_similar' => array(
'title' => ts('Check for Similar Contacts'),
'weight' => 8,
'html_type' => NULL,
),
'editor_id' => array(
'html_type' => NULL,
'weight' => 12,
),
'do_not_notify_assignees_for' => array(
'html_type' => 'select',
'option_values' => $optionValues,
'attributes' => array('multiple' => 1, "class" => "huge crm-select2"),
'title' => ts('Do not notify assignees for'),
'weight' => 14,
),
),
);
parent::preProcess();
}
/**
* @return array
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
parent::cbsDefaultValues($defaults);
return $defaults;
}
/**
* Build the form object.
*/
public function buildQuickForm() {
$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 = Civi::settings()->get('contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$this->assign('invoicing', $invoicing);
$extra = array();
$this->addElement('select', 'editor_id', ts('WYSIWYG Editor'), $wysiwyg_options, $extra);
$this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor'));
$this->addRadio('contact_ajax_check_similar', ts('Check for Similar Contacts'), array(
'1' => ts('While Typing'),
'0' => ts('When Saving'),
'2' => ts('Never'),
));
$editOptions = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0');
$this->assign('editOptions', $editOptions);
......@@ -151,13 +103,8 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
CRM_Core_BAO_OptionValue::updateOptionWeights($opGroupId, array_flip($preferenceWeights));
}
$this->_config->editor_id = $this->_params['editor_id'];
$this->postProcessCommon();
// Fixme - shouldn't be needed
Civi::settings()->set('contact_ajax_check_similar', $this->_params['contact_ajax_check_similar']);
// If "Configure CKEditor" button was clicked
if (!empty($this->_params['ckeditor_config'])) {
// Suppress the "Saved" status message and redirect to the CKEditor Config page
......
......@@ -127,7 +127,7 @@ trait CRM_Admin_Form_SettingTrait {
foreach ($settingMetaData as $setting => $props) {
$quickFormType = $this->getQuickFormType($props);
if (isset($quickFormType)) {
$options = NULL;
$options = CRM_Utils_Array::value('options', $props);
if (isset($props['pseudoconstant'])) {
$options = civicrm_api3('Setting', 'getoptions', [
'field' => $setting,
......
......@@ -214,10 +214,13 @@ return array(
'group' => 'core',
'name' => 'editor_id',
'type' => 'String',
'html_type' => 'Select',
'html_type' => 'select',
'default' => 'CKEditor',
'add' => '4.1',
'title' => ts('Wysiwig Editor'),
'pseudoconstant' => array(
'optionGroupName' => 'wysiwyg_editor',
),
'is_domain' => 1,
'is_contact' => 0,
'description' => NULL,
......@@ -236,6 +239,7 @@ return array(
'is_contact' => 0,
'description' => NULL,
'help_text' => NULL,
'options' => ['1' => ts('While Typing'), '0' => ts('When Saving'), '2' => ts('Never')],
),
'ajaxPopupsEnabled' => array(
'group_name' => 'CiviCRM Preferences',
......@@ -996,9 +1000,9 @@ return array(
'is_domain' => 1,
'is_contact' => 0,
'default' => array(),
'title' => 'Do not notify assignees for',
'help_text' => 'These activity types will be excluded from automated email notifications to assignees.',
'html_type' => 'Select',
'title' => ts('Do not notify assignees for'),
'description' => ts('These activity types will be excluded from automated email notifications to assignees.'),
'html_type' => 'select',
'html_attributes' => array(
'multiple' => 1,
'class' => 'huge crm-select2',
......
......@@ -125,7 +125,7 @@
</tr>
<tr class="crm-preferences-display-form-block-activity_assignee_notification">
<td class="label"></td>
<td>{$form.activity_assignee_notification.html} {$form.activity_assignee_notification.label}</td>
<td>{$form.activity_assignee_notification.html}</td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
......@@ -145,7 +145,7 @@
</tr>
<tr class="crm-preferences-display-form-block-activity_assignee_notification_ics">
<td class="label"></td>
<td>{$form.activity_assignee_notification_ics.html} {$form.activity_assignee_notification_ics.label}</td>
<td>{$form.activity_assignee_notification_ics.html}</td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
......@@ -238,8 +238,8 @@
}
// show/hide activity types based on checkbox value
$('.crm-preferences-display-form-activity_types').toggle($('#activity_assignee_notification').is(":checked"));
$('#activity_assignee_notification').click(function() {
$('.crm-preferences-display-form-activity_types').toggle($('#activity_assignee_notification_activity_assignee_notification').is(":checked"));
$('#activity_assignee_notification_activity_assignee_notification').click(function() {
$('.crm-preferences-display-form-activity_types').toggle($(this).is(":checked"));
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment