allow clipboard items to have duplicate bufferDate
This commit is contained in:
parent
7fcd9df789
commit
b5cc0d37a4
1 changed files with 30 additions and 26 deletions
|
|
@ -23,10 +23,9 @@ use WebGUI::Utility;
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
return "" unless ($session{var}{adminOn});
|
return "" unless ($session{var}{adminOn});
|
||||||
my (%hash2, $miscSelect, $adminSelect, $clipboardSelect, %hash, $output, $contentSelect, $key, $a, %HoL, $query);
|
my (%hash2, $miscSelect, $adminSelect, $clipboardSelect, %hash, $output, $contentSelect, $r, $i, @item, $query);
|
||||||
tie %hash, "Tie::IxHash";
|
tie %hash, "Tie::IxHash";
|
||||||
tie %hash2, "Tie::IxHash";
|
tie %hash2, "Tie::IxHash";
|
||||||
tie %HoL, "Tie::IxHash";
|
|
||||||
#--content adder
|
#--content adder
|
||||||
$hash{WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId})} = WebGUI::International::get(2);
|
$hash{WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId})} = WebGUI::International::get(2);
|
||||||
if ($session{user}{uiLevel} >= 7) {
|
if ($session{user}{uiLevel} >= 7) {
|
||||||
|
|
@ -53,23 +52,7 @@ sub process {
|
||||||
%hash2 = ();
|
%hash2 = ();
|
||||||
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
|
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
|
||||||
|
|
||||||
# get wobjects and store in hash of arrays in order to integrate with pages and sort by buffer date
|
# get pages and store in array of arrays in order to integrate with wobjects and sort by buffer date
|
||||||
if ($session{setting}{sharedClipboard} eq "1") {
|
|
||||||
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId=2 "
|
|
||||||
." order by bufferDate";
|
|
||||||
} else {
|
|
||||||
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId=2 "
|
|
||||||
." and bufferUserId=$session{user}{userId} "
|
|
||||||
." order by bufferDate";
|
|
||||||
}
|
|
||||||
$a = WebGUI::SQL->read($query);
|
|
||||||
while (%hash = $a->hash) {
|
|
||||||
$HoL{ $hash{bufferDate} } = [ WebGUI::URL::page('func=paste&wid='.$hash{wobjectId}) ,
|
|
||||||
$hash{title} . ' ('. $hash{namespace} .')' ];
|
|
||||||
}
|
|
||||||
$a->finish;
|
|
||||||
|
|
||||||
# get pages and store in hash of arrays in order to integrate with wobjects and sort by buffer date
|
|
||||||
if ($session{setting}{sharedClipboard} eq "1") {
|
if ($session{setting}{sharedClipboard} eq "1") {
|
||||||
$query = "select bufferDate,pageId,title from page where parentId=2 order by bufferDate";
|
$query = "select bufferDate,pageId,title from page where parentId=2 order by bufferDate";
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -77,17 +60,38 @@ sub process {
|
||||||
." and bufferUserId=$session{user}{userId} "
|
." and bufferUserId=$session{user}{userId} "
|
||||||
." order by bufferDate";
|
." order by bufferDate";
|
||||||
}
|
}
|
||||||
$a = WebGUI::SQL->read($query);
|
$r = WebGUI::SQL->read($query);
|
||||||
while (%hash = $a->hash) {
|
while (%hash = $r->hash) {
|
||||||
$HoL{ $hash{bufferDate} } = [ WebGUI::URL::page('op=pastePage&pageId='.$hash{pageId}) ,
|
push @item, [ $hash{bufferDate},
|
||||||
$hash{title} ." (". WebGUI::International::get(2) .")" ];
|
WebGUI::URL::page('func=paste&wid='.$hash{wobjectId}),
|
||||||
|
$hash{title} . ' ('. WebGUI::International::get(2) .')' ];
|
||||||
}
|
}
|
||||||
$a->finish;
|
$r->finish;
|
||||||
|
|
||||||
|
# get wobjects and store in array of arrays in order to integrate with pages and sort by buffer date
|
||||||
|
if ($session{setting}{sharedClipboard} eq "1") {
|
||||||
|
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId=2 "
|
||||||
|
." order by bufferDate";
|
||||||
|
} else {
|
||||||
|
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId=2 "
|
||||||
|
." and bufferUserId=$session{user}{userId} "
|
||||||
|
." order by bufferDate";
|
||||||
|
}
|
||||||
|
$r = WebGUI::SQL->read($query);
|
||||||
|
while (%hash = $r->hash) {
|
||||||
|
push @item, [ $hash{bufferDate},
|
||||||
|
WebGUI::URL::page('func=paste&wid='.$hash{wobjectId}),
|
||||||
|
$hash{title} . ' ('. $hash{namespace} .')' ];
|
||||||
|
}
|
||||||
|
$r->finish;
|
||||||
|
|
||||||
# Reverse sort by bufferDate and and create hash from list values
|
# Reverse sort by bufferDate and and create hash from list values
|
||||||
foreach $key (reverse sort keys %HoL) {
|
my @sorted_item = sort {$b->[0] <=> $a->[0]} @item;
|
||||||
$hash2{$HoL{$key}[0]} = $HoL{$key}[1];
|
@item = ();
|
||||||
|
for $i ( 0 .. $#sorted_item ) {
|
||||||
|
$hash2{ $sorted_item[$i][1] } = $sorted_item[$i][2];
|
||||||
}
|
}
|
||||||
|
@sorted_item = ();
|
||||||
|
|
||||||
$clipboardSelect = WebGUI::Form::selectList({
|
$clipboardSelect = WebGUI::Form::selectList({
|
||||||
name=>"clipboardSelect",
|
name=>"clipboardSelect",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue