diff --git a/docs/upgrades/upgrade_5.2.6-5.3.0.sql b/docs/upgrades/upgrade_5.2.6-5.3.0.sql
index 220e53453..0a30a79df 100644
--- a/docs/upgrades/upgrade_5.2.6-5.3.0.sql
+++ b/docs/upgrades/upgrade_5.2.6-5.3.0.sql
@@ -285,7 +285,7 @@ insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'Item', 61
delete from help where helpId=6 and namespace='WebGUI';
insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (6, 'WebGUI', 656, 611, '12,WebGUI;');
delete from help where helpId=46 and namespace='WebGUI';
-insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (46, 'WebGUI', 696, 651, NULL);
+insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (46, 'WebGUI', 696, 651, '66,WebGUI;');
delete from help where helpId=22 and namespace='WebGUI';
insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (22, 'WebGUI', 672, 627, '12,WebGUI;');
delete from help where helpId=1 and namespace='USS';
@@ -467,51 +467,62 @@ alter table wobject add column bufferUserId int(11) default NULL;
alter table wobject add column bufferDate int(11) default NULL;
alter table wobject add column bufferPrevId int(11) default NULL;
delete from international where languageId=1 and namespace='WebGUI' and internationalId=946;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (946,1,'WebGUI','Use shared trash?', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (946,1,'WebGUI','Use shared trash?', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=947;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (947,1,'WebGUI','Use shared clipboard?', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (947,1,'WebGUI','Use shared clipboard?', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=948;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (948,1,'WebGUI','Manage Clipboard', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (948,1,'WebGUI','Manage Clipboard', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=949;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (949,1,'WebGUI','Manage clipboard.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (949,1,'WebGUI','Manage clipboard.', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=950;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (950,1,'WebGUI','Empty clipboard.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (950,1,'WebGUI','Empty clipboard.', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=951;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (951,1,'WebGUI','Are you certain that you wish to empty the clipboard to the trash?', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (951,1,'WebGUI','Are you certain that you wish to empty the clipboard to the trash?', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=952;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (952,1,'WebGUI','Clipboard Date', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (952,1,'WebGUI','Clipboard Date', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=953;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (953,1,'WebGUI','Previous Location', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (953,1,'WebGUI','Previous Location', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=954;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (954,1,'WebGUI','Manage system clipboard.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (954,1,'WebGUI','Manage system clipboard.', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=955;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (955,1,'WebGUI','Manage System Clipboard', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (955,1,'WebGUI','Manage System Clipboard', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=956;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (956,1,'WebGUI','Are you certain that you wish to move this item from the clipboard to the trash?', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (956,1,'WebGUI','Are you certain that you wish to move this item from the clipboard to the trash?', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=957;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (957,1,'WebGUI','Clipboard, Manage', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (957,1,'WebGUI','Clipboard, Manage', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=958;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (958,1,'WebGUI','The clipboard is a system location to which content may be temporarily cut or copied. Items in the clipboard may then be pasted to a new location.\r\n
The clipboard contents may be managed individually. You may delete or paste an item by selecting the approriate icon. You may also empty the entire contents of the clipboard to the trash by choosing the Empty clipboard menu option.\r\n
Title
The name of the item in the clipboard. You may view the item by selecting the title.\r\n
Type
The type of content object. For instance, a Page, Article, EventsCalendar, etc.\r\n
Clipboard Date
The date and time the item was added to the clipboard\r\n
Previous Location
The location where the item was previously found. You may view the previous location by selecting the location.
Username
The username of the individual who placed the item in the clipboard. This is an optional field is only visible in shared clipboard environments or when an administrator is managing the system clipboard.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (958,1,'WebGUI','The clipboard is a special system location to which content may be temporarily cut or copied. Items in the clipboard may then be pasted to a new location.\r\n
The clipboard contents may be managed individually. You may delete or paste an item by selecting the approriate icon. You may also empty the entire contents of the clipboard to the trash by choosing the Empty clipboard menu option.\r\n
Title
The name of the item in the clipboard. You may view the item by selecting the title.\r\n
Type
The type of content. For instance, a Page, Article, EventsCalendar, etc.\r\n
Clipboard Date
The date and time the item was added to the clipboard\r\n
Previous Location
The location where the item was previously found. You may view the previous location by selecting the location.
Username
The username of the individual who placed the item in the clipboard. This is an optional field is only visible in shared clipboard environments or when an administrator is managing the system clipboard.', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=959;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (959,1,'WebGUI','Empty system clipboard.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (959,1,'WebGUI','Empty system clipboard.', 1052850265);
delete from help where helpId=65 and namespace='WebGUI';
-INSERT INTO help VALUES (65,'WebGUI',957,958,'66,WebGUI;');
+INSERT INTO help VALUES (65,'WebGUI',957,958,'67,WebGUI;');
delete from international where languageId=1 and namespace='WebGUI' and internationalId=960;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (960,1,'WebGUI','Trash, Manage', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (960,1,'WebGUI','Trash, Manage', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=961;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (961,1,'WebGUI','The trash is a system location where deleted content is temporarily stored. Items in the trash may be managed individually. You may cut an item to the clipboard or permanently delete it by selecting the approriate icon. You may also purge/delete all items in the trash by choosing the Empty trash menu option.\r\n
Title
The name of the item in the trash. You may view the item by selecting the title.\r\n
Type
The type of content object. For instance, a page, article, EventsCalendar, etc.\r\n
Trash Date
The date and time the item was added to the trash\r\n
Previous Location
The location where the item was previously found. You may view the previous location by selecting the location.
Username
The username of the individual who placed the item in the trash. This is an optional field is only visible in shared trash environments or when an administrator is managing the system trash.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (961,1,'WebGUI','The trash is a special system location where deleted content is temporarily stored. Items in the trash may be managed individually. You may cut an item to the clipboard or permanently delete it by selecting the approriate icon. You may also purge/delete all items in the trash by choosing the Empty trash menu option.\r\n
Title
The name of the item in the trash. You may view the item by selecting the title.\r\n
Type
The type of content. For instance, a Page, Article, EventsCalendar, etc.\r\n
Trash Date
The date and time the item was added to the trash\r\n
Previous Location
The location where the item was previously found. You may view the previous location by selecting the location.
Username
The username of the individual who placed the item in the trash. This is an optional field is only visible in shared trash environments or when an administrator is managing the system trash.', 1052850265);
delete from help where helpId=66 and namespace='WebGUI';
-INSERT INTO help VALUES (66,'WebGUI',960,961,'65,WebGUI;');
+INSERT INTO help VALUES (66,'WebGUI',960,961,'46,WebGUI;');
delete from international where languageId=1 and namespace='WebGUI' and internationalId=962;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (962,1,'WebGUI','Manage Trash', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (962,1,'WebGUI','Manage Trash', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=963;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (963,1,'WebGUI','Trash Date', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (963,1,'WebGUI','Trash Date', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=964;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (964,1,'WebGUI','Manage system trash.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (964,1,'WebGUI','Manage system trash.', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=965;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (965,1,'WebGUI','Manage System Trash', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (965,1,'WebGUI','Manage System Trash', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=966;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (966,1,'WebGUI','Are you certain that you wish to permantently purge/delete this item from the trash?', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (966,1,'WebGUI','Are you certain that you wish to permantently purge/delete this item from the trash?', 1052850265);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=967;
-insert into international (internationalId,languageId,namespace,message,lastUpdated) values (967,1,'WebGUI','Empty system trash.', 1050170767);
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (967,1,'WebGUI','Empty system trash.', 1052850265);
+delete from international where languageId=1 and namespace='WebGUI' and internationalId=968;
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (968,1,'WebGUI','Clipboard, Empty', 1052850265);
+delete from international where languageId=1 and namespace='WebGUI' and internationalId=969;
+insert into international (internationalId,languageId,namespace,message,lastUpdated) values (969,1,'WebGUI','If you choose to empty your clipboard, any items contained in it will be moved to the trash.\r\n', 1052850265);
+INSERT INTO help VALUES (67,'WebGUI',968,969,'65,WebGUI;');
+delete from settings where name='sharedClipboard';
+insert into settings (name,value) values ('sharedClipboard','0');
+delete from settings where name='sharedTrash';
+insert into settings (name,value) values ('sharedTrash','0');
+delete from international where languageId=1 and namespace='WebGUI' and internationalId=629;
+INSERT INTO international (internationalId,languageId,namespace,message,lastUpdated) VALUES (629,1,'WebGUI','Use shared clipboard?
\r\nEnables a single, system-wide clipboard shared by all users. Default is user separated clipboards.\r\n
\r\n\r\nUse shared trash?
\r\nEnables a single, system-wide trash shared by all users. Default is user separated trash.\r\n
\r\n\r\nPrevent Proxy Caching
\r\nSome companies have proxy servers that cause problems with WebGUI. If you\'re experiencing problems with WebGUI, and you have a proxy server, you may want to set this setting to Yes. Beware that WebGUI\'s URLs will not be as user-friendly after this feature is turned on.\r\n
\r\n\r\nShow debugging?
\r\nShow debugging information in WebGUI\'s output. This is primarily useful for WebGUI developers, but can also be interesting for Administrators trying to troubleshoot a problem.\r\n
\r\n\r\nTrack page statistics?
\r\nWebGUI can track some statistical information for your site. However, this will add a little extra strain on your processor and will make your database grow much more quickly. Enable this only if you do not have an external web statistics program.\r\n
\r\n',1052850265);
diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm
index 4eae64d0e..b9573b30c 100644
--- a/lib/WebGUI.pm
+++ b/lib/WebGUI.pm
@@ -153,7 +153,10 @@ sub _processFunctions {
and WobjectProxy.proxiedWobjectId=".${$wobject}{wobjectId});
${$wobject}{_WobjectProxy} = $proxyWobjectId;
}
- unless (${$wobject}{pageId} == $session{page}{pageId} || ${$wobject}{pageId} == 2 || ${$wobject}{_WobjectProxy} ne "") {
+ unless (${$wobject}{pageId} == $session{page}{pageId}
+ || ${$wobject}{pageId} == 2
+ || ${$wobject}{pageId} == 3
+ || ${$wobject}{_WobjectProxy} ne "") {
$output .= WebGUI::International::get(417);
WebGUI::ErrorHandler::security("access wobject [".$session{form}{wid}."] on page '"
.$session{page}{title}."' [".$session{page}{pageId}."].");
diff --git a/lib/WebGUI/Icon.pm b/lib/WebGUI/Icon.pm
index f6c6f50c2..472e3d2a2 100644
--- a/lib/WebGUI/Icon.pm
+++ b/lib/WebGUI/Icon.pm
@@ -20,8 +20,9 @@ use WebGUI::Session;
use WebGUI::URL;
our @ISA = qw(Exporter);
-our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon ©Icon &deleteIcon &editIcon &moveUpIcon &moveDownIcon
- &moveRightIcon &moveLeftIcon &wobjectIcon &pageIcon &moveTopIcon &moveBottomIcon &viewIcon);
+our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon ©Icon &deleteIcon &editIcon
+ &moveBottomIcon &moveDownIcon &moveLeftIcon &moveRightIcon &moveTopIcon &moveUpIcon
+ &pageIcon &pasteIcon &wobjectIcon &viewIcon);
=head1 NAME
@@ -46,6 +47,7 @@ A package for generating user interface buttons. The subroutines found herein do
$html = moveTopIcon('op=something');
$html = moveUpIcon('op=something');
$html = pageIcon();
+ $html = pasteIcon('op=something');
$html = viewIcon('op=something');
$html = wobjectIcon();
@@ -377,6 +379,34 @@ sub pageIcon {
#-------------------------------------------------------------------
+=head2 pasteIcon ( urlParameters [, pageURL ] )
+
+Generates a button with the word "Paste" printed on it.
+
+=over
+
+=item urlParameters
+
+Any URL parameters that need to be tacked on to the current URL to accomplish whatever function this button represents.
+
+=item pageURL
+
+The URL to any page. Defaults to the current page.
+
+=back
+
+=cut
+
+sub pasteIcon {
+ my ($output, $pageURL);
+ $pageURL = $_[1] || $session{page}{urlizedTitle};
+ $output = '';
+ $output .= '
';
+ return $output;
+}
+
+#-------------------------------------------------------------------
+
=head2 viewIcon ( urlParameters [, pageURL ] )
Generates a button with the word "View" printed on it.
diff --git a/lib/WebGUI/Macro/AdminBar.pm b/lib/WebGUI/Macro/AdminBar.pm
index 8b8207bcd..4b6260295 100644
--- a/lib/WebGUI/Macro/AdminBar.pm
+++ b/lib/WebGUI/Macro/AdminBar.pm
@@ -51,13 +51,25 @@ sub process {
#--clipboard paster
%hash2 = ();
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
- %hash = WebGUI::SQL->buildHash("select pageId,title from page where parentId=2 order by title");
+ # pages
+ if ($session{setting}{sharedClipboard} eq "1") {
+ %hash = WebGUI::SQL->buildHash("select pageId, title from page where parentId=2 order by bufferDate desc");
+ } else {
+ %hash = WebGUI::SQL->buildHash("select pageId, title from page where parentId=2 "
+ ."and bufferUserId=". $session{user}{userId}. " order by bufferDate desc");
+ }
foreach $key (keys %hash) {
$hash2{WebGUI::URL::page('op=pastePage&pageId='.$key)} = $hash{$key};
}
- %hash = WebGUI::SQL->buildHash("select wobjectId,title from wobject where pageId=2 order by title");
+ # wobjects
+ if ($session{setting}{sharedClipboard} eq "1") {
+ %hash = WebGUI::SQL->buildHash("select wobjectId, title from wobject where pageId=2 order by bufferDate desc");
+ } else {
+ %hash = WebGUI::SQL->buildHash("select wobjectId, title from wobject where pageId=2 "
+ ."and bufferUserId=". $session{user}{userId} ." order by bufferDate desc");
+ }
foreach $key (keys %hash) {
- $hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key};
+ $hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key};
}
$clipboardSelect = WebGUI::Form::selectList({
name=>"clipboardSelect",
@@ -71,7 +83,6 @@ sub process {
WebGUI::URL::page('op=listGroups')=>WebGUI::International::get(5),
WebGUI::URL::page('op=manageSettings')=>WebGUI::International::get(4),
WebGUI::URL::page('op=listUsers')=>WebGUI::International::get(7),
- WebGUI::URL::gateway('trash')=>WebGUI::International::get(10),
WebGUI::URL::page('op=listRoots')=>WebGUI::International::get(410),
WebGUI::URL::page('op=viewStatistics')=>WebGUI::International::get(144)
);
@@ -80,8 +91,10 @@ sub process {
%hash = (
'http://validator.w3.org/check?uri=http%3A%2F%2F'.$session{env}{SERVER_NAME}.
WebGUI::URL::page()=>WebGUI::International::get(399),
- WebGUI::URL::page('op=viewPageTree')=>WebGUI::International::get(447),
+ WebGUI::URL::page('op=manageClipboard')=>WebGUI::International::get(949),
WebGUI::URL::page('op=listCollateral')=>WebGUI::International::get(394),
+ WebGUI::URL::page('op=viewPageTree')=>WebGUI::International::get(447),
+ WebGUI::URL::page('op=manageTrash')=>WebGUI::International::get(10),
%hash
);
}
diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm
index 2849e2991..dcca2d810 100644
--- a/lib/WebGUI/Operation.pm
+++ b/lib/WebGUI/Operation.pm
@@ -13,6 +13,7 @@ package WebGUI::Operation;
use strict;
use WebGUI::Operation::Account;
use WebGUI::Operation::Admin;
+use WebGUI::Operation::Clipboard;
use WebGUI::Operation::Collateral;
use WebGUI::Operation::Group;
use WebGUI::Operation::Help;
diff --git a/lib/WebGUI/Operation/Clipboard.pm b/lib/WebGUI/Operation/Clipboard.pm
new file mode 100644
index 000000000..20087f975
--- /dev/null
+++ b/lib/WebGUI/Operation/Clipboard.pm
@@ -0,0 +1,335 @@
+package WebGUI::Operation::Clipboard;
+
+#-------------------------------------------------------------------
+# WebGUI is Copyright 2001-2003 Plain Black LLC.
+#-------------------------------------------------------------------
+# 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 Exporter;
+use strict;
+use WebGUI::DateTime;
+use WebGUI::Grouping;
+use WebGUI::HTMLForm;
+use WebGUI::Icon;
+use WebGUI::International;
+use WebGUI::Operation::Shared;
+use WebGUI::Page;
+use WebGUI::Privilege;
+use WebGUI::Session;
+use WebGUI::SQL;
+use WebGUI::TabForm;
+use WebGUI::URL;
+use WebGUI::Utility;
+
+our @ISA = qw(Exporter);
+our @EXPORT = qw(&www_deleteClipboardItem &www_deleteClipboardItemConfirm
+ &www_emptyClipboard &www_emptyClipboardConfirm &www_manageClipboard);
+
+#-------------------------------------------------------------------
+sub _submenu {
+ my (%menu);
+ tie %menu, 'Tie::IxHash';
+ $menu{WebGUI::URL::page('op=manageClipboard')} = WebGUI::International::get(949);
+ $menu{WebGUI::URL::page('op=emptyClipboard')} = WebGUI::International::get(950);
+ if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Privilege::isInGroup(3)) ) {
+ $menu{WebGUI::URL::page('op=manageClipboard&systemClipboard=1')} = WebGUI::International::get(954);
+ $menu{WebGUI::URL::page('op=emptyClipboard&systemClipboard=1')} = WebGUI::International::get(959);
+ }
+ return menuWrapper($_[0],\%menu);
+}
+
+
+#-------------------------------------------------------------------
+sub www_deleteClipboardItem {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($output);
+ if ($session{form}{wid} ne "") {
+ $output .= helpIcon(14);
+ } elsif ($session{form}{pageId} ne "") {
+ $output .= helpIcon(3);
+ }
+ $output .= ''.WebGUI::International::get(42).'
';
+ $output .= WebGUI::International::get(956).'';
+ if ($session{form}{wid} ne "") {
+ $output .= '
'.WebGUI::International::get(44).'';
+ } elsif ($session{form}{pageId} ne "") {
+ $output .= '
';
+ return $output;
+}
+
+#-------------------------------------------------------------------
+sub www_deleteClipboardItemConfirm {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ if ($session{form}{wid} ne "") {
+ if ( ($session{setting}{sharedClipboard} eq "1") || (WebGUI::Privilege::isInGroup(3)) ) {
+ WebGUI::SQL->write("update wobject set pageId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where pageId=2 "
+ ."and wobjectId=" . $session{form}{wid}
+ );
+ } else {
+ WebGUI::SQL->write("update wobject set pageId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where pageId=2 "
+ ."and wobjectId=" . $session{form}{wid} ." "
+ ."and bufferUserId=".$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::Privilege::isInGroup(3)) ) {
+ WebGUI::SQL->write("update page set parentId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where parentId=2 "
+ ."and pageId=".$session{form}{pageId}
+ );
+ } else {
+ WebGUI::SQL->write("update page set parentId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where parentId=2 "
+ ."and pageId=".$session{form}{pageId} ." "
+ ."and bufferUserId=".$session{user}{userId}
+ );
+ }
+ WebGUI::ErrorHandler::audit("moved page ". $session{form}{pageId} ." from clipboard to trash");
+ }
+ WebGUI::Session::refreshPageInfo($session{page}{pageId},'op=manageClipboard');
+ return "";
+}
+
+#-------------------------------------------------------------------
+sub www_emptyClipboard {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($output);
+ my $output = helpIcon(67);
+ $output .= '
'.WebGUI::International::get(42).'
';
+ $output .= WebGUI::International::get(951).'
';
+ if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Privilege::isInGroup(3)) ) {
+ $output .= '
'.WebGUI::International::get(44).'';
+ } else {
+ $output .= '
';
+ return $output;
+}
+
+#-------------------------------------------------------------------
+sub www_emptyClipboardConfirm {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($allUsers);
+ if ($session{setting}{sharedClipboard} eq "1") {
+ $allUsers = 1;
+ } elsif ($session{form}{systemClipboard} eq "1") {
+ return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
+ $allUsers = 1;
+ } else {
+ $allUsers = 0;
+ }
+ if ($allUsers eq "1") {
+ WebGUI::SQL->write("update page set parentId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where parentId=2 ");
+ WebGUI::SQL->write("update wobject set pageId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$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=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where parentId=2 "
+ ."and bufferUserId=".$session{user}{userId});
+ WebGUI::SQL->write("update wobject set pageId=3, "
+ ."bufferDate=".time().", "
+ ."bufferUserId=".$session{user}{userId} .", "
+ ."bufferPrevId=2 "
+ ."where pageId=2 "
+ ."and bufferUserId=".$session{user}{userId});
+ WebGUI::ErrorHandler::audit("emptied user clipboard to trash");
+ }
+ WebGUI::Session::refreshPageInfo($session{page}{pageId});
+ return "";
+}
+
+#-------------------------------------------------------------------
+sub www_manageClipboard {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($sth, @data, @row, $i, $p, $allUsers);
+ my $output = helpIcon(65);
+
+ if ($session{setting}{sharedClipboard} eq "1") {
+ $allUsers = 1;
+ $output .= '
'. WebGUI::International::get(948) .'
';
+ } elsif ($session{form}{systemClipboard} eq "1") {
+ return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
+ $allUsers = 1;
+ $output .= '
'. WebGUI::International::get(955) .'
';
+ } else {
+ $allUsers = 0;
+ $output .= '
'. WebGUI::International::get(948) .'
';
+ }
+
+
+
+ #
+ # Generate list of pages
+ #
+ if ($allUsers) {
+ $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
+ ."from page where parentId=2 order by bufferDate desc,bufferUserId");
+ } else {
+ $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
+ ."from page where parentId=2 and bufferUserId="
+ . $session{user}{userId} . " order by bufferDate desc");
+ }
+ while (@data = $sth->array) {
+ my ($pageId,$title,$urlizedTitle,$bufferUserId,$bufferDate,$bufferPrevId,$url);
+ $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=".$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=".$bufferPrevId);
+ if ($url ne "") {
+ $bufferPrevId = '
' .$bufferPrevId .'';
+ }
+ }
+ $row[$i] = '
';
+ $row[$i] .= '| '
+ .pageIcon()
+ .deleteIcon('op=deleteClipboardItem&pageId='.$pageId)
+ .pasteIcon('op=pastePage&pageId='.$pageId);
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$title;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.WebGUI::International::get(2);
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferDate;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferPrevId;
+ $row[$i] .= ' | ';
+ if ($allUsers) {
+ $row[$i] .= ''.$bufferUserId;
+ $row[$i] .= ' | ';
+ }
+ $row[$i] .= '
';
+ $i++;
+ }
+
+ #
+ # Generate list of wobjects
+ #
+ if ($allUsers) {
+ $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
+ . "from wobject where pageId=2 order by bufferDate desc,bufferUserId");
+ } else {
+ $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
+ . "from wobject where pageId=2 and bufferUserId="
+ . $session{user}{userId} ." order by bufferDate desc");
+ }
+ while (@data = $sth->array) {
+ my ($wobjectId,$namespace,$title,$bufferUserId,$bufferDate,$bufferPrevId,$url);
+
+ $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=".$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=".$bufferUserId);
+ $bufferUserId = '
'
+ .$bufferUsername .'';
+ }
+
+ $row[$i] = '
';
+ $row[$i] .= '| '
+ .wobjectIcon()
+ .deleteIcon('op=deleteClipboardItem&wid='.$wobjectId)
+ .pasteIcon('func=paste&wid='.$wobjectId);
+ $row[$i] .= ' | '.$title;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$namespace;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferDate;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferPrevId;
+ $row[$i] .= ' | ';
+ if ($allUsers) {
+ $row[$i] .= ''.$bufferUserId;
+ $row[$i] .= ' | ';
+ }
+ $row[$i] .= '
';
+ $i++;
+ }
+ $sth->finish;
+ if ($session{form}{systemClipboard} eq "1") {
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard&systemClipboard=1'),\@row);
+ } else {
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard'),\@row);
+ }
+ $output .= '
';
+ $output .= ' | '
+ .''. WebGUI::International::get(99) .' | '
+ .''. WebGUI::International::get(783) .' | '
+ .''. WebGUI::International::get(952) .' | '
+ .''. WebGUI::International::get(953) .' | ';
+ if ($allUsers) {
+ $output .= ''. WebGUI::International::get(50) .' | '
+ .'
';
+ } else {
+ $output .= '';
+ }
+ $output .= $p->getPage($session{form}{pn});
+ $output .= '
';
+ $output .= $p->getBarTraditional($session{form}{pn});
+ return _submenu($output);
+}
+
+1;
diff --git a/lib/WebGUI/Operation/Page.pm b/lib/WebGUI/Operation/Page.pm
index fecc243ca..6f7df858b 100644
--- a/lib/WebGUI/Operation/Page.pm
+++ b/lib/WebGUI/Operation/Page.pm
@@ -173,7 +173,11 @@ sub www_cutPage {
if ($session{page}{pageId} < 26) {
return WebGUI::Privilege::vitalComponent();
} elsif (WebGUI::Privilege::canEditPage()) {
- WebGUI::SQL->write("update page set parentId=2 where pageId=".$session{page}{pageId});
+ WebGUI::SQL->write("update page set parentId=2, "
+ ."bufferUserId=".$session{user}{userId}.", "
+ ."bufferDate=".time().", "
+ ."bufferPrevId=".$session{page}{parentId}." "
+ ."where pageId=".$session{page}{pageId});
_reorderPages($session{page}{parentId});
WebGUI::Session::refreshPageInfo($session{page}{parentId});
return "";
@@ -206,7 +210,11 @@ sub www_deletePageConfirm {
if ($session{page}{pageId} < 1000 && $session{page}{pageId} > 0) {
return WebGUI::Privilege::vitalComponent();
} elsif (WebGUI::Privilege::canEditPage()) {
- WebGUI::SQL->write("update page set parentId=3 where pageId=".$session{page}{pageId});
+ WebGUI::SQL->write("update page set parentId=3, "
+ ."bufferUserId=".$session{user}{userId}.", "
+ ."bufferDate=".time().", "
+ ."bufferPrevId=".$session{page}{parentId}." "
+ ."where pageId=".$session{page}{pageId});
_reorderPages($session{page}{parentId});
WebGUI::Session::refreshPageInfo($session{page}{parentId});
return "";
@@ -547,7 +555,9 @@ sub www_pastePage {
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from page where parentId=$session{page}{pageId}");
$nextSeq += 1;
if (WebGUI::Privilege::canEditPage()) {
- WebGUI::SQL->write("update page set parentId=$session{page}{pageId}, sequenceNumber='$nextSeq' where pageId=$session{form}{pageId}");
+ WebGUI::SQL->write("update page set parentId=$session{page}{pageId}, sequenceNumber='$nextSeq', "
+ ."bufferUserId=NULL, bufferDate=NULL, bufferPrevId=NULL "
+ ."where pageId=$session{form}{pageId}");
_reorderPages($session{page}{pageId});
return "";
} else {
diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm
index 31b373c19..985500d5a 100644
--- a/lib/WebGUI/Operation/Settings.pm
+++ b/lib/WebGUI/Operation/Settings.pm
@@ -153,6 +153,8 @@ sub www_editMiscSettings {
$output .= '
'.WebGUI::International::get(140).'
';
$f = WebGUI::HTMLForm->new;
$f->hidden("op","saveSettings");
+ $f->yesNo("sharedClipboard",WebGUI::International::get(947),$session{setting}{sharedClipboard});
+ $f->yesNo("sharedTrash",WebGUI::International::get(946),$session{setting}{sharedTrash});
$f->yesNo("preventProxyCache",WebGUI::International::get(400),$session{setting}{preventProxyCache});
$f->yesNo("showDebug",WebGUI::International::get(707),$session{setting}{showDebug});
$f->yesNo("trackPageStatistics",WebGUI::International::get(749),$session{setting}{trackPageStatistics});
diff --git a/lib/WebGUI/Operation/Trash.pm b/lib/WebGUI/Operation/Trash.pm
index 27778159f..9b03f984e 100644
--- a/lib/WebGUI/Operation/Trash.pm
+++ b/lib/WebGUI/Operation/Trash.pm
@@ -13,14 +13,68 @@ package WebGUI::Operation::Trash;
use Exporter;
use strict qw(vars subs);
use Tie::CPHash;
+use WebGUI::DateTime;
use WebGUI::Icon;
+use WebGUI::Operation::Shared;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
-our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm);
+our @EXPORT = qw(&www_cutTrashItem &www_deleteTrashItem &www_deleteTrashItemConfirm
+ &www_emptyTrash &www_emptyTrashConfirm &www_manageTrash);
+
+#-------------------------------------------------------------------
+sub _purgePage {
+}
+
+#-------------------------------------------------------------------
+sub _purgeUserTrash {
+ my (%properties, $base, $extended, $b, $wobjectId, $namespace, $w, $cmd, $userId, $bufferId, $a, $pageId);
+ 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=" . $userId);
+ while ($base = $b->hashRef) {
+ $extended = WebGUI::SQL->quickHashRef("select * from ".$base->{namespace}."
+ where wobjectId=".$base->{wobjectId});
+ %properties = (%{$base}, %{$extended});
+ $cmd = "WebGUI::Wobject::".$properties{namespace};
+ $w = $cmd->new(\%properties);
+ $w->purge;
+ }
+ $b->finish;
+
+ # Delete pages and all subpages
+ $a = WebGUI::SQL->read("select pageId from page where parentId=3 and bufferUserId=" . $userId);
+ while (($pageId) = $a->array) {
+ _recursePageTree($pageId);
+ _purgeWobjects($pageId);
+ WebGUI::SQL->write("delete from page where pageId=$pageId");
+ }
+ $a->finish;
+}
+
+#-------------------------------------------------------------------
+sub _purgeWobject {
+ my (%properties, $base, $extended, $b, $wobjectId, $namespace, $w, $cmd);
+ tie %properties, 'Tie::CPHash';
+ $b = WebGUI::SQL->read("select * from wobject where wobjectId=$_[0]");
+ while ($base = $b->hashRef) {
+ $extended = WebGUI::SQL->quickHashRef("select * from ".$base->{namespace}."
+ where wobjectId=".$base->{wobjectId});
+ %properties = (%{$base}, %{$extended});
+ $cmd = "WebGUI::Wobject::".$properties{namespace};
+ $w = $cmd->new(\%properties);
+ $w->purge;
+ }
+ $b->finish;
+}
#-------------------------------------------------------------------
sub _purgeWobjects {
@@ -51,31 +105,303 @@ sub _recursePageTree {
}
#-------------------------------------------------------------------
-sub www_purgeTrash {
- my ($output);
- if (WebGUI::Privilege::isInGroup(3)) {
- $output = helpIcon(46);
- $output .= '
'.WebGUI::International::get(42).'
';
- $output .= WebGUI::International::get(162).'
';
- $output .= '
';
- return $output;
- } else {
- return WebGUI::Privilege::adminOnly();
- }
+sub _submenu {
+ my (%menu);
+ tie %menu, 'Tie::IxHash';
+ $menu{WebGUI::URL::page('op=manageTrash')} = WebGUI::International::get(10);
+ $menu{WebGUI::URL::page('op=emptyTrash')} = WebGUI::International::get(11);
+ if ( ($session{setting}{sharedTrash} ne "1") && (WebGUI::Privilege::isInGroup(3)) ) {
+ $menu{WebGUI::URL::page('op=manageTrash&systemTrash=1')} = WebGUI::International::get(964);
+ $menu{WebGUI::URL::page('op=emptyTrash&systemTrash=1')} = WebGUI::International::get(967);
+ }
+ return menuWrapper($_[0],\%menu);
+}
+
+
+#-------------------------------------------------------------------
+sub www_cutTrashItem {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ if ($session{form}{wid} ne "") {
+ if ( ($session{setting}{sharedTrash} ne "1") && (!(WebGUI::Privilege::isInGroup(3)) ) ) {
+ my ($bufferUserId) = WebGUI::SQL->quickArray("select bufferUserId from wobject "
+ ."where wobjectId=" .$session{form}{wid});
+ return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
+ }
+ WebGUI::SQL->write("update wobject set pageId=2, "
+ ."bufferUserId=". $session{user}{userId} .", "
+ ."bufferDate=". time() .", "
+ ."bufferPrevId=3 "
+ ."where wobjectId=" .$session{form}{wid});
+ WebGUI::ErrorHandler::audit("moved wobject ". $session{form}{wid} ." from trash to clipboard");
+ } elsif ($session{form}{pageId} ne "") {
+ if ( ($session{setting}{sharedTrash} ne "1") && (!(WebGUI::Privilege::isInGroup(3)) ) ) {
+ my ($bufferUserId) = WebGUI::SQL->quickArray("select bufferUserId from page "
+ ."where pageId=" .$session{form}{pageId});
+ return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
+ }
+ WebGUI::SQL->write("update page set parentId=2, "
+ ."bufferUserId=". $session{user}{userId} .", "
+ ."bufferDate=". time() .", "
+ ."bufferPrevId=3 "
+ ."where pageId=" .$session{form}{pageId});
+ WebGUI::ErrorHandler::audit("moved page ". $session{form}{pageId} ." from trash to clipboard");
+ }
+ WebGUI::Session::refreshPageInfo($session{page}{pageId});
+ return "";
}
#-------------------------------------------------------------------
-sub www_purgeTrashConfirm {
- if (WebGUI::Privilege::isInGroup(3)) {
+sub www_deleteTrashItem {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($output);
+ if ($session{form}{wid} ne "") {
+ $output .= helpIcon(14);
+ } elsif ($session{form}{pageId} ne "") {
+ $output .= helpIcon(3);
+ }
+ $output .= '
'.WebGUI::International::get(42).'
';
+ $output .= WebGUI::International::get(966).'
';
+ if ($session{form}{wid} ne "") {
+ $output .= '
'.WebGUI::International::get(44).'';
+ } elsif ($session{form}{pageId} ne "") {
+ $output .= '
';
+ return $output;
+}
+
+#-------------------------------------------------------------------
+sub www_deleteTrashItemConfirm {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ if ($session{form}{wid} ne "") {
+ if ( ($session{setting}{sharedTrash} eq "1") || (WebGUI::Privilege::isInGroup(3)) ) {
+ _purgeWobject($session{form}{wid});
+ } else {
+ my ($bufferUserId) = WebGUI::SQL->quickArray("select bufferUserId from wobject "
+ ."where wobjectId=" .$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 "") {
+ if ( ($session{setting}{sharedTrash} eq "1") || (WebGUI::Privilege::isInGroup(3)) ) {
+ _recursePageTree($session{form}{pageId});
+ _purgeWobjects($session{form}{pageId});
+ WebGUI::SQL->write("delete from page where pageId=" .$session{form}{pageId});
+ } else {
+ my ($bufferUserId) = WebGUI::SQL->quickArray("select bufferUserId from page "
+ ."where pageId=" .$session{form}{pageId});
+ return WebGUI::Privilege::insufficient() unless ($bufferUserId eq $session{user}{userId});
+ _recursePageTree($session{form}{pageId});
+ _purgeWobjects($session{form}{pageId});
+ WebGUI::SQL->write("delete from page where pageId=" .$session{form}{pageId});
+ }
+ 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::Privilege::isInGroup(4));
+ my ($output);
+ $output = helpIcon(46);
+ $output .= '
'.WebGUI::International::get(42).'
';
+ $output .= WebGUI::International::get(162).'
';
+ $output .= WebGUI::International::get(651).'
';
+ if ($session{form}{systemTrash} eq "1") {
+ $output .= '
'.WebGUI::International::get(44).'';
+ } else {
+ $output .= '
';
+ return $output;
+}
+
+#-------------------------------------------------------------------
+sub www_emptyTrashConfirm {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($allUsers);
+ if ($session{setting}{sharedTrash} eq "1") {
+ $allUsers = 1;
+ } elsif ($session{form}{systemTrash} eq "1") {
+ return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
+ $allUsers = 1;
+ } else {
+ $allUsers = 0;
+ }
+ if ($allUsers eq "1") {
_recursePageTree(3);
_purgeWobjects(3);
- return "";
+ WebGUI::ErrorHandler::audit("emptied system trash");
} else {
- return WebGUI::Privilege::adminOnly();
+ _purgeUserTrash();
+ WebGUI::ErrorHandler::audit("emptied user trash");
}
+ WebGUI::Session::refreshPageInfo($session{page}{pageId});
+ return "";
+}
+
+#-------------------------------------------------------------------
+sub www_manageTrash {
+ return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(4));
+ my ($sth, @data, @row, $i, $p, $allUsers);
+ my $output = helpIcon(66);
+
+ if ($session{setting}{sharedTrash} eq "1") {
+ $allUsers = 1;
+ $output .= '
'. WebGUI::International::get(962) .'
';
+ } elsif ($session{form}{systemTrash} eq "1") {
+ return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
+ $allUsers = 1;
+ $output .= '
'. WebGUI::International::get(965) .'
';
+ } else {
+ $allUsers = 0;
+ $output .= '
'. WebGUI::International::get(962) .'
';
+ }
+
+
+
+ #
+ # Generate list of pages
+ #
+ if ($allUsers) {
+ $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
+ ."from page where parentId=3 order by bufferDate desc,bufferUserId");
+ } else {
+ $sth = WebGUI::SQL->read("select pageId,title,urlizedTitle,bufferUserId,bufferDate,bufferPrevId "
+ ."from page where parentId=3 and bufferUserId="
+ . $session{user}{userId} . " order by bufferDate desc");
+ }
+ while (@data = $sth->array) {
+ my ($pageId,$title,$urlizedTitle,$bufferUserId,$bufferDate,$bufferPrevId,$url);
+ $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=".$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=".$bufferPrevId);
+ if ($url ne "") {
+ $bufferPrevId = '
' .$bufferPrevId .'';
+ }
+ }
+ $row[$i] = '
';
+ $row[$i] .= '| '
+ .pageIcon()
+ .deleteIcon('op=deleteTrashItem&pageId='.$pageId)
+ .cutIcon('op=cutTrashItem&pageId='.$pageId);
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$title;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.WebGUI::International::get(2);
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferDate;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferPrevId;
+ $row[$i] .= ' | ';
+ if ($allUsers) {
+ $row[$i] .= ''.$bufferUserId;
+ $row[$i] .= ' | ';
+ }
+ $row[$i] .= '
';
+ $i++;
+ }
+
+ #
+ # Generate list of wobjects
+ #
+ if ($allUsers) {
+ $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
+ . "from wobject where pageId=3 order by bufferDate desc,bufferUserId");
+ } else {
+ $sth = WebGUI::SQL->read("select wobjectId,namespace,title,bufferUserId,bufferDate,bufferPrevId "
+ . "from wobject where pageId=3 and bufferUserId="
+ . $session{user}{userId} ." order by bufferDate desc");
+ }
+ while (@data = $sth->array) {
+ my ($wobjectId,$namespace,$title,$bufferUserId,$bufferDate,$bufferPrevId,$url);
+
+ $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=".$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=".$bufferUserId);
+ $bufferUserId = '
'
+ .$bufferUsername .'';
+ }
+
+ $row[$i] = '
';
+ $row[$i] .= '| '
+ .wobjectIcon()
+ .deleteIcon('op=deleteTrashItem&wid='.$wobjectId)
+ .cutIcon('op=cutTrashItem&wid='.$wobjectId);
+ $row[$i] .= ' | '.$title;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$namespace;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferDate;
+ $row[$i] .= ' | ';
+ $row[$i] .= ''.$bufferPrevId;
+ $row[$i] .= ' | ';
+ if ($allUsers) {
+ $row[$i] .= ''.$bufferUserId;
+ $row[$i] .= ' | ';
+ }
+ $row[$i] .= '
';
+ $i++;
+ }
+ $sth->finish;
+ if ($session{form}{systemTrash} eq "1") {
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash&systemTrash=1'),\@row);
+ } else {
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash'),\@row);
+ }
+ $output .= '
';
+ $output .= ' | '
+ .''. WebGUI::International::get(99) .' | '
+ .''. WebGUI::International::get(783) .' | '
+ .''. WebGUI::International::get(963) .' | '
+ .''. WebGUI::International::get(953) .' | ';
+ if ($allUsers) {
+ $output .= ''. WebGUI::International::get(50) .' | '
+ .'
';
+ } else {
+ $output .= '';
+ }
+ $output .= $p->getPage($session{form}{pn});
+ $output .= '
';
+ $output .= $p->getBarTraditional($session{form}{pn});
+ return _submenu($output);
}
1;
diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm
index 4d7de7e19..579fd8aa8 100644
--- a/lib/WebGUI/Wobject.pm
+++ b/lib/WebGUI/Wobject.pm
@@ -260,11 +260,16 @@ If specified the wobject will be duplicated to this pageId, otherwise it will be
sub duplicate {
my %properties = %{$_[0]->get};
$properties{pageId} = $_[1] || 2;
+ if ($properties{pageId} == 2) {
+ $properties{bufferUserId} = $session{user}{userId};
+ $properties{bufferDate} = time();
+ $properties{bufferPrevId} = {};
+ }
delete $properties{wobjectId};
my $cmd = "WebGUI::Wobject::".$properties{namespace};
my $w = eval{$cmd->new({namespace=>$properties{namespace},wobjectId=>"new"})};
if ($@) {
- WebGUI::ErrorHandler::warn("Could duplicate wobject ".$properties{namespace}." because: ".$@);
+ WebGUI::ErrorHandler::warn("Couldn't duplicate wobject ".$properties{namespace}." because: ".$@);
}
$w->set(\%properties);
WebGUI::Discussion::duplicate($_[0]->get("wobjectId"),$w->get("wobjectId")) unless ($_[2]);
@@ -649,6 +654,15 @@ sub new {
userDefined5=>{
fieldType=>"text"
},
+ bufferUserId=>{
+ fieldType=>"integer"
+ },
+ bufferDate=>{
+ fieldType=>"integer"
+ },
+ bufferPrevId=>{
+ fieldType=>"integer"
+ },
allowDiscussion=>{
fieldType=>"yesNo",
defaultValue=>0
@@ -1067,7 +1081,10 @@ Moves this instance to the clipboard.
sub www_cut {
if (WebGUI::Privilege::canEditPage()) {
- $_[0]->set({pageId=>2, templatePosition=>1});
+ $_[0]->set({pageId=>2, templatePosition=>1,
+ bufferUserId=>$session{user}{userId},
+ bufferDate=>time(),
+ bufferPrevId=>$session{page}{pageId}});
_reorderWobjects($session{page}{pageId});
return "";
} else {
@@ -1113,7 +1130,10 @@ Moves this instance to the trash.
sub www_deleteConfirm {
if (WebGUI::Privilege::canEditPage()) {
- $_[0]->set({pageId=>3, templatePosition=>1});
+ $_[0]->set({pageId=>3, templatePosition=>1,
+ bufferUserId=>$session{user}{userId},
+ bufferDate=>time(),
+ bufferPrevId=>$session{page}{pageId}});
WebGUI::ErrorHandler::audit("moved Wobject ".$_[0]->{_property}{wobjectId}." to the trash.");
_reorderWobjects($_[0]->get("pageId"));
return "";
@@ -1481,7 +1501,12 @@ sub www_paste {
if (WebGUI::Privilege::canEditPage()) {
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from wobject where pageId=$session{page}{pageId}");
$nextSeq += 1;
- $_[0]->set({sequenceNumber=>$nextSeq, pageId=>$session{page}{pageId}, templatePosition=>1});
+ WebGUI::SQL->write("UPDATE wobject SET "
+ ."pageId=". $session{page}{pageId} .", "
+ ."templatePosition=1, "
+ ."sequenceNumber=". $nextSeq .", "
+ ."bufferUserId=NULL, bufferDate=NULL, bufferPrevId=NULL "
+ ."WHERE wobjectId=". $session{form}{wid} );
return "";
} else {
return WebGUI::Privilege::insufficient();