diff --git a/include/appData.php b/include/appData.php index 2b0c137..d29dea2 100644 --- a/include/appData.php +++ b/include/appData.php @@ -326,7 +326,7 @@ class appData return $oTableRow; } - function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sType) + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true, $sType = null) { /* Not implemented for appData */ if($sState == 'rejected') diff --git a/include/application.php b/include/application.php index 71c9ff9..7bd571e 100644 --- a/include/application.php +++ b/include/application.php @@ -934,6 +934,11 @@ class Application { return $sLink; } + public static function objectGetDefaultSort() + { + return 'appId'; + } + public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE) { $sLimit = ""; diff --git a/include/application_queue.php b/include/application_queue.php index 8584a8c..9e02bba 100644 --- a/include/application_queue.php +++ b/include/application_queue.php @@ -384,6 +384,11 @@ class application_queue return $this->oApp->objectGetEntriesCount($sState); } + public static function objectGetDefaultSort() + { + return application::objectGetDefaultSort(); + } + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE) { return $this->oApp->objectGetEntries($sState, $iRows, $iStart, diff --git a/include/bugs.php b/include/bugs.php index dc75f29..2ab2a30 100644 --- a/include/bugs.php +++ b/include/bugs.php @@ -365,7 +365,7 @@ class Bug return $this->iLinkId; } - function objectGetEntries($sState, $iRows = 0, $iStart = 0) + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true) { $sLimit = ""; diff --git a/include/distribution.php b/include/distribution.php index ce3848a..d25b012 100644 --- a/include/distribution.php +++ b/include/distribution.php @@ -555,6 +555,11 @@ class distribution { return array('name'); } + public static function objectGetDefaultSort() + { + return 'name'; + } + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "name", $bAscending = TRUE) { /* Not implemented */ diff --git a/include/downloadurl.php b/include/downloadurl.php index dab0bd8..3a50457 100644 --- a/include/downloadurl.php +++ b/include/downloadurl.php @@ -432,9 +432,9 @@ class downloadurl return $oAppData->reject(); } - function objectGetEntries($sState, $iRows = 0, $iStart = 0) + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true) { - return appData::objectGetEntries($sState, $iRows, $iStart, 'downloadurl'); + return appData::objectGetEntries($sState, $iRows, $iStart, $sOrderBy, $bAscending, 'downloadurl'); } function objectGetEntriesCount($sState) diff --git a/include/maintainer.php b/include/maintainer.php index b395a38..e856270 100644 --- a/include/maintainer.php +++ b/include/maintainer.php @@ -395,7 +395,7 @@ class maintainer return $hResult; } - function ObjectGetEntries($sState, $iRows = 0, $iStart = 0) + function ObjectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true) { /* Not implemented */ if($sState == 'rejected') diff --git a/include/monitor.php b/include/monitor.php index afa724d..e955454 100644 --- a/include/monitor.php +++ b/include/monitor.php @@ -299,7 +299,7 @@ class Monitor { return ""; } - function objectGetEntries($sState) + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true) { $hResult = query_parameters("SELECT * FROM appMonitors"); diff --git a/include/note.php b/include/note.php index af951c2..30cbed6 100644 --- a/include/note.php +++ b/include/note.php @@ -320,7 +320,7 @@ class Note { // do not support queuing at this point // TODO: we have no permissions scope on retrieving entries // as notes are typically only added to unqueued versions - function objectGetEntries($sState) + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true) { $sQuery = "select * from appNotes"; $hResult = query_parameters($sQuery); diff --git a/include/objectManager.php b/include/objectManager.php index bb7e319..c3d958a 100644 --- a/include/objectManager.php +++ b/include/objectManager.php @@ -271,39 +271,18 @@ class ObjectManager /* Set the sort info */ $this->setSortInfo($aClean); + if(!$this->oSortInfo->sCurrentSort) + $this->oSortInfo->sCurrentSort = $this->getOptionalSetting('objectGetDefaultSort', ''); + /* query the class for its entries */ /* We pass in queue states to tell the object */ /* if we are requesting a list of its queued objects or */ /* all of its objects */ - if($this->oMultiPage->bEnabled) - { - /* Has the user chosen a particular field to sort by? If not we want to use the default */ - if($this->oSortInfo->sCurrentSort) - { - $hResult = $oObject->objectGetEntries($this->sState, - $this->oMultiPage->iItemsPerPage, - $this->oMultiPage->iLowerLimit, - $this->oSortInfo->sCurrentSort, - $this->oSortInfo->bAscending); - } else - { - $hResult = $oObject->objectGetEntries($this->sState, - $this->oMultiPage->iItemsPerPage, - $this->oMultiPage->iLowerLimit); - } - } else - { - /* Has the user chosen a particular field to sort by? If not we want to use the default */ - if($this->oSortInfo->sCurrentSort) - { - $hResult = $oObject->objectGetEntries($this->sState, - $this->oSortInfo->sCurrentSort, - $this->oSortInfo->bAscending); - } else - { - $hResult = $oObject->objectGetEntries($this->sState); - } - } + $hResult = $oObject->objectGetEntries($this->sState, + $this->oMultiPage->iItemsPerPage, + $this->oMultiPage->iLowerLimit, + $this->oSortInfo->sCurrentSort, + $this->oSortInfo->bAscending); /* did we get any entries? */ if(!$hResult || query_num_rows($hResult) == 0) diff --git a/include/screenshot.php b/include/screenshot.php index d2208ce..9556085 100644 --- a/include/screenshot.php +++ b/include/screenshot.php @@ -649,9 +649,9 @@ class screenshot echo "
\n"; } - function objectGetEntries($sState, $iRows = 0, $iStart = 0) + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true) { - return appData::objectGetEntries($sState, $iRows, $iStart, + return appData::objectGetEntries($sState, $iRows, $iStart, $sOrderBy, $bAscending, 'screenshot'); } diff --git a/include/testData.php b/include/testData.php index 0892d5a..e415b64 100644 --- a/include/testData.php +++ b/include/testData.php @@ -1202,7 +1202,12 @@ class testData{ return $oRow->count; } - function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId") + public static function objectGetDefaultSort() + { + return 'testingId'; + } + + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId", $bAscending = true) { $oTest = new testData(); diff --git a/include/testData_queue.php b/include/testData_queue.php index 7831015..fcc5992 100644 --- a/include/testData_queue.php +++ b/include/testData_queue.php @@ -142,9 +142,14 @@ class testData_queue $this->oTestData->objectDisplayAddItemHelp(); } - function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId") + public static function objectGetDefaultSort() { - return $this->oTestData->objectGetEntries($sState, $iRows, $iStart, $sOrderBy); + return testData::objectGetDefaultSort(); + } + + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId", $bAscending = true) + { + return $this->oTestData->objectGetEntries($sState, $iRows, $iStart, $sOrderBy, $bAscending); } function objectGetEntriesCount($sState) diff --git a/include/vendor.php b/include/vendor.php index 5ea8ca2..e3a16dd 100644 --- a/include/vendor.php +++ b/include/vendor.php @@ -242,6 +242,11 @@ class Vendor { return array('vendorName'); } + public static function objectGetDefaultSort() + { + return 'vendorName'; + } + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = 'vendorName', $bAscending = TRUE) { /* Not implemented */ diff --git a/include/version.php b/include/version.php index e8dcc34..674c180 100644 --- a/include/version.php +++ b/include/version.php @@ -1544,7 +1544,12 @@ class version { return array($aItemsPerPage, $iDefaultPerPage); } - public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId") + public static function objectGetDefaultSort() + { + return 'versionId'; + } + + public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true) { $sLimit = ""; diff --git a/include/version_queue.php b/include/version_queue.php index 95e3d93..18cf062 100644 --- a/include/version_queue.php +++ b/include/version_queue.php @@ -235,10 +235,15 @@ class version_queue return $this->oVersion->objectGetEntriesCount($sState); } - function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId") + public static function objectGetDefaultSort() + { + return version::objectGetDefaultSort(); + } + + function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true) { return $this->oVersion->objectGetEntries($sState, $iRows, $iStart, - $sOrderBy); + $sOrderBy, $bAscending); } function objectGetHeader()