diff --git a/CRM/Admin/Form/Setting/Miscellaneous.php b/CRM/Admin/Form/Setting/Miscellaneous.php index b09068e82ccd..5f0cb2c0246a 100644 --- a/CRM/Admin/Form/Setting/Miscellaneous.php +++ b/CRM/Admin/Form/Setting/Miscellaneous.php @@ -54,6 +54,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting { 'recentItemsProviders' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'dedupe_default_limit' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'remote_profile_submissions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'allow_alert_autodismissal' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, ); public $_uploadMaxSize; diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index cf937ffa2bb1..d6e0a2aa6140 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -690,6 +690,7 @@ public static function outputLocalizationJS() { 'filters' => self::getEntityRefFilters(), ), 'ajaxPopupsEnabled' => self::singleton()->ajaxPopupsEnabled, + 'allowAlertAutodismissal' => Civi::settings()->get('allow_alert_autodismissal'), ); print CRM_Core_Smarty::singleton()->fetchWith('CRM/common/l10n.js.tpl', $vars); CRM_Utils_System::civiExit(); diff --git a/api/v3/examples/Setting/GetFields.php b/api/v3/examples/Setting/GetFields.php index 3d2c08eaf8b3..793a47b9babe 100644 --- a/api/v3/examples/Setting/GetFields.php +++ b/api/v3/examples/Setting/GetFields.php @@ -479,6 +479,21 @@ function setting_getfields_expectedresult() { 'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.', 'help_text' => '', ), + 'allow_alert_autodismissal' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'allow_alert_autodismissal', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => '1', + 'html_type' => 'radio', + 'add' => '4.7', + 'title' => 'Allow alerts to auto-dismiss?', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If disabled, alert messages in CiviCRM will never be automatically dismissed after 10 seconds.', + 'help_text' => '', + ), 'editor_id' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', diff --git a/js/Common.js b/js/Common.js index 43cc526b7213..99d23a0bd745 100644 --- a/js/Common.js +++ b/js/Common.js @@ -1246,7 +1246,7 @@ if (!CRM.vars) CRM.vars = {}; unique: true }; options = $.extend(extra, options); - options.expires = options.expires === false ? 0 : parseInt(options.expires, 10); + options.expires = (options.expires === false || !CRM.config.allowAlertAutodismissal) ? 0 : parseInt(options.expires, 10); if (options.unique && options.unique !== '0') { $('#crm-notification-container .ui-notify-message').each(function () { if (title === $('h1', this).html() && text === $('.notify-content', this).html()) { diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 0efc087dac79..75a0e1563ec6 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -192,6 +192,21 @@ 'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.', 'help_text' => NULL, ), + 'allow_alert_autodismissal' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'allow_alert_autodismissal', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => TRUE, + 'html_type' => 'radio', + 'add' => '4.7', + 'title' => 'Allow alerts to auto-dismiss?', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.', + 'help_text' => NULL, + ), 'editor_id' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', diff --git a/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl b/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl index d232d739a837..b94f6602412f 100644 --- a/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl +++ b/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl @@ -85,6 +85,12 @@

{ts}If enabled, CiviCRM will allow users to submit profiles from external sites. This is disabled by default to limit abuse.{/ts}

+ + {$form.allow_alert_autodismissal.label} + {$form.allow_alert_autodismissal.html}
+

{ts}If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.{/ts}

+ +

{ts}reCAPTCHA Keys{/ts}

diff --git a/templates/CRM/common/l10n.js.tpl b/templates/CRM/common/l10n.js.tpl index cacc15e1b900..9bae533886bd 100644 --- a/templates/CRM/common/l10n.js.tpl +++ b/templates/CRM/common/l10n.js.tpl @@ -33,6 +33,7 @@ $.datepicker._defaults.dateFormat = CRM.config.dateInputFormat = {$config->dateInputFormat|@json_encode}; CRM.config.timeIs24Hr = {if $config->timeInputFormat eq 2}true{else}false{/if}; CRM.config.ajaxPopupsEnabled = {$ajaxPopupsEnabled|@json_encode}; + CRM.config.allowAlertAutodismissal = {$allowAlertAutodismissal}; // Merge entityRef settings CRM.config.entityRef = $.extend({ldelim}{rdelim}, {$entityRef|@json_encode}, CRM.config.entityRef || {ldelim}{rdelim}); diff --git a/templates/CRM/common/notifications.tpl b/templates/CRM/common/notifications.tpl index 136c1c4dac29..8da189d6ea4b 100644 --- a/templates/CRM/common/notifications.tpl +++ b/templates/CRM/common/notifications.tpl @@ -1,4 +1,4 @@ -