clipboard sort order fix
This commit is contained in:
parent
558a7b53de
commit
7fcd9df789
1 changed files with 32 additions and 14 deletions
|
|
@ -23,9 +23,10 @@ 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);
|
my (%hash2, $miscSelect, $adminSelect, $clipboardSelect, %hash, $output, $contentSelect, $key, $a, %HoL, $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) {
|
||||||
|
|
@ -51,26 +52,43 @@ sub process {
|
||||||
#--clipboard paster
|
#--clipboard paster
|
||||||
%hash2 = ();
|
%hash2 = ();
|
||||||
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
|
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
|
||||||
# pages
|
|
||||||
|
# get wobjects and store in hash of arrays in order to integrate with pages and sort by buffer date
|
||||||
if ($session{setting}{sharedClipboard} eq "1") {
|
if ($session{setting}{sharedClipboard} eq "1") {
|
||||||
%hash = WebGUI::SQL->buildHash("select pageId, title from page where parentId=2 order by bufferDate desc");
|
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId=2 "
|
||||||
|
." order by bufferDate";
|
||||||
} else {
|
} else {
|
||||||
%hash = WebGUI::SQL->buildHash("select pageId, title from page where parentId=2 "
|
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId=2 "
|
||||||
."and bufferUserId=". $session{user}{userId}. " order by bufferDate desc");
|
." and bufferUserId=$session{user}{userId} "
|
||||||
|
." order by bufferDate";
|
||||||
}
|
}
|
||||||
foreach $key (keys %hash) {
|
$a = WebGUI::SQL->read($query);
|
||||||
$hash2{WebGUI::URL::page('op=pastePage&pageId='.$key)} = $hash{$key};
|
while (%hash = $a->hash) {
|
||||||
|
$HoL{ $hash{bufferDate} } = [ WebGUI::URL::page('func=paste&wid='.$hash{wobjectId}) ,
|
||||||
|
$hash{title} . ' ('. $hash{namespace} .')' ];
|
||||||
}
|
}
|
||||||
# wobjects
|
$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") {
|
||||||
%hash = WebGUI::SQL->buildHash("select wobjectId, title from wobject where pageId=2 order by bufferDate desc");
|
$query = "select bufferDate,pageId,title from page where parentId=2 order by bufferDate";
|
||||||
} else {
|
} else {
|
||||||
%hash = WebGUI::SQL->buildHash("select wobjectId, title from wobject where pageId=2 "
|
$query = "select bufferDate,pageId,title from page where parentId=2 "
|
||||||
."and bufferUserId=". $session{user}{userId} ." order by bufferDate desc");
|
." and bufferUserId=$session{user}{userId} "
|
||||||
|
." order by bufferDate";
|
||||||
}
|
}
|
||||||
foreach $key (keys %hash) {
|
$a = WebGUI::SQL->read($query);
|
||||||
$hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key};
|
while (%hash = $a->hash) {
|
||||||
}
|
$HoL{ $hash{bufferDate} } = [ WebGUI::URL::page('op=pastePage&pageId='.$hash{pageId}) ,
|
||||||
|
$hash{title} ." (". WebGUI::International::get(2) .")" ];
|
||||||
|
}
|
||||||
|
$a->finish;
|
||||||
|
|
||||||
|
# Reverse sort by bufferDate and and create hash from list values
|
||||||
|
foreach $key (reverse sort keys %HoL) {
|
||||||
|
$hash2{$HoL{$key}[0]} = $HoL{$key}[1];
|
||||||
|
}
|
||||||
|
|
||||||
$clipboardSelect = WebGUI::Form::selectList({
|
$clipboardSelect = WebGUI::Form::selectList({
|
||||||
name=>"clipboardSelect",
|
name=>"clipboardSelect",
|
||||||
options=>\%hash2,
|
options=>\%hash2,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue