Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: 4.5
-
Fix Version/s: Unscheduled
-
Component/s: CiviHR, Core CiviCRM
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
Building on CRM-13892:
Summary
========
We need to provide a mechanism for administrators to manage default dashlet configuration for new users (currently this is hard-coded to initialize the 'blog' dashlet). We can store the default dashlets in dashboard_contact table in a row where dashboard_contact.contact_id is NULL. Then we can extend the existing Configure Dashboard class to set defaults by updating that row (rather than the row linked to the current user).
Implementation
============
1. Modify civicrm_contact_dashboard to allow NULL values for contact_id column.
- modify DashboardContact.xml for new installs
- for upgrades:
ALTER TABLE `civicrm_dashboard_contact` CHANGE `contact_id` `contact_id` INT( 10 ) UNSIGNED NULL DEFAULT NULL COMMENT 'Contact ID';
2. Insert row in civicrm_dashboard_contact setting the blog dashlet as the initial default.
- dashboard_id = (select id from dashboard where name = 'blog' and domain_id = $thisDomain)
- contact_id = NULL
- column_no = 1
- is_active = 1
- weight = 1
(Both new installations and upgrades.)
3. Update CRM_Core_BAO_Dashboard::initializeDashlets – instead of hardcoding the reference to the blog widget, retrieve the rows from dashboard_contact where contact_id is NULL and domain_id of linked civicrm_dashboard matches this domain. Insert a copy of each row with contact_id = current user's contact_id.
4. Administrative UI for controlling default dashlets
4.1 Insert new navigation menu item
Administer > Customize Data & Screens > Manage Dashlets
- Permission = 'administer CiviCRM'
- New installs : add to xml/templates/civicrm_navigation.tpl
- Upgrades : add insert to 4.5.alpha1.mysql.tpl
4.2 New Page - Manage Default Dashlets (CRM_Admin_Page_Dashlet)
This page extends CRM_Contact_Page_Dashlet and provides the same functionality - except that it gets and updates dashboard_contact row defaults - i.e. where contact_id is NULL. However, delete action still acts on civicrm_dashboard (same as existing contact dashboard operation).
NOTE: It may make sense to just extend CRM_Contact_Page_Dashlet and CRM_Contact_Page_AJAX::dash let to handle this mode ??
Done button returns to Admin console (/civicrm/admin)
Template needs a conditional flag so an alternative help div can be displayed with the following text:
"Use this screen to select the dashboard elements - dashlets - that you want to be enabled automatically for new users." ?
{help link to help pop-up, with text below}"Use this screen to select the dashboard elements - dashlets - that you want to be enabled automatically for new users. Available dashlets are displayed in the dark gray top bar. Drag and drop dashlets onto the left or right columns below to include them in the default dashboard set. Changes are automatically saved.
If there are non-reserved dashlets that you want to remove completely from your site, you can delete them for all users by clicking the x next to their title. Click 'Done' to return to the Administration Console."
5. Contact Dashboard help (templates/CRM/Contact/Page/Dashboard.hlp)
Add conditional help text paragraph to the id-dash_configure help popup - in
section.
{ts}You can control which dashlets are enabled by default for new users from <a href="%1 -link to new page">'Administer > Customize Data & Screens > Manage Dashlets'</a>.
{/ts}Attachments
Issue Links
- is blocked by
-
CRM-13892 Dashboard: Allow manipulation of default dashlets
- Done/Fixed