added the majority of clipboard, trash, asset history, and purge functions
This commit is contained in:
parent
117fcaee52
commit
8c77e3dfb7
6 changed files with 216 additions and 113 deletions
|
|
@ -62,8 +62,9 @@ create table asset (
|
|||
isHidden int not null default 0,
|
||||
isSystem int not null default 0,
|
||||
encryptPage int not null default 0,
|
||||
lastUpdated bigint not null default 0,
|
||||
assetSize int not null default 0,
|
||||
lastUpdated bigint not null default 0,
|
||||
lastUpdatedBy varchar(22),
|
||||
unique index (lineage asc),
|
||||
unique index (url),
|
||||
index (parentId)
|
||||
|
|
@ -196,7 +197,7 @@ create table ImageAsset (
|
|||
parameters text
|
||||
);
|
||||
|
||||
INSERT INTO template VALUES ('1','Admin Console','^StyleSheet(^Extras;/adminConsole/adminConsole.css);\r\n^JavaScript(^Extras;/adminConsole/adminConsole.js);\r\n\r\n<div id=\"application_help\">\r\n <tmpl_if help.url>\r\n <a href=\"<tmpl_var help.url>\" target=\"_blank\"><img src=\"^Extras;/adminConsole/small/help.gif\" alt=\"?\" border=\"0\" /></a>\r\n </tmpl_if>\r\n</div>\r\n<div id=\"application_icon\">\r\n <img src=\"<tmpl_var application.icon>\" border=\"0\" title=\"<tmpl_var application.title>\" alt=\"<tmpl_var application.title>\" />\r\n</div>\r\n<div class=\"adminConsoleTitleIconMedalian\">\r\n<img src=\"^Extras;/adminConsole/medalian.gif\" border=\"0\" alt=\"*\" />\r\n</div>\r\n<div id=\"console_icon\">\r\n <img src=\"<tmpl_var console.icon>\" border=\"0\" title=\"<tmpl_var console.title>\" alt=\"<tmpl_var console.title>\" />\r\n</div>\r\n<div id=\"application_title\">\r\n <tmpl_var application.title>\r\n</div>\r\n<div id=\"console_title\">\r\n <tmpl_var console.title>\r\n</div>\r\n<div id=\"application_workarea\">\r\n <tmpl_var application.workArea>\r\n</div>\r\n<div id=\"console_workarea\">\r\n <div class=\"adminConsoleSpacer\">\r\n \r\n </div>\r\n <tmpl_loop application_loop>\r\n <tmpl_if canUse>\r\n <div class=\"adminConsoleApplication\">\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon>\" border=\"0\" title=\"<tmpl_var title>\" alt=\"<tmpl_var title>\" /></a><br />\r\n <a href=\"<tmpl_var url>\"><tmpl_var title></a>\r\n </div>\r\n </tmpl_if>\r\n </tmpl_loop>\r\n <div class=\"adminConsoleSpacer\">\r\n \r\n </div>\r\n</div>\r\n<div class=\"adminConsoleMenu\">\r\n <div id=\"adminConsoleMainMenu\" class=\"adminConsoleMainMenu\">\r\n <div id=\"console_toggle_on\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.on.label></a><br />\r\n </div>\r\n <div id=\"console_toggle_off\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.off.label></a><br />\r\n </div>\r\n </div>\r\n <div id=\"adminConsoleApplicationSubmenu\" class=\"adminConsoleApplicationSubmenu\">\r\n <tmpl_loop submenu_loop>\r\n <a href=\"<tmpl_var url>\"><tmpl_var label></a><br />\r\n </tmpl_loop>\r\n </div>\r\n <div id=\"adminConsoleUtilityMenu\" class=\"adminConsoleUtilityMenu\">\r\n <a href=\"^\\;\"><tmpl_var backtosite.label></a><br />\r\n ^AdminToggle;<br />\r\n ^LoginToggle;<br />\r\n </div>\r\n</div>\r\n<script lang=\"JavaScript\">\r\n initAdminConsole(<tmpl_if application.title>true<tmpl_else>false</tmpl_if>,<tmpl_if submenu_loop>true<tmpl_else>false</tmpl_if>);\r\n</script>\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<div id=\"application_help\">\r\n <tmpl_if help.url>\r\n <a href=\"<tmpl_var help.url>\" target=\"_blank\"><img src=\"^Extras;/adminConsole/small/help.gif\" alt=\"?\" border=\"0\" /></a>\r\n </tmpl_if>\r\n</div>\r\n<div id=\"application_icon\">\r\n <img src=\"<tmpl_var application.icon>\" border=\"0\" title=\"<tmpl_var application.title>\" alt=\"<tmpl_var application.title>\" />\r\n</div>\r\n<div class=\"adminConsoleTitleIconMedalian\">\r\n<img src=\"^Extras;/adminConsole/medalian.gif\" border=\"0\" alt=\"*\" />\r\n</div>\r\n<div id=\"console_icon\">\r\n <img src=\"<tmpl_var console.icon>\" border=\"0\" title=\"<tmpl_var console.title>\" alt=\"<tmpl_var console.title>\" />\r\n</div>\r\n<div id=\"application_title\">\r\n <tmpl_var application.title>\r\n</div>\r\n<div id=\"console_title\">\r\n <tmpl_var console.title>\r\n</div>\r\n<div id=\"application_workarea\">\r\n <tmpl_var application.workArea>\r\n</div>\r\n<div id=\"console_workarea\">\r\n <div class=\"adminConsoleSpacer\">\r\n \r\n </div>\r\n <tmpl_loop application_loop>\r\n <tmpl_if canUse>\r\n <div class=\"adminConsoleApplication\">\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon>\" border=\"0\" title=\"<tmpl_var title>\" alt=\"<tmpl_var title>\" /></a><br />\r\n <a href=\"<tmpl_var url>\"><tmpl_var title></a>\r\n </div>\r\n </tmpl_if>\r\n </tmpl_loop>\r\n <div class=\"adminConsoleSpacer\">\r\n \r\n </div>\r\n</div>\r\n<div class=\"adminConsoleMenu\">\r\n <div id=\"adminConsoleMainMenu\" class=\"adminConsoleMainMenu\">\r\n <div id=\"console_toggle_on\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.on.label></a><br />\r\n </div>\r\n <div id=\"console_toggle_off\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.off.label></a><br />\r\n </div>\r\n </div>\r\n <div id=\"adminConsoleApplicationSubmenu\" class=\"adminConsoleApplicationSubmenu\">\r\n <tmpl_loop submenu_loop>\r\n <a href=\"<tmpl_var url>\" <tmpl_var extras>><tmpl_var label></a><br />\r\n </tmpl_loop>\r\n </div>\r\n <div id=\"adminConsoleUtilityMenu\" class=\"adminConsoleUtilityMenu\">\r\n <a href=\"^\\;\"><tmpl_var backtosite.label></a><br />\r\n ^AdminToggle;<br />\r\n ^LoginToggle;<br />\r\n </div>\r\n</div>\r\n<script lang=\"JavaScript\">\r\n initAdminConsole(<tmpl_if application.title>true<tmpl_else>false</tmpl_if>,<tmpl_if submenu_loop>true<tmpl_else>false</tmpl_if>);\r\n</script>\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','<script language=\"JavaScript\" type=\"text/javascript\"> <!--\r\n function goContent(){\r\n location = document.content.contentSelect.options[document.content.contentSelect.selectedIndex].value\r\n }\r\n function goAdmin(){\r\n location = document.admin.adminSelect.options[document.admin.adminSelect.selectedIndex].value\r\n }\r\n //--> </script>\r\n \r\n<div class=\"adminBar\">\r\n<table class=\"adminBar\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\">\r\n <tr>\r\n <form name=\"content\"> <td>\r\n<select name=\"contentSelect\" onChange=\"goContent()\">\r\n<option value=\"\"><tmpl_var addcontent.label></option>\r\n\r\n<tmpl_if clipboard_loop>\r\n<optgroup label=\"<tmpl_var clipboard.label>\"> \r\n<tmpl_loop clipboard_loop>\r\n<option value=\"<tmpl_var clipboard.url>\"><tmpl_var clipboard.label></option>\r\n</tmpl_loop>\r\n</optgroup>\r\n</tmpl_if>\r\n\r\n<tmpl_if contentTypes_loop>\r\n<optgroup label=\"<tmpl_var contentTypes.label>\"> \r\n<tmpl_loop contentTypes_loop>\r\n<option value=\"<tmpl_var contentType.url>\"><tmpl_var contentType.label></option>\r\n</tmpl_loop>\r\n</optgroup>\r\n</tmpl_if>\r\n\r\n<tmpl_if package_loop>\r\n<optgroup label=\"<tmpl_var packages.label>\"> \r\n<tmpl_loop package_loop>\r\n<option value=\"<tmpl_var package.url>\"><tmpl_var package.label></option>\r\n</tmpl_loop>\r\n</optgroup>\r\n</tmpl_if>\r\n\r\n</select>\r\n </td> </form>\r\n\r\n <form name=\"admin\"> <td align=\"center\">\r\n <select name=\"adminSelect\" onChange=\"goAdmin()\">\r\n <option value=\"\"><tmpl_var admin.label></option>\r\n <tmpl_loop admin_loop>\r\n <option value=\"<tmpl_var admin.url>\"><tmpl_var admin.label></option>\r\n </tmpl_loop>\r\n </select>\r\n </td> </form>\r\n </tr>\r\n</table>\r\n</div>\r\n','Macro/AdminBar',1,1);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@ sub addSubmenuItem {
|
|||
my $self = shift;
|
||||
my $url = shift;
|
||||
my $label = shift;
|
||||
my $extras = shift;
|
||||
push (@{$self->{_submenuItem}}, {
|
||||
url=>$url,
|
||||
label=>$label
|
||||
label=>$label,
|
||||
extras=>$extras
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -71,8 +73,8 @@ sub getAdminFunction {
|
|||
namespace=>"WebGUI"
|
||||
},
|
||||
icon=>"clipboard.gif",
|
||||
op=>"manageClipboard",
|
||||
group=>"4"
|
||||
func=>"manageClipboard",
|
||||
group=>"12"
|
||||
},
|
||||
"trash"=>{
|
||||
title=>{
|
||||
|
|
@ -80,8 +82,8 @@ sub getAdminFunction {
|
|||
namespace=>"WebGUI"
|
||||
},
|
||||
icon=>"trash.gif",
|
||||
op=>"manageTrash",
|
||||
group=>"3"
|
||||
func=>"manageTrash",
|
||||
group=>"4"
|
||||
},
|
||||
"databases"=>{
|
||||
title=>{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ sub addChild {
|
|||
}
|
||||
WebGUI::SQL->commit;
|
||||
my $newAsset = WebGUI::Asset->newByDynamicClass($id, $properties->{className});
|
||||
$self->updateHistory("added child ".$id);
|
||||
$newAsset->updateHistory("created");
|
||||
$newAsset->update($properties);
|
||||
return $newAsset;
|
||||
}
|
||||
|
|
@ -81,6 +83,7 @@ sub cut {
|
|||
WebGUI::SQL->write("update asset set state='limbo' where lineage like ".quote($self->get("lineage").'%'));
|
||||
WebGUI::SQL->write("update asset set state='clipboard' where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->commit;
|
||||
$self->updateHistory("cut");
|
||||
$self->{_properties}{state} = "clipboard";
|
||||
}
|
||||
|
||||
|
|
@ -249,6 +252,61 @@ sub getAssetAdderLinks {
|
|||
return \@links;
|
||||
}
|
||||
|
||||
sub getAssetManagerControl {
|
||||
my $self = shift;
|
||||
my $children = shift;
|
||||
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/ContextMenu.js', {type=>"text/javascript"});
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Asset.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/AssetManager.js', {type=>"text/javascript"});
|
||||
my $output = '
|
||||
<div id="contextMenu" class="contextMenu"></div>
|
||||
<div id="propertiesWindow" class="propertiesWindow"></div>
|
||||
<div id="crumbtrail"></div>
|
||||
<div id="workspace">Retrieving Assets...</div>
|
||||
<div id="dragImage" class="dragIdentifier">hello</div>
|
||||
';
|
||||
$output .= "<script>\n";
|
||||
$output .= "/* assetId, url, title */\nvar crumbtrail = [\n";
|
||||
my $ancestors = $self->getLineage(["self","ancestors"],{returnObjects=>1});
|
||||
my @dataArray;
|
||||
foreach my $ancestor (@{$ancestors}) {
|
||||
my $title = $ancestor->get("title");
|
||||
$title =~ s/\'/\\\'/g;
|
||||
push(@dataArray,"['".$ancestor->getId."','".$ancestor->getUrl."','".$title."']\n");
|
||||
}
|
||||
$output .= join(",",@dataArray);
|
||||
$output .= "];\n";
|
||||
$output .= "var columnHeadings = ['Rank','Title','Type','Last Updated','Size'];\n";
|
||||
$output .= "/*rank, title, type, lastUpdate, size, url, assetId, icon */\nvar assets = [\n";
|
||||
@dataArray = ();
|
||||
foreach my $child (@{$children}) {
|
||||
my $title = $child->get("title");
|
||||
$title =~ s/\'/\\\'/g;
|
||||
push(@dataArray, '['.$child->getRank.",'".$title."','".$child->getName."','".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))."','".formatBytes($child->get("assetSize"))."','".$child->getUrl."','".$child->getId."','".$child->getIcon(1)."']\n");
|
||||
#my $hasChildren = "false";
|
||||
#$hasChildren = "true" if ($child->hasChildren);
|
||||
#$output .= $hasChildren;
|
||||
}
|
||||
$output .= join(",",@dataArray);
|
||||
$output .= "];\n var labels = new Array();\n";
|
||||
$output .= "labels['edit'] = 'Edit';\n";
|
||||
$output .= "labels['cut'] = 'Cut';\n";
|
||||
$output .= "labels['copy'] = 'Copy';\n";
|
||||
$output .= "labels['move'] = 'Move';\n";
|
||||
$output .= "labels['view'] = 'View';\n";
|
||||
$output .= "labels['delete'] = 'Delete';\n";
|
||||
$output .= "labels['go'] = 'Go';\n";
|
||||
$output .= "labels['properties'] = 'Properties';\n";
|
||||
$output .= "labels['editTree'] = 'Edit Tree';\n";
|
||||
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.renderAssets();\n</script>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = WebGUI::TabForm->new();
|
||||
|
|
@ -450,6 +508,10 @@ sub getLineage {
|
|||
$mod .= ")";
|
||||
push(@whereModifiers,$mod);
|
||||
}
|
||||
# we need to include children
|
||||
if (isIn("children",@{$relatives})) {
|
||||
push(@whereModifiers,"(parentId=".quote($self->getId).")");
|
||||
}
|
||||
# now lets add in all of the siblings in every level between ourself and the asset we wish to pedigree
|
||||
if (isIn("pedigree",@{$relatives}) && exists $rules->{assetToPedigree}) {
|
||||
my @mods;
|
||||
|
|
@ -475,7 +537,8 @@ sub getLineage {
|
|||
# based upon all available criteria, let's get some assets
|
||||
my $columns = "assetId, className, parentId";
|
||||
$columns = "*" if ($rules->{returnQuickReadObjects});
|
||||
my $sql = "select $columns from asset where $where order by lineage";
|
||||
my $sortOrder = ($rules->{invertTree}) ? "desc" : "asc";
|
||||
my $sql = "select $columns from asset where $where order by lineage $sortOrder";
|
||||
my @lineage;
|
||||
my %relativeCache;
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
|
|
@ -710,6 +773,7 @@ sub paste {
|
|||
my $pastedAsset = WebGUI::Asset->new($assetId);
|
||||
if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self->getId)) {
|
||||
$pastedAsset->republish;
|
||||
$pastedAsset->updateHistory("pasted to parent ".$self->getId);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -748,16 +812,33 @@ sub promote {
|
|||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
# NOTE to self, still need to delete all children too
|
||||
$self->updateHistory("purged");
|
||||
WebGUI::SQL->beginTransaction;
|
||||
foreach my $definition (@{$self->definition}) {
|
||||
WebGUI::SQL->write("delete from ".$definition->{tableName}." where assetId=".quote($self->getId));
|
||||
}
|
||||
WebGUI::SQL->commit;
|
||||
# eliminate anything bound to this asset
|
||||
my $sth = WebGUI::SQL->read("select assetId,className from asset where boundToId=".quote($self->getId));
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($id,$class);
|
||||
if (defined $asset) {
|
||||
$asset->purgeTree;
|
||||
}
|
||||
}
|
||||
$self = undef;
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub purgeTree {
|
||||
my $self = shift;
|
||||
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1, invertTree=>1});
|
||||
foreach my $descendant (@{$descendants}) {
|
||||
$descendant->purge;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub setParent {
|
||||
my $self = shift;
|
||||
my $newParentId = shift;
|
||||
|
|
@ -772,6 +853,7 @@ sub setParent {
|
|||
WebGUI::SQL->write("update asset set parentId=".quote($parent->getId)." where assetId=".quote($self->getId));
|
||||
$self->cascadeLineage($lineage);
|
||||
WebGUI::SQL->commit;
|
||||
$self->updateHistory("moved to parent ".$parent->getId);
|
||||
$self->{_properties}{lineage} = $lineage;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -796,6 +878,7 @@ sub setRank {
|
|||
if (isBetween($sibling->getRank, $newRank, $currentRank)) {
|
||||
$sibling->cascadeLineage($previous);
|
||||
$previous = $sibling->get("lineage");
|
||||
$sibling->updateHistory("changed rank");
|
||||
}
|
||||
}
|
||||
$self->cascadeLineage($previous,$temp);
|
||||
|
|
@ -824,6 +907,7 @@ sub swapRank {
|
|||
$self->cascadeLineage($first,$second);
|
||||
$self->cascadeLineage($second,$temp);
|
||||
WebGUI::SQL->commit;
|
||||
$self->updateHistory("swapped lineage between ".$first." and ".$second);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -835,6 +919,7 @@ sub trash {
|
|||
WebGUI::SQL->write("update asset set state='trash' where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->commit;
|
||||
$self->{_properties}{state} = "trash";
|
||||
$self->updateHistory("trashed");
|
||||
}
|
||||
|
||||
sub update {
|
||||
|
|
@ -866,6 +951,18 @@ sub update {
|
|||
return 1;
|
||||
}
|
||||
|
||||
sub updateHistory {
|
||||
my $self = shift;
|
||||
my $action = shift;
|
||||
my $userId = shift || $session{user}{userId};
|
||||
my $dateStamp = time();
|
||||
WebGUI::SQL->beginTransaction;
|
||||
WebGUI::SQL->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp) values (
|
||||
".quote($self->getId).", ".quote($userId).", ".quote($action).", ".$dateStamp.")");
|
||||
$self->update({lastUpdated=>$dateStamp,lastUpdatedBy=>$userId});
|
||||
WebGUI::SQL->commit;
|
||||
}
|
||||
|
||||
sub view {
|
||||
return "";
|
||||
}
|
||||
|
|
@ -887,7 +984,7 @@ sub www_add {
|
|||
|
||||
sub www_copy {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
my $newAsset = $self->duplicate;
|
||||
$newAsset->cut;
|
||||
return "";
|
||||
|
|
@ -895,7 +992,7 @@ sub www_copy {
|
|||
|
||||
sub www_copyList {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
my $newAsset = $self->duplicate;
|
||||
$newAsset->cut;
|
||||
foreach my $assetId ($session{cgi}->param("assetId")) {
|
||||
|
|
@ -910,14 +1007,14 @@ sub www_copyList {
|
|||
|
||||
sub www_cut {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->cut;
|
||||
return $self->getParent->www_view;
|
||||
}
|
||||
|
||||
sub www_cutList {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
foreach my $assetId ($session{cgi}->param("assetId")) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
||||
if ($asset->canEdit) {
|
||||
|
|
@ -929,14 +1026,14 @@ sub www_cutList {
|
|||
|
||||
sub www_delete {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->trash;
|
||||
return $self->getParent->www_view;
|
||||
}
|
||||
|
||||
sub www_deleteList {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
foreach my $assetId ($session{cgi}->param("assetId")) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
||||
if ($asset->canEdit) {
|
||||
|
|
@ -948,19 +1045,20 @@ sub www_deleteList {
|
|||
|
||||
sub www_demote {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->demote;
|
||||
return "";
|
||||
}
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
return $self->getAdminConsole->render($self->getEditForm->print);
|
||||
}
|
||||
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
my $object;
|
||||
if ($session{form}{assetId} eq "new") {
|
||||
$object = $self->addChild({className=>$session{form}{class}});
|
||||
|
|
@ -969,6 +1067,7 @@ sub www_editSave {
|
|||
$object = $self;
|
||||
}
|
||||
$object->processPropertiesFromFormPost;
|
||||
$object->updateHistory("edited");
|
||||
return $self->www_manageAssets if ($session{form}{afterEdit} eq "assetManager" && $session{form}{assetId} eq "new");
|
||||
return $object->getParent->www_manageAssets if ($session{form}{afterEdit} eq "assetManager");
|
||||
return $object->www_view;
|
||||
|
|
@ -982,59 +1081,46 @@ sub www_editTreeSave {
|
|||
return "not yet implemented";
|
||||
}
|
||||
|
||||
sub www_emptyClipboard {
|
||||
my $self = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("clipboard");
|
||||
return $ac->render(WebGUI::Privilege::insufficient()) unless (WebGUI::Grouping::isInGroup(4));
|
||||
my $limit;
|
||||
unless ($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3)) {
|
||||
$limit = "and lastUpdatedBy=".quote($session{user}{userId});
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select assetId,className from asset where state='clipboard' $limit");
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($id,$class);
|
||||
$asset->trash;
|
||||
}
|
||||
$sth->finish;
|
||||
return $self->www_manageClipboard();
|
||||
}
|
||||
|
||||
sub www_emptyTrash {
|
||||
my $self = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("trash");
|
||||
return $ac->render(WebGUI::Privilege::insufficient()) unless (WebGUI::Grouping::isInGroup(4));
|
||||
my $limit;
|
||||
unless ($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3)) {
|
||||
$limit = "and lastUpdatedBy=".quote($session{user}{userId});
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select assetId,className from asset where state='trash' $limit");
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($id,$class);
|
||||
$asset->purgeTree;
|
||||
}
|
||||
$sth->finish;
|
||||
return $self->www_manageTrash();
|
||||
}
|
||||
|
||||
|
||||
sub www_manageAssets {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
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/ContextMenu.js', {type=>"text/javascript"});
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Asset.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/AssetManager.js', {type=>"text/javascript"});
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
my $children = $self->getLineage(["descendants"],{returnObjects=>1, endingLineageLength=>$self->getLineageLength+1});
|
||||
my $output;
|
||||
$output = '
|
||||
<div id="contextMenu" class="contextMenu"></div>
|
||||
<div id="propertiesWindow" class="propertiesWindow"></div>
|
||||
<div id="crumbtrail"></div>
|
||||
<div id="workspace">Retrieving Assets...</div>
|
||||
<div id="dragImage" class="dragIdentifier">hello</div>
|
||||
';
|
||||
$output .= "<script>\n";
|
||||
$output .= "/* assetId, url, title */\nvar crumbtrail = [\n";
|
||||
my $ancestors = $self->getLineage(["self","ancestors"],{returnObjects=>1});
|
||||
my @dataArray;
|
||||
foreach my $ancestor (@{$ancestors}) {
|
||||
my $title = $ancestor->get("title");
|
||||
$title =~ s/\'/\\\'/g;
|
||||
push(@dataArray,"['".$ancestor->getId."','".$ancestor->getUrl."','".$title."']\n");
|
||||
}
|
||||
$output .= join(",",@dataArray);
|
||||
$output .= "];\n";
|
||||
$output .= "var columnHeadings = ['Rank','Title','Type','Last Updated','Size'];\n";
|
||||
$output .= "/*rank, title, type, lastUpdate, size, url, assetId, icon */\nvar assets = [\n";
|
||||
@dataArray = ();
|
||||
foreach my $child (@{$children}) {
|
||||
my $title = $child->get("title");
|
||||
$title =~ s/\'/\\\'/g;
|
||||
push(@dataArray, '['.$child->getRank.",'".$title."','".$child->getName."','".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))."','".formatBytes($child->get("assetSize"))."','".$child->getUrl."','".$child->getId."','".$child->getIcon(1)."']\n");
|
||||
#my $hasChildren = "false";
|
||||
#$hasChildren = "true" if ($child->hasChildren);
|
||||
#$output .= $hasChildren;
|
||||
}
|
||||
$output .= join(",",@dataArray);
|
||||
$output .= "];\n var labels = new Array();\n";
|
||||
$output .= "labels['edit'] = 'Edit';\n";
|
||||
$output .= "labels['cut'] = 'Cut';\n";
|
||||
$output .= "labels['copy'] = 'Copy';\n";
|
||||
$output .= "labels['move'] = 'Move';\n";
|
||||
$output .= "labels['view'] = 'View';\n";
|
||||
$output .= "labels['delete'] = 'Delete';\n";
|
||||
$output .= "labels['go'] = 'Go';\n";
|
||||
$output .= "labels['properties'] = 'Properties';\n";
|
||||
$output .= "labels['editTree'] = 'Edit Tree';\n";
|
||||
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.renderAssets();\n</script>\n";
|
||||
my $output = $self->getAssetManagerControl($children);
|
||||
$output .= ' <div class="adminConsoleSpacer">
|
||||
|
||||
</div>
|
||||
|
|
@ -1069,17 +1155,70 @@ sub www_manageAssets {
|
|||
return $self->getAdminConsole->render($output);
|
||||
}
|
||||
|
||||
sub www_manageClipboard {
|
||||
my $self = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("clipboard");
|
||||
return $ac->render(WebGUI::Privilege::insufficient()) unless (WebGUI::Grouping::isInGroup(4));
|
||||
my @assets;
|
||||
my ($header, $limit);
|
||||
$ac->setHelp("clipboard manage");
|
||||
if ($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3)) {
|
||||
$header = WebGUI::International::get(965);
|
||||
$ac->addSubmenuItem($self->getUrl('func=manageClipboard'), WebGUI::International::get(949));
|
||||
$ac->addSubmenuItem($self->getUrl('func=emptyClipboard&systemClipboard=1'), WebGUI::International::get(959),
|
||||
'onclick="return window.confirm(\''.WebGUI::International::get(951).'\')"');
|
||||
} else {
|
||||
$ac->addSubmenuItem($self->getUrl('func=manageClipboard&systemClipboard=1'), WebGUI::International::get(954));
|
||||
$ac->addSubmenuItem($self->getUrl('func=emptyClipboard'), WebGUI::International::get(950),
|
||||
'onclick="return window.confirm(\''.WebGUI::International::get(951).'\')"');
|
||||
$limit = "and lastUpdatedBy=".quote($session{user}{userId});
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select assetId,className from asset where state='clipboard' $limit");
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
push(@assets,WebGUI::Asset->newByDynamicClass($id,$class));
|
||||
}
|
||||
$sth->finish;
|
||||
return $ac->render($self->getAssetManagerControl(\@assets), $header);
|
||||
}
|
||||
|
||||
|
||||
sub www_manageTrash {
|
||||
my $self = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("trash");
|
||||
return $ac->render(WebGUI::Privilege::insufficient()) unless (WebGUI::Grouping::isInGroup(4));
|
||||
my @assets;
|
||||
my ($header, $limit);
|
||||
$ac->setHelp("trash manage");
|
||||
if ($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3)) {
|
||||
$header = WebGUI::International::get(965);
|
||||
$ac->addSubmenuItem($self->getUrl('func=manageTrash'), WebGUI::International::get(10));
|
||||
$ac->addSubmenuItem($self->getUrl('func=emptyTrash&systemTrash=1'), WebGUI::International::get(967),
|
||||
'onclick="return window.confirm(\''.WebGUI::International::get(651).'\')"');
|
||||
} else {
|
||||
$ac->addSubmenuItem($self->getUrl('func=manageTrash&systemTrash=1'), WebGUI::International::get(964));
|
||||
$ac->addSubmenuItem($self->getUrl('func=emptyTrash'), WebGUI::International::get(11),
|
||||
'onclick="return window.confirm(\''.WebGUI::International::get(651).'\')"');
|
||||
$limit = "and lastUpdatedBy=".quote($session{user}{userId});
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select assetId,className from asset where state='trash' $limit");
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
push(@assets,WebGUI::Asset->newByDynamicClass($id,$class));
|
||||
}
|
||||
$sth->finish;
|
||||
return $ac->render($self->getAssetManagerControl(\@assets), $header);
|
||||
}
|
||||
|
||||
|
||||
sub www_paste {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->paste($session{form}{assetId});
|
||||
return "";
|
||||
}
|
||||
|
||||
sub www_pasteList {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
foreach my $clipId ($session{cgi}->param("assetId")) {
|
||||
$self->paste($clipId);
|
||||
}
|
||||
|
|
@ -1088,14 +1227,14 @@ sub www_pasteList {
|
|||
|
||||
sub www_promote {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->promote;
|
||||
return "";
|
||||
}
|
||||
|
||||
sub www_setParent {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
my $newParent = $session{form}{assetId};
|
||||
$self->setParent($newParent) if (defined $newParent);
|
||||
return $self->www_manageAssets();
|
||||
|
|
@ -1104,7 +1243,7 @@ sub www_setParent {
|
|||
|
||||
sub www_setRank {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
my $newRank = $session{form}{rank};
|
||||
$self->setRank($newRank) if (defined $newRank);
|
||||
return $self->www_manageAssets();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ use WebGUI::Id;
|
|||
use WebGUI::International;
|
||||
use WebGUI::MessageLog;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Page;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ use WebGUI::Id;
|
|||
use WebGUI::International;
|
||||
use WebGUI::MessageLog;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Page;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
|
|||
|
|
@ -515,11 +515,6 @@ The URL of the web site for this theme's designer. If you are in the business of
|
|||
lastUpdated => 1033832377
|
||||
},
|
||||
|
||||
'966' => {
|
||||
message => q|Are you certain that you wish to permanently purge/delete this item from the trash?|,
|
||||
lastUpdated => 1101775259
|
||||
},
|
||||
|
||||
'992' => {
|
||||
message => q|Title|,
|
||||
lastUpdated => 1056151382
|
||||
|
|
@ -535,11 +530,6 @@ The URL of the web site for this theme's designer. If you are in the business of
|
|||
lastUpdated => 1050430737
|
||||
},
|
||||
|
||||
'783' => {
|
||||
message => q|Type|,
|
||||
lastUpdated => 1036954378
|
||||
},
|
||||
|
||||
'706' => {
|
||||
message => q|Hour(s)|,
|
||||
lastUpdated => 1031514049
|
||||
|
|
@ -1338,11 +1328,6 @@ How should this user be notified when they get a new WebGUI message?
|
|||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'953' => {
|
||||
message => q|Previous Location|,
|
||||
lastUpdated => 1052850265
|
||||
},
|
||||
|
||||
'39' => {
|
||||
message => q|You do not have sufficient privileges to access this page.|,
|
||||
lastUpdated => 1031514049
|
||||
|
|
@ -1983,7 +1968,7 @@ By default, WebGUI has one big content area to place wobjects. However, by speci
|
|||
<p>
|
||||
|
||||
<b>Synopsis</b><br>
|
||||
A short description of a page. It is used to populate default descriptive meta tags as well as to provide descriptions on Site Maps.
|
||||
A short description of a page.
|
||||
<p>
|
||||
|
||||
<b>Meta Tags</b><br>
|
||||
|
|
@ -2227,18 +2212,10 @@ will be modified to make it unique.|,
|
|||
},
|
||||
|
||||
'651' => {
|
||||
message => q|If you choose to empty your trash, any items contained in it will be lost forever. If you're unsure about a few items, it might be best to cut them to your clipboard before you empty the trash.
|
||||
<p>
|
||||
|
||||
|,
|
||||
message => q|Emptying your trash will remove these assets from your site forever. Are you sure you want to continue?|,
|
||||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'956' => {
|
||||
message => q|Are you certain that you wish to move this item from the clipboard to the trash?|,
|
||||
lastUpdated => 1052850265
|
||||
},
|
||||
|
||||
'498' => {
|
||||
message => q|End Date|,
|
||||
lastUpdated => 1031514049
|
||||
|
|
@ -3741,10 +3718,6 @@ on the page.
|
|||
The toolbar icon that allows the wobject to be repositioned via a click and drag interface.
|
||||
<p>
|
||||
|
||||
<b>wobject.namespace</b><br>
|
||||
The namespace of this wobject. This is also known as the wobject type, for instance Article, USS, SQLReport, and SiteMap are all namespaces.
|
||||
<p>
|
||||
|
||||
<b>wobject.id</b><br>
|
||||
The unique identifier for this wobject.
|
||||
<p>
|
||||
|
|
@ -4225,11 +4198,6 @@ The description of this forum as passed by the calling object.
|
|||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'162' => {
|
||||
message => q|Are you certain that you wish to purge all the pages and wobjects in the trash?|,
|
||||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'880' => {
|
||||
message => q|Last Resort Editor|,
|
||||
lastUpdated => 1044705137
|
||||
|
|
@ -5535,11 +5503,6 @@ Privileges and styles assigned to pages in the package will not be copied when t
|
|||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'963' => {
|
||||
message => q|Trash Date|,
|
||||
lastUpdated => 1052850265
|
||||
},
|
||||
|
||||
'ends with' => {
|
||||
message => q|Ends With|,
|
||||
lastUpdated => 1089039511
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue