more updates to the asset manager system
This commit is contained in:
parent
2050de56cd
commit
93536887c2
9 changed files with 269 additions and 146 deletions
|
|
@ -552,6 +552,7 @@ Returns a text string of HTML code for the Asset Manager Control Page. English o
|
||||||
sub getAssetManagerControl {
|
sub getAssetManagerControl {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $children = shift;
|
my $children = shift;
|
||||||
|
my $controlType = shift;
|
||||||
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
|
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
|
||||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Tools.js', {type=>"text/javascript"});
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Tools.js', {type=>"text/javascript"});
|
||||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/ContextMenu.js', {type=>"text/javascript"});
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/ContextMenu.js', {type=>"text/javascript"});
|
||||||
|
|
@ -559,6 +560,9 @@ sub getAssetManagerControl {
|
||||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Display.js', {type=>"text/javascript"});
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Display.js', {type=>"text/javascript"});
|
||||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/EventManager.js', {type=>"text/javascript"});
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/EventManager.js', {type=>"text/javascript"});
|
||||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/AssetManager.js', {type=>"text/javascript"});
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/AssetManager.js', {type=>"text/javascript"});
|
||||||
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/AssetManagerAsset.js', {type=>"text/javascript"});
|
||||||
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/CrumbTrailAsset.js', {type=>"text/javascript"});
|
||||||
|
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/'.$controlType.'.js', {type=>"text/javascript"}) if (defined $controlType);
|
||||||
my $output = '
|
my $output = '
|
||||||
<div id="contextMenu" class="contextMenu"></div>
|
<div id="contextMenu" class="contextMenu"></div>
|
||||||
<div id="propertiesWindow" class="propertiesWindow"></div>
|
<div id="propertiesWindow" class="propertiesWindow"></div>
|
||||||
|
|
@ -596,10 +600,14 @@ sub getAssetManagerControl {
|
||||||
$output .= "labels['move'] = 'Move';\n";
|
$output .= "labels['move'] = 'Move';\n";
|
||||||
$output .= "labels['view'] = 'View';\n";
|
$output .= "labels['view'] = 'View';\n";
|
||||||
$output .= "labels['delete'] = 'Delete';\n";
|
$output .= "labels['delete'] = 'Delete';\n";
|
||||||
|
$output .= "labels['restore'] = 'Restore';\n";
|
||||||
|
$output .= "labels['purge'] = 'Purge';\n";
|
||||||
$output .= "labels['go'] = 'Go';\n";
|
$output .= "labels['go'] = 'Go';\n";
|
||||||
$output .= "labels['properties'] = 'Properties';\n";
|
$output .= "labels['properties'] = 'Properties';\n";
|
||||||
$output .= "labels['editTree'] = 'Edit Tree';\n";
|
$output .= "labels['editTree'] = 'Edit Tree';\n";
|
||||||
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.renderAssets();\n</script>\n";
|
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);\n";
|
||||||
|
$output .= "manager.assetType='".$controlType."';\n" if (defined $controlType);
|
||||||
|
$output .= "manager.renderAssets();\n</script>\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2310,7 +2318,7 @@ sub www_manageClipboard {
|
||||||
$limit = 1;
|
$limit = 1;
|
||||||
}
|
}
|
||||||
foreach my $assetData (@{$self->getAssetsInClipboard($limit)}) {
|
foreach my $assetData (@{$self->getAssetsInClipboard($limit)}) {
|
||||||
push(@assets,WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className}));
|
push(@assets,WebGUI::Asset->newByDynamicClass($assetData->{assetId},"ManageClipboard",$assetData->{className}));
|
||||||
}
|
}
|
||||||
return $ac->render($self->getAssetManagerControl(\@assets), $header);
|
return $ac->render($self->getAssetManagerControl(\@assets), $header);
|
||||||
}
|
}
|
||||||
|
|
@ -2344,7 +2352,7 @@ sub www_manageTrash {
|
||||||
foreach my $assetData (@{$self->getAssetsInTrash($limit)}) {
|
foreach my $assetData (@{$self->getAssetsInTrash($limit)}) {
|
||||||
push(@assets,WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className}));
|
push(@assets,WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className}));
|
||||||
}
|
}
|
||||||
return $ac->render($self->getAssetManagerControl(\@assets), $header);
|
return $ac->render($self->getAssetManagerControl(\@assets,"ManageTrash"), $header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ function Asset() {
|
||||||
//properties
|
//properties
|
||||||
this.url = "";
|
this.url = "";
|
||||||
this.rank = 1;
|
this.rank = 1;
|
||||||
|
this.labels = new Array();
|
||||||
this.assetId = "";
|
this.assetId = "";
|
||||||
this.type = "";
|
this.type = "";
|
||||||
this.title = "";
|
this.title = "";
|
||||||
|
|
@ -13,23 +14,23 @@ function Asset() {
|
||||||
this.lastUpdate = "";
|
this.lastUpdate = "";
|
||||||
this.icon = "";
|
this.icon = "";
|
||||||
this.div = null;
|
this.div = null;
|
||||||
|
this.dragEnabled = true;
|
||||||
|
this.allowMultiSelect = true;
|
||||||
this.isParent=false;
|
this.isParent=false;
|
||||||
|
|
||||||
//methods
|
|
||||||
this.edit = Asset_edit;
|
|
||||||
this.view = Asset_view;
|
|
||||||
this.go = Asset_go;
|
|
||||||
this.setRank = Asset_setRank;
|
|
||||||
// this.displayProperties = Asset_displayProperties;
|
|
||||||
this.setParent = Asset_setParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------Method Implementations -------------
|
//---------Method Implementations -------------
|
||||||
|
|
||||||
|
this.registerEvents = function() {
|
||||||
|
this.div.ondblclick=Asset_doubleClick;
|
||||||
|
this.div.onmousedown=Asset_mouseDown;
|
||||||
|
this.div.oncontextmenu=Asset_rightClick;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Moving to a new parent (move)
|
//Moving to a new parent (move)
|
||||||
//----------------------
|
//----------------------
|
||||||
//url + ?||& + func=setParent&assetId= + assetId
|
//url + ?||& + func=setParent&assetId= + assetId
|
||||||
function Asset_setParent(asset) {
|
this.setParent = function(asset) {
|
||||||
//parentURL
|
//parentURL
|
||||||
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=setParent&assetId="+ asset.assetId;
|
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=setParent&assetId="+ asset.assetId;
|
||||||
}
|
}
|
||||||
|
|
@ -38,33 +39,117 @@ function Asset_setParent(asset) {
|
||||||
//Set the rank of an asset amongst its siblings (move)
|
//Set the rank of an asset amongst its siblings (move)
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
//url + ?||& + func=setRank&rank= + newRank
|
//url + ?||& + func=setRank&rank= + newRank
|
||||||
function Asset_setRank(rank) {
|
this.setRank = function(rank) {
|
||||||
//to child
|
//to child
|
||||||
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=setRank&rank="+ rank;
|
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=setRank&rank="+ rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//url + ?||& + func=editTree
|
||||||
|
this.editTree = function() {
|
||||||
|
//parentURL
|
||||||
|
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=editTree";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Edit the properties of an asset (edit)
|
//Edit the properties of an asset (edit)
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
//url + ?||& + func=edit
|
//url + ?||& + func=edit
|
||||||
function Asset_edit() {
|
this.edit = function() {
|
||||||
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=edit&proceed=manageAssets";
|
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=edit&proceed=manageAssets";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Edit the properties of an asset (edit)
|
//Edit the properties of an asset (edit)
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
//url + ?||& + func=edit
|
//url + ?||& + func=edit
|
||||||
function Asset_go() {
|
this.go = function() {
|
||||||
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=manageAssets";
|
location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=manageAssets";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//View an asset (view)
|
//View an asset (view)
|
||||||
//-------------
|
//-------------
|
||||||
//url + ?||& + func=view
|
//url + ?||& + func=view
|
||||||
function Asset_view() {
|
this.view = function() {
|
||||||
location.href = "http://" + manager.tools.getHostName(location.href) + this.url;
|
location.href = "http://" + manager.tools.getHostName(location.href) + this.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//displays the right click context menu
|
||||||
|
this.getContextMenu = function () {
|
||||||
|
var arr = new Array();
|
||||||
|
if (AssetManager_getManager().display.overObjects.length == 1) {
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["go"],"javascript:manager.display.contextMenu.owner.go()");
|
||||||
|
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
||||||
|
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(this.labels["delete"],"javascript:manager.remove()");
|
||||||
|
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:AssetManager_getManager().cut()");
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["copy"],"javascript:manager.copy()");
|
||||||
|
|
||||||
|
if (AssetManager_getManager().display.overObjects.length ==1) {
|
||||||
|
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["editTree"],"javascript:manager.display.contextMenu.owner.editTree()");
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.select= function() {
|
||||||
|
this.div.className="am-grid-row-over";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.deselect = function() {
|
||||||
|
this.div.className="am-grid-row";
|
||||||
|
}
|
||||||
|
|
||||||
|
}//end object
|
||||||
|
|
||||||
|
//Staic Methods
|
||||||
|
function Asset_doubleClick(e) {
|
||||||
|
alert("here");
|
||||||
|
var dom = document.getElementById&&!document.all;
|
||||||
|
var e=dom? e : event;
|
||||||
|
var obj =dom? e.target : e.srcElement
|
||||||
|
|
||||||
|
AssetManager_getManager().getAsset(obj).go();
|
||||||
|
}
|
||||||
|
|
||||||
|
function Asset_rightClick(e) {
|
||||||
|
var dom = document.getElementById&&!document.all;
|
||||||
|
e=dom? e : event;
|
||||||
|
|
||||||
|
if (!dom) {
|
||||||
|
e.cancelBubble = true;
|
||||||
|
e.returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj =dom? e.target : e.srcElement
|
||||||
|
|
||||||
|
var asset = AssetManager_getManager().getAsset(obj);
|
||||||
|
|
||||||
|
manager.display.contextMenu.owner = asset;
|
||||||
|
manager.displayContextMenu(e.clientX,e.clientY,asset);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Asset_mouseDown(e) {
|
||||||
|
var dom = document.getElementById&&!document.all;
|
||||||
|
e=dom? e : event;
|
||||||
|
|
||||||
|
//Display_adjustScrollBars(e);
|
||||||
|
|
||||||
|
if (e.button==2) {
|
||||||
|
//this is a hack to get the context menu stuff to work right in IE
|
||||||
|
if (!dom) {
|
||||||
|
e.cancelBubble = true;
|
||||||
|
e.returnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ function AssetManager(assetArrayData,headerArrayData,labels,crumbtrail) {
|
||||||
|
|
||||||
this.parentURL = "";
|
this.parentURL = "";
|
||||||
|
|
||||||
|
this.assetType = "Asset";
|
||||||
|
|
||||||
|
|
||||||
this.labels = labels;
|
this.labels = labels;
|
||||||
this.crumbtrail = crumbtrail;
|
this.crumbtrail = crumbtrail;
|
||||||
this.parentURL = "d";
|
this.parentURL = "d";
|
||||||
|
|
@ -29,7 +32,6 @@ function AssetManager(assetArrayData,headerArrayData,labels,crumbtrail) {
|
||||||
this.getAsset= AssetManager_getAsset;
|
this.getAsset= AssetManager_getAsset;
|
||||||
this.buildCrumbTrail = AssetManager_buildCrumbTrail;
|
this.buildCrumbTrail = AssetManager_buildCrumbTrail;
|
||||||
this.displayContextMenu = AssetManager_displayContextMenu;
|
this.displayContextMenu = AssetManager_displayContextMenu;
|
||||||
this.editTree=AssetManager_editTree;
|
|
||||||
this.remove = AssetManager_remove;
|
this.remove = AssetManager_remove;
|
||||||
this.cut = AssetManager_cut;
|
this.cut = AssetManager_cut;
|
||||||
this.copy = AssetManager_copy;
|
this.copy = AssetManager_copy;
|
||||||
|
|
@ -44,6 +46,9 @@ function AssetManager_getManager() {
|
||||||
|
|
||||||
//renders the full asset manager
|
//renders the full asset manager
|
||||||
function AssetManager_renderAssets() {
|
function AssetManager_renderAssets() {
|
||||||
|
|
||||||
|
var parent = this.buildCrumbTrail();
|
||||||
|
|
||||||
var gridStr = '<table border="0" cellspacing="0" id="am_grid" class="am-grid"><tbody id="am_grid_body"><tr id="am_grid.headers" class="am-grid-headers">';
|
var gridStr = '<table border="0" cellspacing="0" id="am_grid" class="am-grid"><tbody id="am_grid_body"><tr id="am_grid.headers" class="am-grid-headers">';
|
||||||
var eventStr='';
|
var eventStr='';
|
||||||
var id = "";
|
var id = "";
|
||||||
|
|
@ -51,9 +56,11 @@ function AssetManager_renderAssets() {
|
||||||
for (i=0;i<this.columnHeadings.length;i++) {
|
for (i=0;i<this.columnHeadings.length;i++) {
|
||||||
id = 'am_grid.headers.' + i;
|
id = 'am_grid.headers.' + i;
|
||||||
gridStr+= '<td id="' + id + '" class="am-grid-header-' + i + '">' + this.columnHeadings[i] + '</td>';
|
gridStr+= '<td id="' + id + '" class="am-grid-header-' + i + '">' + this.columnHeadings[i] + '</td>';
|
||||||
eventStr += 'document.getElementById("' + id + '").onclick=AssetManager_getManager().eventManager.gridHeaderClick;';
|
if (this.sortEnabled) {
|
||||||
eventStr += 'document.getElementById("' + id + '").onmouseover=AssetManager_getManager().eventManager.gridHeaderMouseOver;';
|
eventStr += 'document.getElementById("' + id + '").onclick=AssetManager_getManager().eventManager.gridHeaderClick;';
|
||||||
eventStr += 'document.getElementById("' + id + '").onmouseout=AssetManager_getManager().eventManager.gridHeaderMouseOut;';
|
eventStr += 'document.getElementById("' + id + '").onmouseover=AssetManager_getManager().eventManager.gridHeaderMouseOver;';
|
||||||
|
eventStr += 'document.getElementById("' + id + '").onmouseout=AssetManager_getManager().eventManager.gridHeaderMouseOut;';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gridStr+= '</tr>';
|
gridStr+= '</tr>';
|
||||||
|
|
@ -61,8 +68,7 @@ function AssetManager_renderAssets() {
|
||||||
id = 'am_grid.row.'+ i;
|
id = 'am_grid.row.'+ i;
|
||||||
gridStr += '<tr id="'+ id + '" class="am-grid-row">';
|
gridStr += '<tr id="'+ id + '" class="am-grid-row">';
|
||||||
|
|
||||||
asset = new Asset();
|
asset = eval("new " + this.assetType + "()");
|
||||||
|
|
||||||
asset.rank = this.assetArrayData[i][0];
|
asset.rank = this.assetArrayData[i][0];
|
||||||
asset.title = this.assetArrayData[i][1];
|
asset.title = this.assetArrayData[i][1];
|
||||||
asset.type = this.assetArrayData[i][2];
|
asset.type = this.assetArrayData[i][2];
|
||||||
|
|
@ -71,15 +77,14 @@ function AssetManager_renderAssets() {
|
||||||
asset.url = this.assetArrayData[i][5];
|
asset.url = this.assetArrayData[i][5];
|
||||||
asset.assetId = this.assetArrayData[i][6];
|
asset.assetId = this.assetArrayData[i][6];
|
||||||
asset.icon = this.assetArrayData[i][7];
|
asset.icon = this.assetArrayData[i][7];
|
||||||
this.assets[i]=asset;
|
asset.parent = parent;
|
||||||
|
asset.labels = this.labels;
|
||||||
|
var assetIndex = this.assets.length;
|
||||||
|
this.assets[assetIndex]=asset;
|
||||||
|
|
||||||
//add the row events
|
|
||||||
eventStr += 'document.getElementById("' + id + '").ondblclick=AssetManager_getManager().eventManager.assetDoubleClick;';
|
|
||||||
eventStr += 'document.getElementById("' + id + '").onmousedown=AssetManager_getManager().eventManager.assetMouseDown;';
|
|
||||||
eventStr += 'document.getElementById("' + id + '").oncontextmenu=AssetManager_getManager().eventManager.assetRightClick;';
|
|
||||||
eventStr += 'document.getElementById("' + id + '").asset = AssetManager_getManager().assets[' + i + '];';
|
|
||||||
eventStr += 'AssetManager_getManager().assets[' + i + '].div = document.getElementById("' + id + '");';
|
|
||||||
|
|
||||||
|
eventStr += 'document.getElementById("' + id + '").asset = AssetManager_getManager().assets[' + assetIndex + '];';
|
||||||
|
eventStr += 'AssetManager_getManager().assets[' + assetIndex + '].div = document.getElementById("' + id + '");';
|
||||||
|
|
||||||
for (k=0;k<this.columnHeadings.length;k++) {
|
for (k=0;k<this.columnHeadings.length;k++) {
|
||||||
id = 'am_grid.row' + '.' + i + '.col.' + k;
|
id = 'am_grid.row' + '.' + i + '.col.' + k;
|
||||||
|
|
@ -90,15 +95,15 @@ function AssetManager_renderAssets() {
|
||||||
}
|
}
|
||||||
gridStr+=this.assetArrayData[i][k] + '</td>';
|
gridStr+=this.assetArrayData[i][k] + '</td>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
gridStr+='</tr>';
|
gridStr+='</tr>';
|
||||||
|
}
|
||||||
gridStr += '</tbody></table>';
|
gridStr += '</tbody></table>';
|
||||||
|
|
||||||
document.getElementById("workspace").innerHTML=gridStr;
|
document.getElementById("workspace").innerHTML=gridStr;
|
||||||
eval(eventStr);
|
eval(eventStr);
|
||||||
|
for (i=0; i< this.assets.length; i++) {
|
||||||
this.buildCrumbTrail();
|
this.assets[i].registerEvents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -123,21 +128,22 @@ function AssetManager_buildCrumbTrail() {
|
||||||
crumbtrail.innerHTML = contents;
|
crumbtrail.innerHTML = contents;
|
||||||
|
|
||||||
//build assets attach the div properties
|
//build assets attach the div properties
|
||||||
|
var lastAsset = null;
|
||||||
for (i=0; i< this.crumbtrail.length; i++ ) {
|
for (i=0; i< this.crumbtrail.length; i++ ) {
|
||||||
var asset = new Asset();
|
var asset = new CrumbTrailAsset();
|
||||||
asset.title = this.crumbtrail[i][2];
|
asset.title = this.crumbtrail[i][2];
|
||||||
asset.url = this.crumbtrail[i][1];
|
asset.url = this.crumbtrail[i][1];
|
||||||
asset.assetId = this.crumbtrail[i][0];
|
asset.assetId = this.crumbtrail[i][0];
|
||||||
asset.div = document.getElementById(this.crumbtrail[i][0]);
|
asset.parent = lastAsset;
|
||||||
|
lastAsset = asset;
|
||||||
asset.div.ondblclick=AssetManager_getManager().eventManager.assetDoubleClick;
|
|
||||||
asset.div.onmousedown=AssetManager_getManager().eventManager.assetMouseDown;
|
|
||||||
asset.div.oncontextmenu=AssetManager_getManager().eventManager.assetRightClick;
|
|
||||||
|
|
||||||
asset.isParent = true;
|
asset.isParent = true;
|
||||||
|
asset.labels = this.labels;
|
||||||
|
asset.div = document.getElementById(this.crumbtrail[i][0]);
|
||||||
document.getElementById(this.crumbtrail[i][0]).asset = asset;
|
document.getElementById(this.crumbtrail[i][0]).asset = asset;
|
||||||
this.assets[this.assets.length] = asset;
|
this.assets[this.assets.length] = asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.assets[this.assets.length -1];
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns an asset based on a div object
|
//returns an asset based on a div object
|
||||||
|
|
@ -150,34 +156,7 @@ function AssetManager_getAsset(obj) {
|
||||||
|
|
||||||
//displays the right click context menu
|
//displays the right click context menu
|
||||||
function AssetManager_displayContextMenu(x,y,asset) {
|
function AssetManager_displayContextMenu(x,y,asset) {
|
||||||
var arr = new Array();
|
manager.contextMenu.render(asset.getContextMenu(),x,y,asset);
|
||||||
if (this.display.overObjects.length == 1) {
|
|
||||||
arr[arr.length] = new ContextMenuItem(this.labels["go"],"javascript:manager.display.contextMenu.owner.go()");
|
|
||||||
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
|
||||||
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()");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!asset.isParent) {
|
|
||||||
arr[arr.length] = new ContextMenuItem(this.labels["delete"],"javascript:manager.remove()");
|
|
||||||
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
|
||||||
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("<img src='/extras/assetManager/breakerLine.gif'>","");
|
|
||||||
arr[arr.length] = new ContextMenuItem(this.labels["editTree"],"javascript:manager.editTree()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manager.contextMenu.render(arr,x,y,asset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//url + ?||& + func=editTree
|
|
||||||
function AssetManager_editTree() {
|
|
||||||
//parentURL
|
|
||||||
location.href = this.tools.addParamDelimiter(this.parentURL) + "func=editTree";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
10
www/extras/assetManager/AssetManagerAsset.js
Normal file
10
www/extras/assetManager/AssetManagerAsset.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
//--------Constructor--------------------
|
||||||
|
|
||||||
|
//Creates a new asset object.
|
||||||
|
function AssetManagerAsset() {
|
||||||
|
var asset = new Asset();
|
||||||
|
return asset;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
32
www/extras/assetManager/CrumbTrailAsset.js
Normal file
32
www/extras/assetManager/CrumbTrailAsset.js
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
//--------Constructor--------------------
|
||||||
|
|
||||||
|
//Creates a new asset object.
|
||||||
|
function CrumbTrailAsset() {
|
||||||
|
var asset = new Asset();
|
||||||
|
|
||||||
|
asset.dragEnabled = false;
|
||||||
|
asset.allowMultiSelect = false;
|
||||||
|
|
||||||
|
//displays the right click context menu
|
||||||
|
asset.getContextMenu = function () {
|
||||||
|
var arr = new Array();
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["go"],"javascript:manager.display.contextMenu.owner.go()");
|
||||||
|
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
||||||
|
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()");
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.select= function() {
|
||||||
|
this.div.className="am-crumbtrail-over";
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.deselect = function() {
|
||||||
|
this.div.className="am-crumbtrail";
|
||||||
|
}
|
||||||
|
|
||||||
|
return asset;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ function Display_dragStart(firedobj,xCoordinate,yCoordinate) {
|
||||||
firedobj=manager.display.dom? firedobj.parentNode : firedobj.parentElement
|
firedobj=manager.display.dom? firedobj.parentNode : firedobj.parentElement
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!firedobj.asset || firedobj.asset.isParent)) {
|
if ((!firedobj.asset || !firedobj.asset.dragEnabled)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,38 +103,28 @@ function Display_isSelected(asset) {
|
||||||
|
|
||||||
//adds an asset to the overobjects array
|
//adds an asset to the overobjects array
|
||||||
function Display_selectAsset(asset) {
|
function Display_selectAsset(asset) {
|
||||||
|
if (this.controlKeyDown || this.shiftKeyDown) {
|
||||||
|
if (!asset.allowMultiSelect) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.controlKeyDown && !this.shiftKeyDown) {
|
if (!this.controlKeyDown && !this.shiftKeyDown) {
|
||||||
for (i=0;i<this.overObjects.length;i++) {
|
for (i=0;i<this.overObjects.length;i++) {
|
||||||
|
this.overObjects[i].deselect();
|
||||||
if (asset.isParent) {
|
|
||||||
this.overObjects[i].div.className="am-crumbtrail";
|
|
||||||
}else {
|
|
||||||
this.overObjects[i].div.className="am-grid-row";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.overObjects=new Array();
|
this.overObjects=new Array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!this.isSelected(asset)) {
|
if (!this.isSelected(asset)) {
|
||||||
this.overObjects[this.overObjects.length] = asset;
|
this.overObjects[this.overObjects.length] = asset;
|
||||||
if (asset.isParent) {
|
asset.select();
|
||||||
asset.div.className="am-crumbtrail-over";
|
|
||||||
}else {
|
|
||||||
asset.div.className="am-grid-row-over";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Clears out the over objects array
|
//Clears out the over objects array
|
||||||
function Display_clearSelectedAssets() {
|
function Display_clearSelectedAssets() {
|
||||||
for (i=0;i<this.overObjects.length;i++) {
|
for (i=0;i<this.overObjects.length;i++) {
|
||||||
if (this.overObjects[i].isParent) {
|
this.overObjects[i].deselect();
|
||||||
this.overObjects[i].div.className="am-crumbtrail";
|
|
||||||
}else {
|
|
||||||
this.overObjects[i].div.className="am-grid-row";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.overObjects=new Array();
|
this.overObjects=new Array();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ function EventManager() {
|
||||||
this.gridHeaderClick = EventManager_gridHeaderClick;
|
this.gridHeaderClick = EventManager_gridHeaderClick;
|
||||||
this.gridHeaderMouseOver = EventManager_gridHeaderMouseOver;
|
this.gridHeaderMouseOver = EventManager_gridHeaderMouseOver;
|
||||||
this.gridHeaderMouseOut = EventManager_gridHeaderMouseOut;
|
this.gridHeaderMouseOut = EventManager_gridHeaderMouseOut;
|
||||||
this.assetDoubleClick = EventManager_assetDoubleClick;
|
|
||||||
this.assetRightClick = EventManager_assetRightClick;
|
|
||||||
this.assetMouseDown = EventManager_assetMouseDown;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,49 +54,7 @@ function EventManager_keyUp(e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EventManager_assetDoubleClick(e) {
|
|
||||||
var dom = document.getElementById&&!document.all;
|
|
||||||
var e=dom? e : event;
|
|
||||||
var obj =dom? e.target : e.srcElement
|
|
||||||
|
|
||||||
AssetManager_getManager().getAsset(obj).go();
|
|
||||||
}
|
|
||||||
|
|
||||||
function EventManager_assetRightClick(e) {
|
|
||||||
var dom = document.getElementById&&!document.all;
|
|
||||||
e=dom? e : event;
|
|
||||||
|
|
||||||
if (!dom) {
|
|
||||||
e.cancelBubble = true;
|
|
||||||
e.returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj =dom? e.target : e.srcElement
|
|
||||||
|
|
||||||
var asset = manager.getAsset(obj);
|
|
||||||
|
|
||||||
manager.display.contextMenu.owner = asset;
|
|
||||||
manager.displayContextMenu(e.clientX,e.clientY,asset);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function EventManager_assetMouseDown(e) {
|
|
||||||
var dom = document.getElementById&&!document.all;
|
|
||||||
e=dom? e : event;
|
|
||||||
|
|
||||||
Display_adjustScrollBars(e);
|
|
||||||
|
|
||||||
if (e.button==2) {
|
|
||||||
//this is a hack to get the context menu stuff to work right in IE
|
|
||||||
if (!dom) {
|
|
||||||
e.cancelBubble = true;
|
|
||||||
e.returnValue = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function EventManager_documentMouseDown(e) {
|
function EventManager_documentMouseDown(e) {
|
||||||
var dom = document.getElementById&&!document.all;
|
var dom = document.getElementById&&!document.all;
|
||||||
|
|
@ -118,7 +73,9 @@ function EventManager_documentMouseDown(e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
manager.display.clearSelectedAssets();
|
if (manager.display.contextMenu.owner == null) {
|
||||||
|
manager.display.clearSelectedAssets();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.button != 2) {
|
if (e.button != 2) {
|
||||||
|
|
@ -138,7 +95,7 @@ function EventManager_documentMouseUp(e) {
|
||||||
if (manager.display.contextMenu.owner && (!asset || asset.assetId != manager.display.contextMenu.owner.assetId)) {
|
if (manager.display.contextMenu.owner && (!asset || asset.assetId != manager.display.contextMenu.owner.assetId)) {
|
||||||
manager.display.contextMenu.hide();
|
manager.display.contextMenu.hide();
|
||||||
}else {
|
}else {
|
||||||
if (!asset) {
|
if (!asset && manager.display.contextMenu.owner == null) {
|
||||||
manager.display.clearSelectedAssets();
|
manager.display.clearSelectedAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
31
www/extras/assetManager/ManageClipboard.js
Normal file
31
www/extras/assetManager/ManageClipboard.js
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
//--------Constructor--------------------
|
||||||
|
|
||||||
|
//Creates a new asset object.
|
||||||
|
function ManageClipboard() {
|
||||||
|
var asset = new Asset();
|
||||||
|
|
||||||
|
asset.dragEnabled = false;
|
||||||
|
asset.allowMultiSelect = true;
|
||||||
|
|
||||||
|
//displays the right click context menu
|
||||||
|
asset.getContextMenu = function () {
|
||||||
|
var arr = new Array();
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["restore"],"javascript:manager.display.contextMenu.owner.restore()");
|
||||||
|
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["delete"],"javascript:manager.display.contextMenu.owner.delete()");
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.select= function() {
|
||||||
|
this.div.className="am-crumbtrail-over";
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.deselect = function() {
|
||||||
|
this.div.className="am-crumbtrail";
|
||||||
|
}
|
||||||
|
|
||||||
|
return asset;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
31
www/extras/assetManager/ManageTrash.js
Normal file
31
www/extras/assetManager/ManageTrash.js
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
//--------Constructor--------------------
|
||||||
|
|
||||||
|
//Creates a new asset object.
|
||||||
|
function ManageTrash() {
|
||||||
|
var asset = new Asset();
|
||||||
|
|
||||||
|
asset.dragEnabled = false;
|
||||||
|
asset.allowMultiSelect = true;
|
||||||
|
|
||||||
|
//displays the right click context menu
|
||||||
|
asset.getContextMenu = function () {
|
||||||
|
var arr = new Array();
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:manager.display.contextMenu.owner.cut()");
|
||||||
|
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
|
||||||
|
arr[arr.length] = new ContextMenuItem(this.labels["purge"],"javascript:manager.display.contextMenu.owner.purge()");
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.select= function() {
|
||||||
|
this.div.className="am-crumbtrail-over";
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.deselect = function() {
|
||||||
|
this.div.className="am-crumbtrail";
|
||||||
|
}
|
||||||
|
|
||||||
|
return asset;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue