ChangeSet ID: 31282 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/07/28 15:08:50
Modified files: include : application.php application_queue.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Use multipage controls for application lists
Patch: http://cvs.winehq.org/patch.py?id=31282
Old revision New revision Changes Path 1.120 1.121 +42 -6 appdb/include/application.php 1.9 1.10 +13 -2 appdb/include/application_queue.php
Index: appdb/include/application.php diff -u -p appdb/include/application.php:1.120 appdb/include/application.php:1.121 --- appdb/include/application.php:1.120 28 Jul 2007 20: 8:50 -0000 +++ appdb/include/application.php 28 Jul 2007 20: 8:50 -0000 @@ -343,6 +343,14 @@ class Application { addmsg("The application has been rejected.", "green"); } } + + function objectGetItemsPerPage($bQueued = false) + { + $aItemsPerPage = array(25, 50, 100, 200); + $iDefaultPerPage = 25; + return array($aItemsPerPage, $iDefaultPerPage); + } + function ReQueue() { if(!$_SESSION['current']->canRequeueApplication($this)) @@ -818,8 +826,21 @@ class Application { return $sLink; }
- function objectGetEntries($bQueued, $bRejected, $sOrderBy = "appId") + function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "appId") { + $sLimit = ""; + + /* Should we add a limit clause to the query? */ + if($iRows || $iStart) + { + $sLimit = " LIMIT ?,?"; + + /* Selecting 0 rows makes no sense, so we assume the user wants to select all of them + after an offset given by iStart */ + if(!$iRows) + $iRows = maintainer::objectGetEntriesCount($bQueued, $bRejected); + } + $sQuery = "SELECT * FROM appFamily WHERE appFamily.queued = '?'";
@@ -831,13 +852,28 @@ class Application { if(!$bRejected) return FALSE;
- $sQuery .= " AND appFamily.submitterId = '?' ORDER BY '?'"; - $hResult = query_parameters($sQuery, $sQueued, - $_SESSION['current']->iUserId, $sOrderBy); + $sQuery .= " AND appFamily.submitterId = '?' ORDER BY '?'$sLimit"; + if($sLimit) + { + $hResult = query_parameters($sQuery, $sQueued, + $_SESSION['current']->iUserId, $sOrderBy, + $iStart, $iRows); + } else + { + $hResult = query_parameters($sQuery, $sQueued, + $_SESSION['current']->iUserId, $sOrderBy); + } } else { - $sQuery .= " ORDER BY '?'"; - $hResult = query_parameters($sQuery, $sQueued, $sOrderBy); + $sQuery .= " ORDER BY '?'$sLimit"; + if($sLimit) + { + $hResult = query_parameters($sQuery, $sQueued, $sOrderBy, + $iStart, $iRows); + } else + { + $hResult = query_parameters($sQuery, $sQueued, $sOrderBy); + } }
if(!$hResult) Index: appdb/include/application_queue.php diff -u -p appdb/include/application_queue.php:1.9 appdb/include/application_queue.php:1.10 --- appdb/include/application_queue.php:1.9 28 Jul 2007 20: 8:50 -0000 +++ appdb/include/application_queue.php 28 Jul 2007 20: 8:50 -0000 @@ -292,9 +292,20 @@ class application_queue return TRUE; }
- function objectGetEntries($bQueued, $bRejected) + function objectGetItemsPerPage($bQueued = false) { - return $this->oApp->objectGetEntries($bQueued, $bRejected); + return $this->oApp->objectGetItemsPerPage($bQueued); + } + + function objectGetEntriesCount($bQueued, $bRejected) + { + return $this->oApp->objectGetEntriesCount($bQueued, $bRejected); + } + + function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "appId") + { + return $this->oApp->objectGetEntries($bQueued, $bRejected, $iRows, $iStart, + $sOrderBy); }
function objectGetHeader()