      1 /**
      2  * @ignore
      3  */
      4 var Ozone = Ozone ? Ozone : {};
      5
      6 /**
      7  * @namespace
      8  * @since OWF 5.0
      9  */
     10 OWF = window.OWF ? window.OWF : {};
     11
     12 (function(window, document, undefined) {
     13
     14 	var WIDGET_READY_SERVICE_NAME = '_widgetReady',
     15
     16         isReady = false,
     17 		readyList = [],
     18 		widget = Ozone.util.parseWindowNameData(),
     19 		eventingController,
     20 		dragAndDropController,
     21 		launchingController,
     22 		chromeController;
     23
     24 	owfdojo.mixin(OWF, /** @lends OWF */ {
     25
     26 		/**
     27 		 * The OWF.Eventing object manages the eventing for an individual widget
     28 		 *
     29 		 * @namespace
     30 		 * @name OWF.Eventing
     31 		 */
     32 		Eventing: {},
     33
     34 		/**
     35 		 * @namespace
     36 		 * @name OWF.RPC
     37 		 */
     38 		RPC: {},
     39
     40 		/**
     41 		 * This object is used to create, retrieve, update and delete user preferences.
     42 		 *
     43 		 * @namespace
     44 		 * @name OWF.Preferences
     45 		 */
     46 		Preferences: {},
     47
     48 		/**
     49 		 * This object is used launch other widgets.
     50 		 *
     51 		 * @namespace
     52 		 * @name OWF.Launcher
     53 		 */
     54 		Launcher: {},
     55
     56 		/**
     57 		 * The OWF.DragAndDrop object manages the drag and drop for an individual widget.
     58 		 *
     59 		 * @namespace
     60 		 * @name OWF.DragAndDrop
     61 		 */
     62 		DragAndDrop: {},
     63
     64 		/**
     65 		 * This object allows a widget to modify the button contained in the widget header (the chrome).
     66 		 *
     67 		 * @namespace
     68 		 * @name OWF.Chrome
     69 		 */
     70 		Chrome: {},
     71
     72 		/**
     73 		 * Provides OWF utility methods for the widget developer
     74 		 *
     75 		 * @namespace
     76 		 * @name OWF.Util
     77 		 */
     78 		Util: Ozone.util,
     79
     80 		/**
     81 		 *
     82 		 *
     83 		 * @namespace
     84 		 * @name OWF.Metrics
     85 		 */
     86 		Metrics: Ozone.metrics,
     87
     88 		/**
     89 		 * Provides functions to log messages and objects
     90 		 *
     91 		 * @namespace
     92 		 * @name OWF.Log
     93 		 */
     94 		Log: Ozone.log,
     95
     96 		/**
     97 		 * Provides utility methods for localization
     98 		 *
     99 		 * @namespace
    100 		 * @name OWF.Lang
    101 		 */
    102 		Lang: Ozone.lang,
    103
    104 		Version: Ozone.version,
    105
    106 		/**
    107 			Accepts a function that is executed when Ozone APIs are ready for use
    108 			@param {Function} handler Function to execute when OWF APIs are ready
    109 			@param {Object} scope The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.
    110 		*/
    111 		ready: function(handler, scope) {
    112
    113 			if(handler === undefined) {
    114 				throw 'Error: no arguments passed';
    115 				return;
    116 			}
    117
    118 			if(typeof handler !== 'function') {
    119 				throw 'Error: handler must be a function';
    120 				return;
    121 			}
    122
    123 			isReady === true ? handler.call(scope) : readyList.push( {fn: handler, scope: scope} );
    124
    125 		},
    126
    127       /**
    128        * This function should be called once the widget is ready and all initialization is completed.  This will send a
    129        * message to the container which in turn may notify other widgets
    130        */
    131         notifyWidgetReady: function() {
    132           //send a message to container that this widget is ready
    133           gadgets.rpc.call('..', WIDGET_READY_SERVICE_NAME, null, OWF.getIframeId());
    134         },
    135
    136 		/**
    137 			Returns definition GUID of the widget. This is auto generated by OWF when the widget was brought in an OWF instance.
    138 		*/
    139 		getWidgetGuid : function() {
    140 			return widget.guid;
    141 		},
    142
    143 		/**
    144 			Returns instance GUID of the widget.
    145 		*/
    146 		getInstanceId : function() {
    147 			return widget.id;
    148 		},
    149
    150         /**
    151          * @description Returns the Widget Id
    152          * @returns {String} The widgetId is a complex JSON encoded string which identifies a widget for Eventing.
    153          *   Embedded in this string is the widget's uniqueId as the 'id' attribute.  There is other data is in the string
    154          *   which is needed for Eventing and other APIs to function properly. This complex widgetId string may be used in
    155          *   the <a href="./OWF.Eventing.html#.publish">OWF.Eventing.publish</a> function to designate a specific recipient for a message.
    156          *   Additionally, once subscribed to a channel via <a href="./OWF.Eventing.html#.subscribe">OWF.Eventing.subscribe</a> during the
    157          *   receipt of a message, the sender's widgetId is made available as the first argument to the handler function.
    158          * @example
    159          * //decode and retrieve the widget's unique id
    160          * var complexIdString = OWF.getIframeId();
    161          * var complexIdObj = owfdojo.toJson(complexIdString);
    162          *
    163          * //complexIdObj will look like
    164          * // {
    165          * //  //widget's uniqueId
    166          * //  id:"49cd21f0-3110-8121-d905-18ffa81b442e"
    167          * // }
    168          *
    169          * //get Widget's uniqueId
    170          * alert('widget id = ' + complexIdObj.id);
    171          */
    172 		getIframeId : function() {
    173 			return '{\"id\":\"' + widget.id + '\"}';
    174 		},
    175
    176 		/**
    177 			Returns type of dashboard in which the widget is opened. [portal, desktop, accordion, tabbed]
    178 		*/
    179 		getDashboardLayout : function() {
    180 			return widget.layout;
    181 		},
    182
    183 		/**
    184 			Returns version of the widget.
    185 		*/
    186 		getVersion : function() {
    187 			return widget.version;
    188 		},
    189
    190 		/**
    191 			Returns URL of the widget.
    192 		*/
    193 		getUrl : function() {
    194 			return widget.url;
    195 		},
    196
    197 		/**
    198 			Returns an object containing information on the current OWF theme
    199 			@returns {Object} Returns an object below: <br>
    200 			{ <br>
    201 				//name of the theme <br>
    202 				themeName: 'theme-name', <br>
    203 				<br>
    204 				//describes color contrast of the theme.  This may be one of 3 values: <br>
    205 				// 'standard' (colors provide no special contrast) <br>
    206 				// 'black-on-white' (black on white color contrast) <br>
    207 				// 'white-on-black' (white on black color contrast) <br>
    208 				themeContrast: 'black-on-white', <br>
    209 				<br>
    210 				//this field is a number of the fontSize in pixels <br>
    211 				themeFontSize: 12 <br>
    212 			}
    213 			@example
    214 			var themeObj = OWF.getCurrentTheme();
    215 		*/
    216 		getCurrentTheme : function() {
    217 			return widget.currentTheme;
    218 		},
    219
    220 		/**
    221 			Returns the name of the Container the Widget is in
    222 		*/
    223 		getContainerName: function() {
    224 			return widget.containerName;
    225 		},
    226
    227 		/**
    228 			Returns the version of the Container the Widget is in
    229 		*/
    230 		getContainerVersion: function() {
    231 			return widget.containerVersion;
    232 		},
    233
    234 		/**
    235 			Returns whether or not the dashboard in which the widget is opened is locked.
    236 		*/
    237 		isDashboardLocked : function() {
    238 			return widget.locked;
    239 		},
    240
    241 		/**
    242 		Returns the URL of the Container the Widget is in
    243 		*/
    244 		getContainerUrl: function() {
    245             //figure out from preference location
    246 			var pref = widget.preferenceLocation;
    247             return pref.substring(0, pref.length - 6);
    248 		},
    249
    250 		/**
    251 			Gets all opened widgets on the current dashboard.
    252
    253 			@param {Function} callback function to execute when opened widgets are retrieved from OWF. Function is passed an array of objects with the structure below: <br>
    254 			{<br>
    255 				id: 'instance guid of widget',<br>
    256 				frameId: 'iframe id of widget',<br>
    257 				widgetGuid: 'widget guid of the widget',<br>
    258 				url: 'url of the widget',<br>
    259 				name: 'name of the widget'<br>
    260 			}<br>
    261 			@example
    262 			OWF.getOpenedWidgets(function(openedWidgets) {
    263
    264 			});
    265 		*/
    266 		getOpenedWidgets: function(fn) {
    267
    268 			if(fn === undefined) {
    269 				throw 'Error: no arguments passed';
    270 				return;
    271 			}
    272
    273 			if(typeof fn !== 'function') {
    274 				throw 'Error: fn must be a function';
    275 				return;
    276 			}
    277
    278 			Ozone.eventing.getAllWidgets(fn);
    279 		}
    280 	});
    281
    282 	// for backwards compatibility
    283 	Ozone.Widget = OWF;
    284
    285 	OWF._init = function(window, document, undefined) {
    286
    287         if (OWF.relayFile != null) {
    288           Ozone.eventing.Widget.widgetRelayURL = OWF.relayFile;
    289         }
    290
    291 		// Eventing API
    292 		function initEventing() {
    293 			for(var i = 0, methods = ['publish', 'subscribe', 'unsubscribe'] ; i < methods.length ; i++) {
    294 				OWF.Eventing[ methods[i] ] = this[ methods[i] ];
    295 			}
    296 		}
    297
    298 		// RPC/Directed Eventing API
    299 		function initRPC() {
    300 			OWF.RPC.registerFunctions = Ozone.eventing.registerFunctions;
    301 			OWF.RPC.getWidgetProxy = Ozone.eventing.importWidget;
    302 			OWF.RPC.handleDirectMessage = function(fn) {
    303 				if(typeof fn !== 'function') {
    304 					throw 'Error: fn must be a function';
    305 					return;
    306 				}
    307 				Ozone.eventing.handleDirectMessage = fn;
    308 			};
    309 		}
    310
    311 		// Preferences API
    312 		function initPreferences() {
    313 			for(var i in Ozone.pref.PrefServer) {
    314 				if(typeof Ozone.pref.PrefServer[ i ] === 'function')
    315 					OWF.Preferences[ i ] = Ozone.pref.PrefServer[ i ];
    316 			}
    317 		}
    318
    319 		// Launching API
    320 		function initLauncher() {
    321 			OWF.Launcher.launch = launchingController.launchWidget;
    322 			OWF.Launcher.getLaunchData = Ozone.launcher.WidgetLauncherUtils.getLaunchConfigData;
    323 		}
    324
    325 		// Drag and Drop API
    326 		function initDragAndDrop() {
    327 			OWF.DragAndDrop = {
    328 				onDragStart: function(callback, scope) {
    329 					dragAndDropController.addCallback('dragStart', owfdojo.hitch(scope, callback));
    330 					return this;
    331 				},
    332
    333 				onDragStop: function(callback, scope) {
    334 					dragAndDropController.addCallback('dragStop', owfdojo.hitch(scope, callback));
    335 					return this;
    336 				},
    337
    338 				onDrop: function(callback, scope) {
    339 					dragAndDropController.addCallback('dropReceive', owfdojo.hitch(scope, callback));
    340 					return this;
    341 				},
    342
    343 				startDrag: function(cfg) {
    344 					dragAndDropController.doStartDrag(cfg);
    345 					return this;
    346 				}
    347 			};
    348
    349 			for(var i = 0, methods = ['addDropZoneHandler', 'getDragStartData', 'getDropEnabled', 'setDropEnabled', 'isDragging', 'getFlashWidgetId', 'setFlashWidgetId'] ; i < methods.length ; i++) {
    350
    351 				OWF.DragAndDrop[ methods[i] ] = function( methodName ) {
    352
    353 					return function() {
    354 						return dragAndDropController[methodName].apply(dragAndDropController, arguments);
    355 					};
    356
    357 				}( methods[i] );
    358
    359 			}
    360 		}
    361
    362 		// Chrome API
    363 		function initChrome() {
    364 			for(var i = 0,
    365 				methods = ['addHeaderButtons', 'addHeaderMenus', 'insertHeaderButtons', 'insertHeaderMenus', 'isModified', 'listHeaderButtons', 'listHeaderMenus', 'removeHeaderButtons', 'removeHeaderMenus', 'updateHeaderButtons', 'updateHeaderMenus'] ; i < methods.length ; i++) {
    366 				OWF.Chrome[ methods[i] ] = chromeController[ methods[i] ];
    367 			}
    368 		}
    369
    370 		eventingController = Ozone.eventing.Widget.getInstance(function() {
    371
    372 			dragAndDropController = Ozone.dragAndDrop.WidgetDragAndDrop.getInstance({
    373 				widgetEventingController: this
    374 			});
    375 			launchingController = Ozone.launcher.WidgetLauncher.getInstance();
    376 			chromeController = Ozone.chrome.WidgetChrome.getInstance({
    377 				widgetEventingController: this
    378 			});
    379
    380 			initEventing.call(this);
    381 			initRPC();
    382 			initPreferences();
    383 			initLauncher();
    384 			initDragAndDrop();
    385 			initChrome();
    386
    387 			Ozone.components.keys.createKeyEventSender(this);
    388
    389 			// execute ready listeners
    390 			isReady = true;
    391 			for(var i = 0, len = readyList.length ; i < len ; i++) {
    392 				readyList[i].fn.call(readyList[i].scope);
    393 			}
    394
    395 		});
    396
    397 	};
    398
    399 }(window, document));
    400
    401 // --------------------------------------------------------------------------------------------------
    402 // ------------------- Eventing ---------------------------------------------------------------------
    403 // --------------------------------------------------------------------------------------------------
    404 /**
    405  * @name relayFile
    406  * @memberOf OWF
    407  * @description The location of the widget relay file.  The relay file should be defined
    408  *   globally for the entire widget by setting OWF.relayFile to the relay file url, immediately after
    409  *   including the widget bundle javascript.  If the relay is not defined at all it is assumed to be at
    410  *   /[context]/js/eventing/rpc_relay.uncompressed.html. The relay file must be specified with full location details, but without a fully
    411  *   qualified path. In the case where the relay is residing @ http://server/path/relay.html, the path used must be from the context root of the local
    412  *   widget. In this case, it would be /path/relay.html.  Do not include the protocol.
    413  * @since OWF 5.0.0
    414  * @example
    415  * <script type="text/javascript" src="../../js-min/owf-widget-min.js"></script>
    416  * <script>
    417  *       //The location is assumed to be at /[context]/js/eventing/rpc_relay.uncompressed.html if it is not
    418  *       //set the path correctly below
    419  *       OWF.relayFile = '/owf/js/eventing/rpc_relay.uncompressed.html';
    420  *       //...
    421  * </script>
    422  *
    423  */
    424
    425 /**
    426 	Subscribe to a named channel for a given function.
    427 	@name subscribe
    428 	@methodOf OWF.Eventing
    429
    430 	@param {String} channelName The channel to subscribe to.
    431 	@param {Function} handler The function you wish to subscribe.  This function will be called with three
    432 		arguments: sender, msg, channel.
    433 	@param {String} [handler.sender] The first argument passed to the handler function is the id of the sender of the message. See <a href="OWF.html#.getIframeId">OWF.getIframeId</a> for a description of this id.
    434 	@param {Object} [handler.msg] The second argument passed to the handler function is the message itself.
    435 	@param {String} [handler.channel] The third argument passed to the handler function is the channel the message was published on.
    436
    437 	@example
    438 OWF.Eventing.subscribe("ClockChannel", this.update);
    439 var update = function(sender, msg, channel) {
    440 	document.getElementById('currentTime').innerHTML = msg;
    441 }
    442  */
    443
    444 /**
    445 	Unsubscribe to a named channel.
    446 	@name unsubscribe
    447 	@methodOf OWF.Eventing
    448
    449 	@param {String} channelName The channel to unsubscribe to.
    450
    451 	@example
    452 OWF.Eventing.unsubscribe("ClockChannel");
    453  */
    454
    455 /**
    456 	Publishes a message to a given channel.
    457 	@name publish
    458 	@methodOf OWF.Eventing
    459
    460 	@param {String} channelName The name of the channel to publish to
    461 	@param {Object} message The message to publish to the channel.
    462 	@param {String} [dest] The id of a particular destination.  Defaults to null which sends to all
    463 		subscribers on the channel.  See <a href="OWF.html#.getIframeId">OWF.getIframeId</a>
    464 		for a description of the id.
    465
    466 	@example
    467 OWF.Eventing.publish("ClockChannel", currentTimeString);
    468 */
    469
    470 // --------------------------------------------------------------------------------------------------
    471 // ------------------- RPC --------------------------------------------------------------------------
    472 // --------------------------------------------------------------------------------------------------
    473
    474 /**
    475 	Register one or more functions to OWF to expose to other widgets.
    476 	@name registerFunctions
    477 	@methodOf OWF.RPC
    478
    479 	@param {Object/Array} objs Object or an array of objects of following structure.<br />
    480 		{<br />
    481 			name: 'name of the function', <br />
    482 			fn: function() {}, <br />
    483 			scope: window //The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.<br />
    484 		}<br />
    485
    486 	@example
    487 Calculator = {
    488 	add: function() {
    489 		var args = arguments,
    490 			val = 0;
    491 		for(var i = 0, len = args.length; i < len; i++) {
    492 			val += parseFloat(args[i]);
    493 		}
    494 		return val;
    495 	},
    496 	multiply: function() {
    497 		var args = arguments,
    498 			val = 1;
    499 		for(var i = 0, len = args.length; i < len; i++) {
    500 			val *= parseFloat(args[i]);
    501 		}
    502 		return val;
    503 	}
    504 };
    505 OWF.RPC.registerFunctions([
    506 	{
    507 		name: 'add'
    508 		fn: Calculator.add,
    509 		scope: Calculator
    510 	},
    511 	{
    512 		name: 'multiply'
    513 		fn: Calculator.multiply,
    514 		scope: Calculator
    515 	}
    516 ]);
    517 */
    518
    519 /**
    520 	Gets a proxy object that contains methods exposed by other widget.
    521 	@name getWidgetProxy
    522 	@methodOf OWF.RPC
    523
    524 	@param {String} instanceGuid instance guid of the widget to import
    525 	@param {Function} callback function that will be executed if the widget is found opened on the current dashboard. The function is passed a proxy object as the first argument which will contain methods that were exposed by the widget. In addition, the proxy abject also has sendMessage method to send a direct message to the widget.
    526
    527 	@example
    528 OWF.RPC.getWidgetProxy('instanceGuid of widgetA', function(widgetA) {
    529
    530 	widgetA.add(1,2,3, function(result) {
    531 		console.log(result); // log the result
    532 	})
    533
    534 	widgetA.sendMessage('some secret message');
    535
    536 });
    537 */
    538
    539 /**
    540 	Register a function to be executed when a direct message is received from another widget.
    541 	@name handleDirectMessage
    542 	@methodOf OWF.RPC
    543
    544 	@param {Function} fn function that will be executed when a direct message is received from another widget.
    545
    546 	@example
    547 OWF.RPC.handleDirectMessage(function(msg) {
    548 	// do something with the message
    549 });
    550 */
    551
    552 // --------------------------------------------------------------------------------------------------
    553 // ------------------- Drag and Drop ----------------------------------------------------------------
    554 // --------------------------------------------------------------------------------------------------
    555 /**
    556 	Use this method to set flex dom element id, so that drag and drop can be enabled in flex widgets.
    557 	@name setFlashWidgetId
    558 	@methodOf OWF.DragAndDrop
    559
    560 	@param {String} id dom element id of flex widget
    561 */
    562
    563 /**
    564 	Starts a drag.  The config object passed in describes the drag and contains the data to be passed to the drop.
    565 	@name startDrag
    566 	@methodOf OWF.DragAndDrop
    567
    568 	@param {Object} cfg config object see below
    569 	@param {String} cfg.dragDropLabel Name to be used as text for the dragDrop indicator
    570 	@param {Object} cfg.dragDropData Data to be sent on a successful drag and drop.  This property is only sent to the
    571 	successful recipient of the drag (the dropReceive event).  It will not be sent for other events.
    572 	@param {Object} cfg.dragZone dom node which presents a dragZone which is associated with this drag.  This property is
    573 	only saved and used locally to the widget to identify whether a dragZone is in fact the node as a dropZone.  It will not be
    574 	sent to other events callbacks.
    575 	@param {Object} cfg.* other custom properties may be specified, these will be passed along to event handlers
    576
    577 	@example
    578 //add handler to text field for dragging
    579 owfdojo.connect(document.getElementById('dragSource'), 'onmousedown', this, function(e) {
    580 	e.preventDefault();
    581 	var data = document.getElementById('InputChannel').value;
    582 	if (data) {
    583 		OWF.DragAndDrop.startDrag({
    584 			dragDropLabel: data,
    585 			dragDropData: data,
    586 			dragZone:  document.getElementById('dragZone'),
    587 			dragDropGroup: 'location'  //extra property to pass along
    588 		});
    589 	}
    590 });
    591 */
    592
    593
    594 /**
    595 	Adds a new drop zone to be managed.  The handler function defined in the cfg object will be called when
    596 	a drop occurs over a dom node which matches the id or the className or is equal to or a child of the dropTarget node
    597 	@name addDropZoneHandler
    598 	@methodOf OWF.DragAndDrop
    599
    600 	@param {Object} cfg config object see below
    601 	@param {className} cfg.class class of the dropZone
    602 	@param {String} cfg.id Id of the dropZone
    603 	@param {Node} cfg.dropZone HTML node which represents the dropZone
    604 	@param {Function} cfg.handler function to be called when a drop occurs over the dropZone.  A msg object will be passed in
    605
    606 	@example
    607 //Example cfg Object
    608 {
    609 	id: 'mygrid-1',
    610 	className: 'mygridClass',
    611 	dropZone: document.getElementById('dropZone'),
    612 	handler: function(msg) {
    613 		//some code here to handle the msg and respond
    614 	}
    615 }
    616
    617 //Example usage of addDropZoneHandler which handles a drop that occurs over an Ext Grid and inserts new data into
    618 //that grid based on the dragged data
    619 OWF.DragAndDrop.addDropZoneHandler({
    620 	//dom node of an Ext grid
    621 	dropZone:grid.getView().scroller.dom,
    622
    623 	//this function is called only when a drop occurs over the grid (i.e. the mouse was released over the grid)
    624 	handler: (function(msg){
    625
    626 		var store = grid.getStore();
    627 		var processedSelections = [];
    628 		var errorMsg = null;
    629
    630 		//loop through msg.dragDropData which is an array and check for dupes versus the destination store
    631 		for (var i = 0; i < msg.dragDropData.length; i++) {
    632 			//get data for one possible new record in the dragDropData
    633 			var recData = msg.dragDropData[i];
    634
    635 			//is it already in the dest Ext Store?
    636 			if (store.findExact('id',recData.id) >= 0) {
    637 				//found the record already in the store
    638 			}
    639 			else {
    640 				//add new record based on the dragDropData
    641 				var newRec = new store.recordType(recData);
    642 				//calling an external function to decide whether to add the new rec
    643 				var rs = displayPanel.validateRecordOnAdd(newRec);
    644 				if (rs.success) {
    645 					processedSelections.push(newRec);
    646 				}
    647 				else {
    648 					errorMsg = rs.msg;
    649 				}
    650 			}
    651 		}
    652
    653 		if (errorMsg) {
    654 			Ext.Msg.alert('Error', errorMsg);
    655 		}
    656
    657 		//actually insert into the store which adds it the new recs to the grid
    658 		if (processedSelections.length > 0) {
    659 			store.insert(0, processedSelections);
    660 		}
    661
    662 }).createDelegate(grid)});   //createDelegate is an Ext function which sets the scope of the callback
    663
    664 */
    665
    666
    667 /**
    668 	Returns whether the a drop is enabled (this is only true when the mouse is over a drop zone)
    669 	@name getDropEnabled
    670 	@methodOf OWF.DragAndDrop
    671 */
    672
    673 /**
    674 	Returns whether a drag is in progress
    675 	@name isDragging
    676 	@methodOf OWF.DragAndDrop
    677 */
    678
    679 /**
    680 	Returns data sent when a drag was started
    681 	@name getDragStartData
    682 	@methodOf OWF.DragAndDrop
    683 */
    684
    685 /**
    686 	Toggles the dragIndicator to indicate successful or unsuccessful drop
    687 	@name setDropEnabled
    688 	@methodOf OWF.DragAndDrop
    689
    690 	@param {Boolean} dropEnabled true to enable a drop, false to indicate a unsuccessful drop
    691
    692 	@example
    693 //attach mouseover callback to a particular area. If the mouse is here allow a drop
    694 cmp.getView().scroller.on('mouseover',function(e,t,o) {
    695 	if (cmp.dragging) {
    696 		OWF.DragAndDrop.setDropEnabled(true);
    697 	}
    698 },this);
    699
    700 //attach a mouse out callback to a particular area. If the mouse leaves disable drop
    701 cmp.getView().scroller.on('mouseout',function(e,t,o) {
    702 	if (cmp.dragging) {
    703 		OWF.DragAndDrop.setDropEnabled(false);
    704 	}
    705 },this);
    706    */
    707
    708
    709 /**
    710 	Executes the callback passed when a drag starts in any widget.
    711 	@name onDragStart
    712 	@methodOf OWF.DragAndDrop
    713
    714 	@param {Function} callback The function to execute as a callback.
    715 	@param {Object} scope The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.
    716
    717 	@example
    718 //example callback, highlights an Ext Grid when a drag occurs
    719 OWF.DragAndDrop.onDragStart(function(sender, msg) {
    720 	//get the Ext Grid
    721 	var grid = this.getComponent(this.gridId);
    722
    723 	//check custom dragDropGroup property to see if the drag is meant for this grid
    724 	//if so highlight the grid by adding the ddOver class
    725 	if (grid && msg != null && msg.dragDropGroup == 'users') {
    726 		grid.getView().scroller.addClass('ddOver');
    727 	}
    728 }, this);
    729 */
    730
    731 /**
    732 	Executes the callback passed when a drag stops in any widget.
    733 	@name onDragStop
    734 	@methodOf OWF.DragAndDrop
    735
    736 	@param {Function} callback The function to execute as a callback.
    737 	@param {Object} scope The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.
    738
    739 	@example
    740
    741 OWF.DragAndDrop.onDragStop(function(sender, msg) {
    742 	// do something here
    743 }, this);
    744 */
    745
    746 /**
    747 	Executes the callback passed when a drop occurs in the widget. If one has multiple dropZones in a widget it is easier to use <a href="#addDropZoneHandler">addDropZoneHandler</a>
    748 	@name onDrop
    749 	@methodOf OWF.DragAndDrop
    750
    751 	@param {Function} callback The function to execute as a callback.
    752 	@param {Object} scope The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.
    753
    754 	@example
    755
    756 OWF.DragAndDrop.onDrop(function(sender, msg) {
    757 	var data = msg.dragDropData;
    758
    759 	// do something with the data here
    760 }, this);
    761 	*/
    762
    763 // --------------------------------------------------------------------------------------------------
    764 // ------------------- Launcher ---------------------------------------------------------------------
    765 // --------------------------------------------------------------------------------------------------
    766
    767 /**
    768 	Launches a Widget based on the config.
    769 	@name launch
    770 	@methodOf OWF.Launcher
    771
    772 	@param {Object} config object see example for structure
    773 	@param {Function} callback a function to be called once after the launchWidget is executed
    774
    775 	@example
    776 OWF.Launcher.launch({
    777 	guid: 'guid_of_widget_to_launch',
    778 	launchOnlyIfClosed: true,	//if true will only launch the widget if it is not already opened.
    779 								//if it is opened then the widget will be brought to focus
    780 	data: dataString			//initial launch data to be passed to a widget only if the widget is opened. This must be a string.
    781 }, callback);
    782  */
    783
    784 /**
    785 	Retrieves initial launch data for this widget if it is opened by another widget.
    786 	@name getLaunchData
    787 	@methodOf OWF.Launcher
    788
    789 	@returns {Object} data object which contains initial launch data for the widget
    790
    791 	@example
    792 var launchData = OWF.Launcher.getLaunchData();
    793 if (launchData != null) {
    794 	var data = Ozone.util.parseJson(launchData);  //in this example the data object has two fields: channel and message
    795 	if (data != null) {
    796 		//do something with the data
    797 		OWF.Eventing.subscribe(data.channel, function() {});
    798 	}
    799 }
    800 */
    801
    802 // --------------------------------------------------------------------------------------------------
    803 // ------------------- Chrome -----------------------------------------------------------------------
    804 // --------------------------------------------------------------------------------------------------
    805
    806 /**
    807 	Checks to see if the Widget Chrome has already been modified.  This is useful when the widget iframe is reloaded.
    808 	@name isModified
    809 	@methodOf OWF.Chrome
    810
    811 	@param {Object} cfg config object see below for properties
    812 	@param {Function} cfg.callback The function which receives the results.
    813 	This method will be passed an object which has following properties. <br>
    814 	<br>
    815 		{Boolean} success: true if the widget is currently opened on the dashboard, or else false. <br>
    816 		{Boolean} modified: true if the widget chrome(header) is modified, or else false. <br>
    817 	*
    818 	@example
    819 OWF.Chrome.isModified({
    820 	callback: function(msg) {
    821 		//msg will always be a json string
    822 		var res = Ozone.util.parseJson(msg);
    823 		if (res.success) {
    824 			//if the chrome was never modified
    825 			if (!res.modified) {
    826 			   //do something, perhaps add buttons
    827 			}
    828 			//if we already modified the chrome
    829 			else {
    830 			  //do something or perhaps nothing if the buttons are already added
    831 			}
    832 		}
    833 	}
    834 });
    835 */
    836
    837
    838 /**
    839 	Adds buttons to the Widget Chrome. Buttons are added after existing buttons.
    840 	@name addHeaderButtons
    841 	@methodOf OWF.Chrome
    842
    843 	@param {Object} cfg config object see below for properties
    844 	@param {Object[]} cfg.items an array of buttons configurations to add to the chrome.  See example for button configs
    845 	@param {String} cfg.items[*].itemId itemId is a unique id among all buttons that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate buttons which may not be able to be removed properly.
    846 	@param {String} cfg.items[*].xtype xtype is ExtJS-like property used to determine the component to create.  Currently the Widget Chrome API only supports two xtype values: ‘button’ and ‘widgettool’.  xtype is an optional field, if it is omitted ‘widgettool’ is used.
    847 	@param {String} cfg.items[*].type Used only for ‘widgettool’ buttons.  It determines the standard icon to be used.  For a complete list of types please see the ExtJS 4.x API documentation, <a href='http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Tool-cfg-type'>http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Tool-cfg-type</a>
    848 	@param {String} cfg.items[*].icon This property defines the URL of the image to be used for the button.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    849 	@param {String} cfg.items[*].text This property defines text to appear alongside the button.  This property is only used if the xtype is ‘button.’  ‘widgettool’ will not show text.
    850 	@param {Object} cfg.items[*].tooltip This property defines a tooltip.  It has two important sub properties, title and text.  tooltip is only used when the xtype is ‘button’
    851 	@param {Function} cfg.items[*].handler The handler attribute defines a function to be executed when the button is pressed. This function is executed using Widget Eventing API from inside the widget.  The internal channel name used is the itemId attribute. This function’s parameter list contains the standard parameters for an Eventing callback function.
    852
    853 	@example
    854 OWF.Chrome.addHeaderButtons({
    855 	items: [
    856 		{
    857 			xtype: 'button',
    858 			//path to an image to use. this path should either be fully qualified or relative to the /owf context
    859 			icon: './themes/common/images/skin/exclamation.png',
    860 			text: 'Alert',
    861 			itemId:'alert',
    862 			tooltip:  {
    863 			  text: 'Alert!'
    864 			},
    865 			handler: function(sender, data) {
    866 				//widgetState is an already instantiated WidgetState Obj
    867 				if (widgetState) {
    868 					widgetState.getWidgetState({
    869 						callback: function(state) {
    870 							//check if the widget is visible
    871 							if (!state.collapsed && !state.minimized && state.active) {
    872 								//only render visual content, perhaps popup a message box if the widget is visible
    873 								//otherwise it may not render correctly
    874 							}
    875 						}
    876 					});
    877 				}
    878 			}
    879 		},
    880 		{
    881 			xtype: 'widgettool',
    882 			//path to an image to use. this path should either be fully qualified or relative to the /owf context
    883 			icon: './themes/common/images/skin/information.png',
    884 			itemId:'help',
    885 			handler: function(sender, data) {
    886 				alert('About Button Pressed');
    887 			}
    888 		},
    889 		{
    890 			//gear is a standard ext tool type
    891 			type: 'gear',
    892 			itemId:'gear',
    893 			handler: function(sender, data) {
    894 				alert('Utility Button Pressed');
    895 			}
    896 		}
    897 	]
    898 });
    899    */
    900
    901 /**
    902 	Updates any existing buttons in the Widget Chrome based on the itemId.
    903 	@name updateHeaderButtons
    904 	@methodOf OWF.Chrome
    905
    906 	@param {Object} cfg config object see below for properties
    907 	@param {Object[]} cfg.items an array of buttons configurations to add to the chrome.  See example below for button configs
    908 	@param {String} cfg.items[*].itemId itemId is a unique id among all buttons that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate buttons which may not be able to be removed properly.
    909 	@param {String} cfg.items[*].xtype xtype is ExtJS-like property used to determine the component to create.  Currently the Widget Chrome API only supports two xtype values: ‘button’ and ‘widgettool’.  xtype is an optional field, if it is omitted ‘widgettool’ is used.
    910 	@param {String} cfg.items[*].type Used only for ‘widgettool’ buttons.  It determines the standard icon to be used.  For a complete list of types please see the ExtJS 4.x API documentation, <a href='http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Tool-cfg-type'>http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Tool-cfg-type</a>
    911 	@param {String} cfg.items[*].icon This property defines the URL of the image to be used for the button.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    912 	@param {String} cfg.items[*].text This property defines text to appear alongside the button.  This property is only used if the xtype is ‘button.’  ‘widgettool’ will not show text.
    913 	@param {Object} cfg.items[*].tooltip This property defines a tooltip.  It has two important sub properties, title and text.  tooltip is only used when the xtype is ‘button’
    914 	@param {Function} cfg.items[*].handler The handler attribute defines a function to be executed when the button is pressed. This function is executed using Widget Eventing API from inside the widget.  The internal channel name used is the itemId attribute. This function’s parameter list contains the standard parameters for an Eventing callback function.
    915
    916 	@example
    917 OWF.Chrome.updateHeaderButtons({
    918 	items: [
    919 		{
    920 			xtype: 'button',
    921 			//path to an image to use. this path should either be fully qualified or relative to the /owf context
    922 			icon: './themes/common/images/skin/exclamation.png',
    923 			text: 'Alert',
    924 			itemId:'alert',
    925 			tooltip:  {
    926 			  text: 'Alert!'
    927 			},
    928 			handler: function(sender, data) {
    929 				//widgetState is an already instantiated WidgetState Obj
    930 				if (widgetState) {
    931 					widgetState.getWidgetState({
    932 						callback: function(state) {
    933 							//check if the widget is visible
    934 							if (!state.collapsed && !state.minimized && state.active) {
    935 								//only render visual content, perhaps popup a message box if the widget is visible
    936 								//otherwise it may not render correctly
    937 							}
    938 						}
    939 					});
    940 				}
    941 			}
    942 		},
    943 		{
    944 			xtype: 'widgettool',
    945 			//path to an image to use. this path should either be fully qualified or relative to the /owf context
    946 			icon: './themes/common/images/skin/information.png',
    947 			itemId:'help',
    948 			handler: function(sender, data) {
    949 				alert('About Button Pressed');
    950 			}
    951 		},
    952 		{
    953 			//gear is a standard ext tool type
    954 			type: 'gear',
    955 			itemId:'gear',
    956 			handler: function(sender, data) {
    957 				alert('Utility Button Pressed');
    958 			}
    959 		}
    960 	]
    961 });
    962 */
    963
    964 /**
    965 	Inserts new buttons to the Widget Chrome.  Buttons are added to the same area as existing buttons.
    966 	@name insertHeaderButtons
    967 	@methodOf OWF.Chrome
    968
    969 	@param {Object} cfg config object see below for properties
    970 	@param {Number} [cfg.pos=0] 0-based index of where buttons will be added, among any pre-existing buttons.
    971 	@param {Object[]} cfg.items an array of buttons configurations to insert to the chrome.  See example below for button configs
    972 	@param {String} cfg.items[*].itemId itemId is a unique id among all buttons that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate buttons which may not be able to be removed properly.
    973 	@param {String} cfg.items[*].xtype xtype is ExtJS-like property used to determine the component to create.  Currently the Widget Chrome API only supports two xtype values: ‘button’ and ‘widgettool’.  xtype is an optional field, if it is omitted ‘widgettool’ is used.
    974 	@param {String} cfg.items[*].type Used only for ‘widgettool’ buttons.  It determines the standard icon to be used.  For a complete list of types please see the ExtJS 4.x API documentation, <a href='http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Tool-cfg-type'>http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Tool-cfg-type</a>
    975 	@param {String} cfg.items[*].icon This property defines the URL of the image to be used for the button.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    976 	@param {String} cfg.items[*].text This property defines text to appear alongside the button.  This property is only used if the xtype is ‘button.’  ‘widgettool’ will not show text.
    977 	@param {Object} cfg.items[*].tooltip This property defines a tooltip.  It has two important sub properties, title and text.  tooltip is only used when the xtype is ‘button’
    978 	@param {Function} cfg.items[*].handler The handler attribute defines a function to be executed when the button is pressed. This function is executed using Widget Eventing API from inside the widget.  The internal channel name used is the itemId attribute. This function’s parameter list contains the standard parameters for an Eventing callback function.
    979
    980 	@example
    981 OWF.Chrome.insertHeaderButtons({
    982 	pos: 0,
    983 	items: [
    984 		{
    985 			xtype: 'button',
    986 			//path to an image to use. this path should either be fully qualified or relative to the /owf context
    987 			icon: './themes/common/images/skin/exclamation.png',
    988 			text: 'Alert',
    989 			itemId:'alert',
    990 			tooltip:  {
    991 				text: 'Alert!'
    992 			},
    993 			handler: function(sender, data) {
    994 				//widgetState is an already instantiated WidgetState Obj
    995 				if (widgetState) {
    996 					widgetState.getWidgetState({
    997 						callback: function(state) {
    998 							//check if the widget is visible
    999 							if (!state.collapsed && !state.minimized && state.active) {
    1000 								//only render visual content, perhaps popup a message box if the widget is visible
    1001 								//otherwise it may not render correctly
    1002 							}
    1003 						}
    1004 					});
    1005 				}
    1006 			}
    1007 		},
    1008 		{
    1009 			xtype: 'widgettool',
    1010 			//path to an image to use. this path should either be fully qualified or relative to the /owf context
    1011 			icon: './themes/common/images/skin/information.png',
    1012 			itemId:'help',
    1013 			handler: function(sender, data) {
    1014 				alert('About Button Pressed');
    1015 			}
    1016 		},
    1017 			{
    1018 			//gear is a standard ext tool type
    1019 			type: 'gear',
    1020 			itemId:'gear',
    1021 			handler: function(sender, data) {
    1022 				alert('Utility Button Pressed');
    1023 			}
    1024 		}
    1025 	]
    1026 });
    1027 */
    1028
    1029 /**
    1030 	Removes existing buttons on the Widget Chrome based on itemId.
    1031 	@name removeHeaderButtons
    1032 	@methodOf OWF.Chrome
    1033
    1034 	@param {Object} cfg config object see below for properties
    1035 	@param {Object[]} cfg.items an array of buttons configurations to remove to the chrome.  Only itemId is required.
    1036 	See example below for button configs
    1037 	@param {String} cfg.items[*].itemId itemId is a unique id among all buttons that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate buttons which may not be able to be removed properly.
    1038
    1039 	@example
    1040 OWF.Chrome.removeHeaderButtons({
    1041 		items:[
    1042 			{
    1043 				itemId:'alert'
    1044 			},
    1045 			{
    1046 				itemId:'help'
    1047 			},
    1048 			{
    1049 				itemId:'gear'
    1050 			}
    1051 		]
    1052 });
    1053 */
    1054
    1055 /**
    1056 	Lists all buttons that have been added to the widget chrome.
    1057 	@name listHeaderButtons
    1058 	@methodOf OWF.Chrome
    1059
    1060 	@param {Object} cfg config object see below for properties
    1061 	@param {Function} cfg.callback The function which receives the results.
    1062
    1063 	@example
    1064 OWF.Chrome.listHeaderButtons({
    1065 	callback: function(msg) {
    1066 		//msg will always be a json string
    1067 		var res = Ozone.util.parseJson(msg);
    1068 		if (res.success) {
    1069 			for (var i = 0; i < res.items.length; i++) {
    1070 				// do something with the buttons
    1071 			}
    1072 		}
    1073 	}
    1074 });
    1075 */
    1076
    1077 /**
    1078 	Adds menus to the Widget Chrome.  Menus are added after existing menus.
    1079 	@name addHeaderMenus
    1080 	@methodOf OWF.Chrome
    1081
    1082 	@param {Object} cfg config object see below for properties
    1083 	@param {Object[]} cfg.items an array of menu configurations to add to the chrome.  See example for menu configs
    1084 	@param {String} cfg.items[*].parentId itemId is the itemId of the menu to which this configuration should be added as a sub-menu.  If omitted, the configuration will be added as a main menu on the menu toolbar.
    1085 	@param {String} cfg.items[*].itemId itemId is a unique id among all menus that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate menus which may not be able to be removed properly.
    1086 	@param {String} cfg.items[*].icon This property defines the URL of the image to be used for the menu.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    1087 	@param {String} cfg.items[*].text This property defines text to appear alongside the menu.
    1088 	@param {Object} cfg.items[*].menu menu configuration object
    1089 	@param {Object[]} cfg.items[*].menu.items an array of menu item configurations to add to the chrome.  See example for menu item configs
    1090 	@param {String} cfg.items[*].menu.items[*].itemId itemId is a unique id among all menu items that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.
    1091 	@param {String} cfg.items[*].menu.items[*].xtype xtype is used to specify the type of menu item to add.  This attribute should be omitted unless specifying a menuseparator. Setting this value to "menuseparator" adds a separator bar to a menu, used to divide logical groups of menu items. If specified, only xtype should be specified.  Generally you will add one of these by using "-" in your items config rather than creating one directly using xtype.  See example below for usage.
    1092 	@param {String} cfg.items[*].menu.items[*].icon This property defines the URL of the image to be used for the menu item.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    1093 	@param {String} cfg.items[*].menu.items[*].text This property defines text to appear for the menu item.
    1094 	@param {Function} cfg.items[*].menu.items[*].handler The handler attribute defines a function to be executed when the menu item is clicked. This function is executed using Widget Eventing API from inside the widget.  The internal channel name used is the itemId attribute. This function's parameter list contains the standard parameters for an Eventing callback function.
    1095 	@param {Object} cfg.items[*].menu.items[*].menu sub-menu configuration object.  See example for sub-menu config.
    1096
    1097 	@example
    1098 OWF.Chrome.addHeaderMenus({
    1099 	items: [
    1100 		{
    1101 			itemId:'regularMenu',
    1102 			icon: './themes/common/images/skin/exclamation.png',
    1103 			text: 'Regular Menu',
    1104 			menu: {
    1105 				items: [
    1106 					{
    1107 						itemId:'regularMenuItem1',
    1108 						icon: './themes/common/images/skin/exclamation.png',
    1109 						text: 'Regular Menu Item 1',
    1110 						handler: function(sender, data) {
    1111 							alert('You clicked the Regular Menu menu item.');
    1112 						}
    1113 					}
    1114 				]
    1115 			}
    1116 		},
    1117 		{
    1118 			itemId:'snacks',
    1119 			icon: './themes/common/images/skin/exclamation.png',
    1120 			text: 'Menu with Sub-Menu',
    1121 			menu: {
    1122 				items: [
    1123 					{
    1124 						itemId:'fruits',
    1125 						icon: './themes/common/images/skin/exclamation.png',
    1126 						text: 'Fruits',
    1127 						menu: {
    1128 							items: [
    1129 								{
    1130 									itemId:'apple',
    1131 									icon: './themes/common/images/skin/exclamation.png',
    1132 									text: 'Apple',
    1133 									handler: function(sender, data) {
    1134 										alert('Your snack will be an Apple.');
    1135 									}
    1136 								},
    1137 							   {
    1138 								   xtype: 'menuseparator'
    1139 							   },
    1140 								{
    1141 									itemId:'banana',
    1142 									icon: './themes/common/images/skin/exclamation.png',
    1143 									text: 'Banana',
    1144 									handler: function(sender, data) {
    1145 										alert('Your snack will be a Banana.');
    1146 									}
    1147 								}, {
    1148 									itemId:'cherry',
    1149 									icon: './themes/common/images/skin/exclamation.png',
    1150 									text: 'Cherries',
    1151 									handler: function(sender, data) {
    1152 										alert('Your snack will be Cherries.');
    1153 									}
    1154 								}
    1155 							]
    1156 						}
    1157 					},
    1158 					'-', // another way to add a menu separator
    1159 					{
    1160 						itemId:'cupcake',
    1161 						icon: './themes/common/images/skin/exclamation.png',
    1162 						text: 'Cupcake',
    1163 						handler: function(sender, data) {
    1164 							alert('Your snack will be a Cupcake.');
    1165 						}
    1166 					},
    1167 					{
    1168 						itemId:'chips',
    1169 						icon: './themes/common/images/skin/exclamation.png',
    1170 						text: 'Potato Chips',
    1171 						handler: function(sender, data) {
    1172 							alert('Your snack will be a Potato Chips.');
    1173 						}
    1174 					}
    1175 				]
    1176 			}
    1177 		}
    1178 	]
    1179 });
    1180 */
    1181
    1182 /**
    1183 	Updates any existing menus in the Widget Chrome based on the itemId.
    1184 	@name updateHeaderMenus
    1185 	@methodOf OWF.Chrome
    1186
    1187 	@param {Object} cfg config object see below for properties
    1188 	@param {Object[]} cfg.items an array of menu configurations to add to the chrome.  See example for menu configs
    1189 	@param {String} cfg.items[*].itemId itemId is a unique id among all menus that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate menus which may not be able to be removed properly.
    1190 	@param {String} cfg.items[*].icon This property defines the URL of the image to be used for the menu.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    1191 	@param {String} cfg.items[*].text This property defines text to appear alongside the menu.
    1192 	@param {Object} cfg.items[*].menu menu configuration object
    1193 	@param {Object[]} cfg.items[*].menu.items an array of menu item configurations to add to the chrome.  See example for menu item configs
    1194 	@param {String} cfg.items[*].menu.items[*].itemId itemId is a unique id among all menu items that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.
    1195 	@param {String} cfg.items[*].menu.items[*].xtype xtype is used to specify the type of menu item to add.  This attribute should be omitted unless specifying a menuseparator. Setting this value to "menuseparator" adds a separator bar to a menu, used to divide logical groups of menu items. If specified, only xtype should be specified.  See example below for usage.
    1196 	@param {String} cfg.items[*].menu.items[*].icon This property defines the URL of the image to be used for the menu item.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    1197 	@param {String} cfg.items[*].menu.items[*].text This property defines text to appear for the menu item.
    1198 	@param {Function} cfg.items[*].menu.items[*].handler The handler attribute defines a function to be executed when the menu item is clicked. This function is executed using Widget Eventing API from inside the widget.  The internal channel name used is the itemId attribute. This function's parameter list contains the standard parameters for an Eventing callback function.
    1199 	@param {Object} cfg.items[*].menu.items[*].menu sub-menu configuration object.  See example for sub-menu config.
    1200
    1201 	@example
    1202 OWF.Chrome.updateHeaderMenus({
    1203 	items:[
    1204 		{
    1205 			itemId:'regularMenu',
    1206 			icon: './themes/common/images/skin/exclamation.png',
    1207 			text: 'Regular Menu',
    1208 			menu: {
    1209 				items: [
    1210 					{
    1211 						itemId:'regularMenuItem1',
    1212 						icon: './themes/common/images/skin/exclamation.png',
    1213 						text: 'Regular Menu Item 1',
    1214 						handler: function(sender, data) {
    1215 							alert('You clicked the Regular Menu menu item.');
    1216 						}
    1217 					}
    1218 				]
    1219 			}
    1220 		},
    1221 		{
    1222 			itemId:'snacks',
    1223 			icon: './themes/common/images/skin/exclamation.png',
    1224 			text: 'Menu with Sub-Menu',
    1225 			menu: {
    1226 				items: [
    1227 					{
    1228 						itemId:'fruits',
    1229 						icon: './themes/common/images/skin/exclamation.png',
    1230 						text: 'Fruits',
    1231 						menu: {
    1232 							items: [
    1233 								{
    1234 									itemId:'apple',
    1235 									icon: './themes/common/images/skin/exclamation.png',
    1236 									text: 'Apple',
    1237 									handler: function(sender, data) {
    1238 										alert('Your snack will be an Apple.');
    1239 									}
    1240 								},
    1241 							   {
    1242 								   xtype: 'menuseparator'
    1243 							   },
    1244 								{
    1245 									itemId:'banana',
    1246 									icon: './themes/common/images/skin/exclamation.png',
    1247 									text: 'Banana',
    1248 									handler: function(sender, data) {
    1249 										alert('Your snack will be a Banana.');
    1250 									}
    1251 								}, {
    1252 									itemId:'cherry',
    1253 									icon: './themes/common/images/skin/exclamation.png',
    1254 									text: 'Cherries',
    1255 									handler: function(sender, data) {
    1256 										alert('Your snack will be Cherries.');
    1257 									}
    1258 								}
    1259 							]
    1260 						}
    1261 					},
    1262 					'-', // another way to add a menu separator
    1263 					{
    1264 						itemId:'cupcake',
    1265 						icon: './themes/common/images/skin/exclamation.png',
    1266 						text: 'Cupcake',
    1267 						handler: function(sender, data) {
    1268 							alert('Your snack will be a Cupcake.');
    1269 						}
    1270 					},
    1271 					{
    1272 						itemId:'chips',
    1273 						icon: './themes/common/images/skin/exclamation.png',
    1274 						text: 'Potato Chips',
    1275 						handler: function(sender, data) {
    1276 							alert('Your snack will be a Potato Chips.');
    1277 						}
    1278 					}
    1279 				]
    1280 			}
    1281 		}
    1282 	]
    1283 });
    1284 */
    1285
    1286 /**
    1287 	Inserts new menus into the Widget Chrome. Menus are added to the same area as existing menus.
    1288 	@name insertHeaderMenus
    1289 	@methodOf OWF.Chrome
    1290
    1291 	@param {Object} cfg config object see below for properties
    1292 	@param {Number} [cfg.pos=0] 0-based index of where menus will be added, among any pre-existing menus.
    1293 	@param {Object[]} cfg.items an array of menu configurations to add to the chrome.  See example for menu configs
    1294 	@param {String} cfg.items[*].parentId itemId is the itemId of the menu to which this configuration should be added as a sub-menu.  If omitted, the configuration will be added as a main menu on the menu toolbar.
    1295 	@param {String} cfg.items[*].itemId itemId is a unique id among all menus that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.  If itemId is not unique this may result in duplicate menus which may not be able to be removed properly.
    1296 	@param {String} cfg.items[*].icon This property defines the URL of the image to be used for the menu.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    1297 	@param {String} cfg.items[*].text This property defines text to appear alongside the menu.  This property is only used if the xtype is ‘menu.’  ‘widgettool’ will not show text.
    1298 	@param {Object} cfg.items[*].menu menu configuration object
    1299 	@param {Object[]} cfg.items[*].menu.items an array of menu item configurations to add to the chrome.  See example for menu item configs
    1300 	@param {String} cfg.items[*].menu.items[*].itemId itemId is a unique id among all menu items that are added.  It is a required property.  It is used for identification and defines the internal Eventing channel which is used to execute the handler function.
    1301 	@param {String} cfg.items[*].menu.items[*].xtype xtype is used to specify the type of menu item to add.  This attribute should be omitted unless specifying a menuseparator. Setting this value to "menuseparator" adds a separator bar to a menu, used to divide logical groups of menu items. If specified, only xtype should be specified.  See example below for usage.
    1302 	@param {String} cfg.items[*].menu.items[*].icon This property defines the URL of the image to be used for the menu item.  If the URL is a relative path, it will be relative to the /owf context.  This is useful if the desired image is hosted by the OWF web server.  Otherwise a fully qualified URL should be used.  If type is being used to determine the image, the icon property is optional
    1303 	@param {String} cfg.items[*].menu.items[*].text This property defines text to appear for the menu item.
    1304 	@param {Function} cfg.items[*].menu.items[*].handler The handler attribute defines a function to be executed when the menu item is clicked. This function is executed using Widget Eventing API from inside the widget.  The internal channel name used is the itemId attribute. This function's parameter list contains the standard parameters for an Eventing callback function.
    1305 	@param {Object} cfg.items[*].menu.items[*].menu sub-menu configuration object.  See example for sub-menu config.
    1306
    1307 	@example
    1308 OWF.Chrome.insertHeaderMenus({
    1309 		pos: 0,
    1310 		items: [{
    1311 		 itemId:'insertedMenu',
    1312 			icon: './themes/common/images/skin/exclamation.png',
    1313 			text: 'Inserted Menu',
    1314 			menu: {
    1315 				items: [
    1316 					{
    1317 						itemId:'insertedMenuItem1',
    1318 						icon: './themes/common/images/skin/exclamation.png',
    1319 						text: 'Inserted Menu Item 1',
    1320 						handler: function(sender, data) {
    1321 							alert('You clicked the Inserted Menu menu item.');
    1322 						}
    1323 					},
    1324 					{
    1325 						xtype: 'menuseparator'
    1326 					},
    1327 					{
    1328 						itemId:'insertedMenuItem2',
    1329 						icon: './themes/common/images/skin/exclamation.png',
    1330 						text: 'Inserted Menu Item 2',
    1331 						handler: function(sender, data) {
    1332 							alert('You clicked the Inserted Menu menu item.');
    1333 						}
    1334 					},
    1335 					'-', // another way to add a menu separator
    1336 					{
    1337 						itemId:'insertedMenuItem3',
    1338 						icon: './themes/common/images/skin/exclamation.png',
    1339 						text: 'Inserted Menu Item 3',
    1340 						handler: function(sender, data) {
    1341 							alert('You clicked the Inserted Menu menu item.');
    1342 						}
    1343 					}
    1344 				]
    1345 			}
    1346 		}]
    1347 });
    1348 */
    1349
    1350 /**
    1351 	Removes existing menus on the Widget Chrome based on itemId.
    1352 	@name removeHeaderMenus
    1353 	@methodOf OWF.Chrome
    1354
    1355 	@param {Object} cfg config object see below for properties
    1356 	@param {Object[]} cfg.items an array of objects containing itemIds for the menus to remove from the chrome.
    1357 	  See example below for button configs
    1358
    1359 	@example
    1360 OWF.Chrome.removeHeaderMenus({
    1361 	items: [{
    1362 		itemId: 'regularMenu'
    1363 	}]
    1364 });
    1365 */
    1366
    1367 /**
    1368 	Lists all menus that have been added to the widget chrome.
    1369 	@name listHeaderMenus
    1370 	@methodOf OWF.Chrome
    1371
    1372 	@param {Object} cfg config object see below for properties
    1373 	@param {Function} cfg.callback The function which receives the results.
    1374
    1375 	@example
    1376 OWF.Chrome.listHeaderMenus({
    1377 	callback: function(msg) {
    1378 		//msg will always be a json string
    1379 		var res = Ozone.util.parseJson(msg);
    1380 		if (res.success) {
    1381 			for (var i = 0; i < res.items.length; i++) {
    1382 				// do something with the menus
    1383 			}
    1384 		}
    1385 	}
    1386 });
    1387 	*/
    1388
    1389 // --------------------------------------------------------------------------------------------------
    1390 // ------------------- Preferences ------------------------------------------------------------------
    1391 // --------------------------------------------------------------------------------------------------
    1392
    1393 /**
    1394 	Get the url for the Preference Server
    1395 	@name getUrl
    1396 	@methodOf OWF.Preferences
    1397
    1398 	@returns {String} url
    1399  */
    1400
    1401 /**
    1402 	Sets the url for the Preference Server
    1403 	@name setUrl
    1404 	@methodOf OWF.Preferences
    1405
    1406 	@param {String} url
    1407 	@returns void
    1408  */
    1409
    1410 /**
    1411 	Gets the dashboard with the specified id
    1412 	@name getDashboard
    1413 	@methodOf OWF.Preferences
    1414
    1415 	@param {Object} cfg config object see below for properties
    1416 	@param {String} cfg.dashboardId Unigue dashbard identifier
    1417 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback parameter is json representation of a dashboard.
    1418 	This method will be passed the dashboard object which has the following properties:<br>
    1419 	<br>
    1420 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1421 		{Date} createdDate: date dashboard was created<br>
    1422 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1423 		{String} layout: layout of dashboard<br>
    1424 		{Boolean} isdefault: true if this is a default dashboard<br>
    1425 		{String} name: name of dashboard<br>
    1426 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1427 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1428 		    {String} userId: unique user identifier<br>
    1429 		{List} EDashboardLayoutList: list of dashboard types<br>
    1430 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1431 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1432 		    {String} userId: unique user identifier<br>
    1433 		    {String} userRealName: user's name<br>
    1434 		{Date} editedDate: date dashboard was last edited<br>
    1435 		{Array} groups:  groups dashboard is assigned to<br>
    1436 		{String} description: description of dashboard<br>
    1437 		{String} guid: uniqued dashboard identifier<br>
    1438 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1439 		    {String} widgetGuid: unique widget identifier<br>
    1440 		    {Number} width: width of widget in pixels<br>
    1441 		    {Number} zIndex: in pixels<br>
    1442 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1443 		    {Boolean} pinned: true if widget is pinned open<br>
    1444 		    {String} buttonId: identifier of button that opens widget<br>
    1445 		    {Number} height: height of widget in pixels<br>
    1446 		    {Number} columnPos: position of widget in a column<br>
    1447 		    {String} name: widget name<br>
    1448 		    {Number} statePosition<br>
    1449 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1450 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1451 		    {Boolean} minimized: true if widget is minimized<br>
    1452 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1453 		    {Boolean} collapsed: true if widget is collapsed<br>
    1454 		    {Number} y: y-axis position in pixels<br>
    1455 		    {Number} x: x-axis position in pixels<br>
    1456 		    {Boolean} maximized: true if widget is maximized<br>
    1457 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1458 	<br>
    1459 		@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1460
    1461 		@example
    1462 var onSuccess = function(dashboard) {
    1463 	alert(dashboard.name);
    1464 };
    1465 var onFailure = function(error) {
    1466 	alert(error);
    1467 };
    1468
    1469 OWF.Preferences.getDashboard({
    1470 	dashboardId:'917b4cd0-ecbd-410b-afd9-42d150c26426',
    1471 	onSuccess:onSuccess,
    1472 	onFailure:onFailure
    1473 });
    1474  */
    1475
    1476 /**
    1477 	Gets the user's default dashboard
    1478 	@name getDefaultDashboard
    1479 	@methodOf OWF.Preferences
    1480
    1481 	@param {Object} cfg config object see below for properties
    1482 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
    1483 	This method will be passed the dashboard object which has the following properties:<br>
    1484 	<br>
    1485 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1486 		{Date} createdDate: date dashboard was created<br>
    1487 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1488 		{String} layout: layout of dashboard<br>
    1489 		{Boolean} isdefault: true if this is a default dashboard<br>
    1490 		{String} name: name of dashboard<br>
    1491 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1492 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1493 		    {String} userId: unique user identifier<br>
    1494 		{List} EDashboardLayoutList: list of dashboard types<br>
    1495 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1496 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1497 		    {String} userId: unique user identifier<br>
    1498 		    {String} userRealName: user's name<br>
    1499 		{Date} editedDate: date dashboard was last edited<br>
    1500 		{Array} groups:  groups dashboard is assigned to<br>
    1501 		{String} description: description of dashboard<br>
    1502 		{String} guid: uniqued dashboard identifier<br>
    1503 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1504 		    {String} widgetGuid: unique widget identifier<br>
    1505 		    {Number} width: width of widget in pixels<br>
    1506 		    {Number} zIndex: in pixels<br>
    1507 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1508 		    {Boolean} pinned: true if widget is pinned open<br>
    1509 		    {String} buttonId: identifier of button that opens widget<br>
    1510 		    {Number} height: height of widget in pixels<br>
    1511 		    {Number} columnPos: position of widget in a column<br>
    1512 		    {String} name: widget name<br>
    1513 		    {Number} statePosition<br>
    1514 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1515 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1516 		    {Boolean} minimized: true if widget is minimized<br>
    1517 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1518 		    {Boolean} collapsed: true if widget is collapsed<br>
    1519 		    {Number} y: y-axis position in pixels<br>
    1520 		    {Number} x: x-axis position in pixels<br>
    1521 		    {Boolean} maximized: true if widget is maximized<br>
    1522 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1523 		<br>
    1524 		@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1525
    1526 		@example
    1527 var onSuccess = function(dashboard) {
    1528 	alert(dashboard.name);
    1529 };
    1530 var onFailure = function(error) {
    1531 	alert(error);
    1532 };
    1533 OWF.Preferences.getDefaultDashboard({
    1534 	onSuccess:onSuccess,
    1535 	onFailure:onFailure
    1536 });
    1537  */
    1538
    1539 /**
    1540 	Sets the user's default dashboard
    1541 	@name setDefaultDashboard
    1542 	@methodOf OWF.Preferences
    1543 	@param {Object} cfg config object see below for properties
    1544 	@param {String} cfg.dashboardId Unigue dashbard identifier
    1545 	@param {Boolean} cfg.isDefault true to set as default dashboard
    1546 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
    1547 	This method will be passed the dashboard object which has the following properties:<br>
    1548 	<br>
    1549 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1550 		{Date} createdDate: date dashboard was created<br>
    1551 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1552 		{String} layout: layout of dashboard<br>
    1553 		{Boolean} isdefault: true if this is a default dashboard<br>
    1554 		{String} name: name of dashboard<br>
    1555 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1556 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1557 		    {String} userId: unique user identifier<br>
    1558 		{List} EDashboardLayoutList: list of dashboard types<br>
    1559 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1560 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1561 		    {String} userId: unique user identifier<br>
    1562 		    {String} userRealName: user's name<br>
    1563 		{Date} editedDate: date dashboard was last edited<br>
    1564 		{Array} groups:  groups dashboard is assigned to<br>
    1565 		{String} description: description of dashboard<br>
    1566 		{String} guid: uniqued dashboard identifier<br>
    1567 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1568 		    {String} widgetGuid: unique widget identifier<br>
    1569 		    {Number} width: width of widget in pixels<br>
    1570 		    {Number} zIndex: in pixels<br>
    1571 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1572 		    {Boolean} pinned: true if widget is pinned open<br>
    1573 		    {String} buttonId: identifier of button that opens widget<br>
    1574 		    {Number} height: height of widget in pixels<br>
    1575 		    {Number} columnPos: position of widget in a column<br>
    1576 		    {String} name: widget name<br>
    1577 		    {Number} statePosition<br>
    1578 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1579 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1580 		    {Boolean} minimized: true if widget is minimized<br>
    1581 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1582 		    {Boolean} collapsed: true if widget is collapsed<br>
    1583 		    {Number} y: y-axis position in pixels<br>
    1584 		    {Number} x: x-axis position in pixels<br>
    1585 		    {Boolean} maximized: true if widget is maximized<br>
    1586 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1587 	<br>
    1588 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1589
    1590 	@example
    1591 var onSuccess = function(dashboard) {
    1592 	alert(dashboard.name);
    1593 };
    1594
    1595 var onFailure = function(error) {
    1596 	alert(error);
    1597 };
    1598
    1599 OWF.Preferences.setDefaultDashboard({
    1600 	dashboardId:'917b4cd0-ecbd-410b-afd9-42d150c26426',
    1601 	isDefault:true,
    1602 	onSuccess:onSuccess,
    1603 	onFailure:onFailure
    1604 });
    1605 */
    1606
    1607 /**
    1608 	@description Saves changes to a new or existing dashboard
    1609 	@name createOrUpdateDashboard
    1610 	@methodOf OWF.Preferences
    1611 	@param {Object} cfg config object see below for properties
    1612 	@param {Object} cfg.json The encoded JSON object representing the dashboard.
    1613 	The dashboard object has the following properties:<br>
    1614 	<br>
    1615 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1616 		{String} layout: layout of dashboard<br>
    1617 		{Boolean} isdefault: true if this is a default dashboard<br>
    1618 		{String} name: name of dashboard<br>
    1619 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1620 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1621 		{Array} groups:  groups dashboard is assigned to<br>
    1622 		{String} description: description of dashboard<br>
    1623 		{String} guid: uniqued dashboard identifier<br>
    1624 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1625 		    {String} widgetGuid: unique widget identifier<br>
    1626 		    {Number} width: width of widget in pixels<br>
    1627 		    {Number} zIndex: in pixels<br>
    1628 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1629 		    {Boolean} pinned: true if widget is pinned open<br>
    1630 		    {String} buttonId: identifier of button that opens widget<br>
    1631 		    {Number} height: height of widget in pixels<br>
    1632 		    {Number} columnPos: position of widget in a column<br>
    1633 		    {String} name: widget name<br>
    1634 		    {Number} statePosition<br>
    1635 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1636 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1637 		    {Boolean} minimized: true if widget is minimized<br>
    1638 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1639 		    {Boolean} collapsed: true if widget is collapsed<br>
    1640 		    {Number} y: y-axis position in pixels<br>
    1641 		    {Number} x: x-axis position in pixels<br>
    1642 		    {Boolean} maximized: true if widget is maximized<br>
    1643 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1644 	<br>
    1645 	@param {Boolean} cfg.saveAsNew A Boolean indicating whether the entity being saved is new.
    1646 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
    1647 	This method will be passed the dashboard object which has the following properties:<br>
    1648 	<br>
    1649 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1650 		{Date} createdDate: date dashboard was created<br>
    1651 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1652 		{String} layout: layout of dashboard<br>
    1653 		{Boolean} isdefault: true if this is a default dashboard<br>
    1654 		{String} name: name of dashboard<br>
    1655 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1656 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1657 		    {String} userId: unique user identifier<br>
    1658 		{List} EDashboardLayoutList: list of dashboard types<br>
    1659 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1660 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1661 		    {String} userId: unique user identifier<br>
    1662 		    {String} userRealName: user's name<br>
    1663 		{Date} editedDate: date dashboard was last edited<br>
    1664 		{Array} groups:  groups dashboard is assigned to<br>
    1665 		{String} description: description of dashboard<br>
    1666 		{String} guid: uniqued dashboard identifier<br>
    1667 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1668 		    {String} widgetGuid: unique widget identifier<br>
    1669 		    {Number} width: width of widget in pixels<br>
    1670 		    {Number} zIndex: in pixels<br>
    1671 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1672 		    {Boolean} pinned: true if widget is pinned open<br>
    1673 		    {String} buttonId: identifier of button that opens widget<br>
    1674 		    {Number} height: height of widget in pixels<br>
    1675 		    {Number} columnPos: position of widget in a column<br>
    1676 		    {String} name: widget name<br>
    1677 		    {Number} statePosition<br>
    1678 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1679 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1680 		    {Boolean} minimized: true if widget is minimized<br>
    1681 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1682 		    {Boolean} collapsed: true if widget is collapsed<br>
    1683 		    {Number} y: y-axis position in pixels<br>
    1684 		    {Number} x: x-axis position in pixels<br>
    1685 		    {Boolean} maximized: true if widget is maximized<br>
    1686 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1687 	<br>
    1688 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1689 	@param {Boolean} [cfg.async] Async true or false defaults to true
    1690 	@example
    1691
    1692 var onSuccess = function(dashboard) {
    1693 	alert(dashboard.name);
    1694 };
    1695
    1696 var onFailure = function(error) {
    1697 	alert(error);
    1698 };
    1699
    1700 var dashboard = {
    1701 	isGroupDashboard: false,
    1702 	layout: 'desktop',
    1703 	isdefault: false,
    1704 	name: 'My Dashboard',
    1705 	columnCount: 0,
    1706 	defaultSettings: {},
    1707 	groups: [],
    1708 	description: 'This is my dashboard',
    1709 	guid: guid.util.guid(),
    1710 	state: [],
    1711 	showLaunchMenu: false
    1712 };
    1713
    1714 OWF.Preferences.createOrUpdateDashboard({
    1715 	json: dashboard,
    1716 	saveAsNew: true,
    1717 	onSuccess: onSuccess,
    1718 	onFailure: onFailure,
    1719 	async: true
    1720 });
    1721 */
    1722
    1723 /**
    1724 	@description Copies an existing dashboard and saves it as new
    1725 	@name cloneDashboard
    1726 	@methodOf OWF.Preferences
    1727
    1728 	@param {Object} cfg config object see below for properties
    1729 	@param {Object} cfg.json The encoded JSON object representing the dashboard.
    1730 	The dashboard object has the following properties:<br>
    1731 	<br>
    1732 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1733 		{Date} createdDate: date dashboard was created<br>
    1734 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1735 		{String} layout: layout of dashboard<br>
    1736 		{Boolean} isdefault: true if this is a default dashboard<br>
    1737 		{String} name: name of dashboard<br>
    1738 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1739 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1740 		    {String} userId: unique user identifier<br>
    1741 		{List} EDashboardLayoutList: list of dashboard types<br>
    1742 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1743 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1744 		    {String} userId: unique user identifier<br>
    1745 		    {String} userRealName: user's name<br>
    1746 		{Date} editedDate: date dashboard was last edited<br>
    1747 		{Array} groups:  groups dashboard is assigned to<br>
    1748 		{String} description: description of dashboard<br>
    1749 		{String} guid: uniqued dashboard identifier<br>
    1750 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1751 		    {String} widgetGuid: unique widget identifier<br>
    1752 		    {Number} width: width of widget in pixels<br>
    1753 		    {Number} zIndex: in pixels<br>
    1754 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1755 		    {Boolean} pinned: true if widget is pinned open<br>
    1756 		    {String} buttonId: identifier of button that opens widget<br>
    1757 		    {Number} height: height of widget in pixels<br>
    1758 		    {Number} columnPos: position of widget in a column<br>
    1759 		    {String} name: widget name<br>
    1760 		    {Number} statePosition<br>
    1761 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1762 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1763 		    {Boolean} minimized: true if widget is minimized<br>
    1764 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1765 		    {Boolean} collapsed: true if widget is collapsed<br>
    1766 		    {Number} y: y-axis position in pixels<br>
    1767 		    {Number} x: x-axis position in pixels<br>
    1768 		    {Boolean} maximized: true if widget is maximized<br>
    1769 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1770 	<br>
    1771 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
    1772 	This method will be passed the dashboard object which has the following properties:<br>
    1773 	<br>
    1774 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1775 		{Date} createdDate: date dashboard was created<br>
    1776 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1777 		{String} layout: layout of dashboard<br>
    1778 		{Boolean} isdefault: true if this is a default dashboard<br>
    1779 		{String} name: name of dashboard<br>
    1780 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1781 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1782 		    {String} userId: unique user identifier<br>
    1783 		{List} EDashboardLayoutList: list of dashboard types<br>
    1784 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1785 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1786 		    {String} userId: unique user identifier<br>
    1787 		    {String} userRealName: user's name<br>
    1788 		{Date} editedDate: date dashboard was last edited<br>
    1789 		{Array} groups:  groups dashboard is assigned to<br>
    1790 		{String} description: description of dashboard<br>
    1791 		{String} guid: uniqued dashboard identifier<br>
    1792 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1793 		    {String} widgetGuid: unique widget identifier<br>
    1794 		    {Number} width: width of widget in pixels<br>
    1795 		    {Number} zIndex: in pixels<br>
    1796 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1797 		    {Boolean} pinned: true if widget is pinned open<br>
    1798 		    {String} buttonId: identifier of button that opens widget<br>
    1799 		    {Number} height: height of widget in pixels<br>
    1800 		    {Number} columnPos: position of widget in a column<br>
    1801 		    {String} name: widget name<br>
    1802 		    {Number} statePosition<br>
    1803 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1804 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1805 		    {Boolean} minimized: true if widget is minimized<br>
    1806 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1807 		    {Boolean} collapsed: true if widget is collapsed<br>
    1808 		    {Number} y: y-axis position in pixels<br>
    1809 		    {Number} x: x-axis position in pixels<br>
    1810 		    {Boolean} maximized: true if widget is maximized<br>
    1811 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1812 	<br>
    1813 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1814
    1815 	@example
    1816 var onSuccess = function(dashboard) {
    1817 	alert(dashboard.name);
    1818 };
    1819
    1820 var onFailure = function(error) {
    1821 	alert(error);
    1822 };
    1823
    1824 var dashboard = {
    1825 	alteredByAdmin: 'false',
    1826 	createdDate: '04/18/2012 11:29 AM EDT',
    1827 	isGroupDashboard: false,
    1828 	layout: 'desktop',
    1829 	isdefault: false,
    1830 	name: 'My Dashboard',
    1831 	columnCount: 0,
    1832 	user: {
    1833 		userId: 'testAdmin1',
    1834 	},
    1835 	EDashboardLayoutList: ['accordion', 'desktop', 'portal', 'tabbed'],
    1836 	defaultSettings: {},
    1837 	createdBy: {
    1838 		userId: 'testAdmin1',
    1839 		userRealName: 'Test Admin 1'
    1840 	},
    1841 	editedDate: '04/18/2012 11:29 AM EDT',
    1842 	groups: [],
    1843 	description: 'This is my dashboard',
    1844 	guid: guid.util.guid(),
    1845 	state: [],
    1846 	showLaunchMenu: false
    1847 };
    1848
    1849 OWF.Preferences.cloneDashboard({
    1850 	json: dashboard,
    1851 	onSuccess: onSuccess,
    1852 	onFailure: onFailure
    1853 });
    1854  */
    1855
    1856 /**
    1857 	@description Saves changes to existing dashboards
    1858 	@name updateAndDeleteDashboards
    1859 	@methodOf OWF.Preferences
    1860
    1861 	@param {Object} cfg config object see below for properties
    1862 	@param {Array} cfg.viewsToUpdate array of JSON objects containing the view guid and data to be updated
    1863 	@param {Array} cfg.viewGuidsToDelete array of guids of views to be deleted
    1864 	@param {Boolean} cfg.updateOrder flag to update order
    1865 	@param {Function} cfg.onSuccess callback function to capture the success result
    1866 	@param {Function} [cfg.onFailure] callback to execute if there is an error (optional, a default alert provided)
    1867  */
    1868
    1869 /**
    1870 	@description Deletes the dashboard with the specified id
    1871 	@name deleteDashboard
    1872 	@methodOf OWF.Preferences
    1873
    1874 	@param {Object} cfg config object see below for properties
    1875 	@param {String} cfg.dashboardId Unigue dashbard identifier
    1876 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
    1877 	This method will be passed the dashboard object which has the following properties:<br>
    1878 	<br>
    1879 		{Boolean} alteredByAdmin: true if altered by an administrator<br>
    1880 		{Date} createdDate: date dashboard was created<br>
    1881 		{Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1882 		{String} layout: layout of dashboard<br>
    1883 		{Boolean} isdefault: true if this is a default dashboard<br>
    1884 		{String} name: name of dashboard<br>
    1885 		{Number} columnCount: number of columns if dashboard is a portal type<br>
    1886 		{Object} user: the dashoard owner.  Has the following properties:<br>
    1887 		    {String} userId: unique user identifier<br>
    1888 		{List} EDashboardLayoutList: list of dashboard types<br>
    1889 		{String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1890 		{Object} createdBy: dashboard creator.  Has the following properties:<br>
    1891 		    {String} userId: unique user identifier<br>
    1892 		    {String} userRealName: user's name<br>
    1893 		{Date} editedDate: date dashboard was last edited<br>
    1894 		{Array} groups:  groups dashboard is assigned to<br>
    1895 		{String} description: description of dashboard<br>
    1896 		{String} guid: uniqued dashboard identifier<br>
    1897 		{Array} state: array of widget state objects.  Has the following properties:<br>
    1898 		    {String} widgetGuid: unique widget identifier<br>
    1899 		    {Number} width: width of widget in pixels<br>
    1900 		    {Number} zIndex: in pixels<br>
    1901 		    {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1902 		    {Boolean} pinned: true if widget is pinned open<br>
    1903 		    {String} buttonId: identifier of button that opens widget<br>
    1904 		    {Number} height: height of widget in pixels<br>
    1905 		    {Number} columnPos: position of widget in a column<br>
    1906 		    {String} name: widget name<br>
    1907 		    {Number} statePosition<br>
    1908 		    {Boolean} active: true if this widget is the active (has focus) widget<br>
    1909 		    {String} uniqueId: unique widget identifier on dashboard<br>
    1910 		    {Boolean} minimized: true if widget is minimized<br>
    1911 		    {Boolean} buttonOpened: true if button launched widget is opened<br>
    1912 		    {Boolean} collapsed: true if widget is collapsed<br>
    1913 		    {Number} y: y-axis position in pixels<br>
    1914 		    {Number} x: x-axis position in pixels<br>
    1915 		    {Boolean} maximized: true if widget is maximized<br>
    1916 		{Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1917 	<br>
    1918 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1919
    1920 	@example
    1921 var onSuccess = function(dashboard) {
    1922 	alert(dashboard.name);
    1923 };
    1924
    1925 var onFailure = function(error) {
    1926 	 alert(error);
    1927 };
    1928
    1929 OWF.Preferences.deleteDashboard({
    1930 	dashboardId:'917b4cd0-ecbd-410b-afd9-42d150c26426',
    1931 	onSuccess:onSuccess,
    1932 	onFailure:onFailure
    1933 });
    1934 */
    1935
    1936 /**
    1937 	@description Returns all dashboards for the logged in user.
    1938 	@name findDashboards
    1939 	@methodOf OWF.Preferences
    1940
    1941 	@param {Object} cfg config object see below for properties
    1942 	@param {Function} cfg.onSuccess Callback function to capture the success result.
    1943 	This method is passed an object having the following properties:<br>
    1944 	<br>
    1945 		{Boolean} success: true if dashboards found<br>
    1946 		{Number} results: number of dashboards found<br>
    1947 		{Array} data: array of dashboards objects found.  Dashboard object has the following properties:<br>
    1948 		<br>
    1949 		    {Boolean} alteredByAdmin: true if altered by an administrator<br>
    1950 		    {Date} createdDate: date dashboard was created<br>
    1951 		    {Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    1952 		    {String} layout: layout of dashboard<br>
    1953 		    {Boolean} isdefault: true if this is a default dashboard<br>
    1954 		    {String} name: name of dashboard<br>
    1955 		    {Number} columnCount: number of columns if dashboard is a portal type<br>
    1956 		    {Object} user: the dashoard owner.  Has the following properties:<br>
    1957 		        {String} userId: unique user identifier<br>
    1958 		    {List} EDashboardLayoutList: list of dashboard types<br>
    1959 		    {String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    1960 		    {Object} createdBy: dashboard creator.  Has the following properties:<br>
    1961 		        {String} userId: unique user identifier<br>
    1962 		        {String} userRealName: user's name<br>
    1963 		    {Date} editedDate: date dashboard was last edited<br>
    1964 		    {Array} groups:  groups dashboard is assigned to<br>
    1965 		    {String} description: description of dashboard<br>
    1966 		    {String} guid: uniqued dashboard identifier<br>
    1967 		    {Array} state: array of widget state objects.  Has the following properties:<br>
    1968 		        {String} widgetGuid: unique widget identifier<br>
    1969 		        {Number} width: width of widget in pixels<br>
    1970 		        {Number} zIndex: in pixels<br>
    1971 		        {String} region: containing region on dashboard.  Dashboard type specific.<br>
    1972 		        {Boolean} pinned: true if widget is pinned open<br>
    1973 		        {String} buttonId: identifier of button that opens widget<br>
    1974 		        {Number} height: height of widget in pixels<br>
    1975 		        {Number} columnPos: position of widget in a column<br>
    1976 		        {String} name: widget name<br>
    1977 		        {Number} statePosition<br>
    1978 		        {Boolean} active: true if this widget is the active (has focus) widget<br>
    1979 		        {String} uniqueId: unique widget identifier on dashboard<br>
    1980 		        {Boolean} minimized: true if widget is minimized<br>
    1981 		        {Boolean} buttonOpened: true if button launched widget is opened<br>
    1982 		        {Boolean} collapsed: true if widget is collapsed<br>
    1983 		        {Number} y: y-axis position in pixels<br>
    1984 		        {Number} x: x-axis position in pixels<br>
    1985 		        {Boolean} maximized: true if widget is maximized<br>
    1986 		    {Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    1987 		<br>
    1988 	<br>
    1989 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    1990
    1991 	@example
    1992 var onSuccess = function(obj) {
    1993 	alert(obj.results);
    1994 	if (obj.results > 0) {
    1995 		for (var i = 0; i < obj.results; i++) {
    1996 			alert(obj.data[i].name);
    1997 		}
    1998 	}
    1999 };
    2000
    2001 var onFailure = function(error) {
    2002 	alert(error);
    2003 };
    2004
    2005 OWF.Preferences.findDashboards({
    2006 	onSuccess:onSuccess,
    2007 	onFailure:onFailure
    2008 });
    2009 */
    2010
    2011 /**
    2012 	@description Returns all dashboards for the logged in user filtered by the type of dashboard.
    2013 	@name findDashboardsByType
    2014 	@methodOf OWF.Preferences
    2015
    2016 	@param {Object} cfg config object see below for properties
    2017 	@param {String} cfg.type A string representing the type of dashboard. If using built in dashboard types, this would include desktop, tabbed, portal, and accordion.
    2018 	@param {Function} cfg.onSuccess Callback function to capture the success result.
    2019 	This method is passed an object having the following properties:<br>
    2020 	<br>
    2021 		{Boolean} success: true if dashboards found<br>
    2022 		{Number} results: number of dashboards found<br>
    2023 		{Array} data: array of dashboards objects found.  Dashboard object has the following properties:<br>
    2024 		<br>
    2025 		    {Boolean} alteredByAdmin: true if altered by an administrator<br>
    2026 		    {Date} createdDate: date dashboard was created<br>
    2027 		    {Boolean} isGroupDashboard: true if dashboard is a group dashboard<br>
    2028 		    {String} layout: layout of dashboard<br>
    2029 		    {Boolean} isdefault: true if this is a default dashboard<br>
    2030 		    {String} name: name of dashboard<br>
    2031 		    {Number} columnCount: number of columns if dashboard is a portal type<br>
    2032 		    {Object} user: the dashoard owner.  Has the following properties:<br>
    2033 		        {String} userId: unique user identifier<br>
    2034 		    {List} EDashboardLayoutList: list of dashboard types<br>
    2035 		    {String} defaultSettings: JSON string of default settings which varies by dashboard type<br>
    2036 		    {Object} createdBy: dashboard creator.  Has the following properties:<br>
    2037 		        {String} userId: unique user identifier<br>
    2038 		        {String} userRealName: user's name<br>
    2039 		    {Date} editedDate: date dashboard was last edited<br>
    2040 		    {Array} groups:  groups dashboard is assigned to<br>
    2041 		    {String} description: description of dashboard<br>
    2042 		    {String} guid: uniqued dashboard identifier<br>
    2043 		    {Array} state: array of widget state objects.  Has the following properties:<br>
    2044 		        {String} widgetGuid: unique widget identifier<br>
    2045 		        {Number} width: width of widget in pixels<br>
    2046 		        {Number} zIndex: in pixels<br>
    2047 		        {String} region: containing region on dashboard.  Dashboard type specific.<br>
    2048 		        {Boolean} pinned: true if widget is pinned open<br>
    2049 		        {String} buttonId: identifier of button that opens widget<br>
    2050 		        {Number} height: height of widget in pixels<br>
    2051 		        {Number} columnPos: position of widget in a column<br>
    2052 		        {String} name: widget name<br>
    2053 		        {Number} statePosition<br>
    2054 		        {Boolean} active: true if this widget is the active (has focus) widget<br>
    2055 		        {String} uniqueId: unique widget identifier on dashboard<br>
    2056 		        {Boolean} minimized: true if widget is minimized<br>
    2057 		        {Boolean} buttonOpened: true if button launched widget is opened<br>
    2058 		        {Boolean} collapsed: true if widget is collapsed<br>
    2059 		        {Number} y: y-axis position in pixels<br>
    2060 		        {Number} x: x-axis position in pixels<br>
    2061 		        {Boolean} maximized: true if widget is maximized<br>
    2062 		    {Boolean} showLaunchMenu: true if launch menu is opened on dashboard<br>
    2063 		<br>
    2064 	<br>
    2065 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    2066
    2067 	@example
    2068 var onSuccess = function(obj) {
    2069 	alert(obj.results);
    2070 	if (obj.results > 0) {
    2071 		for (var i = 0; i < obj.results; i++) {
    2072 			alert(obj.data[i].name);
    2073 		}
    2074 	}
    2075 };
    2076
    2077 var onFailure = function(error) {
    2078 	alert(error);
    2079 };
    2080
    2081 OWF.Preferences.findDashboardsByType({
    2082 	type:'desktop',
    2083 	onSuccess:onSuccess,
    2084 	onFailure:onFailure
    2085 });
    2086 */
    2087
    2088 /**
    2089 	@description Gets the widget with the specified id
    2090 	@name getWidget
    2091 	@methodOf OWF.Preferences
    2092
    2093 	@param {Object} cfg config object see below for properties
    2094 	@param {String} cfg.widgetId The unique identifier (normally a guid) for the widget.
    2095 	@param {Function} cfg.onSuccess Callback function to capture the success result. Callback is passed the following object as a parameter: {id:Number, namespace:String, value:Object, path:String}
    2096 	This method is passed an object having the following properties:<br>
    2097 	<br>
    2098 		{Number} id: database pk identifier<br>
    2099 		{String} namespace: "widget"<br>
    2100 		{Object} value: widget object having the following properties:<br>
    2101 		<br>
    2102 		    {Boolean} editable: true if widget can be edited<br>
    2103 		    {Boolean} visible: true if widget is visible<br>
    2104 		    {Number} position<br>
    2105 		    {String} userId: widget owner identifier<br>
    2106 		    {String} userRealName: widget owner name<br>
    2107 		    {String} namespace: widget name<br>
    2108 		    {String} url: url of widget application<br>
    2109 		    {String} headerIcon: url of widget header icon<br>
    2110 		    {String} image: url of widget image<br>
    2111 		    {String} smallIconUrl: url of widget's small icon<br>
    2112 		    {String} largeIconUrl: url of widget's large icon<br>
    2113 		    {Number} width: width of the widget in pixels<br>
    2114 		    {Number} height: height of the widget in pixels<br>
    2115 		    {Number} x: x-axis position<br>
    2116 		    {Number} y: y-axis position<br>
    2117 		    {Boolean} minimized: true if widget is minimized<br>
    2118 		    {Boolean} maximized: true if widget is maximized<br>
    2119 		    {String} widgetVersion: widget version<br>
    2120 		    {Array} tags: array of tag strings<br>
    2121 		    {Boolean} definitionVisible: true if definition is visible<br>
    2122 		    {Boolean} singleton: true if widget is a singleton<br>
    2123 		    {Boolean} background: true if widget runs in the background<br>
    2124 		    {Array} allRequired: array of all widgets required by this widget<br>
    2125 		    {Array} directRequired: array of all widgets directly required by this widget<br>
    2126 		    {Array} widgetTypes: array of widget types this widget belongs to<br>
    2127 		<br>
    2128 		{String} path: unnique widget identifier<br>
    2129 	<br>
    2130 	@param {Function} [cfg.onFailure] Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
    2131
    2132 	@example
    2133 var onSuccess = function(obj) {
    2134 	if (obj.value) {
    2135 		alert(obj.value.namespace);
    2136 	}
    2137 };
    2138
    2139 var onFailure = function(error) {
    2140 	alert(error);
    2141 };
    2142
    2143 OWF.Preferences.getWidget({
    2144 	widgetId:'ea5435cf-4021-4f2a-ba69-dde451d12551',
    2145 	onSuccess:onSuccess,
    2146 	onFailure:onFailure
    2147 });
    2148 */
    2149
    2150 /**
    2151 	@description Gets all widgets for a given user.
    2152 	@name findWidgets
    2153 	@methodOf OWF.Preferences
    2154
    2155 	@param {Object} cfg config object see below for properties
    2156 	@param {Boolean} [cfg.userOnly] boolean flag that determines whether to only return widgets assigned to the user (excluding widgets to which the user only has access via their assigned groups)
    2157 	@param {Object} [cfg.searchParams] object containing search parameters
    2158 	@param {String} [cfg.searchParams.widgetName] name of widget '%' are wildcards
    2159 	@param {String} [cfg.searchParams.widgetNameExactMatch] true or false to match the name exactly. defaults to false
    2160 	@param {String} [cfg.searchParams.widgetVersion] version of widget '%' are wildcards
    2161 	@param {String} [cfg.searchParams.widgetGuid] guid of widget '%' are wildcards
    2162 	@param {Function} cfg.onSuccess callback function to capture the success result.
    2163 	This method is passed an array of objects having the following properties:<br>
    2164 	<br>
    2165 		{Number} id: database pk identifier<br>
    2166 		{String} namespace: "widget"<br>
    2167 		{Object} value: widget object having the following properties:<br>
    2168 		<br>
    2169 		    {Boolean} editable: true if widget can be edited<br>
    2170 		    {Boolean} visible: true if widget is visible<br>
    2171 		    {Number} position<br>
    2172 		    {String} userId: widget owner identifier<br>
    2173 		    {String} userRealName: widget owner name<br>
    2174 		    {String} namespace: widget name<br>
    2175 		    {String} url: url of widget application<br>
    2176 		    {String} headerIcon: url of widget header icon<br>
    2177 		    {String} image: url of widget image<br>
    2178 		    {String} smallIconUrl: url of widget's small icon<br>
    2179 		    {String} largeIconUrl: url of widget's large icon<br>
    2180 		    {Number} width: width of the widget in pixels<br>
    2181 		    {Number} height: height of the widget in pixels<br>
    2182 		    {Number} x: x-axis position<br>
    2183 		    {Number} y: y-axis position<br>
    2184 		    {Boolean} minimized: true if widget is minimized<br>
    2185 		    {Boolean} maximized: true if widget is maximized<br>
    2186 		    {String} widgetVersion: widget version<br>
    2187 		    {Array} tags: array of tag strings<br>
    2188 		    {Boolean} definitionVisible: true if definition is visible<br>
    2189 		    {Boolean} singleton: true if widget is a singleton<br>
    2190 		    {Boolean} background: true if widget runs in the background<br>
    2191 		    {Array} allRequired: array of all widgets required by this widget<br>
    2192 		    {Array} directRequired: array of all widgets directly required by this widget<br>
    2193 		    {Array} widgetTypes: array of widget types this widget belongs to<br>
    2194 		<br>
    2195 		{String} path: unnique widget identifier<br>
    2196 	<br>
    2197 	@param {Function} [cfg.onFailure] callback to execute if there is an error (optional, a default alert provided).  This callback is called with two parameters: a error message string, and optionally a status code
    2198
    2199 	@example
    2200 var onSuccess = function(widgets) {
    2201 	if (widgets.length > 0) {
    2202 		alert(widgets[0].value.namespace);
    2203 	}
    2204 };
    2205
    2206 var onFailure = function(error, status) {
    2207 	alert(error);
    2208 };
    2209
    2210 OWF.Preferences.findWidgets({
    2211 	onSuccess:onSuccess,
    2212 	onFailure:onFailure
    2213 });
    2214 */
    2215
    2216 /**
    2217 	@description Saves changes to existing widgets
    2218 	@name updateAndDeleteWidgets
    2219 	@methodOf OWF.Preferences
    2220
    2221 	@param {Object} cfg config object see below for properties
    2222 	@param {Array} cfg.widgetsToUpdate array of JSON objects containing the widget guid and data to be updated
    2223 	@param {Array} cfg.widgetGuidsToDelete array of guids of widgets to be deleted
    2224 	@param {Boolean} cfg.updateOrder flag to update order
    2225 	@param {Function} cfg.onSuccess callback function to capture the success result
    2226 	@param {Function} [cfg.onFailure] callback to execute if there is an error (optional, a default alert provided)
    2227  */
    2228
    2229 /**
    2230 	@description Retrieves the user preference for the provided name and namespace
    2231 	@name getUserPreference
    2232 	@methodOf OWF.Preferences
    2233
    2234 	@param {Object} cfg config object see below for properties
    2235 	@param {String} cfg.namespace The namespace of the requested user preference
    2236 	@param {String} cfg.name The name of the requested user preference
    2237 	@param {Function} cfg.onSuccess The function to be called if the user preference is successfully retrieved from
    2238 	the database.  This function takes a single argument, which is a JSON object.  If a preference is found, the
    2239 	complete JSON structure as shown below will be returned.  If it is not found this function be passed an empty JSON object.
    2240 	@example
    2241 The following is an example of a complete preference object passed to the onSuccess
    2242 function:
    2243 {
    2244 	"value":"true",
    2245 	"path":"militaryTime",
    2246 	"user":
    2247 	{
    2248 		"userId":"testAdmin1"
    2249 	},
    2250 	"namespace":"com.mycompany.AnnouncingClock"
    2251 }
    2252 		@param {Function} [cfg.onFailure] This parameter is optional. If this function is not specified a default error
    2253 		message will be displayed.This function is called if an error occurs on preference retrieval.  It is not
    2254 		called if the preference is simply missing.
    2255 		This function should accept two arguments:<br>
    2256 		<br>
    2257 		error: String<br>
    2258 		The error message<br>
    2259 		<br>
    2260 		Status: The numeric HTTP Status code (if applicable)<br>
    2261 		401: You are not authorized to access this entity.<br>
    2262 		500: An unexpected error occurred.<br>
    2263 		404: The user preference was not found.<br>
    2264 		400: The requested entity failed to pass validation.<br>
    2265
    2266 		@example
    2267 The following shows how to make a call to getUserPreference:
    2268 function onSuccess(pref){
    2269 	alert(Ozone.util.toString(pref.value));
    2270 }
    2271
    2272 function onFailure(error,status){
    2273 	alert('Error ' + error);
    2274 	alert(status);
    2275 }
    2276
    2277 // The following code calls getUserPreference with the above defined onSuccess and
    2278 // onFailure callbacks.
    2279 OWF.Preferences.getUserPreference({
    2280 	namespace:'com.company.widget',
    2281 	name:'First President',
    2282 	onSuccess:onSuccess,
    2283 	onFailure:onFailure
    2284 });
    2285 */
    2286
    2287 /**
    2288 	@description Checks for the existence of a user preference for a given namespace and name
    2289 	@name doesUserPreferenceExist
    2290 	@methodOf OWF.Preferences
    2291
    2292 	@param {Object} cfg config object see below for properties
    2293 	@param {String} cfg.namespace The namespace of the requested user
    2294 	@param {String} cfg.name The name of the requested user
    2295 	@param {Function} cfg.onSuccess The callback function that is called if a preference successfully return from the database.
    2296 	This method is passed an object having the following properties:<br>
    2297 	<br>
    2298 		{Number} statusCode: status code<br>
    2299 		{Boolean} preferenceExist: true if preference exists<br>
    2300 	<br>
    2301 	@param {Function} [cfg.onFailure] The callback function that is called if the preference could not be found in the database. Callback parameter is an error string.
    2302
    2303 	@example
    2304 var onSuccess = function(obj) {
    2305 	if (obj.statusCode = 200) {
    2306 		alert(obj.preferenceExist);
    2307 	}
    2308 };
    2309
    2310 var onFailure = function(error) {
    2311 	alert(error);
    2312 };
    2313
    2314 OWF.Preferences.doesUserPreferenceExist({
    2315 	namespace:'foo.bar.0',
    2316 	name:'test path entry 0',
    2317 	onSuccess:onSuccess,
    2318 	onFailure:onFailure
    2319 });
    2320 */
    2321
    2322 /**
    2323 	@description retrieves the current user logged into the system
    2324 	@name getCurrentUser
    2325 	@methodOf OWF.Preferences
    2326
    2327 	@param {Object} cfg config object see below for properties
    2328 	@param {Function} cfg.onSuccess The callback function that is called for a successful retrieval of the user logged in.
    2329 	This method is passed an object having the following properties:<br>
    2330 	<br>
    2331 		{String} currentUserName: user name<br>
    2332 		{String} currentUser: user real name<br>
    2333 		{Date} currentUserPrevLogin: previous login date<br>
    2334 		{Number} currentId: database pk index<br>
    2335 	<br>
    2336 	@param {Function} cfg.[onFailure] The callback function that is called when the system is unable to retrieve the current user logged in. Callback parameter is an error string.
    2337
    2338 	@example
    2339 var onSuccess = function(obj) {
    2340 	if (obj) {
    2341 		alert(obj.currentUser);
    2342 	}
    2343 };
    2344
    2345 var onFailure = function(error) {
    2346 	alert(error);
    2347 };
    2348
    2349 OWF.Preferences.getCurrentUser({
    2350 	onSuccess:onSuccess,
    2351 	onFailure:onFailure
    2352 });
    2353 */
    2354
    2355 /**
    2356 	@description For retrieving the OWF system server version
    2357 	@name getServerVersion
    2358 	@methodOf OWF.Preferences
    2359
    2360 	@param {Object} cfg config object see below for properties
    2361 	@param {Function} cfg.onSuccess The callback function that is called for successfully retrieving the server version of the OWF system.
    2362 	This method is passed an object having the following properties:<br>
    2363 	<br>
    2364 		{String} {serverVersion: server version<br>
    2365 	<br>
    2366 	@param {Function} [cfg.onFailure] The callback function that is called when the system fails to retrieve the server version of the OWF system. Callback parameter is an error string.
    2367 	@example
    2368
    2369 var onSuccess = function(obj) {
    2370 	if (obj) {
    2371 		alert(obj.serverVersion);
    2372 	}
    2373 };
    2374
    2375 var onFailure = function(error) {
    2376 	alert(error);
    2377 };
    2378
    2379 OWF.Preferences.getServerVersion({
    2380 	onSuccess:onSuccess,
    2381 	onFailure:onFailure
    2382 });
    2383 */
    2384
    2385 /**
    2386 	@description Creates or updates a user preference for the provided namespace and name.
    2387 	@name setUserPreference
    2388 	@methodOf OWF.Preferences
    2389
    2390 	@param {Object} cfg config object see below for properties
    2391 	@param {String} cfg.namespace  The namespace of the user preference
    2392 	@param {String} cfg.name The name of the user preference
    2393 	@param {String} cfg.value  The value of the user preference. The value can be any string including JSON.
    2394 	@param {Function} cfg.onSuccess The function to be called if the user preference is successfully updated in
    2395 	the database.
    2396
    2397 	@example
    2398 The following is an example of a complete preference object passed to the onSuccess function:
    2399 {
    2400 	"value":"true",
    2401 	"path":"militaryTime",
    2402 	"user": {
    2403 		"userId":"testAdmin1"
    2404 	},
    2405 	"namespace":"com.mycompany.AnnouncingClock"
    2406 }
    2407 		@param {Function} [cfg.onFailure] The function to be called if the user preference cannot be stored in the database.
    2408 		If this function is not specified a default error message will be displayed. This function is passed
    2409 		back the following parameters:<br>
    2410 		<br>
    2411 		error: String<br>
    2412 		The error message<br>
    2413 		<br>
    2414 		Status: The HTTP Status code<br>
    2415 		401: You are not authorized to access this entity.<br>
    2416 		500: An unexpected error occurred.<br>
    2417 		404: The requested entity was not found.<br>
    2418 		400: The requested entity failed to pass validation.<br>
    2419
    2420 		@example
    2421 function onSuccess(pref){
    2422 	alert(pref.value);
    2423 }
    2424
    2425 function onFailure(error,status){
    2426 	alert('Error ' + error);
    2427 	alert(status);
    2428 }
    2429
    2430 var text = 'George Washington';
    2431 OWF.Preferences.setUserPreference({
    2432 	namespace:'com.company.widget',
    2433 	name:'First President',
    2434 	value:text,
    2435 	onSuccess:onSuccess,
    2436 	onFailure:onFailure
    2437 });
    2438 */
    2439
    2440 /**
    2441 	Deletes a user preference with the provided namespace and name.
    2442 	@name deleteUserPreference
    2443 	@methodOf OWF.Preferences
    2444
    2445 	@param {Object} cfg config object see below for properties
    2446 	@param {String} cfg.namespace The namespace of the user preference
    2447 	@param {String} cfg.name The name of the user preference
    2448 	@param {Function} cfg.onSuccess The function to be called if the user preference is successfully deleted from the database.
    2449 	@example
    2450 The following is an example of a complete preference object passed to the onSuccess
    2451 function:
    2452
    2453 {
    2454 	"value":"true",
    2455 	"path":"militaryTime",
    2456 	"user":
    2457 	{
    2458 		"userId":"testAdmin1"
    2459 	},
    2460 	"namespace":"com.mycompany.AnnouncingClock"
    2461 }
    2462 		@param {Function} [cfg.onFailure] The function to be called if the user preference cannot be deleted from the
    2463 		database or if the preference does not exist. If this function is not specified a default error message will be
    2464 		displayed. This function is passed back the following parameters: <br>
    2465 		<br>
    2466 		error: String <br>
    2467 		The error message <br>
    2468 		<br>
    2469 		Status: The HTTP Status code<br>
    2470 		<br>
    2471 		401: You are not authorized to access this entity.<br>
    2472 		500: An unexpected error occurred.<br>
    2473 		404: The user preference was not found.<br>
    2474 		400: The requested entity failed to pass validation. <br>
    2475 		<br>
    2476 		@example
    2477 function onSuccess(pref){
    2478 	alert(pref.value);
    2479 }
    2480
    2481 function onFailure(error,status){
    2482 	alert('Error ' + error);
    2483 	alert(status);
    2484 }
    2485
    2486 OWF.Preferences.deleteUserPreference({
    2487 	namespace:'com.company.widget',
    2488 	name:'First President',
    2489 	onSuccess:onSuccess,
    2490 	onFailure:onFailure
    2491 });
    2492  */
    2493
    2494 /**
    2495 	This method informs a widget developer if their widget is running from the OWF or from a direct URL call.
    2496 	@name isRunningInOWF
    2497 	@methodOf OWF.Util
    2498
    2499 	@returns  boolean true if the widget is inside OWF, false otherwise.
    2500  */
    2501
    2502 /**
    2503  @name isInContainer
    2504  @methodOf OWF.Util
    2505  * @description This method informs a widget developer if their widget is running
    2506  * in a Container, like OWF
    2507  *
    2508  * @returns  boolean true if the widget is inside a container, false otherwise.
    2509  *
    2510  */
    2511
    2512 /**
    2513 	Returns a globally unique identifier (guid).
    2514 	@name guid
    2515 	@methodOf OWF.Util
    2516
    2517 	@returns  boolean true if the widget is inside OWF, false otherwise.
    2518  */
    2519
    2520 /**
    2521 	This method returns flash/flex dom element from dom.
    2522 	@name getFlashApp
    2523 	@methodOf OWF.Util
    2524
    2525 	@param {String} id id of the flex dom element
    2526
    2527 	@returns  flash/flex object from dom
    2528  */
    2529
    2530  /**
    2531 	Basic logging capability - meant to be called by other methods which transform or validate data.
    2532 	@name logMetric
    2533 	@methodOf OWF.Metrics
    2534 	@since OWF 3.8.0
    2535
    2536 	@param {String} userId
    2537 	@param {String} userName
    2538 	@param {String} metricSite Identifier, potentially URL, for source of metric - typically OWF instance
    2539 	@param {String} componentName
    2540 	@param {String} componentId
    2541 	@param {String} componentInstanceId
    2542 	@param {String} metricTypeId String describing metric - recommend package name construct
    2543 	@param {String} metricData Any additional data for metric - do any necessary validation appropriate to metricTypeId before sending through
    2544  */
    2545
    2546 /**
    2547  * @description Logs a set of metrics to the server all at once.  All
    2548  * metrics passed into a call to this function will be logged in a single
    2549  * HTTP request, instead of one request per metric
    2550  * @name logBatchMetrics
    2551  * @methodOf OWF.Metrics
    2552  * @since OWF 6.0
    2553  *
    2554  * @param {Array} metrics
    2555  * @param {String} metrics[*].userId
    2556  * @param {String} metrics[*].userName
    2557  * @param {Number} metrics[*].metricTime The time at which is metric was collected (in UNIX time)
    2558  * @param {String} metrics[*].site Identifier, potentially URL, for source of metric - typically OWF instance
    2559  * @param {String} metrics[*].component
    2560  * @param {String} metrics[*].componentId
    2561  * @param {String} metrics[*].instanceId
    2562  * @param {String} metrics[*].metricTypeId String describing metric - recommend package name construct
    2563  * @param {String} metrics[*].widgetData Any additional data for metric - do any necessary validation appropriate to metricTypeId before sending through
    2564  * @param {String} metrics[*].userAgent Should be set to the user-agent string of the browser
    2565  */
    2566
    2567 /**
    2568 	Log view of widget - see calls in dashboards.
    2569 	@name logWidgetRender
    2570 	@methodOf OWF.Metrics
    2571 	@since OWF 3.8.0
    2572
    2573 	@param {String} userId     - see Ozone.metrics.logMetric userId
    2574 	@param {String} userName   - see Ozone.metrics.logMetric userName
    2575 	@param {String} metricSite - see Ozone.metrics.logMetric metricSite
    2576 	@param {Object} widget
    2577  */
    2578
    2579 /**
    2580 	Get a logger by name, if the logger has not already been created it will be created.
    2581 	@name getLogger
    2582 	@methodOf OWF.Log
    2583 	@since OWF 3.8.0
    2584 	@param {String} loggerName
    2585  */
    2586
    2587 /**
    2588 	Enable/Disable logging for the OWF application.
    2589 	@name setEnabled
    2590 	@methodOf OWF.Log
    2591 	@since OWF 3.8.0
    2592 	@param {Boolean} enabled true will enable logging false will disable
    2593  */
    2594
    2595 /**
    2596 	Get OWF's default logger
    2597 	@name getDefaultLogger
    2598 	@methodOf OWF.Log
    2599 	@since OWF 3.8.0
    2600  */
    2601
    2602 /**
    2603 	Launch the log window pop-up, this will re-launch the window in the event it has been closed.
    2604 	@name launchPopupAppender
    2605 	@methodOf OWF.Log
    2606 	@since OWF 3.8.0
    2607  */
    2608
    2609 /**
    2610 	Gets the language that is currently being used by OWF.
    2611 	@name getLanguage
    2612 	@methodOf OWF.Lang
    2613
    2614 	@returns {String} Returns the ISO 639-1 language code for the language that is currently being used by OWF.
    2615  */
    2616