Alexander Nicolaysen Sørnes : distribution: Make tables sortable
Chris Morgan
cmorgan at winehq.org
Mon Nov 26 20:05:37 CST 2007
Module: appdb
Branch: master
Commit: 6361b26cb206e1d973987aec585931d852d9dab1
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=6361b26cb206e1d973987aec585931d852d9dab1
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Mon Nov 26 23:43:27 2007 +0100
distribution: Make tables sortable
---
include/distribution.php | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/distribution.php b/include/distribution.php
index e82ab54..ef2c5be 100644
--- a/include/distribution.php
+++ b/include/distribution.php
@@ -492,9 +492,9 @@ class distribution {
function objectGetHeader()
{
- $oTableRow = new TableRow();
+ $oTableRow = new TableRowSortable();
- $oTableRow->AddTextCell("Distribution name");
+ $oTableRow->AddSortableTextCell("Distribution name", "name");
$oTableRow->AddTextCell("Distribution url");
@@ -505,7 +505,12 @@ class distribution {
return $oTableRow;
}
- function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
+ public static function objectGetSortableFields()
+ {
+ return array('name');
+ }
+
+ function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "name", $bAscending = TRUE)
{
/* Not implemented */
if($bRejected)
@@ -516,12 +521,14 @@ class distribution {
if($bQueued && !distribution::canEdit())
return NULL;
+ $sOrder = $bAscending ? "ASC" : "DESC";
+
/* If row limit is 0 we want to fetch all rows */
if(!$iRows)
$iRows = distribution::objectGetEntriesCount($bQueued, $bRejected);
$sQuery = "SELECT * FROM distributions
- WHERE queued = '?' ORDER BY name LIMIT ?,?";
+ WHERE queued = '?' ORDER BY $sOrderBy $sOrder LIMIT ?,?";
return query_parameters($sQuery, $bQueued ? "true" : "false",
$iStart, $iRows);
More information about the wine-cvs
mailing list