diff --git a/CRM/Contact/Page/DashBoard.php b/CRM/Contact/Page/DashBoard.php index 657fa89e1b32..87cdc6ed1d9e 100644 --- a/CRM/Contact/Page/DashBoard.php +++ b/CRM/Contact/Page/DashBoard.php @@ -50,8 +50,6 @@ public function run() { $resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE); $resources->addStyleFile('civicrm', 'css/dashboard.css'); - $config = CRM_Core_Config::singleton(); - $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject); CRM_Utils_System::setTitle(ts('CiviCRM Home')); @@ -71,50 +69,6 @@ public function run() { $this->assign('hookContentPlacement', $contentPlacement); } - //check that default FROM email address, owner (domain) organization name and default mailbox are configured. - $fromEmailOK = TRUE; - $ownerOrgOK = TRUE; - $defaultMailboxOK = TRUE; - - // Don't put up notices if user doesn't have administer CiviCRM permission - if (CRM_Core_Permission::check('administer CiviCRM')) { - $destination = CRM_Utils_System::url( - 'civicrm/dashboard', - 'reset=1', - FALSE, NULL, FALSE - ); - - $destination = urlencode($destination); - - list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE); - - if (!$domainEmailAddress || $domainEmailAddress == 'info@EXAMPLE.ORG') { - $fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}"); - $this->assign('fixEmailUrl', $fixEmailUrl); - $fromEmailOK = FALSE; - } - - $domain = CRM_Core_BAO_Domain::getDomain(); - $domainName = $domain->name; - if (!$domainName || $domainName == 'Default Domain Name') { - $fixOrgUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}"); - $this->assign('fixOrgUrl', $fixOrgUrl); - $ownerOrgOK = FALSE; - } - - if (in_array('CiviMail', $config->enableComponents) && - CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG" - ) { - $fixDefaultMailbox = CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1&civicrmDestination={$destination}"); - $this->assign('fixDefaultMailbox', $fixDefaultMailbox); - $defaultMailboxOK = FALSE; - } - } - - $this->assign('fromEmailOK', $fromEmailOK); - $this->assign('ownerOrgOK', $ownerOrgOK); - $this->assign('defaultMailboxOK', $defaultMailboxOK); - $communityMessages = CRM_Core_CommunityMessages::create(); if ($communityMessages->isEnabled()) { $message = $communityMessages->pick(); diff --git a/CRM/Utils/Check.php b/CRM/Utils/Check.php index b61f165ed598..a0bdcfc048bc 100644 --- a/CRM/Utils/Check.php +++ b/CRM/Utils/Check.php @@ -84,11 +84,12 @@ public function showPeriodicAlerts($messages = NULL, $filter = array(__CLASS__, $statusMessages = array(); $statusType = 'alert'; + uasort($messages, array(__CLASS__, 'severitySort')); foreach ($messages as $message) { if ($filter === TRUE || call_user_func($filter, $message->getSeverity()) >= 3) { $statusType = (call_user_func($filter, $message->getSeverity()) >= 4) ? 'error' : $statusType; - $statusMessages[] = $message->getMessage(); - $statusTitle = $message->getTitle(); + $statusMessage = $message->getMessage(); + $statusMessages[] = $statusTitle = $message->getTitle(); } } @@ -97,9 +98,7 @@ public function showPeriodicAlerts($messages = NULL, $filter = array(__CLASS__, $statusTitle = ts('Multiple Alerts'); $statusMessage = ''; } - else { - $statusMessage = array_shift($statusMessages); - } + // TODO: add link to status page CRM_Core_Session::setStatus($statusMessage, $statusTitle, $statusType); } @@ -107,6 +106,22 @@ public function showPeriodicAlerts($messages = NULL, $filter = array(__CLASS__, } } + /** + * Sort messages based upon severity + * + * @param CRM_Utils_Check_Message $a + * @param CRM_Utils_Check_Message $b + * @return integer + */ + public function severitySort($a, $b) { + $aSeverity = $a->getSeverity(); + $bSeverity = $b->getSeverity(); + if ($aSeverity == $bSeverity) { + return 0; + } + return (self::severityMap($aSeverity) > self::severityMap($bSeverity)); + } + /** * Get the integer value (useful for thresholds) of the severity. * diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index 461be3439e40..24e63310523a 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -43,7 +43,9 @@ public function checkAll() { $messages = array_merge( $this->checkMysqlTime(), $this->checkDebug(), - $this->checkOutboundMail() + $this->checkOutboundMail(), + $this->checkDomainNameEmail(), + $this->checkDefaultMailbox() ); return $messages; } @@ -66,7 +68,7 @@ public function checkMysqlTime() { 2 => $sqlNow, 3 => $phpNow, )), - ts('Environment Settings'), + ts('Timestamp Mismatch'), \Psr\Log\LogLevel::ERROR ); } @@ -86,7 +88,7 @@ public function checkDebug() { 'checkDebug', ts('Warning: Debug is enabled in system settings. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))), - ts('Debug Mode'), + ts('Debug Mode Enabled'), \Psr\Log\LogLevel::WARNING ); } @@ -110,7 +112,7 @@ public function checkOutboundMail() { 'checkOutboundMail', ts('Warning: Outbound email is disabled in system settings. Proper settings should be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))), - ts('Outbound Email Settings'), + ts('Outbound Email Disabled'), \Psr\Log\LogLevel::WARNING ); } @@ -118,4 +120,66 @@ public function checkOutboundMail() { return $messages; } + /** + * Check that domain email and org name are set + * @return array + */ + + public function checkDomainNameEmail() { + $messages = array(); + + list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE); + $domain = CRM_Core_BAO_Domain::getDomain(); + $domainName = $domain->name; + $fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1"); + + if (!$domainEmailAddress || $domainEmailAddress == 'info@EXAMPLE.ORG') { + if (!$domainName || $domainName == 'Default Domain Name') { + $msg = ts("Please enter your organization's name, primary address, and default FROM Email Address (for system-generated emails).", + array(1 => $fixEmailUrl)); + } + else { + $msg = ts('Please enter a default FROM Email Address (for system-generated emails).', + array(1 => $fixEmailUrl)); + } + } + elseif (!$domainName || $domainName == 'Default Domain Name') { + $msg = ts("Please enter your organization's name and primary address.", + array(1 => $fixEmailUrl)); + } + $messages[] = new CRM_Utils_Check_Message( + 'checkDomainNameEmail', + $msg, + ts('Complete Setup'), + \Psr\Log\LogLevel::WARNING + ); + + return $messages; + } + + /** + * Checks if a default bounce handling mailbox is set up + * @return array + */ + + public function checkDefaultMailbox() { + $messages = array(); + $config = CRM_Core_Config::singleton(); + + if (in_array('CiviMail', $config->enableComponents) && + CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG" + ) { + $message = new CRM_Utils_Check_Message( + 'checkDefaultMailbox', + ts('Please configure a default mailbox for CiviMail.', + array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1"))), + ts('Configure Default Mailbox'), + \Psr\Log\LogLevel::WARNING + ); + $message->addHelp(ts('Learn more in the user guide', array(1 => 'http://book.civicrm.org/user/advanced-configuration/email-system-configuration/'))); + $messages[] = $message; + } + + return $messages; + } } diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php index e52c7ccf5191..59064da39f7b 100644 --- a/CRM/Utils/Check/Message.php +++ b/CRM/Utils/Check/Message.php @@ -54,6 +54,12 @@ class CRM_Utils_Check_Message { */ private $level; + /** + * @var string + * help text (to be presented separately from the message) + */ + private $help; + /** * @param string $name * Symbolic name for the check. @@ -105,21 +111,33 @@ public function getLevel() { /** * Alias for Level * @return string - **/ + */ public function getSeverity() { return $this->getLevel(); } + /** + * Set optional additional help text + * @param string help + */ + public function addHelp($help) { + $this->help = $help; + } + /** * @return array */ public function toArray() { - return array( + $array = array( 'name' => $this->name, 'message' => $this->message, 'title' => $this->title, - 'level' => $this->level, + 'severity' => $this->level, ); + if (!empty($this->help)) { + $array['help'] = $this->help; + } + return $array; } } diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index 706afb4a3c9b..eb4cb3a16c51 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -111,7 +111,7 @@ public function checkLogFileIsNotAccessible() { $messages[] = new CRM_Utils_Check_Message( 'checkLogFileIsNotAccessible', ts($msg, array(1 => $log_url, 2 => $docs_url)), - ts('Security Warning'), + ts('Debug Log Downloadable'), \Psr\Log\LogLevel::CRITICAL ); } @@ -159,7 +159,7 @@ public function checkUploadsAreNotAccessible() { 2 => $privateDir, 3 => $heuristicUrl, )), - ts('Security Warning'), + ts('Private Files Readable'), \Psr\Log\LogLevel::WARNING ); } @@ -206,7 +206,7 @@ public function checkDirectoriesAreNotBrowseable() { $messages[] = new CRM_Utils_Check_Message( 'checkDirectoriesAreNotBrowseable', ts($msg, array(1 => $publicDir, 2 => $publicDir, 3 => $docs_url)), - ts('Security Warning'), + ts('Browseable Directories'), \Psr\Log\LogLevel::ERROR ); } @@ -255,7 +255,7 @@ public function checkFilesAreNotPresent() { $messages[] = new CRM_Utils_Check_Message( 'checkFilesAreNotPresent', ts('File \'%1\' presents a security risk and should be deleted.', array(1 => $file)), - ts('Security Warning'), + ts('Unsafe Files'), $file[1] ); } diff --git a/css/civicrm.css b/css/civicrm.css index ee95e8ce456d..385c00e86ce4 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3362,33 +3362,6 @@ div.m ul#civicrm-menu, #crm-container .crm-fb-tweet-buttons { width: 93%; } -#crm-container div.finalconf-button { - float: right; - padding: 5px 0 0 0; -} -#crm-container div.finalconf-button input { - margin: 0; -} -#crm-container div.finalconf-intro { - padding-bottom: 12px; - font-style: italic; -} -#crm-container h4.finalconf-item { - border-top: 1px solid #ccc; - padding: 8px 0 8px 10px; - margin: 0; -} -#crm-container div.finalconf-itemdesc { - font-style: italic; - padding: 6px 12px 6px 12px; - color: #666; - float: right; - width: 60%; -} -#crm-container h4.finalconf-btm { - border-bottom: 1px solid #ccc; - margin-bottom: 20px; -} /* classes related to batch entry operation */ .crm-container span.batch-edit, diff --git a/templates/CRM/Contact/Page/DashBoardDashlet.tpl b/templates/CRM/Contact/Page/DashBoardDashlet.tpl index c653fa44394d..5469fd14c1c5 100644 --- a/templates/CRM/Contact/Page/DashBoardDashlet.tpl +++ b/templates/CRM/Contact/Page/DashBoardDashlet.tpl @@ -26,37 +26,6 @@ {include file="CRM/common/dashboard.tpl"} {include file="CRM/common/openFlashChart.tpl"} {* Alerts for critical configuration settings. *} -{if ! $fromEmailOK || ! $ownerOrgOK || ! $defaultMailboxOK} -
-
- {ts}There are a few things to setup before using your site ...{/ts} -
- {if ! $ownerOrgOK} -
-
{ts}Go{/ts}
-
-
{ts}Please enter your organization's name and primary address.{/ts}
-

 {ts}Organization Name{/ts}

-
- {/if} - {if ! $fromEmailOK} -
-
{ts}Go{/ts}
-
-
{ts}Please enter a default FROM Email Address (for system-generated emails).{/ts}
-

 {ts}From Email Address{/ts}

-
- {/if} - {if ! $defaultMailboxOK} -
-
{ts}Go{/ts}
-
-
{ts}Please configure a default mailbox for CiviMail.{/ts} ({ts}learn more{/ts})
-

 {ts}Default CiviMail Mailbox{/ts}

-
- {/if} -
-{/if} {$communityMessages}