diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 671c8fe7ed3f..103b43680368 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -78,10 +78,7 @@ public function setDefaultValues() { * Build the form object. */ public function buildQuickForm() { - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); - $args = func_get_args(); - $check = reset($args); + CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); $this->addButtons(array( array( 'type' => 'next', @@ -96,9 +93,8 @@ public function buildQuickForm() { ); $descriptions = array(); - foreach ($this->_settings as $setting => $group) { - $settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting)); - $props = $settingMetaData['values'][$setting]; + $settingMetaData = $this->getSettingsMetaData(); + foreach ($settingMetaData as $setting => $props) { if (isset($props['quick_form_type'])) { if (isset($props['pseudoconstant'])) { $options = civicrm_api3('Setting', 'getoptions', array( @@ -150,7 +146,9 @@ public function buildQuickForm() { } } + // setting_description should be deprecated - see Mail.tpl for metadata based tpl. $this->assign('setting_descriptions', $descriptions); + $this->assign('settings_fields', $settingMetaData); } /** @@ -291,4 +289,17 @@ public static function getAutocompleteContactSearch() { ) + $autoSearchFields; } + /** + * Get the metadata relating to the settings on the form, ordered by the keys in $this->_settings. + * + * @return array + */ + protected function getSettingsMetaData() { + $allSettingMetaData = civicrm_api3('setting', 'getfields', array()); + $settingMetaData = array_intersect_key($allSettingMetaData['values'], $this->_settings); + // This array_merge re-orders to the key order of $this->_settings. + $settingMetaData = array_merge($this->_settings, $settingMetaData); + return $settingMetaData; + } + } diff --git a/CRM/Admin/Form/Setting/Mail.php b/CRM/Admin/Form/Setting/Mail.php index 960ce2abae1e..83679cabe9b7 100644 --- a/CRM/Admin/Form/Setting/Mail.php +++ b/CRM/Admin/Form/Setting/Mail.php @@ -37,12 +37,12 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { protected $_settings = array( - 'replyTo' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailerBatchLimit' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'mailThrottleTime' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailerJobSize' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailerJobsMax' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailThrottleTime' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'verpSeparator' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'replyTo' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, ); /** @@ -50,15 +50,9 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - CiviMail')); - $check = TRUE; - - // redirect to Administer Section After hitting either Save or Cancel button. - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); - $this->addFormRule(array('CRM_Admin_Form_Setting_Mail', 'formRule')); - parent::buildQuickForm($check); + parent::buildQuickForm(); } /** diff --git a/templates/CRM/Admin/Form/Setting/Mail.tpl b/templates/CRM/Admin/Form/Setting/Mail.tpl index 964dd095a46f..86194e7c6a27 100644 --- a/templates/CRM/Admin/Form/Setting/Mail.tpl +++ b/templates/CRM/Admin/Form/Setting/Mail.tpl @@ -25,36 +25,8 @@ *} {capture assign=docLink}{docURL page="CiviMail Mailer Settings" text="CiviMail Mailer Settings and Optimization" resource="wiki"}{/capture}
{$form.mailerBatchLimit.label} | {$form.mailerBatchLimit.html} - {ts}Throttle email delivery by setting the maximum number of emails sent during each CiviMail run (0 = unlimited).{/ts} |
-
{$form.mailThrottleTime.label} | {$form.mailThrottleTime.html} - {ts}The time to sleep in between each e-mail in micro seconds. Setting this above 0 allows you to control the rate at which e-mail messages are sent to the mail server, avoiding filling up the mail queue very quickly. Set to 0 to disable.{/ts} |
-
{$form.mailerJobSize.label} | {$form.mailerJobSize.html} - {ts}If you want to utilize multi-threading enter the size you want your sub jobs to be split into. Recommended values are between 1,000 and 10,000. Use a lower value if your server has multiple cron jobs running simultaneously, but do not use values smaller than 1,000. Enter "0" to disable multi-threading and process mail as one single job - batch limits still apply.{/ts} |
-
{$form.mailerJobsMax.label} | {$form.mailerJobsMax.html} - {ts}The maximum number of mailer delivery jobs executing simultaneously (0 = allow as many processes to execute as started by cron){/ts} |
-
{$form.verpSeparator.label} | {$form.verpSeparator.html} - {ts}Separator character used when CiviMail generates VERP (variable envelope return path) Mail-From addresses.{/ts} |
-
{$form.replyTo.label} | {$form.replyTo.html} - {ts}Allow CiviMail users to send mailings with a custom Reply-To header.{/ts} |
-
{$form.$setting_name.label} | {$form.$setting_name.html} + + {ts}{$setting_detail.description}{/ts} + + {if $setting_detail.help_text} + {assign var='tplhelp_id' value = $setting_name|cat:'-id'|replace:'_':'-'}{help id="$tplhelp_id"} + {/if} + |
+