From 95bac1098659b94ece56f1822337ac50b341f55d Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 21 Dec 2004 04:33:26 +0000 Subject: [PATCH] more asset manager changes --- docs/upgrades/upgrade_6.2.9-6.3.0.sql | 2 +- lib/WebGUI/Asset/File.pm | 44 +++--- lib/WebGUI/Asset/File/Image.pm | 1 + lib/WebGUI/Storage.pm | 2 +- lib/WebGUI/TabForm.pm | 9 +- www/extras/assetManager/Asset.js | 31 ++-- www/extras/assetManager/AssetManager.js | 38 ++--- www/extras/assetManager/ContextMenu.js | 9 +- www/extras/assetManager/Display.js | 13 +- www/extras/assetManager/EventManager.js | 4 +- www/extras/assetManager/assetManager.css | 193 +++++++++++++++++++---- www/extras/assetManager/breakerLine.gif | Bin 70 -> 64 bytes www/extras/assetManager/crumbArrow.gif | Bin 0 -> 50 bytes www/extras/assetManager/down.gif | Bin 0 -> 182 bytes www/extras/assetManager/up.gif | Bin 0 -> 183 bytes 15 files changed, 247 insertions(+), 99 deletions(-) create mode 100644 www/extras/assetManager/crumbArrow.gif create mode 100644 www/extras/assetManager/down.gif create mode 100644 www/extras/assetManager/up.gif diff --git a/docs/upgrades/upgrade_6.2.9-6.3.0.sql b/docs/upgrades/upgrade_6.2.9-6.3.0.sql index 8b1c00f44..092d77ff4 100644 --- a/docs/upgrades/upgrade_6.2.9-6.3.0.sql +++ b/docs/upgrades/upgrade_6.2.9-6.3.0.sql @@ -182,7 +182,7 @@ create table ImageAsset ( thumbnailSize int not null default 50 ); -INSERT INTO template VALUES ('1','Admin Console','^StyleSheet(^Extras;/adminConsole/adminConsole.css);\r\n^JavaScript(^Extras;/adminConsole/adminConsole.js);\r\n\r\n
\r\n \r\n \" target=\"_blank\">\"?\"\r\n \r\n
\r\n
\r\n \" border=\"0\" title=\"\" alt=\"\" />\r\n
\r\n
\r\n\"*\"\r\n
\r\n
\r\n \" border=\"0\" title=\"\" alt=\"\" />\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n  \r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n  \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \">
\r\n
\r\n
\r\n
\r\n
\r\n ^AdminToggle;
\r\n ^LoginToggle;
\r\n
\r\n
\r\n\r\n','AdminConsole',1,1); +INSERT INTO template VALUES ('1','Admin Console','^StyleSheet(^Extras;/adminConsole/adminConsole.css);\r\n^JavaScript(^Extras;/adminConsole/adminConsole.js);\r\n\r\n
\r\n \r\n \" target=\"_blank\">\"?\"\r\n \r\n
\r\n
\r\n \" border=\"0\" title=\"\" alt=\"\" />\r\n
\r\n
\r\n\"*\"\r\n
\r\n
\r\n \" border=\"0\" title=\"\" alt=\"\" />\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n  \r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n  \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \">
\r\n
\r\n
\r\n
\r\n
\r\n ^AdminToggle;
\r\n ^LoginToggle;
\r\n
\r\n
\r\n\r\n','AdminConsole',1,1); insert into settings (name,value) values ('AdminConsoleTemplate',1); delete from template where namespace='Macro/AdminBar' and templateId in ('1','2'); INSERT INTO template VALUES ('1','Default Admin Bar','\r\n \r\n
\r\n\r\n \r\n \r\n\r\n \r\n \r\n
\r\n\r\n
\r\n \r\n
\r\n
\r\n','Macro/AdminBar',1,1); diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index 519177ac7..f7324dd0b 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -98,13 +98,14 @@ sub getEditForm { my $self = shift; my $tabform = $self->SUPER::getEditForm(); if ($self->get("filename") ne "") { - my $storage = WebGUI::Storage->new($self->get("storageId")); + my $storage = WebGUI::Storage->get($self->get("storageId")); } - $tabform->getTab("properties")->url( + $tabform->getTab("properties")->file( -name=>"file", -label=>"File To Upload" ); + return $tabform; } @@ -113,7 +114,7 @@ sub getIcon { my $self = shift; my $small = shift; if ($small) { - my $storage = WebGUI::Storage->new($self->get("storageId")); + my $storage = WebGUI::Storage->get($self->get("storageId")); return $storage->getFileIconUrl($self->get("filename")); } return $session{config}{extrasURL}.'/assets/file.gif'; @@ -144,15 +145,25 @@ sub purge { my @old = split("\n",$self->get("olderVersions")); foreach my $oldone (@old) { my ($storageId, $filename) = split("|",$oldone); - my $storage = WebGUI::Storage->new($storageId); + my $storage = WebGUI::Storage->get($storageId); $storage->delete; } - my $storage = WebGUI::Storage->new($self->get("storageId")); + my $storage = WebGUI::Storage->get($self->get("storageId")); $storage->delete; return $self->SUPER::purge; } +sub view { + my $self = shift; + if ($session{var}{adminOn}) { + return $self->www_edit; + } + my $storage = WebGUI::Storage->get($self->get("storageId")); + WebGUI::HTTP::setRedirect($storage->getUrl($self->get("filename"))); + return ""; +} + #------------------------------------------------------------------- =head2 www_editSave @@ -185,24 +196,11 @@ sub www_editSave { return $output; } - -#------------------------------------------------------------------- - -=head2 www_view - -A web executable method that redirects the user to the specified page, or displays the edit interface when admin mode is enabled. - -=cut - -sub www_view { - my $self = shift; - if ($session{var}{adminOn}) { - return $self->www_edit; - } - my $storage = WebGUI::Storage->new($self->get("storageId")); - WebGUI::HTTP::setRedirect($storage->getUrl($self->get("filename"))); - return ""; -} +#sub www_view { +# my $self = shift; +# return WebGUI::Privilege::noAccess() unless $self->canView; +# return $self->view; +#} 1; diff --git a/lib/WebGUI/Asset/File/Image.pm b/lib/WebGUI/Asset/File/Image.pm index 94e27facd..3884f8823 100644 --- a/lib/WebGUI/Asset/File/Image.pm +++ b/lib/WebGUI/Asset/File/Image.pm @@ -149,6 +149,7 @@ sub getEditForm { -value=>'thumbnail' ); } + return $tabform; } diff --git a/lib/WebGUI/Storage.pm b/lib/WebGUI/Storage.pm index 3928b4308..0c99d19c7 100644 --- a/lib/WebGUI/Storage.pm +++ b/lib/WebGUI/Storage.pm @@ -458,7 +458,7 @@ sub getFileIconUrl { if (-f $path) { return $session{config}{extrasURL}."/fileIcons/".$extension.".gif"; } - return $session{config}{extrasURL}."/fileIcons/unkonwn.gif"; + return $session{config}{extrasURL}."/fileIcons/unknown.gif"; } diff --git a/lib/WebGUI/TabForm.pm b/lib/WebGUI/TabForm.pm index 785af11b0..e0880ff3f 100644 --- a/lib/WebGUI/TabForm.pm +++ b/lib/WebGUI/TabForm.pm @@ -20,6 +20,7 @@ use Tie::IxHash; use WebGUI::Form; use WebGUI::HTMLForm; use WebGUI::Session; +use WebGUI::Style; =head1 NAME @@ -214,11 +215,9 @@ Returns an HTML string with all the necessary components to draw the tab form. sub print { my $self = shift; - my $output = ' - - - '; - $output .= $self->{_form}; + WebGUI::Style::setScript($session{config}{extrasURL}.'/tabs/tabs.js',{type=>"text/javascript"}); + WebGUI::Style::setLink($self->{_css},{rel=>"stylesheet", rev=>"stylesheet",type=>"text/css"}); + my $output = $self->{_form}; $output .= $self->{_hidden}; my $i = 1; my $tabs; diff --git a/www/extras/assetManager/Asset.js b/www/extras/assetManager/Asset.js index 3fe996733..68ee42633 100644 --- a/www/extras/assetManager/Asset.js +++ b/www/extras/assetManager/Asset.js @@ -17,8 +17,9 @@ function Asset() { //methods this.edit = Asset_edit; this.view = Asset_view; + this.go = Asset_go; this.setRank = Asset_setRank; - this.displayProperties = Asset_displayProperties; +// this.displayProperties = Asset_displayProperties; this.setParent = Asset_setParent; } @@ -49,6 +50,14 @@ function Asset_edit() { location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=edit&afterEdit=assetManager"; } +//Edit the properties of an asset (edit) +//------------------------------- +//url + ?||& + func=edit +function Asset_go() { + location.href = "http://" + manager.tools.getHostName(location.href) + manager.tools.addParamDelimiter(this.url) + "func=manageAssets"; +} + + //View an asset (view) //------------- //url + ?||& + func=view @@ -56,16 +65,16 @@ function Asset_view() { location.href = "http://" + manager.tools.getHostName(location.href) + this.url; } -function Asset_displayProperties() { - html = ""; - html+="" - html+="" - html+="" - html+="" - html+="" - html+="
Title:" + this.title + "
Rank:" + this.rank + "
Asset ID:" + this.assetId + "
Asset Type:" + this.type + "
Size:" + this.size + "
Last Updated:" + this.lastUpdate + "
"; - manager.display.displayPropertiesWindow(html); -} +//function Asset_displayProperties() { +// html = ""; +// html+="" +// html+="" +// html+="" +// html+="" +// html+="" +// html+="
Title:" + this.title + "
Rank:" + this.rank + "
Asset ID:" + this.assetId + "
Asset Type:" + this.type + "
Size:" + this.size + "
Last Updated:" + this.lastUpdate + "
"; +// manager.display.displayPropertiesWindow(html); +//} diff --git a/www/extras/assetManager/AssetManager.js b/www/extras/assetManager/AssetManager.js index 766cb1d15..39a576af8 100644 --- a/www/extras/assetManager/AssetManager.js +++ b/www/extras/assetManager/AssetManager.js @@ -42,7 +42,7 @@ function AssetManager_getManager() { function AssetManager_renderAssets() { - var gridStr = ''; + var gridStr = '
'; var eventStr=''; var id = ""; @@ -107,14 +107,14 @@ function AssetManager_renderAssets() { function AssetManager_buildCrumbTrail() { var crumbtrail = document.getElementById("crumbtrail"); - var contents = "
"; + var contents = '
'; var parentAssets = new Array(); for (i=0;i' + this.crumbtrail[i][2] + ''; + contents += ''; if (i != this.crumbtrail.length -1) { - contents += ""; + contents += ""; } } @@ -155,28 +155,30 @@ function AssetManager_getAsset(obj) { return obj.asset; } -function AssetManager_displayContextMenu(x,y) { +function AssetManager_displayContextMenu(x,y,asset) { var arr = new Array(); 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("",""); 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("",""); - arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:AssetManager_getManager().cut()"); - arr[arr.length] = new ContextMenuItem(this.labels["copy"],"javascript:manager.copy()"); + if (!asset.isParent) { + 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(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); + if (this.display.overObjects.length ==1) { + arr[arr.length] = new ContextMenuItem("",""); + arr[arr.length] = new ContextMenuItem(this.labels["editTree"],"javascript:manager.editTree()"); + } + } - manager.contextMenu.render(arr,x,y,this); + manager.contextMenu.render(arr,x,y,asset); } @@ -240,11 +242,11 @@ function AssetManager_sortGrid(columnIndex) { if (colHeader.sortOrder==">") { colHeader.sortOrder="<"; - document.getElementById('am_grid.headers.' + columnIndex).innerHTML = this.columnHeadings[columnIndex] + " (up)"; + document.getElementById('am_grid.headers.' + columnIndex).innerHTML = this.columnHeadings[columnIndex] + ' '; }else { colHeader.sortOrder=">"; - document.getElementById('am_grid.headers.' + columnIndex).innerHTML = this.columnHeadings[columnIndex] + "(down)"; + document.getElementById('am_grid.headers.' + columnIndex).innerHTML = this.columnHeadings[columnIndex] + ' '; } diff --git a/www/extras/assetManager/ContextMenu.js b/www/extras/assetManager/ContextMenu.js index 29423f570..084ed1d92 100644 --- a/www/extras/assetManager/ContextMenu.js +++ b/www/extras/assetManager/ContextMenu.js @@ -62,11 +62,14 @@ function ContextMenu_render(contextMenuItemArray,x,y,owner) { if (y > parseInt(this.contextMenu.offsetHeight)) { - this.contextMenu.style.top = (y + document.body.scrollTop - this.contextMenu.offsetHeight -1) + "px"; +// this.contextMenu.style.top = (y + document.body.scrollTop - this.contextMenu.offsetHeight -1) + "px"; + this.contextMenu.style.top = (y + window.scrollY - this.contextMenu.offsetHeight -1) + "px"; }else { - this.contextMenu.style.top = (y + document.body.scrollTop + 3) + "px"; + // this.contextMenu.style.top = (y + document.body.scrollTop + 3) + "px"; + this.contextMenu.style.top = (y + window.scrollY + 3) + "px"; } - this.contextMenu.style.left= (x + document.body.scrollLeft) + "px"; + //this.contextMenu.style.left= (x + document.body.scrollLeft) + "px"; + this.contextMenu.style.left= (x + window.scrollX) + "px"; manager.display.bringToFront(this.contextMenu); diff --git a/www/extras/assetManager/Display.js b/www/extras/assetManager/Display.js index 23bc2375e..a4393b43c 100644 --- a/www/extras/assetManager/Display.js +++ b/www/extras/assetManager/Display.js @@ -168,7 +168,7 @@ function Display_selectAsset(asset) { // debug(this.overObjects.length); if (!this.controlKeyDown && !this.shiftKeyDown) { for (i=0;iC>l{DRUHmvM_*v4u}BBFffVt^shYqmVfb_Eny9t@9p`` O-}cC3+OtYA25SJ93>Oao literal 70 zcmZ?wbhEHbT*bh|Fp&WSK7IQ1|Nnm=L-8jIs|Zk72P6uTXJ8U<>0f#JE&t*IEY0oOf7_0#WnHc;4 diff --git a/www/extras/assetManager/crumbArrow.gif b/www/extras/assetManager/crumbArrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..e77e0747abff59959468485aaa05fc300a7a658b GIT binary patch literal 50 zcmZ?wbhEHbWM$xBXkcV`6~^%Y|9{1wEQ|~cj0`#qKmd|qVB%zHYCBzdPsD|l!5RQJ CUJIT8 literal 0 HcmV?d00001 diff --git a/www/extras/assetManager/down.gif b/www/extras/assetManager/down.gif new file mode 100644 index 0000000000000000000000000000000000000000..1a06bc9e84925bee0480e0d499c292115db038f0 GIT binary patch literal 182 zcmV;n07?HxNk%w1VF~~V0K^>ta*CC9lcIT+rR?tTvct@ep{j3)lgQH8zsk^Yij{DS znTMaMjHR-uyv5Gg-QVTtb&{apV!Z literal 0 HcmV?d00001 diff --git a/www/extras/assetManager/up.gif b/www/extras/assetManager/up.gif new file mode 100644 index 0000000000000000000000000000000000000000..aca6d1783e685399555f262e8c5cd0c9985de032 GIT binary patch literal 183 zcmV;o07(BwNk%w1VF~~V0K^>ta*CC9lcIT+rR?tTvct@ep{j3)lgQH8zsk^Yij{DS znTMaMjHR-uyv5Gg-QVTtb&{apqRfS|;cP4qkpuwY7=Ilh(P=~;7!8e9OK^k$06W4MR-XU> literal 0 HcmV?d00001
' + this.crumbtrail[i][2] + ' ->  /