{*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
*}
{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.
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: {
// * 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
}
},
- // 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:
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:
}
};
- // 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}