ChangeSet ID: 31187 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/06/11 19:02:41
Modified files: include : objectManager.php testData.php testData_queue.php vendor.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Add multi-page control to list of un-queued testData
Patch: http://cvs.winehq.org/patch.py?id=31187
Old revision New revision Changes Path 1.23 1.24 +2 -2 appdb/include/objectManager.php 1.59 1.60 +41 -7 appdb/include/testData.php 1.9 1.10 +12 -2 appdb/include/testData_queue.php 1.30 1.31 +1 -1 appdb/include/vendor.php
Index: appdb/include/objectManager.php diff -u -p appdb/include/objectManager.php:1.23 appdb/include/objectManager.php:1.24 --- appdb/include/objectManager.php:1.23 12 Jun 2007 0: 2:41 -0000 +++ appdb/include/objectManager.php 12 Jun 2007 0: 2:41 -0000 @@ -532,14 +532,14 @@ class ObjectManager $oObject = new $this->sClass();
if(!method_exists($oObject, "objectGetItemsPerPage") || - $oObject->objectGetItemsPerPage() === FALSE) + $oObject->objectGetItemsPerPage($this->bIsQueue) === FALSE) { /* Do not enable the MultiPage controls */ $this->oMultiPage->MultiPage(FALSE); return; }
- $aReturn = $oObject->objectGetItemsPerPage(); + $aReturn = $oObject->objectGetItemsPerPage($this->bIsQueue); $aItemsPerPage = $aReturn[0]; $iDefaultPerPage = $aReturn[1];
Index: appdb/include/testData.php diff -u -p appdb/include/testData.php:1.59 appdb/include/testData.php:1.60 --- appdb/include/testData.php:1.59 12 Jun 2007 0: 2:41 -0000 +++ appdb/include/testData.php 12 Jun 2007 0: 2:41 -0000 @@ -841,10 +841,24 @@ class testData{ return $oRow->count; }
- function objectGetEntries($bQueued, $bRejected, $sOrderBy = "testingId") + function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "testingId") { $oTest = new testData(); $sQueued = objectManager::getQueueString($bQueued, $bRejected); + + $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 = testData::objectGetEntriesCount($bQueued, $bRejected); + } + if($bQueued && !$oTest->canEdit()) { if($bRejected) @@ -856,7 +870,7 @@ class testData{ AND testResults.submitterId = '?' AND - testResults.queued = '?' ORDER BY '?'"; + testResults.queued = '?' ORDER BY '?'$sLimit"; } else { $sQuery = "SELECT testResults.* FROM testResults, appVersion, @@ -881,10 +895,17 @@ class testData{ ) ) AND - testResults.queued = '?' ORDER BY '?'"; + testResults.queued = '?' ORDER BY '?'$sLimit"; + } + if($sLimit) + { + $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, + $sQueued, $sOrderBy, $iStart, $iRows); + } else + { + $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, + $sQueued, $sOrderBy); } - $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, - $sQueued, $sOrderBy); } else { $sQuery = "SELECT testResults.* FROM testResults, appVersion WHERE @@ -892,8 +913,11 @@ class testData{ AND appVersion.queued = 'false' AND - testResults.queued = '?' ORDER by '?'"; - $hResult = query_parameters($sQuery, $sQueued, $sOrderBy); + testResults.queued = '?' ORDER by '?'$sLimit"; + if($sLimit) + $hResult = query_parameters($sQuery, $sQueued, $sOrderBy, $iStart, $iRows); + else + $hResult = query_parameters($sQuery, $sQueued, $sOrderBy); }
if(!$hResult) @@ -1037,6 +1061,16 @@ class testData{ { return FALSE; } + + function objectGetItemsPerPage($bQueued = false) + { + if($bQueued) + return FALSE; + + $aItemsPerPage = array(25, 50, 100, 200); + $iDefaultPerPage = 25; + return array($aItemsPerPage, $iDefaultPerPage); + } }
?> Index: appdb/include/testData_queue.php diff -u -p appdb/include/testData_queue.php:1.9 appdb/include/testData_queue.php:1.10 --- appdb/include/testData_queue.php:1.9 12 Jun 2007 0: 2:41 -0000 +++ appdb/include/testData_queue.php 12 Jun 2007 0: 2:41 -0000 @@ -122,9 +122,14 @@ class testData_queue $this->oTestData->objectDisplayAddItemHelp(); }
- function objectGetEntries($bQueued, $bRejected) + function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "testingId") { - return $this->oTestData->objectGetEntries($bQueued, $bRejected); + return $this->oTestData->objectGetEntries($bQueued, $bRejected, $iRows, $iStart, $sOrderBy); + } + + function objectGetEntriesCount($bQueued, $bRejected) + { + return testData::objectGetEntriesCount($bQueued, $bRejected); }
function objectGetHeader() @@ -168,6 +173,11 @@ class testData_queue { return testData::allowAnonymousSubmissions(); } + + function objectGetItemsPerPage($bQueued = false) + { + return testData::objectGetItemsPerPage($bQueued); + } }
?> Index: appdb/include/vendor.php diff -u -p appdb/include/vendor.php:1.30 appdb/include/vendor.php:1.31 --- appdb/include/vendor.php:1.30 12 Jun 2007 0: 2:41 -0000 +++ appdb/include/vendor.php 12 Jun 2007 0: 2:41 -0000 @@ -356,7 +356,7 @@ class Vendor { return $this->iVendorId; }
- function objectGetItemsPerPage() + function objectGetItemsPerPage($bQueued = false) { $aItemsPerPage = array(25, 50, 100, 200); $iDefaultPerPage = 25;