/**
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Private properties of dashboard.
*/
-
+
// Used to determine whether there are any incomplete ajax requests pending initialization of the dashboard.
var asynchronousRequestCounter = 0;
initialWidgets: Array(),
element: $('<ul id="column-' + c + '" class="column column-' + c + '"></ul>').appendTo(dashboard.element)
};
-
+
// Add the empty placeholder now, hide it and save it.
col.emptyPlaceholder = $(markup).appendTo(col.element).hide();
initialColumn: col,
minimized: ( widgets[c][widgetID[1]] > 0 ? true : false )
});
-
+
//set empty Dashboard to false
emptyDashboard = false;
}
if ( emptyDashboard ) {
emptyDashboardCondition( );
}
-
+
invokeCallback(opts.callbacks.init, dashboard);
}
cj(".show-refresh").hide( );
cj("#empty-message").show( );
}
-
+
// Contructors for each widget call this when initialization has finished so that dashboard can complete it's intitialization.
function completeInit() {
// Don't do anything if any widgets are waiting for ajax requests to complete in order to finish initialization.
handle: '.widget-header',
// The class of placeholder elements (the 'ghost' widget showing where the dragged item would land if released now.)
- placeholder: 'placeholder',
- activate: function(event, ui) {
- var h= cj(ui.item).height();
+ placeholder: 'placeholder',
+ activate: function(event, ui) {
+ var h= cj(ui.item).height();
$('.placeholder').css('height', h +'px'); },
-
+
opacity: 0.2,
// Maks sure that only widgets are sortable, and not empty placeholders.
items: '> .widget',
-
+
forcePlaceholderSize: true,
-
+
// Callback functions.
update: resorted,
start: hideEmptyPlaceholders
}
// Things get messy here.
- // @todo Refactor to use currentState and targetedState properties to determine what needs
- // to be done to get to any desired state on any UI or AJAX event – since these don't always
- // match.
- // E.g. When a user starts a new UI event before the Ajax event handler from a previous
+ // @todo Refactor to use currentState and targetedState properties to determine what needs
+ // to be done to get to any desired state on any UI or AJAX event – since these don't always
+ // match.
+ // E.g. When a user starts a new UI event before the Ajax event handler from a previous
// UI event gets invoked.
// Hide the settings first of all.
}
CRM.loadPage(widget.fullscreenUrl);
};
-
+
// Exit fullscreen mode.
widget.exitFullscreen = function() {
// This is just a wrapper for dashboard.exitFullscreen() which does the heavy lifting.
// Adds controls to a widget. id is for internal use and image file name in images/dashboard/ (a .gif).
widget.addControl = function(id, control) {
- var markup = '<a class="widget-icon ' + id + '-icon" alt="' + control.description + '" title="' + control.description + '"></a>';
+ var markup = '<a class="widget-icon ' + id + '-icon" alt="' + control.description + '" title="' + control.description + '"></a>';
control.element = $(markup).prependTo($('.widget-controls', widget.element)).click(control.callback);
};
// Removes the widget from the dashboard, and saves columns.
widget.remove = function() {
- if ( confirm( 'Are you sure you want to remove "' + widget.title + '"?') ) {
+ if ( confirm( 'Are you sure you want to remove "' + widget.title + '"?') ) {
invokeCallback(opts.widgetCallbacks.remove, widget);
widget.element.fadeOut(opts.animationSpeed, function() {
$(this).remove();
if (!widget.throbber) {
widget.throbber = $(opts.throbberMarkup).appendTo($('.widget-wrapper', widget.element));
}
- };
+ }
// Event handler/callback for cancel button clicks.
// @todo test this gets caught by all browsers when the cancel button is 'clicked' via the keyboard.
function cancelEditSettings() {
widget.toggleSettings();
return false;
- };
+ }
// Helper function to execute external script on the server.
// @todo It would be nice to provide some context to the script. How?
$.getScript(url);
}
}
- };
+ }
};
// Public static properties of dashboard. Default settings.