Skip to content

Commit

Permalink
Accessibility #4: Make alerts accessible, Added new setting under misc.
Browse files Browse the repository at this point in the history
  • Loading branch information
agilewarealok committed May 31, 2018
1 parent 6ea9063 commit d19abfd
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions CRM/Admin/Form/Setting/Miscellaneous.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions CRM/Core/Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 15 additions & 0 deletions api/v3/examples/Setting/GetFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion js/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
15 changes: 15 additions & 0 deletions settings/Core.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions templates/CRM/Admin/Form/Setting/Miscellaneous.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
<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>
Expand Down
1 change: 1 addition & 0 deletions templates/CRM/common/l10n.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/common/notifications.tpl
Original file line number Diff line number Diff line change
@@ -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>
Expand Down

0 comments on commit d19abfd

Please sign in to comment.