diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm
index aea30850c..5c7952d59 100644
--- a/lib/WebGUI/Operation.pm
+++ b/lib/WebGUI/Operation.pm
@@ -89,11 +89,6 @@ sub getOperations {
'logout' => 'WebGUI::Operation::Auth',
'recoverPassword' => 'WebGUI::Operation::Auth',
'init' => 'WebGUI::Operation::Auth',
- 'deleteClipboardItem' => 'WebGUI::Operation::Clipboard',
- 'deleteClipboardItemConfirm' => 'WebGUI::Operation::Clipboard',
- 'emptyClipboard' => 'WebGUI::Operation::Clipboard',
- 'emptyClipboardConfirm' => 'WebGUI::Operation::Clipboard',
- 'manageClipboard' => 'WebGUI::Operation::Clipboard',
'copyDatabaseLink' => 'WebGUI::Operation::DatabaseLink',
'deleteDatabaseLink' => 'WebGUI::Operation::DatabaseLink',
'deleteDatabaseLinkConfirm' => 'WebGUI::Operation::DatabaseLink',
@@ -183,12 +178,6 @@ sub getOperations {
'editTheme' => 'WebGUI::Operation::Theme',
'editThemeSave' => 'WebGUI::Operation::Theme',
'listThemes' => 'WebGUI::Operation::Theme',
- 'cutTrashItem' => 'WebGUI::Operation::Trash',
- 'deleteTrashItem' => 'WebGUI::Operation::Trash',
- 'deleteTrashItemConfirm' => 'WebGUI::Operation::Trash',
- 'emptyTrash' => 'WebGUI::Operation::Trash',
- 'emptyTrashConfirm' => 'WebGUI::Operation::Trash',
- 'manageTrash' => 'WebGUI::Operation::Trash',
'editUserKarma' => 'WebGUI::Operation::User',
'editUserKarmaSave' => 'WebGUI::Operation::User',
'deleteGrouping' => 'WebGUI::Operation::Group',
diff --git a/lib/WebGUI/Operation/Clipboard.pm b/lib/WebGUI/Operation/Clipboard.pm
deleted file mode 100644
index 7caf76b38..000000000
--- a/lib/WebGUI/Operation/Clipboard.pm
+++ /dev/null
@@ -1,316 +0,0 @@
-package WebGUI::Operation::Clipboard;
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2004 Plain Black Corporation.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-use strict;
-use WebGUI::AdminConsole;
-use WebGUI::DateTime;
-use WebGUI::Grouping;
-use WebGUI::HTMLForm;
-use WebGUI::Icon;
-use WebGUI::International;
-use WebGUI::Page;
-use WebGUI::Paginator;
-use WebGUI::Privilege;
-use WebGUI::Session;
-use WebGUI::SQL;
-use WebGUI::TabForm;
-use WebGUI::URL;
-use WebGUI::Utility;
-
-
-#-------------------------------------------------------------------
-sub _submenu {
- my $workarea = shift;
- my $title = shift;
- $title = WebGUI::International::get($title) if ($title);
- my $help = shift;
- my $ac = WebGUI::AdminConsole->new("clipboard");
- if ($help) {
- $ac->setHelp($help);
- }
- $ac->addSubmenuItem(WebGUI::URL::page('op=manageClipboard'), WebGUI::International::get(949));
- if ($session{form}{systemClipboard} ne "1") {
- $ac->addSubmenuItem(WebGUI::URL::page('op=emptyClipboard'), WebGUI::International::get(950));
- }
- if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Grouping::isInGroup(3)) ) {
- $ac->addSubmenuItem(WebGUI::URL::page('op=manageClipboard&systemClipboard=1'), WebGUI::International::get(954));
- if ($session{form}{systemClipboard} eq "1") {
- $ac->addSubmenuItem(WebGUI::URL::page('op=emptyClipboard&systemClipboard=1'), WebGUI::International::get(959));
- }
- }
- return $ac->render($workarea, $title);
-}
-
-#-------------------------------------------------------------------
-sub www_deleteClipboardItemConfirm {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- if ($session{form}{wid} ne "") {
- if ( ($session{setting}{sharedClipboard} eq "1") || (WebGUI::Grouping::isInGroup(3)) ) {
- WebGUI::SQL->write("update wobject set pageId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where pageId='2' "
- ."and wobjectId=" . quote($session{form}{wid})
- );
- } else {
- WebGUI::SQL->write("update wobject set pageId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where pageId='2' "
- ."and wobjectId=" . quote($session{form}{wid}) ." "
- ."and bufferUserId=".quote($session{user}{userId})
- );
- }
- WebGUI::ErrorHandler::audit("moved wobject ". $session{form}{wid} ." from clipboard to trash");
- } elsif ($session{form}{pageId} ne "") {
- if ( ($session{setting}{sharedClipboard} eq "1") || (WebGUI::Grouping::isInGroup(3)) ) {
- WebGUI::SQL->write("update page set parentId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where parentId='2' "
- ."and pageId=".quote($session{form}{pageId})
- );
- } else {
- WebGUI::SQL->write("update page set parentId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where parentId='2' "
- ."and pageId=".quote($session{form}{pageId}) ." "
- ."and bufferUserId=".quote($session{user}{userId})
- );
- }
- WebGUI::ErrorHandler::audit("moved page ". $session{form}{pageId} ." from clipboard to trash");
- }
- WebGUI::Session::refreshPageInfo($session{page}{pageId},'op=manageClipboard');
- return www_manageClipboard();
-}
-
-#-------------------------------------------------------------------
-sub www_emptyClipboard {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- my ($output);
- $output .= WebGUI::International::get(951).'
';
- if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Grouping::isInGroup(3)) ) {
- $output .= '
'.WebGUI::International::get(44).'';
- } else {
- $output .= '
';
- return _submenu($output,"42","clipboard empty");
-}
-
-#-------------------------------------------------------------------
-sub www_emptyClipboardConfirm {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- my ($allUsers);
- if ($session{setting}{sharedClipboard} eq "1") {
- $allUsers = 1;
- } elsif ($session{form}{systemClipboard} eq "1") {
- return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
- $allUsers = 1;
- } else {
- $allUsers = 0;
- }
- if ($allUsers eq "1") {
- WebGUI::SQL->write("update page set parentId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where parentId='2' ");
- WebGUI::SQL->write("update wobject set pageId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where pageId='2' ");
- WebGUI::ErrorHandler::audit("emptied clipboard to trash");
- } else {
- WebGUI::SQL->write("update page set parentId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where parentId='2' "
- ."and bufferUserId=".quote($session{user}{userId}));
- WebGUI::SQL->write("update wobject set pageId='3', "
- ."bufferDate=".time().", "
- ."bufferUserId=".quote($session{user}{userId}) .", "
- ."bufferPrevId='2' "
- ."where pageId='2' "
- ."and bufferUserId=".quote($session{user}{userId}));
- WebGUI::ErrorHandler::audit("emptied user clipboard to trash");
- }
- WebGUI::Session::refreshPageInfo($session{page}{pageId});
- return www_manageClipboard();
-}
-
-#-------------------------------------------------------------------
-sub www_manageClipboard {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
-
- my ($sth, @data, @row, @sorted_row, $i, $p, $allUsers, $title);
- my $output;
-
- # Add appropriate html page header
- if ($session{setting}{sharedClipboard} eq "1") {
- $allUsers = 1;
- } elsif ($session{form}{systemClipboard} eq "1") {
- return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
- $allUsers = 1;
- $title = '955';
- } else {
- $allUsers = 0;
- }
-
- # Generate list of pages in clipboard
- if ($allUsers) {
- $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
- ."from page where parentId='2' order by bufferDate");
- } else {
- $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
- ."from page where parentId='2' and bufferUserId="
- . quote($session{user}{userId}) . " order by bufferDate");
- }
- while (@data = $sth->array) {
- my ($pageId,$title,$urlizedTitle,$bufferUserId,$bufferDate,$bufferPrevId,$url,$htmlData);
- $pageId = $data[0];
- $title = $data[1];
- $urlizedTitle = $data[2];
- $title = '
' .$title .'';
-
- $bufferUserId = $data[3];
- if ($bufferUserId ne "") {
- my ($bufferUsername) = WebGUI::SQL->quickArray("select username from users where userId=".quote($bufferUserId));
- $bufferUserId = '
'
- .$bufferUsername .'';
- }
- $bufferDate = epochToHuman($data[4]);
- $bufferPrevId = $data[5];
- if ($bufferPrevId ne "") {
- ($bufferPrevId,$url) = WebGUI::SQL->quickArray("select title,urlizedTitle "
- ."from page where pageId=".quote($bufferPrevId));
- if ($url ne "") {
- $bufferPrevId = '
' .$bufferPrevId .'';
- }
- }
-
- # create html row data
- $htmlData = '
';
- $htmlData .= '| '
- .pageIcon()
- .deleteIcon('op=deleteClipboardItemConfirm&pageId='.$pageId,'',WebGUI::International::get(956))
- .pasteIcon('op=pastePage&pageId='.$pageId);
- $htmlData .= ' | ';
- $htmlData .= ''. $title .' | ';
- $htmlData .= ''. WebGUI::International::get(2) .' | ';
- $htmlData .= ''. $bufferDate .' | ';
- $htmlData .= ''. $bufferPrevId .' | ';
- if ($allUsers) {
- $htmlData .= ''. $bufferUserId .' | ';
- }
- $htmlData .= '
';
-
- # store row data in array of arrays with integer bufferDate for later sorting
- push @row, [$data[4], $htmlData];
- }
-
- # Generate list of wobjects in clipboard
- if ($allUsers) {
- $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
- . "from wobject where pageId='2' order by bufferDate");
- } else {
- $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
- . "from wobject where pageId='2' and bufferUserId="
- . quote($session{user}{userId}) ." order by bufferDate");
- }
- while (@data = $sth->array) {
- my ($wobjectId,$namespace,$title,$bufferUserId,$bufferDate,$bufferPrevId,$url,$htmlData);
-
- $wobjectId = $data[0];
- $namespace = $data[1];
- $title = $data[2];
- $title = '
'. $title .'';
-
- $bufferPrevId = $data[5];
- if ($bufferPrevId ne "") {
- ($bufferPrevId,$url) = WebGUI::SQL->quickArray("select title,urlizedTitle "
- ."from page where pageId=".quote($bufferPrevId));
- if ($url ne "") {
- $bufferPrevId = '
' .$bufferPrevId .'';
- }
- }
- $bufferDate = epochToHuman($data[4]);
-
- $bufferUserId = $data[3];
- if ($bufferUserId ne "") {
- my ($bufferUsername) = WebGUI::SQL->quickArray("select username from users where userId=".quote($bufferUserId));
- $bufferUserId = '
'
- .$bufferUsername .'';
- }
-
- # create html row data
- $htmlData = '
';
- $htmlData .= '| '
- .wobjectIcon()
- .deleteIcon('op=deleteClipboardItemConfirm&wid='.$wobjectId,'',WebGUI::International::get(956))
- .pasteIcon('func=paste&wid='.$wobjectId);
- $htmlData .= ' | ';
- $htmlData .= ''. $title .' | ';
- $htmlData .= ''. $namespace .' | ';
- $htmlData .= ''. $bufferDate .' | ';
- $htmlData .= ''. $bufferPrevId .' | ';
- if ($allUsers) {
- $htmlData .= ''. $bufferUserId .' | ';
- }
- $htmlData .= '
';
-
- # store row data in array of arrays with integer bufferDate for later sorting
- push @row, [$data[4], $htmlData];
- }
- $sth->finish;
-
- # Reverse sort row htmlData by bufferDate
- @sorted_row = sort {$b->[0] <=> $a->[0]} @row;
- @row = ();
- for $i ( 0 .. $#sorted_row ) {
- push @row, $sorted_row[$i][1];
- }
-
- # Create output with pagination
- $output .= '
';
- $output .= ' | ';
- $output .= ''. WebGUI::International::get(99) .' | ';
- $output .= ''. WebGUI::International::get(783) .' | ';
- $output .= ''. WebGUI::International::get(952) .' | ';
- $output .= ''. WebGUI::International::get(953) .' | ';
- if ($allUsers) {
- $output .= ''. WebGUI::International::get(50) .' | ';
- }
- $output .= '
';
- if ($session{form}{systemClipboard} eq "1") {
- $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard&systemClipboard=1'));
- } else {
- $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard'));
- }
- $p->setDataByArrayRef(\@row);
- $output .= $p->getPage($session{form}{pn});
- $output .= '
';
- $output .= $p->getBarTraditional($session{form}{pn});
- return _submenu($output, $title, "clipboard manage");
-}
-
-1;
diff --git a/lib/WebGUI/Operation/Trash.pm b/lib/WebGUI/Operation/Trash.pm
deleted file mode 100644
index fee825328..000000000
--- a/lib/WebGUI/Operation/Trash.pm
+++ /dev/null
@@ -1,405 +0,0 @@
-package WebGUI::Operation::Trash;
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2004 Plain Black Corporation.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-use strict qw(vars subs);
-use Tie::CPHash;
-use WebGUI::AdminConsole;
-use WebGUI::DateTime;
-use WebGUI::Grouping;
-use WebGUI::Icon;
-use WebGUI::Page;
-use WebGUI::Paginator;
-use WebGUI::Privilege;
-use WebGUI::Session;
-use WebGUI::SQL;
-use WebGUI::URL;
-
-#-------------------------------------------------------------------
-sub _purgeUserTrash {
- my (%properties, $base, $extended, $b, $wobjectId, $namespace, $w, $cmd, $userId, $bufferId, $page, $currentPage, $currentWobjectPage);
- tie %properties, 'Tie::CPHash';
-
- $userId = $session{user}{userId};
-
- #WebGUI::ErrorHandler::audit("emptying user trash");
-
- # Delete wobjects
- $b = WebGUI::SQL->read("select * from wobject where pageId='3' and bufferUserId=" . quote($userId));
- while ($base = $b->hashRef) {
- $extended = WebGUI::SQL->quickHashRef("select * from ".$base->{namespace}."
- where wobjectId=".quote($base->{wobjectId}));
- %properties = (%{$base}, %{$extended});
- $cmd = "WebGUI::Wobject::".$properties{namespace};
- my $load = "use ".$cmd;
- eval($load);
- WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
- $w = $cmd->new(\%properties);
- $w->purge;
- }
- $b->finish;
-
- # Delete pages and all subpages
- $page = WebGUI::Page->getPage(3);
- foreach ($page->daughters) {
- $currentPage = WebGUI::Page->new($_);
- if ($currentPage->get('bufferUserId') eq $userId) {
- foreach $currentWobjectPage ($currentPage->self_and_descendants) {
- _purgeWobjects($currentWobjectPage->{'pageId'});
- }
- $currentPage->purge;
- }
- }
-}
-
-#-------------------------------------------------------------------
-sub _purgeWobject {
- my (%properties, $base, $extended, $b, $wobjectId, $namespace, $w, $cmd);
- tie %properties, 'Tie::CPHash';
- $b = WebGUI::SQL->read("select * from wobject where wobjectId=".quote($_[0]));
- while ($base = $b->hashRef) {
- $extended = WebGUI::SQL->quickHashRef("select * from ".$base->{namespace}."
- where wobjectId=".quote($base->{wobjectId}));
- %properties = (%{$base}, %{$extended});
- $cmd = "WebGUI::Wobject::".$properties{namespace};
- my $load = "use ".$cmd;
- eval($load);
- WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
- $w = $cmd->new(\%properties);
- $w->purge;
- }
- $b->finish;
-}
-
-#-------------------------------------------------------------------
-sub _purgeWobjects {
- my (%properties, $base, $extended, $b, $wobjectId, $namespace, $w, $cmd);
- tie %properties, 'Tie::CPHash';
- $b = WebGUI::SQL->read("select * from wobject where pageId=".quote($_[0]));
- while ($base = $b->hashRef) {
- $extended = WebGUI::SQL->quickHashRef("select * from ".$base->{namespace}."
- where wobjectId=".quote($base->{wobjectId}));
- %properties = (%{$base}, %{$extended});
- $cmd = "WebGUI::Wobject::".$properties{namespace};
- my $load = "use ".$cmd;
- eval($load);
- WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
- $w = $cmd->new(\%properties);
- $w->purge;
- }
- $b->finish;
-}
-
-#-------------------------------------------------------------------
-sub _recursePageTree {
- my ($a, $pageId);
- $a = WebGUI::SQL->read("select pageId from page where parentId=".quote($_[0]));
- while (($pageId) = $a->array) {
- _recursePageTree($pageId);
- _purgeWobjects($pageId);
- WebGUI::SQL->write("delete from page where pageId=".quote($pageId));
- }
- $a->finish;
-}
-
-#-------------------------------------------------------------------
-sub _submenu {
- my $workarea = shift;
- my $title = shift;
- $title = WebGUI::International::get($title) if ($title);
- my $help = shift;
- my $ac = WebGUI::AdminConsole->new("trash");
- if ($help) {
- $ac->setHelp($help);
- }
- $ac->addSubmenuItem(WebGUI::URL::page('op=manageTrash'), WebGUI::International::get(10));
- if ($session{form}{systemTrash} ne "1") {
- $ac->addSubmenuItem(WebGUI::URL::page('op=emptyTrash'), WebGUI::International::get(11));
- }
- if ( ($session{setting}{sharedTrash} ne "1") && (WebGUI::Grouping::isInGroup(3)) ) {
- $ac->addSubmenuItem(WebGUI::URL::page('op=manageTrash&systemTrash=1'), WebGUI::International::get(964));
- if ($session{form}{systemTrash} eq "1") {
- $ac->addSubmenuItem(WebGUI::URL::page('op=emptyTrash&systemTrash=1'), WebGUI::International::get(967));
- }
- }
- return $ac->render($workarea, $title);
-}
-
-
-#-------------------------------------------------------------------
-sub www_cutTrashItem {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- if ($session{form}{wid} ne "") {
- if ( ($session{setting}{sharedTrash} ne "1") && (!(WebGUI::Grouping::isInGroup(3)) ) ) {
- my ($bufferUserId) = WebGUI::SQL->quickArray("select bufferUserId from wobject "
- ."where wobjectId=" .quote($session{form}{wid}));
- return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
- }
- WebGUI::SQL->write("update wobject set pageId='2', "
- ."bufferUserId=". quote($session{user}{userId}) .", "
- ."bufferDate=". time() .", "
- ."bufferPrevId=3 "
- ."where wobjectId=" .quote($session{form}{wid}));
- WebGUI::ErrorHandler::audit("moved wobject ". $session{form}{wid} ." from trash to clipboard");
- } elsif ($session{form}{pageId} ne "") {
- my $page = WebGUI::Page->getPage($session{form}{pageId});
-
- if ( ($session{setting}{sharedTrash} ne "1") && (!(WebGUI::Grouping::isInGroup(3)) ) ) {
- my ($bufferUserId) = $page->get("bufferUserId");
- return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
- }
-
- $page->cut;
-
- WebGUI::ErrorHandler::audit("moved page ". $session{form}{pageId} ." from trash to clipboard");
- }
- WebGUI::Session::refreshPageInfo($session{page}{pageId});
-
- return "";
-}
-
-#-------------------------------------------------------------------
-sub www_deleteTrashItemConfirm {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- if ($session{form}{wid} ne "") {
- if ( ($session{setting}{sharedTrash} eq "1") || (WebGUI::Grouping::isInGroup(3)) ) {
- _purgeWobject($session{form}{wid});
- } else {
- my ($bufferUserId) = WebGUI::SQL->quickArray("select bufferUserId from wobject "
- ."where wobjectId=" .quote($session{form}{wid}));
- return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
- _purgeWobject($session{form}{wid});
- }
- WebGUI::ErrorHandler::audit("purged wobject ". $session{form}{wid} ." from trash");
- } elsif ($session{form}{pageId} ne "") {
- my $page = WebGUI::Page->getPage($session{form}{pageId});
-
- unless ( ($session{setting}{sharedTrash} eq "1") || (WebGUI::Grouping::isInGroup(3)) ) {
- my ($bufferUserId) = $page->get("bufferUserId");
- return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
- }
-
- foreach my $currentPage ($page->self_and_descendants) {
- _purgeWobjects($currentPage->{"pageId"});
- }
-
- $page->purge;
-
- WebGUI::ErrorHandler::audit("purged page ". $session{form}{pageId} ." from trash");
- }
- WebGUI::Session::refreshPageInfo($session{page}{pageId});
- return "";
-}
-
-#-------------------------------------------------------------------
-sub www_emptyTrash {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- my ($output);
- $output .= WebGUI::International::get(162).'
';
- $output .= WebGUI::International::get(651).'
';
- if ($session{form}{systemTrash} eq "1") {
- $output .= '
'.WebGUI::International::get(44).'';
- } else {
- $output .= '
';
- return _submenu($output,'42',"trash empty");
-}
-
-#-------------------------------------------------------------------
-sub www_emptyTrashConfirm {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
- my ($allUsers, $page, $currentPage, $currentWobjectPage);
- if ($session{setting}{sharedTrash} eq "1") {
- $allUsers = 1;
- } elsif ($session{form}{systemTrash} eq "1") {
- return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
- $allUsers = 1;
- } else {
- $allUsers = 0;
- }
- if ($allUsers eq "1") {
- $page = WebGUI::Page->getPage(3);
- foreach ($page->daughters) {
- $currentPage = WebGUI::Page->new($_);
- foreach $currentWobjectPage ($currentPage->self_and_descendants) {
- _purgeWobjects($currentWobjectPage->{"pageId"});
- }
- $currentPage->purge;
- }
- _purgeWobjects(3);
- WebGUI::ErrorHandler::audit("emptied system trash");
- } else {
- _purgeUserTrash();
- WebGUI::ErrorHandler::audit("emptied user trash");
- }
- WebGUI::Session::refreshPageInfo($session{page}{pageId});
- return www_manageTrash();
-}
-
-#-------------------------------------------------------------------
-sub www_manageTrash {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
-
- my ($sth, @data, @row, @sorted_row, $i, $p, $allUsers);
- my ($title,$output);
- # Add appropriate html page header
- if ($session{setting}{sharedTrash} eq "1") {
- $allUsers = 1;
- } elsif ($session{form}{systemTrash} eq "1") {
- return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
- $allUsers = 1;
- $title = '
'. WebGUI::International::get(965) .'
';
- } else {
- $allUsers = 0;
- }
-
- # Generate list of pages in trash
- if ($allUsers) {
- $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
- ."from page where parentId='3' order by bufferDate");
- } else {
- $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
- ."from page where parentId='3' and bufferUserId="
- . quote($session{user}{userId}) . " order by bufferDate");
- }
- while (@data = $sth->array) {
- my ($pageId,$title,$urlizedTitle,$bufferUserId,$bufferDate,$bufferPrevId,$url,$htmlData);
- $pageId = $data[0];
- $title = $data[1];
- $urlizedTitle = $data[2];
- $title = '
' .$title .'';
-
- $bufferUserId = $data[3];
- if ($bufferUserId ne "") {
- my ($bufferUsername) = WebGUI::SQL->quickArray("select username from users where userId=".quote($bufferUserId));
- $bufferUserId = '
'
- .$bufferUsername .'';
- }
- $bufferDate = epochToHuman($data[4]);
- $bufferPrevId = $data[5];
- if ($bufferPrevId ne "") {
- ($bufferPrevId,$url) = WebGUI::SQL->quickArray("select title,urlizedTitle "
- ."from page where pageId=".quote($bufferPrevId));
- if ($url ne "") {
- $bufferPrevId = '
' .$bufferPrevId .'';
- }
- }
-
- # create html row data
- $htmlData = '
';
- $htmlData .= '| '
- .pageIcon()
- .deleteIcon('op=deleteTrashItemConfirm&pageId='.$pageId,'',WebGUI::International::get(966))
- .cutIcon('op=cutTrashItem&pageId='.$pageId);
- $htmlData .= ' | ';
- $htmlData .= ''. $title .' | ';
- $htmlData .= ''. WebGUI::International::get(2) .' | ';
- $htmlData .= ''. $bufferDate .' | ';
- $htmlData .= ''. $bufferPrevId .' | ';
- if ($allUsers) {
- $htmlData .= ''. $bufferUserId .' | ';
- }
- $htmlData .= '
';
-
- # store row data in array of arrays with integer bufferDate for later sorting
- push @row, [$data[4], $htmlData];
- }
-
- # Generate list of wobjects in clipboard
- if ($allUsers) {
- $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
- . "from wobject where pageId='3' order by bufferDate");
- } else {
- $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
- . "from wobject where pageId='3' and bufferUserId="
- . quote($session{user}{userId}) ." order by bufferDate");
- }
- while (@data = $sth->array) {
- my ($wobjectId,$namespace,$title,$bufferUserId,$bufferDate,$bufferPrevId,$url,$htmlData);
-
- $wobjectId = $data[0];
- $namespace = $data[1];
- $title = $data[2];
- $title = '
'. $title .'';
-
- $bufferPrevId = $data[5];
- if ($bufferPrevId ne "") {
- ($bufferPrevId,$url) = WebGUI::SQL->quickArray("select title,urlizedTitle "
- ."from page where pageId=".quote($bufferPrevId));
- if ($url ne "") {
- $bufferPrevId = '
' .$bufferPrevId .'';
- }
- }
- $bufferDate = epochToHuman($data[4]);
-
- $bufferUserId = $data[3];
- if ($bufferUserId ne "") {
- my ($bufferUsername) = WebGUI::SQL->quickArray("select username from users where userId=".quote($bufferUserId));
- $bufferUserId = '
'
- .$bufferUsername .'';
- }
-
- # create html row data
- $htmlData = '
';
- $htmlData .= '| '
- .wobjectIcon()
- .deleteIcon('op=deleteTrashItemConfirm&wid='.$wobjectId ,'',WebGUI::International::get(966))
- .cutIcon('op=cutTrashItem&wid='.$wobjectId);
- $htmlData .= ' | ';
- $htmlData .= ''. $title .' | ';
- $htmlData .= ''. $namespace .' | ';
- $htmlData .= ''. $bufferDate .' | ';
- $htmlData .= ''. $bufferPrevId .' | ';
- if ($allUsers) {
- $htmlData .= ''. $bufferUserId .' | ';
- }
- $htmlData .= '
';
-
- # store row data in array of arrays with integer bufferDate for later sorting
- push @row, [$data[4], $htmlData];
- }
- $sth->finish;
-
- # Reverse sort row htmlData by bufferDate
- @sorted_row = sort {$b->[0] <=> $a->[0]} @row;
- @row = ();
- for $i ( 0 .. $#sorted_row ) {
- push @row, $sorted_row[$i][1];
- }
-
- # Create output with pagination
- $output .= '
';
- $output .= ' | ';
- $output .= ''. WebGUI::International::get(99) .' | ';
- $output .= ''. WebGUI::International::get(783) .' | ';
- $output .= ''. WebGUI::International::get(963) .' | ';
- $output .= ''. WebGUI::International::get(953) .' | ';
- if ($allUsers) {
- $output .= ''. WebGUI::International::get(50) .' | ';
- }
- $output .= '
';
- if ($session{form}{systemTrash} eq "1") {
- $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash&systemTrash=1'));
- } else {
- $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash'));
- }
- $p->setDataByArrayRef(\@row);
- $output .= $p->getPage($session{form}{pn});
- $output .= '
';
- $output .= $p->getBarTraditional($session{form}{pn});
- return _submenu($output,$title,"trash manage");
-}
-
-1;