Alexander Nicolaysen Sørnes : Replace browse_newest_apps class using sorting
Chris Morgan
cmorgan at winehq.org
Fri Nov 9 18:45:34 CST 2007
Module: appdb
Branch: master
Commit: 7e66843cc4b54c7173fae83affd95129f53fd41a
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=7e66843cc4b54c7173fae83affd95129f53fd41a
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Fri Nov 9 23:10:34 2007 +0100
Replace browse_newest_apps class using sorting
---
include/application.php | 2 +-
include/browse_newest_apps.php | 176 ----------------------------------------
include/sidebar.php | 4 +-
objectManager.php | 1 -
unit_test/test_om_objects.php | 7 --
5 files changed, 3 insertions(+), 187 deletions(-)
diff --git a/include/application.php b/include/application.php
index 8449e6a..c2e2501 100644
--- a/include/application.php
+++ b/include/application.php
@@ -943,7 +943,7 @@ class Application {
public static function objectGetSortableFields()
{
- return array("submitTime", "appName");
+ return array('submitTime', 'appName', 'appId');
}
public static function objectGetHeader()
diff --git a/include/browse_newest_apps.php b/include/browse_newest_apps.php
deleted file mode 100644
index b7b5ba8..0000000
--- a/include/browse_newest_apps.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-// class lists the newest applications and versions in the database
-
-class browse_newest_apps
-{
- var $iAppId;
-
- // constructor doesn't need to perform any queries. we provide a constructor for
- // browse_newest_apps because the objectManager requires an instance for some methods
- function browse_newest_apps($iAppId = null, $oRow = null)
- {
- if(!$iAppId && !$oRow)
- return;
-
- if(!$oRow)
- {
- $this->iAppId = $iAppId;
- }
-
- if($oRow)
- {
- $this->iAppId = $oRow->appId;
- }
- }
-
- function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
- {
- // We don't implement queues or rejected applications
- if($bQueued || $bRejected)
- return false;
-
-
- // if row limit is 0 we want to fetch all rows
- if(!$iRows)
- {
- $iRows = browse_newest_apps::objectGetEntriesCount($bQueued, $bRejected);
- }
-
- $sQuery = "SELECT appId, appName, description, submitTime FROM appFamily WHERE".
- " queued = '?' ORDER BY appId DESC LIMIT ?,?";
-
- return query_parameters($sQuery, $bQueued ? "true" : "false",
- $iStart, $iRows);
- }
-
- function objectGetEntriesCount($bQueued, $bRejected)
- {
- // We don't implement queues or rejected applications
- if($bQueued || $bRejected)
- {
- return 0;
- }
-
- return application::objectGetEntriesCount($bQueued, $bRejected);
- }
-
- function objectGetHeader()
- {
- $oTableRow = new TableRow();
-
- $oTableCell = new TableCell("Submission Date");
- $oTableRow->AddCell($oTableCell);
-
- $oTableCell = new TableCell("Application");
- $oTableRow->AddCell($oTableCell);
-
- $oTableCell = new TableCell("Description");
- $oTableRow->AddCell($oTableCell);
-
- return $oTableRow;
- }
-
- function objectGetTableRow()
- {
- $oApp = new application($this->iAppId);
-
- $oTableRow = new TableRow();
-
- $oTableCell = new TableCell(print_short_date(mysqldatetime_to_unixtimestamp($oApp->sSubmitTime)));
- $oTableCell->SetWidth("20%");
- $oTableRow->AddCell($oTableCell);
- $oTableRow->AddTextCell($oApp->objectMakeLink());
- $oTableRow->AddTextCell(util_trim_description($oApp->sDescription));
-
- // make the row clickable
- $oTableRowClick = new TableRowClick($oApp->objectMakeUrl());
- $oTableRow->SetRowClick($oTableRowClick);
-
- $oOMTableRow = new OMTableRow($oTableRow);
- return $oOMTableRow;
- }
-
- function objectGetItemsPerPage($bQueued = false)
- {
- $aItemsPerPage = array(25, 50, 100, 200);
- $iDefaultPerPage = 25;
- return array($aItemsPerPage, $iDefaultPerPage);
- }
-
- function objectGetChildren()
- {
- $oApp = new application($this->iAppId);
- return $oApp->objectGetChildren();
- }
-
- function objectGetSubmitterId()
- {
- $oApp = new application($this->iAppId);
- return $oApp->objectGetSubmitterId();
- }
-
- function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
- {
- $oApp = new application($this->iAppId);
- return $oApp->objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction);
- }
-
- function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
- {
- $oApp = new application($this->iAppId);
- return $oApp->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
- }
-
- function objectGetId()
- {
- return $this->iAppId;
- }
-
- // stub implementation
- function allowAnonymousSubmissions()
- {
- return false;
- }
-
- // stub canEdit() out, no one can edit these entries
- function canEdit()
- {
- return false;
- }
-
- // stub implementation
- function display()
- {
- }
-
- // stub implementation
- function outputEditor()
- {
- }
-
- // stub implementation
- function getOutputEditorValues($aValues)
- {
- }
-
- // stub implementation
- function objectMakeLink()
- {
- $oApp = new Application($this->iAppId);
- return $oApp->objectMakeLink();
- }
-
- // stub implementation
- function objectMakeUrl()
- {
- }
-
- // stub implementation
- function mustBeQueued()
- {
- return false;
- }
-}
-
-?>
diff --git a/include/sidebar.php b/include/sidebar.php
index b24fcaf..270adc1 100644
--- a/include/sidebar.php
+++ b/include/sidebar.php
@@ -20,8 +20,8 @@ function global_sidebar_menu()
$g = new htmlmenu("AppDB");
$g->add("Screenshots", BASE."viewScreenshots.php");
$g->add("Browse Apps", BASE."appbrowse.php");
- $g->add("Browse Newest Apps", BASE."objectManager.php?sClass=browse_newest_apps&".
- "bIsQueue=false&sTitle=Newest%20apps");
+ $g->add("Browse Newest Apps", BASE."objectManager.php?sClass=application&".
+ "bIsQueue=false&sTitle=Newest%20apps&sOrderBy=appId&bAscending=false");
$g->add("Downloadable Apps", BASE."browse_downloadable.php");
$g->add("Browse Apps by Rating", BASE."browse_by_rating.php");
$g->add("Top 25", BASE."votestats.php");
diff --git a/objectManager.php b/objectManager.php
index d50fe6f..11f1e23 100644
--- a/objectManager.php
+++ b/objectManager.php
@@ -22,7 +22,6 @@ require_once(BASE.'include/objectManager.php');
require_once(BASE.'include/application_queue.php');
require_once(BASE.'include/version_queue.php');
require_once(BASE.'include/testData_queue.php');
-require_once(BASE.'include/browse_newest_apps.php');
require_once(BASE.'include/bugs.php');
/* if we have no valid class name we should abort */
diff --git a/unit_test/test_om_objects.php b/unit_test/test_om_objects.php
index 82b018d..7e1695a 100644
--- a/unit_test/test_om_objects.php
+++ b/unit_test/test_om_objects.php
@@ -10,7 +10,6 @@ require_once(BASE.'include/maintainer.php');
require_once(BASE.'include/testData_queue.php');
require_once(BASE.'include/version_queue.php');
require_once(BASE.'include/application_queue.php');
-require_once(BASE.'include/browse_newest_apps.php');
require_once(BASE.'include/monitor.php');
require_once(BASE.'include/bugs.php');
@@ -28,11 +27,6 @@ function test_class($sClassName, $aTestMethods)
return false;
}
- // TODO: work around for 'browse_newest_apps' class
- // since we can't create a new database object of browse_newest_apps
- if($sClassName == "browse_newest_apps")
- return true;
-
/* Set up test user */
$sTestEmail = __FUNCTION__."@localhost.com";
$sTestPassword = "password";
@@ -275,7 +269,6 @@ function test_object_methods()
$aTestClasses = array("application",
"application_queue",
- "browse_newest_apps",
"bug",
"distribution",
"downloadurl",
More information about the wine-cvs
mailing list