From 679a5bc92beaba13565b5b61382ad985a9bd01f8 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 25 Nov 2002 22:11:17 +0000 Subject: [PATCH] Templatized Download manager --- docs/upgrades/upgrade_4.8.0-4.9.0.sql | 11 +- lib/WebGUI/Attachment.pm | 15 +- lib/WebGUI/Operation/Collateral.pm | 1 - lib/WebGUI/Search.pm | 158 +++++++++++--------- lib/WebGUI/Session.pm | 4 +- lib/WebGUI/Wobject/FileManager.pm | 203 +++++++++++++------------- 6 files changed, 211 insertions(+), 181 deletions(-) diff --git a/docs/upgrades/upgrade_4.8.0-4.9.0.sql b/docs/upgrades/upgrade_4.8.0-4.9.0.sql index 61097e638..35aca1b7b 100644 --- a/docs/upgrades/upgrade_4.8.0-4.9.0.sql +++ b/docs/upgrades/upgrade_4.8.0-4.9.0.sql @@ -921,8 +921,15 @@ INSERT INTO language VALUES (9,' INSERT INTO language VALUES (10,'Dansk (Danish)','ISO-8859-1','default'); INSERT INTO language VALUES (11,'Arabic','ISO-8859-6','default'); INSERT INTO style VALUES (-8,'WebGUI 5','','^AdminBar;\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
^C;User: ^a(^@;);
\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n
\r\n
\r\n ^H;\r\n
\r\n ^FlexMenu;\r\n ^a;\r\n
\r\n
\r\n
\r\n
\r\n
^-;
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n
\r\n\r\n\r\n'); - - +alter table userSessionScratch change name name varchar(255); +delete from international where namespace='FileManager' and internationalId=21; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (74,1,'FileManager','Add a new file.', 1038262375); +delete from international where namespace='FileManager' and internationalId=22; +alter table FileManager add column templateId int not null default 1; +update FileManager set templateId=2 where displayThumbnails=1; +alter table FileManager drop column displayThumbnails; +INSERT INTO template VALUES (1,'Default File Manager','\r\n

\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n \r\n\r\n\r\n
\r\n \">\r\n \r\n · \">\r\n \r\n
\">\">\">
\r\n \r\n \r\n \r\n \">\r\n  · \r\n \">\" border=\"0\" width=\"16\" height=\"16\" align=\"middle\" />/\r\n \r\n  · \r\n \">\" border=0 width=\"16\" height=\"16\" align=\"middle\" />/\r\n \r\n \r\n  · \r\n \">\" border=\"0\" width=\"16\" height=\"16\" align=\"middle\" />/\r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n\r\n

\r\n · · \r\n
\r\n
','FileManager'); +INSERT INTO template VALUES (2,'List with Thumbnails','\r\n

\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n \r\n\r\n\r\n
\r\n \">\r\n \r\n · \">\r\n \r\n
\">\">\">
\r\n \r\n \r\n \r\n \">\r\n  · \r\n \">\" border=\"0\" width=\"16\" height=\"16\" align=\"middle\" />/\r\n \r\n  · \r\n \">\" border=0 width=\"16\" height=\"16\" align=\"middle\" />/\r\n \r\n \r\n  · \r\n \">\" border=\"0\" width=\"16\" height=\"16\" align=\"middle\" />/\r\n \r\n \r\n \r\n \" border=0 align=\"middle\" hspace=\"3\">\r\n \r\n \r\n \r\n \r\n
\r\n\r\n\r\n

\r\n · · \r\n
\r\n
','FileManager'); diff --git a/lib/WebGUI/Attachment.pm b/lib/WebGUI/Attachment.pm index 81183106c..a878b86b7 100644 --- a/lib/WebGUI/Attachment.pm +++ b/lib/WebGUI/Attachment.pm @@ -48,6 +48,7 @@ use WebGUI::Utility; $url = $attachment->getThumbnail; $string = $attachment->getType; $url = $attachment->getURL; + $boolean = $attachment->isImage; $attachment->copy("files","10"); $attachment->delete; $attachment->deleteNode; @@ -68,7 +69,7 @@ use WebGUI::Utility; #------------------------------------------------------------------- sub _createThumbnail { my ($image, $error, $x, $y, $r, $n); - if ($hasImageMagick && isIn($_[0]->getType, qw(jpg jpeg gif png tif tiff bmp))) { + if ($hasImageMagick && $_[0]->isImage) { $image = Image::Magick->new; $error = $image->Read($_[0]->getPath); WebGUI::ErrorHandler::warn("Couldn't read image for thumnail creation: ".$error) if $error; @@ -390,6 +391,18 @@ sub getURL { } +#------------------------------------------------------------------- + +=head2 isImage ( ) + + Returns a 1 or 0 depending on whether the file is an image or not. + +=cut + +sub isImage { + return isIn($_[0]->getType, qw(gif jpeg jpg tif tiff png bmp)),; +} + #------------------------------------------------------------------- =head2 new ( filename, node [, nodeSubordinate ] ) diff --git a/lib/WebGUI/Operation/Collateral.pm b/lib/WebGUI/Operation/Collateral.pm index 336215e16..3d6a000db 100644 --- a/lib/WebGUI/Operation/Collateral.pm +++ b/lib/WebGUI/Operation/Collateral.pm @@ -385,7 +385,6 @@ sub www_listCollateral { '-delete-'=>WebGUI::International::get(782), %{WebGUI::SQL->buildHashRef("select distinct(userId), username from collateral order by username")} ); - $session{form}{keyword} = '-delete-' if (exists $session{form}{keyword} && $session{form}{keyword} eq ""); WebGUI::Session::setScratch("keyword",$session{form}{keyword}); WebGUI::Session::setScratch("collateralUser",$session{form}{collateralUser}); WebGUI::Session::setScratch("collateralType",$session{form}{collateralType}); diff --git a/lib/WebGUI/Search.pm b/lib/WebGUI/Search.pm index 19f7b2e2f..77eff470a 100644 --- a/lib/WebGUI/Search.pm +++ b/lib/WebGUI/Search.pm @@ -30,8 +30,8 @@ use WebGUI::SQL; =head1 SYNOPSIS use WebGUI::Search; + $sql = WebGUI::Search::buildConstraints(\@fields); $html = WebGUI::Search::form(\%hidden); - $sql = WebGUI::buildConstraints(\@fields); =head1 DESCRIPTION @@ -45,62 +45,6 @@ use WebGUI::SQL; =cut -#------------------------------------------------------------------- - -=head2 form ( hiddenFields ) { [ numResults ] } - - Generates and returns the advanced search form. - -=item hiddenFields - - A hash reference that contains any name/value pairs that should be - included as hidden fields in the search form. - -=item numResults - - A form param that can optionally specify the number of results to - display. Defaults to 25. - -=cut - -sub form { - my ($key, $numResults, $output, $f, $resultsText, %results); - tie %results, 'Tie::IxHash'; - $numResults = $session{form}{numResults} || 25; - $resultsText = WebGUI::International::get(529); - %results = (10=>'10 '.$resultsText, 25=>'25 '.$resultsText, 50=>'50 '.$resultsText, 100=>'100 '.$resultsText); - $f = WebGUI::HTMLForm->new(1); - foreach $key (keys %{$_[0]}) { - $f->hidden($key,${$_[0]}{$key}); - } - $output = ''; - $f->raw(''); - $output .= $f->print; - $output .= '
'; - $output .= '

'.WebGUI::International::get(364).'

'; - $output .= '
'); - $f->raw(''); - $f->raw(''); - $f->raw(''); - $f->raw(''); - $f->raw(''); - $f->raw('
'.WebGUI::International::get(530).''); - $f->text('all','',$session{form}{all},'','','',($session{setting}{textBoxSize}-5)); - $f->raw('
'.WebGUI::International::get(531).''); - $f->text('exactPhrase','',$session{form}{exactPhrase},'','','',($session{setting}{textBoxSize}-5)); - $f->raw('
'.WebGUI::International::get(532).''); - $f->text('atLeastOne','',$session{form}{atLeastOne},'','','',($session{setting}{textBoxSize}-5)); - $f->raw('
'.WebGUI::International::get(533).''); - $f->text('without','',$session{form}{without},'','','',($session{setting}{textBoxSize}-5)); - $f->raw('
'); - $f->raw('
'); - $f->select("numResults",\%results,'',[$numResults]); - $f->raw('

'); - $f->submit(WebGUI::International::get(170)); - $f->raw('

'; - return $output; -} - #------------------------------------------------------------------- =head2 buildConstraints ( fieldList ) { [ all, atLeastOne, exactPhrase, without ] } @@ -141,10 +85,10 @@ sub form { sub buildConstraints { my ($field, $all, $allSub, $exactPhrase, $atLeastOne, $without, @words, $word, $sql); - if ($session{form}{all} ne "") { - $session{form}{all} =~ s/,/ /g; - $session{form}{all} =~ s/\s+/ /g; - @words = split(/ /,$session{form}{all}); + if ($session{scratch}{all} ne "") { + $session{scratch}{all} =~ s/,/ /g; + $session{scratch}{all} =~ s/\s+/ /g; + @words = split(/ /,$session{scratch}{all}); foreach $word (@words) { $all .= " and " if ($all ne ""); $all .= "("; @@ -157,16 +101,16 @@ sub buildConstraints { $all .= ")"; } } - if ($session{form}{exactPhrase} ne "") { + if ($session{scratch}{exactPhrase} ne "") { foreach $field (@{$_[0]}) { $exactPhrase .= " or " if ($exactPhrase ne ""); - $exactPhrase .= " $field like ".quote("%".$session{form}{exactPhrase}."%"); + $exactPhrase .= " $field like ".quote("%".$session{scratch}{exactPhrase}."%"); } } - if ($session{form}{atLeastOne} ne "") { - $session{form}{atLeastOne} =~ s/,/ /g; - $session{form}{atLeastOne} =~ s/\s+/ /g; - @words = split(/ /,$session{form}{atLeastOne}); + if ($session{scratch}{atLeastOne} ne "") { + $session{scratch}{atLeastOne} =~ s/,/ /g; + $session{scratch}{atLeastOne} =~ s/\s+/ /g; + @words = split(/ /,$session{scratch}{atLeastOne}); foreach $word (@words) { foreach $field (@{$_[0]}) { $atLeastOne .= " or " if ($atLeastOne ne ""); @@ -174,10 +118,10 @@ sub buildConstraints { } } } - if ($session{form}{without} ne "") { - $session{form}{without} =~ s/,/ /g; - $session{form}{without} =~ s/\s+/ /g; - @words = split(/ /,$session{form}{without}); + if ($session{scratch}{without} ne "") { + $session{scratch}{without} =~ s/,/ /g; + $session{scratch}{without} =~ s/\s+/ /g; + @words = split(/ /,$session{scratch}{without}); foreach $word (@words) { foreach $field (@{$_[0]}) { $without .= " and " if ($without ne ""); @@ -195,7 +139,79 @@ sub buildConstraints { return $sql; } +#------------------------------------------------------------------- +=head2 form ( hiddenFields ) { [ numResults ] } + + Generates and returns the advanced search form. + +=item hiddenFields + + A hash reference that contains any name/value pairs that should be + included as hidden fields in the search form. + +=item numResults + + A form param that can optionally specify the number of results to + display. Defaults to 25. + +=cut + +sub form { + WebGUI::Session::setScratch("all",$session{form}{all}); + WebGUI::Session::setScratch("atLeastOne",$session{form}{atLeastOne}); + WebGUI::Session::setScratch("exactPhrase",$session{form}{exactPhrase}); + WebGUI::Session::setScratch("without",$session{form}{without}); + WebGUI::Session::setScratch("numResults",$session{form}{numResults}); + my ($key, $numResults, $output, $f, $resultsText, %results); + tie %results, 'Tie::IxHash'; + $numResults = $session{scratch}{numResults} || 25; + $resultsText = WebGUI::International::get(529); + %results = (10=>'10 '.$resultsText, 25=>'25 '.$resultsText, 50=>'50 '.$resultsText, 100=>'100 '.$resultsText); + $f = WebGUI::HTMLForm->new(1); + foreach $key (keys %{$_[0]}) { + $f->hidden($key,${$_[0]}{$key}); + } + $output = ''; + $f->raw(''); + $output .= $f->print; + $output .= '
'; + $output .= '

'.WebGUI::International::get(364).'

'; + $output .= '
'); + $f->raw(''); + $f->raw(''); + $f->raw(''); + $f->raw(''); + $f->raw(''); + $f->raw('
'.WebGUI::International::get(530).''); + $f->text('all','',$session{scratch}{all},'','','',($session{setting}{textBoxSize}-5)); + $f->raw('
'.WebGUI::International::get(531).''); + $f->text('exactPhrase','',$session{scratch}{exactPhrase},'','','',($session{setting}{textBoxSize}-5)); + $f->raw('
'.WebGUI::International::get(532).''); + $f->text('atLeastOne','',$session{scratch}{atLeastOne},'','','',($session{setting}{textBoxSize}-5)); + $f->raw('
'.WebGUI::International::get(533).''); + $f->text('without','',$session{scratch}{without},'','','',($session{setting}{textBoxSize}-5)); + $f->raw('
'); + $f->raw('
'); + $f->select("numResults",\%results,'',[$numResults]); + $f->raw('

'); + $f->submit(WebGUI::International::get(170)); + $f->raw('

'; + return $output; +} + +#------------------------------------------------------------------- +sub toggleURL { + WebGUI::Session::setScratch("search",$session{form}{search}); + my $url; + if ($session{scratch}{search}) { + $url = WebGUI::URL::page("search=0"); + } else { + $url = WebGUI::URL::page("search=1"); + } + $url = WebGUI::URL::append($url,$_[0]) if ($_[0]); + return $url; +} 1; diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index 1990a9dcf..8cbc35199 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -376,8 +376,8 @@ sub setCookie { sub setScratch { my ($name, $value) = @_; - return "" unless ($session{var}{sessionId} ne "" && $name ne "" && $value ne ""); - if ($value eq "-delete-") { + return "" unless ($session{var}{sessionId} ne "" && $name ne "" && defined $value); + if ($value eq "-delete-" || (defined $value && $value eq "")) { WebGUI::SQL->write("delete from userSessionScratch where sessionId=".quote($session{var}{sessionId}) ." and name=".quote($name)); $value = ""; diff --git a/lib/WebGUI/Wobject/FileManager.pm b/lib/WebGUI/Wobject/FileManager.pm index 24a62c2fc..23463db47 100644 --- a/lib/WebGUI/Wobject/FileManager.pm +++ b/lib/WebGUI/Wobject/FileManager.pm @@ -30,24 +30,12 @@ our $namespace = "FileManager"; our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- -# example: sortByColumn(columnToSort,columnLabel); -sub sortByColumn { - my ($output); - $output = 'get("wobjectId").".sortDirection"} eq "asc") { + return WebGUI::URL::append($_[2],'sort='.$_[1]."&sortDirection=desc"); } else { - $output .= "asc"; + return WebGUI::URL::append($_[2],'sort='.$_[1]."&sortDirection=asc"); } - $output .= '">'.$_[1].''; - if ($session{form}{sort} eq $_[0]) { - if ($session{form}{sortDirection} eq "desc") { - $output .= ' '; - } else { - $output .= ' '; - } - } - return $output; } @@ -59,7 +47,7 @@ sub duplicate { $w = WebGUI::Wobject::FileManager->new({wobjectId=>$w,namespace=>$namespace}); $w->set({ paginateAfter=>$_[0]->get("paginateAfter"), - displayThumbnails=>$_[0]->get("displayThumbnails") + templateId=>$_[0]->get("templateId") }); $sth = WebGUI::SQL->read("select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId")); while (%row = $sth->hash) { @@ -86,7 +74,7 @@ sub purge { #------------------------------------------------------------------- sub set { - $_[0]->SUPER::set($_[1],[qw(paginateAfter displayThumbnails)]); + $_[0]->SUPER::set($_[1],[qw(paginateAfter templateId)]); } #------------------------------------------------------------------- @@ -156,9 +144,22 @@ sub www_edit { $output .= '

'.WebGUI::International::get(9,$namespace).'

'; $paginateAfter = $_[0]->get("paginateAfter") || 50; $f = WebGUI::HTMLForm->new; + $f->template( + -name=>"templateId", + -value=>$_[0]->get("templateId"), + -namespace=>$namespace, + -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") + ); $f->integer("paginateAfter",WebGUI::International::get(20,$namespace),$paginateAfter); - $f->yesNo("displayThumbnails",WebGUI::International::get(21,$namespace),$_[0]->get("displayThumbnails")); - $f->yesNo("proceed",WebGUI::International::get(22,$namespace),$proceed); + if ($_[0]->get("wobjectId") eq "new") { + $f->whatNext( + -options=>{ + addQuestion=>WebGUI::International::get(74,$namespace), + backToPage=>WebGUI::International::get(745) + }, + -value=>"addQuestion" + ); + } $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; } @@ -168,7 +169,7 @@ sub www_editSave { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); $_[0]->SUPER::www_editSave({ paginateAfter=>$session{form}{paginateAfter}, - displayThumbnails=>$session{form}{displayThumbnails} + templateId=>$session{form}{templateId} }); if ($session{form}{proceed}) { return $_[0]->www_editDownload(); @@ -270,93 +271,87 @@ sub www_moveDownloadUp { #------------------------------------------------------------------- sub www_view { - my ($url, @row, $i, $p, $file, $constraints, $alt1, $numResults, $alt2, $output, $sth, $head, $sql, %download, $flag, $columns); - tie %download, 'Tie::CPHash'; - $numResults = $session{form}{numResults} || $_[0]->get("paginateAfter") || 25; - $url = WebGUI::URL::page(); - $url = WebGUI::URL::append($url,"all=$session{form}{all}") if ($session{form}{all}); - $url = WebGUI::URL::append($url,"atLeastOne=$session{form}{atLeastOne}") if ($session{form}{atLeastOne}); - $url = WebGUI::URL::append($url,"without=$session{form}{without}") if ($session{form}{without}); - $url = WebGUI::URL::append($url,"exactPhrase=$session{form}{exactPhrase}") if ($session{form}{exactPhrase}); - $url = WebGUI::URL::append($url,"numResults=$numResults"); - $columns = ''.sortByColumn("fileTitle",WebGUI::International::get(14,$namespace),$url). - ''.sortByColumn("briefSynopsis",WebGUI::International::get(15,$namespace),$url). - ''.sortByColumn("dateUploaded",WebGUI::International::get(16,$namespace),$url). - ''; - $url = WebGUI::URL::append($url,"sortDirection=$session{form}{sortDirection}") if ($session{form}{sortDirection}); - $url = WebGUI::URL::append($url,"sort=$session{form}{sort}") if ($session{form}{sort}); + my ($sortDirection, %var, @fileloop, $files, $sort, $file, $p, $file1, $file2, $file3, $constraints, + $url, $numResults, $sql, $flag); + $url = WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")); + WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection",$session{form}{sortDirection}); + WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort",$session{form}{sort}); + $numResults = $_[0]->get("paginateAfter") || 25; + $var{"titleColumn.label"} = WebGUI::International::get(14,$namespace); + $var{"titleColumn.url"} = $_[0]->_sortByColumn("fileTitle",$url); + $var{"descriptionColumn.label"} = WebGUI::International::get(15,$namespace); + $var{"descriptionColumn.url"} = $_[0]->_sortByColumn("briefSynopsis",$url); + $var{"dateColumn.label"} = WebGUI::International::get(16,$namespace); + $var{"dateColumn.url"} = $_[0]->_sortByColumn("dateUploaded",$url); $session{form}{sort} = "sequenceNumber" if ($session{form}{sort} eq ""); + $var{"search.form"} = WebGUI::Search::form(); + $var{"search.url"} = WebGUI::Search::toggleURL(); + $var{"search.label"} = WebGUI::International::get(364); + $var{"addfile.url"} = WebGUI::URL::page('func=editDownload&did=new&wid='.$_[0]->get("wobjectId")); + $var{"addfile.label"} = WebGUI::International::get(11,$namespace); $sql = "select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId")." "; - $constraints = WebGUI::Search::buildConstraints([qw(fileTitle downloadFile alternateVersion1 alternateVersion2 briefSynopsis)]); - $sql .= " and ".$constraints if ($constraints ne ""); - $sql .= " order by $session{form}{sort} "; - $sql .= $session{form}{sortDirection}; - $output = $_[0]->displayTitle; - $output .= $_[0]->description; - $output = $_[0]->processMacros($output); - if ($session{form}{search}) { - $output .= WebGUI::Search::form({search=>1}); - } else { - $head = ''; - $head .= ''.WebGUI::International::get(364).''; - if ($session{var}{adminOn}) { - $head .= ' · '.WebGUI::International::get(11,$namespace).''; - } - $head .= ''; + if ($session{scratch}{search}) { + $numResults = $session{scratch}{numResults}; + $constraints = WebGUI::Search::buildConstraints( + [qw(fileTitle downloadFile alternateVersion1 alternateVersion2 briefSynopsis)]); + $sql .= " and ".$constraints if ($constraints ne ""); } - $output .= ''.$head.$columns; - $sth = WebGUI::SQL->read($sql); - while (%download = $sth->hash) { - if (WebGUI::Privilege::isInGroup($download{groupToView})) { - $file = WebGUI::Attachment->new($download{downloadFile}, - $_[0]->get("wobjectId"), $download{FileManager_fileId}); - $row[$i] = ''.''; - $flag = 1; - $i++; - } + $sort = $session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sort"} || "dateUploaded"; + $sortDirection = $session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sortDirection"} || "desc"; + $sql .= " order by $sort $sortDirection"; + $p = WebGUI::Paginator->new($url,[],$numResults); + $p->setDataByQuery($sql); + $files = $p->getPageData; + foreach $file (@$files) { + $file1 = WebGUI::Attachment->new($file->{downloadFile},$_[0]->get("wobjectId"),$file->{FileManager_fileId}); + $file2 = WebGUI::Attachment->new($file->{alternateVersion1},$_[0]->get("wobjectId"),$file->{FileManager_fileId}); + $file3 = WebGUI::Attachment->new($file->{alternateVersion2},$_[0]->get("wobjectId"),$file->{FileManager_fileId}); + push (@fileloop,{ + "file.canView"=>WebGUI::Privilege::isInGroup($file->{groupToView}), + "file.controls"=>deleteIcon('func=deleteDownload&wid='.$_[0]->get("wobjectId") + .'&did='.$file->{FileManager_fileId}).editIcon('func=editDownload&wid='.$_[0]->get("wobjectId") + .'&did='.$file->{FileManager_fileId}).moveUpIcon('func=moveDownloadUp&wid=' + .$_[0]->get("wobjectId") + .'&did='.$file->{FileManager_fileId}).moveDownIcon('func=moveDownloadDown&wid=' + .$_[0]->get("wobjectId").'&did='.$file->{FileManager_fileId}), + "file.title"=>$file->{fileTitle}, + "file.version1.name"=>$file1->getFilename, + "file.version1.url"=>$file1->getURL, + "file.version1.icon"=>$file1->getIcon, + "file.version1.size"=>$file1->getSize, + "file.version1.type"=>$file1->getType, + "file.version1.thumbnail"=>$file1->getThumbnail, + "file.version1.isImage"=>$file1->isImage, + "file.version2.name"=>$file2->getFilename, + "file.version2.url"=>$file2->getURL, + "file.version2.icon"=>$file2->getIcon, + "file.version2.size"=>$file2->getSize, + "file.version2.type"=>$file2->getType, + "file.version2.thumbnail"=>$file2->getThumbnail, + "file.version2.isImage"=>$file2->isImage, + "file.version3.name"=>$file3->getFilename, + "file.version3.url"=>$file3->getURL, + "file.version3.icon"=>$file3->getIcon, + "file.version3.size"=>$file3->getSize, + "file.version3.type"=>$file3->getType, + "file.version3.thumbnail"=>$file3->getThumbnail, + "file.version3.isImage"=>$file3->isImage, + "file.description"=>$file->{briefSynopsis}, + "file.date"=>epochToHuman($file->{dateUploaded},"%z"), + "file.time"=>epochToHuman($file->{dateUploaded},"%Z") + }); + $flag = 1; } - $sth->finish; - $output .= '' unless ($flag); - $p = WebGUI::Paginator->new($url,\@row,$numResults); - $output .= $p->getPage($session{form}{pn}); - $output .= '
'; - if ($session{var}{adminOn}) { - $row[$i] .= deleteIcon('func=deleteDownload&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}) - .editIcon('func=editDownload&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}) - .moveUpIcon('func=moveDownloadUp&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}) - .moveDownIcon('func=moveDownloadDown&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}) - .' '; - } - $row[$i] .= ''.$download{fileTitle}.' · '.$file->getType.'/'.$file->getSize.''; - if ($download{alternateVersion1}) { - $alt1 = WebGUI::Attachment->new($download{alternateVersion1}, - $_[0]->get("wobjectId"), $download{FileManager_fileId}); - $row[$i] .= ' · '. - $alt1->getType.'/'.$alt1->getSize.''; - } - if ($download{alternateVersion2}) { - $alt2 = WebGUI::Attachment->new($download{alternateVersion2}, - $_[0]->get("wobjectId"), $download{FileManager_fileId}); - $row[$i] .= ' · '. - $alt2->getType.'/'.$alt2->getSize.''; - } - $row[$i] .= ''; - if ($_[0]->get("displayThumbnails") && isIn($file->getType, qw(gif jpeg jpg tif tiff png bmp))) { - $row[$i] .= ''; - } - $row[$i] .= $download{briefSynopsis}.''. - epochToHuman($download{dateUploaded},"%z").'
'.WebGUI::International::get(19,$namespace).'
'; - $output .= $p->getBarTraditional($session{form}{pn}); - return $output; + $var{"noresults.message"} = WebGUI::International::get(19,$namespace); + $var{noresults} = !$flag; + $var{file_loop} = \@fileloop; + $var{firstPage} = $p->getFirstPageLink; + $var{lastPage} = $p->getLastPageLink; + $var{nextPage} = $p->getNextPageLink; + $var{pageList} = $p->getPageLinks; + $var{previousPage} = $p->getPreviousPageLink; + $var{multiplePages} = ($p->getNumberOfPages > 1); + return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); }