From cf6f10ce583d779a10dc6a7f5d9d6bf1c2c18a7e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 1 Apr 2013 16:50:37 -0700 Subject: [PATCH] Fix changing case status in dashboard CRM-12202 --- CRM/Contact/Page/DashBoard.php | 17 +++++++++++++---- CRM/Core/BAO/Dashboard.php | 2 +- css/civicrm.css | 8 ++++---- templates/CRM/Case/Form/ActivityChangeStatus.js | 9 +++++---- templates/CRM/Case/Form/CaseView.tpl | 1 - templates/CRM/Case/Form/Selector.tpl | 1 - templates/CRM/Case/Page/DashBoard.tpl | 1 - 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CRM/Contact/Page/DashBoard.php b/CRM/Contact/Page/DashBoard.php index 77a1c2fcc7..de9719d7f6 100644 --- a/CRM/Contact/Page/DashBoard.php +++ b/CRM/Contact/Page/DashBoard.php @@ -47,9 +47,19 @@ class CRM_Contact_Page_DashBoard extends CRM_Core_Page { */ function run() { // Add dashboard js and css - CRM_Core_Resources::singleton() - ->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.dashboard.js', 0, 'html-header', FALSE) - ->addStyleFile('civicrm', 'packages/jquery/css/dashboard.css'); + $resources = CRM_Core_Resources::singleton(); + $resources->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.dashboard.js', 0, 'html-header', FALSE); + $resources->addStyleFile('civicrm', 'packages/jquery/css/dashboard.css'); + + $config = CRM_Core_Config::singleton(); + + // Add dashlet-specific js files + // TODO: Need a much better way of managing on-the-fly js requirements. Require.js perhaps? + // Checking if a specific dashlet is enabled is a pain and including the js here sucks anyway + // So here's a compromise: + if (in_array('CiviCase', $config->enableComponents)) { + $resources->addScriptFile('civicrm', 'templates/CRM/Case/Form/ActivityChangeStatus.js'); + } $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject); @@ -101,7 +111,6 @@ class CRM_Contact_Page_DashBoard extends CRM_Core_Page { $ownerOrgOK = FALSE; } - $config = CRM_Core_Config::singleton(); if (in_array('CiviMail', $config->enableComponents) && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG" ) { diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index 703a067ac9..4d5b0c795a 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -285,7 +285,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { $contactID = $session->get('userID'); //we need to get existing dashletes, so we know when to update or insert - $contactDashlets = CRM_Core_BAO_Dashboard::getContactDashlets(true); + $contactDashlets = self::getContactDashlets(TRUE); $dashletIDs = array(); if (is_array($columns)) { diff --git a/css/civicrm.css b/css/civicrm.css index 26ae06e91c..aba780eec6 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3571,18 +3571,18 @@ div.m ul#civicrm-menu, } /* in place edit */ -#crm-container .crm-editable-enabled { +.crm-container .crm-editable-enabled { white-space: nowrap; } -#crm-container .crm-editable-enabled, -#crm-container .crm-editable-textarea-enabled { +.crm-container .crm-editable-enabled, +.crm-container .crm-editable-textarea-enabled { display: block; padding-left: 2px; border: 2px dashed transparent; } -#crm-container .crm-editable-enabled:hover { +.crm-container .crm-editable-enabled:hover { display: block; padding-left: 2px; border: 2px dashed lightgrey; diff --git a/templates/CRM/Case/Form/ActivityChangeStatus.js b/templates/CRM/Case/Form/ActivityChangeStatus.js index b51a7a01b9..ec150e76bb 100644 --- a/templates/CRM/Case/Form/ActivityChangeStatus.js +++ b/templates/CRM/Case/Form/ActivityChangeStatus.js @@ -1,17 +1,18 @@ // http://civicrm.org/licensing cj(function($) { - - $('#crm-container').on('click', 'a.crm-activity-change-status', function() { + // Elements are sometimes in a jQuery dialog box which is outside crm-container, + // So gotta attach this handler to the whole body - sorry. + $('body').on('click', 'a.crm-activity-change-status', function() { var link = $(this), activityId = $(this).attr('activity_id'), current_status_id = $(this).attr('current_status'), caseId = $(this).attr('case_id'), data = 'snippet=1&reset=1', o = $('
'); - addCiviOverlay(o); + o.block({theme:true}); o.load(CRM.url('civicrm/case/changeactivitystatus'), data, function() { - removeCiviOverlay(o); + o.unblock(); cj("#activity_change_status").val(current_status_id); }); diff --git a/templates/CRM/Case/Form/CaseView.tpl b/templates/CRM/Case/Form/CaseView.tpl index df0ad7e3b0..955c03b06e 100644 --- a/templates/CRM/Case/Form/CaseView.tpl +++ b/templates/CRM/Case/Form/CaseView.tpl @@ -1123,4 +1123,3 @@ function printCaseReport( ) { {/if} {* view related cases if end *} -{include file="CRM/common/overlay.tpl"} diff --git a/templates/CRM/Case/Form/Selector.tpl b/templates/CRM/Case/Form/Selector.tpl index 1b86ee5113..7c96eff158 100644 --- a/templates/CRM/Case/Form/Selector.tpl +++ b/templates/CRM/Case/Form/Selector.tpl @@ -165,4 +165,3 @@ function buildCaseDetails( caseId, contactId ) {/literal} -{include file="CRM/common/overlay.tpl"} diff --git a/templates/CRM/Case/Page/DashBoard.tpl b/templates/CRM/Case/Page/DashBoard.tpl index 22d415570a..102e6fb714 100644 --- a/templates/CRM/Case/Page/DashBoard.tpl +++ b/templates/CRM/Case/Page/DashBoard.tpl @@ -110,4 +110,3 @@ {/if} {/if} -{include file="CRM/common/overlay.tpl"} -- 2.25.1