From fdf7c82dd28749229a9ea9aa16ed617a35174192 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 1 Dec 2002 06:18:52 +0000 Subject: [PATCH] Fixing bugs and template inconsistencies. --- docs/upgrades/upgrade_4.8.0-4.9.0.sql | 7 ++++ lib/WebGUI/HTMLForm.pm | 2 +- lib/WebGUI/Wobject.pm | 2 +- lib/WebGUI/Wobject/USS.pm | 53 ++++++++++++--------------- 4 files changed, 33 insertions(+), 31 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 0d606b4f7..64b2cd6e0 100644 --- a/docs/upgrades/upgrade_4.8.0-4.9.0.sql +++ b/docs/upgrades/upgrade_4.8.0-4.9.0.sql @@ -979,6 +979,13 @@ alter table page add column languageId int not null default 1; insert into international (internationalId,languageId,namespace,message,lastUpdated) values (823,1,'WebGUI','Go to the new page.', 1038706332); insert into settings values ("mailFooter","^c;\n^e;\n^u;\n"); insert into international (internationalId,languageId,namespace,message,lastUpdated) values (824,1,'WebGUI','Email Footer', 1038708558); +delete from template where namespace='USS' and templateId<1000; +INSERT INTO template VALUES (1,'Default USS','\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

\r\n · · \r\n
\r\n
\r\n','USS'); +INSERT INTO template VALUES (2,'Traditional 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 ()\r\n \r\n\r\n \r\n \">\" border=\"0\">\r\n \r\n \">
\r\n\r\n\r\n

\r\n · · \r\n
\r\n
\r\n\r\n','USS'); +INSERT INTO template VALUES (3,'Weblog','\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\" align=\"right\"/>\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','USS'); +INSERT INTO template VALUES (4,'Photo Gallery','\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\"/>
\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','USS'); +INSERT INTO template VALUES (5,'Classifieds','\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\"/ align=\"right\">
\r\n
\r\n\r\n
\r\n\r\n\r\n

\r\n · · \r\n
\r\n
\r\n','USS'); +INSERT INTO template VALUES (6,'Guest Book','\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\nOn \"> from \">the department wrote, \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','USS'); diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index 0ff99a22d..27794c8bb 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -1527,7 +1527,7 @@ sub template { my ($name, $value, $label, $namespace, $afterEdit, $extras, $uiLevel) = rearrange([qw(name value label namespace afterEdit extras uiLevel)], @p); if (_uiLevelChecksOut($uiLevel)) { - $label = $_[0]->{label} || WebGUI::International::get(356); + $label = $label || WebGUI::International::get(356); if (WebGUI::Privilege::isInGroup($session{setting}{templateManagersGroup})) { if ($afterEdit) { $subtext = '{$keyName}); } WebGUI::SQL->write($sql); - $_[0]->reorderCollateral($table,$keyName,$setName,$setValue) if ($properties->{sequenceNumber} < 1); + $_[0]->reorderCollateral($table,$keyName,$setName,$setValue) if ($properties->{sequenceNumber} < 0); return $properties->{$keyName}; } diff --git a/lib/WebGUI/Wobject/USS.pm b/lib/WebGUI/Wobject/USS.pm index ca7e35f69..b0a224304 100644 --- a/lib/WebGUI/Wobject/USS.pm +++ b/lib/WebGUI/Wobject/USS.pm @@ -305,37 +305,32 @@ sub www_showMessage { #------------------------------------------------------------------- sub www_view { - my (%var, $row, $page, $p, $constraints, @submission, @content, $image, $i, $url, $thumbnail, $responses); - $var{"label.readmore"} = WebGUI::International::get(46,$namespace); - $var{"label.responses"} = WebGUI::International::get(57,$namespace); + my (%var, $row, $page, $p, $constraints, @submission, @content, $image, $i, $numResults, $thumbnail, $responses); + $numResults = $_[0]->get("submissionsPerPage"); + $var{"readmore.label"} = WebGUI::International::get(46,$namespace); + $var{"responses.label"} = WebGUI::International::get(57,$namespace); + $var{title} = $_[0]->processMacros($_[0]->get("title")); $var{description} = $_[0]->processMacros($_[0]->get("description")); - if (WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute"))) { - $var{post} = ''.WebGUI::International::get(20,$namespace).''; - } - unless ($session{form}{search}) { - $url = 'func=view&search=1&wid='.$_[0]->get("wobjectId"); + $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")); + $var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId")); + $var{"post.label"} = WebGUI::International::get(20,$namespace); + $var{"search.label"} = WebGUI::International::get(364); + $var{"search.Form"} = WebGUI::Search::form({wid=>"$session{form}{wid}",func=>'view',search=>1}); + $var{"search.url"} = WebGUI::Search::toggleURL(); + if ($session{scratch}{search}) { + $numResults = $session{scratch}{numResults}; + $constraints = WebGUI::Search::buildConstraints([qw(username title content)]); } - $var{search} = ''.WebGUI::International::get(364).''; - if ($session{form}{search}) { - $var{searchForm} = WebGUI::Search::form({wid=>"$session{form}{wid}",func=>'view',search=>1}); - } - $constraints = WebGUI::Search::buildConstraints([qw(username title content)]); if ($constraints ne "") { $constraints = "status='Approved' and ".$constraints; } else { $constraints = "(status='Approved' or userId=$session{user}{userId})"; } - $var{"label.title"} = WebGUI::International::get(99); - $var{"label.thumbnail"} = WebGUI::International::get(52,$namespace); - $var{"label.date"} = WebGUI::International::get(13,$namespace); - $var{"label.by"} = WebGUI::International::get(21,$namespace); - $url = WebGUI::URL::page('func=view&search='.$session{form}{search}.'&wid='.$_[0]->get("wobjectId") - .'&all='.WebGUI::URL::escape($session{form}{all}) - .'&exactPhrase='.WebGUI::URL::escape($session{form}{exactPhrase}).'&atLeastOne=' - .WebGUI::URL::escape($session{form}{atLeastOne}).'&numResults='.$session{form}{numResults} - .'&without='.WebGUI::URL::escape($session{form}{without})); - $p = WebGUI::Paginator->new($url, [], $_[0]->get("submissionsPerPage")); + $var{"title.label"} = WebGUI::International::get(99); + $var{"thumbnail.label"} = WebGUI::International::get(52,$namespace); + $var{"date.label"} = WebGUI::International::get(13,$namespace); + $var{"by.label"} = WebGUI::International::get(21,$namespace); + $p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults); $p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and $constraints order by dateSubmitted desc"); $page = $p->getPageData; @@ -365,10 +360,10 @@ sub www_view { "submission.currentUser"=>($session{user}{userId} == $page->[$i]->{userId}), "submission.username"=>$page->[$i]->{username}, "submission.userProfile"=>WebGUI::URL::page('op=viewProfile&uid='.$page->[$i]->{userId}), - "submission.secondColumn"=>($i%2==0), - "submission.thirdColumn"=>($i%3==0), - "submission.fourthColumn"=>($i%4==0), - "submission.fifthColumn"=>($i%5==0), + "submission.secondColumn"=>(($i+1)%2==0), + "submission.thirdColumn"=>(($i+1)%3==0), + "submission.fourthColumn"=>(($i+1)%4==0), + "submission.fifthColumn"=>(($i+1)%5==0), }); $i++; } @@ -379,7 +374,7 @@ sub www_view { $var{pageList} = $p->getPageLinks; $var{previousPage} = $p->getPreviousPageLink; $var{multiplePages} = ($p->getNumberOfPages > 1); - return $_[0]->processMacros($_[0]->displayTitle).$_[0]->processTemplate($_[0]->get("templateId"),\%var); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } #-------------------------------------------------------------------