From 2a24367582f83937cc4584e695751b40a3c3ca37 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 9 Dec 2015 16:34:48 -0500 Subject: [PATCH] SystemCheck help improvements --- CRM/Utils/Check/Env.php | 25 +++++++++++-------------- ang/crmStatusPage/StatusPage.html | 2 +- ang/crmStatusPage/StatusPageCtrl.js | 2 +- js/Common.js | 28 ++++++++++++++++++---------- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index 51089006bd..9a6241ef99 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -223,7 +223,11 @@ class CRM_Utils_Check_Env { \Psr\Log\LogLevel::WARNING, 'fa-envelope' ); - $message->addHelp(ts('Learn more in the user guide', array(1 => 'http://book.civicrm.org/user/advanced-configuration/email-system-configuration/'))); + $docUrl = 'target="_blank" href="' . CRM_Utils_System::docURL(array('page' => 'user/advanced-configuration/email-system-configuration/', 'URLonly' => TRUE)) . '""'; + $message->addHelp( + ts('A default mailbox must be configured for email bounce processing.') . '
' . + ts("Learn more in the online documentation.", array(1 => $docUrl)) + ); $messages[] = $message; } @@ -259,26 +263,19 @@ class CRM_Utils_Check_Env { 'fa-clock-o' ); } - elseif ($lastCron > gmdate('U') - 86400) { - $message = new CRM_Utils_Check_Message( - __FUNCTION__, - $msg, - ts('Cron Not Running'), - \Psr\Log\LogLevel::WARNING, - 'fa-clock-o' - ); - $message->addHelp(ts('Learn more in the Administrator\'s Guide supplement', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'))); - $messages[] = $message; - } else { $message = new CRM_Utils_Check_Message( __FUNCTION__, $msg, ts('Cron Not Running'), - \Psr\Log\LogLevel::ERROR, + ($lastCron > gmdate('U') - 86400) ? \Psr\Log\LogLevel::WARNING : \Psr\Log\LogLevel::ERROR, 'fa-clock-o' ); - $message->addHelp(ts('Learn more in the Administrator\'s Guide supplement', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'))); + $docUrl = 'target="_blank" href="' . CRM_Utils_System::docURL(array('resource' => 'wiki', 'page' => 'Managing Scheduled Jobs', 'URLonly' => TRUE)) . '""'; + $message->addHelp( + ts('Configuring cron on your server is necessary for running scheduled jobs such as sending mail and scheduled reminders.') . '
' . + ts("Learn more in the online documentation.", array(1 => $docUrl)) + ); $messages[] = $message; } diff --git a/ang/crmStatusPage/StatusPage.html b/ang/crmStatusPage/StatusPage.html index 5eefc509e0..60d6172656 100644 --- a/ang/crmStatusPage/StatusPage.html +++ b/ang/crmStatusPage/StatusPage.html @@ -26,7 +26,7 @@ diff --git a/ang/crmStatusPage/StatusPageCtrl.js b/ang/crmStatusPage/StatusPageCtrl.js index eba4413d22..822a392e6d 100644 --- a/ang/crmStatusPage/StatusPageCtrl.js +++ b/ang/crmStatusPage/StatusPageCtrl.js @@ -3,7 +3,7 @@ angular.module('statuspage').controller('statuspageStatusPage', function($scope, crmApi, crmStatus, statusData) { $scope.ts = CRM.ts(); - $scope.alert = CRM.alert; + $scope.help = CRM.help; $scope.formatDate = CRM.utils.formatDate; $scope.statuses = statusData.values; diff --git a/js/Common.js b/js/Common.js index 5abee08f67..fda5c0bfda 100644 --- a/js/Common.js +++ b/js/Common.js @@ -1006,21 +1006,29 @@ if (!CRM.vars) CRM.vars = {}; }; var helpDisplay, helpPrevious; + // Non-ajax example: + // CRM.help('Example title', 'Here is some text to describe this example'); + // Ajax example (will load help id "foo" from templates/CRM/bar.tpl): + // CRM.help('Example title', {id: 'foo', file: 'CRM/bar'}); CRM.help = function (title, params, url) { + var ajax = typeof params !== 'string'; if (helpDisplay && helpDisplay.close) { - // If the same link is clicked twice, just close the display - todo use underscore method for this comparison - if (helpDisplay.isOpen && helpPrevious === JSON.stringify(params)) { + // If the same link is clicked twice, just close the display + if (helpDisplay.isOpen && _.isEqual(helpPrevious, params)) { helpDisplay.close(); return; } helpDisplay.close(); } - helpPrevious = JSON.stringify(params); - params.class_name = 'CRM_Core_Page_Inline_Help'; - params.type = 'page'; - helpDisplay = CRM.alert('...', title, 'crm-help crm-msg-loading', {expires: 0}); - $.ajax(url || CRM.url('civicrm/ajax/inline'), - { + helpPrevious = _.cloneDeep(params); + helpDisplay = CRM.alert(ajax ? '...' : params, title, 'crm-help ' + (ajax ? 'crm-msg-loading' : 'info'), {expires: 0}); + if (ajax) { + if (!url) { + url = CRM.url('civicrm/ajax/inline'); + params.class_name = 'CRM_Core_Page_Inline_Help'; + params.type = 'page'; + } + $.ajax(url, { data: params, dataType: 'html', success: function (data) { @@ -1031,8 +1039,8 @@ if (!CRM.vars) CRM.vars = {}; $('#crm-notification-container .crm-help .notify-content:last').html('Unable to load help file.'); $('#crm-notification-container .crm-help').removeClass('crm-msg-loading').addClass('error'); } - } - ); + }); + } }; /** * @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference -- 2.25.1