From e1674273db2e1a1f1ca025fa30fe842e38fcfa24 Mon Sep 17 00:00:00 2001 From: sunil Date: Fri, 31 Jul 2015 17:45:34 +0530 Subject: [PATCH] Getting started for 4.7 --- CRM/Dashlet/Page/GettingStarted.php | 5 +--- CRM/Upgrade/Incremental/php/FourSeven.php | 24 +++++++++++++++++++ templates/CRM/Dashlet/Page/GettingStarted.tpl | 2 +- xml/templates/civicrm_navigation.tpl | 2 ++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CRM/Dashlet/Page/GettingStarted.php b/CRM/Dashlet/Page/GettingStarted.php index 170a365d30..8489126faa 100644 --- a/CRM/Dashlet/Page/GettingStarted.php +++ b/CRM/Dashlet/Page/GettingStarted.php @@ -39,7 +39,7 @@ class CRM_Dashlet_Page_GettingStarted extends CRM_Core_Page { const CHECK_TIMEOUT = 5; - const CACHE_DAYS = 10; + const CACHE_DAYS = 5; const GETTING_STARTED_URL = 'https://alert.civicrm.org/welcome?prot=1&ver={ver}&uf={uf}&sid={sid}&lang={lang}&co={co}'; /** @@ -119,9 +119,6 @@ class CRM_Dashlet_Page_GettingStarted extends CRM_Core_Page { return NULL; } - // Clean up description - remove tags that would break dashboard layout - $html = preg_replace('#]*>(.+?)]*>#s', '

$1

', $html); - $html = strip_tags($html, "


    • "); $tokensList = CRM_Utils_Token::getTokens($html); $this->replaceLinkToken($tokensList, $html); if ($html) { diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index 9398979f9b..1975099a68 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -92,4 +92,28 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base return $editorID; } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_4_7_alpha2($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'add_getting_started_dashlet'); + } + + public function add_getting_started_dashlet(CRM_Queue_TaskContext $ctx) { + $sql = "SELECT count(*) FROM civicrm_dashboard WHERE name='gettingStarted'"; + $res = CRM_Core_DAO::singleValueQuery($sql); + $domainId = CRM_Core_Config::domainID(); + if ($res <= 0) { + $sql = "INSERT INTO `civicrm_dashboard` + ( `domain_id`, `name`, `label`, `url`, `permission`, `permission_operator`, `column_no`, `is_minimized`, `is_active`, `weight`, `fullscreen_url`, `is_fullscreen`, `is_reserved`)` VALUES ( {$domainId}, 'getting-started', 'CiviCRM Getting Started', 'civicrm/dashlet/getting-started?reset=1&snippet=5', 'access CiviCRM', NULL, 0, 0, 1, 0, 'civicrm/dashlet/getting-started?reset=1&snippet=5&context=dashletFullscreen', 1, 1)"; + CRM_Core_DAO::executeQuery($sql); + // Add default position for Getting Started Dashlet ( left column) + $sql = "INSERT INTO `civicrm_dashboard_contact` (dashboard_id, contact_id, column_no, is_active) +SELECT (SELECT MAX(id) FROM `civicrm_dashboard`), contact_id, 0, IF (SUM(is_active) > 0, 1, 0) +FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id"; + CRM_Core_DAO::executeQuery($sql); + } + } } diff --git a/templates/CRM/Dashlet/Page/GettingStarted.tpl b/templates/CRM/Dashlet/Page/GettingStarted.tpl index 8cbf4c44fb..7da8e5a18c 100644 --- a/templates/CRM/Dashlet/Page/GettingStarted.tpl +++ b/templates/CRM/Dashlet/Page/GettingStarted.tpl @@ -24,4 +24,4 @@ +--------------------------------------------------------------------+ *} -
      {$gettingStarted}
      +
      {$gettingStarted}
      diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 60fed5aca1..c77ae5bcce 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -100,6 +100,8 @@ INSERT INTO `civicrm_dashboard` ( `domain_id`, `name`, `label`, `url`, `permission`, `permission_operator`, `column_no`, `is_minimized`, `is_active`, `weight`, `fullscreen_url`, `is_fullscreen`, `is_reserved`) VALUES ( @domainID, 'blog', '{ts escape="sql"}CiviCRM News{/ts}', 'civicrm/dashlet/blog?reset=1&snippet=5', 'access CiviCRM', NULL, 0, 0, 1, 0, 'civicrm/dashlet/blog?reset=1&snippet=5&context=dashletFullscreen', 1, 1), + ( @domainID, 'getting-started', '{ts escape="sql"}CiviCRM Getting Started{/ts}', 'civicrm/dashlet/getting-started?reset=1&snippet=5', 'access CiviCRM', NULL, 0, 0, 1, 0, 'civicrm/dashlet/getting-started?reset=1&snippet=5&context=dashletFullscreen', 1, 1), + ( @domainID, 'activity', '{ts escape="sql"}Activities{/ts}', 'civicrm/dashlet/activity?reset=1&snippet=5', 'access CiviCRM', NULL, 0, 0, 1, 1, 'civicrm/dashlet/activity?reset=1&snippet=5&context=dashletFullscreen', 1, 1), ( @domainID, 'myCases', '{ts escape="sql"}My Cases{/ts}', 'civicrm/dashlet/myCases?reset=1&snippet=5', 'access my cases and activities', NULL , 0, 0, 1, 2, 'civicrm/dashlet/myCases?reset=1&snippet=5&context=dashletFullscreen', 1, 1), ( @domainID, 'allCases', '{ts escape="sql"}All Cases{/ts}', 'civicrm/dashlet/allCases?reset=1&snippet=5', 'access all cases and activities', NULL , 0, 0, 1, 3, 'civicrm/dashlet/allCases?reset=1&snippet=5&context=dashletFullscreen', 1, 1), -- 2.25.1