diff --git a/www/extras/assetManager/Asset.js b/www/extras/assetManager/Asset.js index b03783ba0..3fe996733 100644 --- a/www/extras/assetManager/Asset.js +++ b/www/extras/assetManager/Asset.js @@ -12,30 +12,48 @@ function Asset() { this.lastUpdate = ""; this.icon = ""; this.div = null; + this.isParent=false; //methods this.edit = Asset_edit; this.view = Asset_view; + this.setRank = Asset_setRank; this.displayProperties = Asset_displayProperties; + this.setParent = Asset_setParent; } //---------Method Implementations ------------- - +//Moving to a new parent (move) +//---------------------- +//url + ?||& + func=setParent&assetId= + assetId +function Asset_setParent(asset) { + //parentURL + location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=setParent&assetId="+ asset.assetId; +} + + +//Set the rank of an asset amongst its siblings (move) +//--------------------------------------------- +//url + ?||& + func=setRank&rank= + newRank +function Asset_setRank(rank) { + //to child + location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=setRank&rank="+ rank; +} //Edit the properties of an asset (edit) //------------------------------- //url + ?||& + func=edit function Asset_edit() { - location.href = manager.tools.addParamDelimiter(this.url) + "func=edit"; + location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=edit&afterEdit=assetManager"; } //View an asset (view) //------------- //url + ?||& + func=view function Asset_view() { - location.href = manager.tools.addParamDelimiter(this.url) + "func=view"; + location.href = "http://" + manager.tools.getHostName(location.href) + this.url; } function Asset_displayProperties() { diff --git a/www/extras/assetManager/AssetManager.js b/www/extras/assetManager/AssetManager.js index df18e0e8f..df6ca63f8 100644 --- a/www/extras/assetManager/AssetManager.js +++ b/www/extras/assetManager/AssetManager.js @@ -1,6 +1,6 @@ //--------Constructor-------------------- -function AssetManager(assetArrayData,headerArrayData,lables,crumbtrail) { +function AssetManager(assetArrayData,headerArrayData,labels,crumbtrail) { this.tools = new Tools(); this.contextMenu = new ContextMenu(); this.display = new Display(); @@ -16,7 +16,7 @@ function AssetManager(assetArrayData,headerArrayData,lables,crumbtrail) { this.parentURL = ""; - this.lables = lables; + this.labels = labels; this.crumbtrail = crumbtrail; this.parentURL = "d"; this.renderAssets = AssetManager_renderAssets; @@ -27,8 +27,6 @@ function AssetManager(assetArrayData,headerArrayData,lables,crumbtrail) { this.buildCrumbTrail = AssetManager_buildCrumbTrail; this.displayContextMenu = AssetManager_displayContextMenu; this.editTree=AssetManager_editTree; - this.setParent=AssetManager_setParent; - this.setRank=AssetManager_setRank; this.remove = AssetManager_remove; this.cut = AssetManager_cut; this.copy = AssetManager_copy; @@ -86,7 +84,12 @@ function AssetManager_renderAssets() { for (k=0;k' + this.assetArrayData[i][k] + ''; + gridStr+= ''; + + if (k == 1) { + gridStr +=''; + } + gridStr+=this.assetArrayData[i][k] + ''; // eventStr += 'document.getElementById("' + id + '").asset = AssetManager_getManager().assets[' + i + '];'; } } @@ -106,35 +109,46 @@ function AssetManager_buildCrumbTrail() { var crumbtrail = document.getElementById("crumbtrail"); var contents = ""; + var parentAssets = new Array(); + for (i=0;i' + this.crumbtrail[i][1] + ''; + contents += ''; if (i != this.crumbtrail.length -1) { contents += ""; } } - this.parentURL = "http://" + this.tools.getHostName("http://www.yahoo.com") + this.crumbtrail[this.crumbtrail.length -1][1]; + this.parentURL = "http://" + this.tools.getHostName(location.href) + this.crumbtrail[this.crumbtrail.length -1][1]; contents += '
' + this.crumbtrail[i][2] + ' -> 
'; crumbtrail.innerHTML = contents; -// for (i=0;i' + this.crumbtrail[i][1] + ''; -// if (i != this.crumbtrail.lenght) { -// contents += " -> "; -// } - - //} + } + } function AssetManager_getAsset(obj) { - while (obj.tagName!=this.display.topLevelElement && obj.className != "am-grid-row") { + while (obj.tagName!=this.display.topLevelElement && !obj.asset) { obj=this.display.dom? obj.parentNode : obj.parentElement } @@ -146,19 +160,19 @@ function AssetManager_displayContextMenu(x,y) { var arr = new Array(); if (this.display.overObjects.length == 1) { - arr[arr.length] = new ContextMenuItem("View","javascript:manager.display.contextMenu.owner.view()"); - arr[arr.length] = new ContextMenuItem("Edit","javascript:manager.display.contextMenu.owner.edit()"); + arr[arr.length] = new ContextMenuItem(this.labels["view"],"javascript:manager.display.contextMenu.owner.view()"); + arr[arr.length] = new ContextMenuItem(this.labels["edit"],"javascript:manager.display.contextMenu.owner.edit()"); } - arr[arr.length] = new ContextMenuItem("Delete","javascript:manager.remove()"); - arr[arr.length] = new ContextMenuItem("",""); - arr[arr.length] = new ContextMenuItem("Cut","javascript:AssetManager_getManager().cut()"); - arr[arr.length] = new ContextMenuItem("Copy","javascript:manager.copy()"); + arr[arr.length] = new ContextMenuItem(this.labels["delete"],"javascript:manager.remove()"); + arr[arr.length] = new ContextMenuItem("",""); + arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:AssetManager_getManager().cut()"); + arr[arr.length] = new ContextMenuItem(this.labels["copy"],"javascript:manager.copy()"); if (this.display.overObjects.length ==1) { - arr[arr.length] = new ContextMenuItem("",""); - arr[arr.length] = new ContextMenuItem("Edit Tree","javascript:manager.editTree()"); - arr[arr.length] = new ContextMenuItem("Properties","javascript:manager.display.contextMenu.owner.displayProperties()"); + arr[arr.length] = new ContextMenuItem("",""); + arr[arr.length] = new ContextMenuItem(this.labels["editTree"],"javascript:manager.editTree()"); + arr[arr.length] = new ContextMenuItem(this.labels["properties"],"javascript:manager.display.contextMenu.owner.displayProperties()"); } // alert("x = " + x + " y= " + y); @@ -168,23 +182,10 @@ function AssetManager_displayContextMenu(x,y) { //url + ?||& + func=editTree function AssetManager_editTree() { + //parentURL location.href = this.tools.addParamDelimiter(this.parentURL) + "func=editTree"; } -//Moving to a new parent (move) -//---------------------- -//url + ?||& + func=setParent&assetId= + assetId -function AssetManager_setParent(parentId) { - location.href = this.tools.addParamDelimiter(this.parentURL) + "func=setParent&assetId="+ parentId; -} - -//Set the rank of an asset amongst its siblings (move) -//--------------------------------------------- -//url + ?||& + func=setRank&rank= + newRank -function AssetManager_setRank(rank) { - location.href = this.tools.addParamDelimiter(this.parentURL) + "func=setRank&rank="+ rank; -} - //Copy an asset to the clipboard (copy) //------------------------------ @@ -211,6 +212,7 @@ function AssetManager_remove() { function AssetManager_getSelectedAssetIds() { var assetIds = ""; + alert(this.display.overObjects.length); for (i=0;i"; + temp = "
" + manager.labels['properties'] + "X
" + html + "
"; propWindow = document.getElementById("propertiesWindow"); propWindow.innerHTML=temp; @@ -78,12 +79,12 @@ function Display_dragStart(firedobj,xCoordinate,yCoordinate) { - while (firedobj.tagName!=this.topLevelElement && firedobj.className.indexOf("am-grid-row") == -1 && firedobj.className != "dragable") { + while (firedobj.tagName!=this.topLevelElement && !firedobj.asset && firedobj.className != "dragable") { firedobj=manager.display.dom? firedobj.parentNode : firedobj.parentElement } - if (firedobj.className.indexOf("am-grid-row") == -1 && firedobj.className != "dragable") { + if ((!firedobj.asset || firedobj.asset.isParent) && firedobj.className != "dragable") { return; } @@ -97,7 +98,12 @@ function Display_dragStart(firedobj,xCoordinate,yCoordinate) { this.pageHeight = window.document.body.scrollHeight; this.pageWidth = window.document.body.scrollWidth; - this.focusObjects[0]=firedobj + if (firedobj.asset) { + this.focusObjects[0]=firedobj.asset; + }else { + this.focusObjects[0] = firedobj; + } + //this.bringToFront(this.focusObject); //hack to get the transparency - need to make generic @@ -130,7 +136,12 @@ function Display_dragStop() { //if (this.focusObjects.dragDescriptor.clazzName == "activityMenuItem") { if (this.overObjects[0] && this.overObjects[0].assetId && this.overObjects[0] != this.focusObjects[0]) { - this.focusObjects[0].setRank(this.overObjects[0].rank); + + if (this.overObjects[0].isParent) { + this.focusObjects[0].setParent(this.overObjects[0]); + }else { + this.focusObjects[0].setRank(this.overObjects[0].rank); + } } //this.focusObject.style.top=0; //this.focusObject.style.left=0; @@ -169,6 +180,14 @@ function Display_selectAsset(asset) { } } +function Display_clearSelectedAssets() { + for (i=0;i