From b6118740f95c2586979dc5b463c60ced090b7cc9 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sat, 29 Jan 2005 00:06:43 +0000 Subject: [PATCH] some basic documentation for the asset manager javascript --- www/extras/assetManager/assetManager.txt | 81 ++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 www/extras/assetManager/assetManager.txt diff --git a/www/extras/assetManager/assetManager.txt b/www/extras/assetManager/assetManager.txt new file mode 100644 index 000000000..e2636424a --- /dev/null +++ b/www/extras/assetManager/assetManager.txt @@ -0,0 +1,81 @@ +some basic documentation: + + +*****************Configuring the asset manager.***************** + +//to create a new asset manager +var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.renderAssets(); + +//available properties. Properties should be set prior to the render asset call. + +********************************************************* +assetType - defaults to "Asset" + +The following example starts the asset manager with a different asset type. + +var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.assetType="MyNewAsset" +manager.renderAssets(); + +********************************************************* +sortEnabled = true - enables or disables sorting of the grid. Defaults to true + +The following example starts the asset manager with sorting disabled. + +var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.sortEnabled=false; +manager.renderAssets(); + +********************************************************* +displayCrumbTrail = Enables or disables display of the crumbtrail. Defaults to true + +The following example starts the asset manager with the crumb trail disabled +. +var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.displayCrumbTrail=false; +manager.renderAssets(); + +********************************************************** +To disable display item in the grid, the disableDisplay function can be called on the asset manager. The function takes the index of the item to disable from the columnHeadings array. + +The following example disables the rank and title + +var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.disableDisplay(0); +manager.disableDisplay(1); +manager.renderAssets(); + +*********************Configuring Assets********************** + +To create a new asset, the Asset object must be extended. The following example creates an asset with the same properties and methods as the Asset object. + +function MyNewAsset() { + var asset = new Asset(); return asset; +} To change the new asset object, properties and methods can be added or overriden + +The following example overrides the getContextMenu method, adds a new retore method, and sets the dragEnabled property to false + +function MyNewAsset) { + var asset = new Asset(); + asset.dragEnabled = false; + +asset.getContextMenu = function () { + var arr = new Array(); arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:" + this.evalReference() + ".cut()"); + arr[arr.length] = new ContextMenuItem("",""); + arr[arr.length] = new ContextMenuItem(this.labels["purge"],"javascript:" + this.evalReference() + ".purge()"); + return arr; } +asset.restore = function() { + location.href = this.parent.getWrappedURL() + "func=postList" + AssetManager_getManager().getSelectedAssetIds(); } + + return asset; + +} /*************availble asset properties ********************* + +dragEnabled - Enables or disables making the asset dragable. Defaults to true +allowMultiSelect - Enables or disables multiselection of the asset. Defaults to true; + + +***************Notes********************* + +1. The asset class contains a getWrappedURL() method that return the asset.url property wrapped in "http://hostname" and the paramenter delimiter +2. asset.parent will return the parent asset (on the crumbtrail) +3. The AssetManager_getManager().getSelectedAssetsIds() method will return a parameter string containing all the selected asset Id's + + +