updating stuff for new paginator

This commit is contained in:
JT Smith 2004-02-02 04:15:02 +00:00
parent 16e9d39a71
commit 019c28e63e
23 changed files with 46 additions and 31 deletions

View file

@ -16,7 +16,6 @@ package WebGUI::Forum;
use strict;
use WebGUI::Forum::Thread;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;

View file

@ -1092,7 +1092,7 @@ sub getForumTemplateVars {
} else {
$query .= "lastPostDate desc";
}
my $p = WebGUI::Paginator->new(WebGUI::URL::append($callback,"forumOp=viewForum&forumId=".$forum->get("forumId")),"",$forum->get("postsPerPage"));
my $p = WebGUI::Paginator->new(WebGUI::URL::append($callback,"forumOp=viewForum&forumId=".$forum->get("forumId")),$forum->get("postsPerPage"));
$p->setDataByQuery($query);
$var{firstPage} = $p->getFirstPageLink;
$var{lastPage} = $p->getLastPageLink;
@ -2073,8 +2073,7 @@ sub www_search {
on a.forumThreadId=b.forumThreadId where b.forumId=".$forum->get("forumId")." and
(a.status='approved' or a.status='archived') and ".WebGUI::Search::buildConstraints([qw(a.subject a.username a.message)])
." order by a.dateOfPost desc";
my $p = WebGUI::Paginator->new(WebGUI::URL::append($caller->{callback},"forumOp=search&doit=1&forumId=".$forum->get("forumId")),
"", $numResults);
my $p = WebGUI::Paginator->new(WebGUI::URL::append($caller->{callback},"forumOp=search&doit=1&forumId=".$forum->get("forumId")), $numResults);
$p->setDataByQuery($query);
my @post_loop;
foreach my $row (@{$p->getPageData}) {

View file

@ -521,7 +521,8 @@ sub www_viewMessageLog {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewMessageLog'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewMessageLog'));
$p->setDataByArrayRef(\@row);
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(351).'</td>
<td class="tableHeader">'.WebGUI::International::get(553).'</td>

View file

@ -19,6 +19,7 @@ use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Operation::Shared;
use WebGUI::Page;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
@ -327,10 +328,11 @@ sub www_manageClipboard {
}
$output .= '</tr>';
if ($session{form}{systemClipboard} eq "1") {
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard&systemClipboard=1'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard&systemClipboard=1'));
} else {
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageClipboard'));
}
$p->setDataByArrayRef(\@row);
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});

View file

@ -414,7 +414,7 @@ sub www_listCollateral {
$constraints .= " and userId=$session{scratch}{collateralUser}" if ($session{scratch}{collateralUser});
$constraints .= " and collateralType=".quote($session{scratch}{collateralType}) if ($session{scratch}{collateralType});
$constraints .= " and name like ".quote('%'.$session{scratch}{keyword}.'%') if ($session{scratch}{keyword});
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listCollateral'),[],"",$session{scratch}{collateralPageNumber});
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listCollateral'),"",$session{scratch}{collateralPageNumber});
$p->setDataByQuery("select collateralId, name, filename, collateralType, dateUploaded, username, parameters
from collateral where $constraints order by name");
$page = $p->getPageData;

View file

@ -138,7 +138,8 @@ sub www_listDatabaseLinks {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listDatabaseLinks'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listDatabaseLinks'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=3 cellspacing=0 align="center">';
$output .= $p->getPage;
$output .= '</table>';

View file

@ -314,7 +314,8 @@ sub www_listGroups {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroups'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroups'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
.WebGUI::International::get(85).'</td><td class="tableHeader">'
@ -345,7 +346,8 @@ sub www_listGroupsSecondary {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroupsSecondary'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroupsSecondary'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
.WebGUI::International::get(85).'</td><td class="tableHeader">'

View file

@ -352,7 +352,8 @@ sub www_listInternationalMessages {
.$list{$key}{id}."</td><td>".$list{$key}{message}."</td></tr>\n";
$i++;
}
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listInternationalMessages&lid='.$session{form}{lid}),\@row,100);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listInternationalMessages&lid='.$session{form}{lid}),100);
$p->setDataByArrayRef(\@row);
$output .= $p->getBarTraditional($session{form}{pn});
$output .= '<table style="font-size: 11px;" width="100%">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(434).'</td><td class="tableHeader">'.

View file

@ -38,7 +38,7 @@ sub www_viewMessageLog {
my (@msg, $vars);
WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(2,$session{user}{userId}));
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(159).'</h1>';
my $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewMessageLog'),[]);
my $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewMessageLog'));
my $query = "select messageLogId,subject,url,dateOfEntry,status from messageLog where userId=$session{user}{userId} order by dateOfEntry desc";
$p->setDataByQuery($query);

View file

@ -22,7 +22,6 @@ use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Mail;
use WebGUI::MessageLog;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
@ -260,4 +259,4 @@ sub www_viewProfile {
return WebGUI::Template::process(WebGUI::Template::get(1,'Operation/Profile/View'), $vars);
}
1;
1;

View file

@ -51,7 +51,8 @@ sub www_listRoots {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listRoots'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listRoots'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=3 cellspacing=0 align="center">';
$output .= $p->getPage;
$output .= '</table>';

View file

@ -49,7 +49,8 @@ sub www_search {
$sth->finish;
}
if ($row[0] ne "") {
$p = WebGUI::Paginator->new($url,\@row,$session{scratch}{numResults});
$p = WebGUI::Paginator->new($url,$session{scratch}{numResults});
$p->setDataByArrayRef(\@row);
$output .= '<p/>'.WebGUI::International::get(365).'<p><ul>';
$output .= $p->getPage($session{form}{pn});
$output .= '</ul>'.$p->getBarTraditional($session{form}{pn});

View file

@ -64,7 +64,8 @@ sub www_viewActiveSessions {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
$output .= '<td>'.WebGUI::International::get(435).'</td>';
@ -95,7 +96,8 @@ sub www_viewLoginHistory {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
$output .= '<td>'.WebGUI::International::get(434).'</td>';

View file

@ -12,6 +12,7 @@ package WebGUI::Operation::Style;
use Exporter;
use strict;
use WebGUI::Paginator;
use WebGUI::Session;
use WebGUI::URL;
@ -57,7 +58,8 @@ sub www_listRoots {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listRoots'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listRoots'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=3 cellspacing=0 align="center">';
$output .= $p->getPage;
$output .= '</table>';

View file

@ -202,7 +202,8 @@ sub www_listTemplates {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listTemplates&namespace='.$session{form}{namespace}),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listTemplates&namespace='.$session{form}{namespace}));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';

View file

@ -454,7 +454,8 @@ sub www_listThemes {
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listThemes'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listThemes'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';

View file

@ -16,6 +16,7 @@ use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::Icon;
use WebGUI::Operation::Shared;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
@ -399,10 +400,11 @@ sub www_manageTrash {
}
$output .= '</tr>';
if ($session{form}{systemTrash} eq "1") {
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash&systemTrash=1'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash&systemTrash=1'));
} else {
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash'),\@row);
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=manageTrash'));
}
$p->setDataByArrayRef(\@row);
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});

View file

@ -31,7 +31,6 @@ use WebGUI::User;
use WebGUI::Utility;
our @ISA = qw(Exporter);
#&www_addUserSecondary &www_addUserSecondarySave
our @EXPORT = qw(&www_editUserKarma &www_editUserKarmaSave &www_editUserGroup &www_editUserProfile &www_editUserProfileSave &www_addUserToGroupSave &www_deleteGrouping &www_editGrouping &www_editGroupingSave &www_becomeUser &www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers);

View file

@ -161,7 +161,8 @@ sub www_view {
$var{isLastPage} = 1;
} else {
my @pages = split(/\^\-\;/,$var{description});
my $p = WebGUI::Paginator->new(WebGUI::URL::page("wid=".$_[0]->get("wobjectId")."&func=view"),\@pages,1);
my $p = WebGUI::Paginator->new(WebGUI::URL::page("wid=".$_[0]->get("wobjectId")."&func=view"),1);
$p->setDataByArrayRef(\@pages);
$var{description} = $p->getPage;
$var{firstPage} = $p->getFirstPageLink;
$var{lastPage} = $p->getLastPageLink;

View file

@ -491,7 +491,8 @@ sub www_view {
}
$row[$i-1] = "page";
}
$p = WebGUI::Paginator->new(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),\@row,1);
$p = WebGUI::Paginator->new(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),1);
$p->setDataByArrayRef(\@row);
$var{"calendar.firstPage"} = $p->getFirstPageLink;
$var{"calendar.lastPage"} = $p->getLastPageLink;
$var{"calendar.nextPage"} = $p->getNextPageLink;
@ -502,7 +503,7 @@ sub www_view {
$flag = 0;
$session{form}{pn} = "";
}
$p = WebGUI::Paginator->new(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),[],$_[0]->get("paginateAfter"));
$p = WebGUI::Paginator->new(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),$_[0]->get("paginateAfter"));
my $query = "select * from EventsCalendar_event where ";
$query .= " wobjectId=".$_[0]->get("wobjectId")." and " unless ($_[0]->get("isMaster"));
$query .= " endDate>=$minDate and startDate<=$maxDate order by startDate,endDate";

View file

@ -316,7 +316,7 @@ sub www_view {
$sort = $session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort"} || "sequenceNumber";
$sortDirection = $session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection"} || "desc";
$sql .= " order by $sort $sortDirection";
$p = WebGUI::Paginator->new($url,[],$numResults);
$p = WebGUI::Paginator->new($url,$numResults);
$p->setDataByQuery($sql);
$files = $p->getPageData;
my $canEditWobject = (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")) || WebGUI::Privilege::canEditPage());

View file

@ -122,7 +122,7 @@ sub www_view {
.'='.WebGUI::URL::escape($session{form}{$_}));
}
}
my $p = WebGUI::Paginator->new($url,[],$_[0]->get("paginateAfter"));
my $p = WebGUI::Paginator->new($url,$_[0]->get("paginateAfter"));
my $error = $p->setDataByQuery($query,$dbh,1);
if ($error ne "") {
WebGUI::ErrorHandler::warn("There was a problem with the query: ".$error);

View file

@ -580,7 +580,7 @@ sub www_view {
$var{"date.updated.label"} = WebGUI::International::get(78,$_[0]->get("namespace"));
$var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
$var{"submission.edit.label"} = WebGUI::International::get(27,$_[0]->get("namespace"));
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults);
$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, dateUpdated,
username, contentType, forumId, userDefined1, userDefined2, userDefined3, userDefined4, userDefined5 from USS_submission
where USS_id=".$_[0]->get("USS_Id")." and $constraints order by ".$_[0]->getValue("sortBy")." ".$_[0]->getValue("sortOrder"));