Accessibility #4: Make alerts accessible, Added new setting under misc.
authorAlok Patel <alok@agileware.com.au>
Thu, 31 May 2018 12:43:48 +0000 (18:13 +0530)
committerAlok Patel <alok@agileware.com.au>
Thu, 31 May 2018 12:43:48 +0000 (18:13 +0530)
CRM/Admin/Form/Setting/Miscellaneous.php
CRM/Core/Resources.php
api/v3/examples/Setting/GetFields.php
js/Common.js
settings/Core.setting.php
templates/CRM/Admin/Form/Setting/Miscellaneous.tpl
templates/CRM/common/l10n.js.tpl
templates/CRM/common/notifications.tpl

index b09068e82ccdf931611909f883fda3b6109eb9ea..5f0cb2c0246abc5e0f4d3da715b4206176dd1b59 100644 (file)
@@ -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;
index cf937ffa2bb10084c7fefa237f4736f0425cfd3c..d6e0a2aa614068d34d98eb99a06cc311d8563223 100644 (file)
@@ -690,6 +690,7 @@ class CRM_Core_Resources {
         '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();
index 3d2c08eaf8b3aeee699bbfa6f3bd401a12901995..793a47b9babe30efe9103cc6f35897b337b8ee51 100644 (file)
@@ -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',
index 43cc526b7213c192b4d2e000f7634bbe9720f7b6..99d23a0bd745f129def2ee5315cd080438bf11f5 100644 (file)
@@ -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()) {
index 0efc087dac7997ce85808a62e8cf56e1d55a5ff0..75a0e1563ec6f2975657a2a0d57ea8ebaa6004af 100644 (file)
@@ -192,6 +192,21 @@ return array(
     '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',
index d232d739a837749c1ccafa327ab865dfc788a039..b94f6602412fdd5fb977c8ef69055cddac5e9951 100644 (file)
             <p class="description">{ts}If enabled, CiviCRM will allow users to submit profiles from external sites. This is disabled by default to limit abuse.{/ts}</p>
           </td>
         </tr>
+        <tr class="crm-miscellaneous-form-block-allow_alert_autodismissal">
+            <td class="label">{$form.allow_alert_autodismissal.label}</td>
+            <td>{$form.allow_alert_autodismissal.html}<br />
+                <p class="description">{ts}If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.{/ts}</p>
+            </td>
+        </tr>
     </table>
 
     <h3>{ts}reCAPTCHA Keys{/ts}</h3>
index cacc15e1b9006abca4cda5746d50d3b09ba90a2e..9bae533886bd69d5ad56cf83d11d53ffd166bd87 100644 (file)
@@ -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});
index 136c1c4dac29c07b846629163c5be4bfd76ae7c1..8da189d6ea4b4fcc239cc215d95c30be7271a51e 100644 (file)
@@ -1,4 +1,4 @@
-<div id="crm-notification-container" style="display:none">
+<div id="crm-notification-container" role="alert" aria-live="assertive" aria-atomic=”true” style="display:none">
   <div id="crm-notification-alert" class="#{ldelim}type{rdelim}">
     <div class="icon ui-notify-close" title="{ts}close{/ts}"> </div>
     <a class="ui-notify-cross ui-notify-close" href="#" title="{ts}close{/ts}">x</a>