Merge remote-tracking branch 'upstream/4.3' into 4.3-4.4-2013-10-23-19-26-23
[civicrm-core.git] / templates / CRM / common / dashboard.tpl
index 16e1bfa1c24d623469ef172adf4465bb712d3c7e..0b81dad705f92010a11795c6e223f7bbd33a7d9c 100644 (file)
@@ -1,6 +1,6 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -25,9 +25,8 @@
 *}
 {literal}
 <script type="text/javascript">
-    
-// Create closure, so that we don't accidentally spoil the global/window namespace.
-cj(function() {
+
+cj(function($) {
   // The set of options we can use to initialize jQuery.dashboard().
   var options = {
     // Optional. Defaults to 3.  You'll need to change the width of columns in CSS too.
@@ -45,7 +44,7 @@ cj(function() {
     ajaxCallbacks: {
 
       // Server returns the configuration of widgets for this user;
-      // An array (keyed by zero-indexed column ID), of arrays (keyed by widget ID) of 
+      // An array (keyed by zero-indexed column ID), of arrays (keyed by widget ID) of
       // booleans; true if the widget is minimized.  False if not.
       // E.g. [{ widgetID: isMinimized, ...}, ...]
       getWidgetsByColumn: {
@@ -68,9 +67,9 @@ cj(function() {
       //  * settings: Boolean.  True if widget has settings pane/display and server-side
       //    callback.
       //
-      // Server-side executable script callbacks are called and executed on certain 
+      // Server-side executable script callbacks are called and executed on certain
       // events.  They can use the widgets property of the dashboard object returned
-      // from jQuery.dashboard().  E.g. dashboard.widgets[widgetID].  They should be 
+      // from jQuery.dashboard().  E.g. dashboard.widgets[widgetID].  They should be
       // javascript files on the server.  Set the property to the path of the js file:
       //  * initScript:  Called when dashboard is initialising (but not finished).
       //  * fullscreenInitScript:  Called when the full screen element is initialising
@@ -91,7 +90,7 @@ cj(function() {
         }
       },
 
-      // jQuery.dashboard() POSTs the widget-to-column settings here.  The server's 
+      // jQuery.dashboard() POSTs the widget-to-column settings here.  The server's
       // response is sent to console.log() (if it exists), but is not used.  No checks
       // for errors have been implemented yet.
       // The 'columns' property of data is reserved for the widget-to-columns settings:
@@ -104,7 +103,7 @@ cj(function() {
           op: 'save_columns', key: {/literal}"{crmKey name='civicrm/ajax/dashboard'}"{literal}
         }
       },
-      
+
       // jQuery.dashboard() GETs a widget's settings object and POST's a users submitted
       // settings back to the server.  The return, in both cases, is an associative
       // array with the new settings markup and other info:
@@ -204,12 +203,10 @@ cj(function() {
     }
   };
 
-  // Initialize the dashboard using these options, and save to the global/window
-  // namesapace so that server-side executable js file callbacks can access
-  // window.dashboardDemo.widgets by ID.
-  window.dashboardDemo = cj('#civicrm-dashboard').dashboard(options);
+  // Initialize the dashboard using these options
+  $('#civicrm-dashboard').dashboard(options);
 
-}); // End closure.
+});
 
 </script>
 {/literal}