Alexander Nicolaysen Sørnes : Allow previewing versions
Chris Morgan
cmorgan at winehq.org
Mon Oct 22 18:32:03 CDT 2007
Module: appdb
Branch: master
Commit: cdee3a77e9b263c7cc276460ec487dce3ed47dcf
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=cdee3a77e9b263c7cc276460ec487dce3ed47dcf
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Mon Oct 22 17:59:40 2007 +0200
Allow previewing versions
---
include/version.php | 31 +++++++++++++++++++++----------
include/version_queue.php | 11 ++++++++++-
2 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/include/version.php b/include/version.php
index 0f91e7e..6da13c4 100644
--- a/include/version.php
+++ b/include/version.php
@@ -746,7 +746,13 @@ class version {
}
}
- public function display($aVars)
+ public function objectShowPreview()
+ {
+ return TRUE;
+ }
+
+ /* $oTest can be passed by version_queue to allow previewing a version, in which case the test id may not be defined */
+ public function display($aVars, $oTest = null)
{
/* is this user supposed to view this version? */
if(!$_SESSION['current']->canViewVersion($this))
@@ -760,10 +766,6 @@ class version {
if(!$oApp->iAppId)
util_show_error_page_and_exit('Internal Database Access Error. No App found.');
- // Oops! Version not found or other error. do something
- if(!$this->iVersionId)
- util_show_error_page_and_exit('Internal Database Access Error. No Version Found.');
-
// show Vote Menu
if($_SESSION['current']->isLoggedIn())
apidb_sidebar_add("vote_menu");
@@ -976,10 +978,13 @@ class version {
echo "\t<div class='title_class'>\n";
echo "\t\tSelected test results <small><small>(selected in 'Test Results' table below)</small></small>\n";
echo "\t</div>\n";
- $oTest = new testData($iTestingId);
+
+ /* oTest may be passed by version_queue to allow previewing a version which does not exist in the database */
+ if(!$oTest && $iTestingId)
+ $oTest = new testData($iTestingId);
/* if $iTestingId wasn't valid then it won't be valid in $oTest */
- if(!$oTest->iTestingId)
+ if(!$oTest)
{
/* fetch a new test id for this version */
$iTestingId = testData::getNewestTestIdFromVersionId($this->iVersionId);
@@ -999,9 +1004,14 @@ class version {
// show the test results table
if($oTest->iTestingId)
{
- $oTest->ShowVersionsTestingTable($this->objectMakeUrl()."&iTestingId=",
- 5);
+ $oTest->ShowVersionsTestingTable($this->objectMakeUrl()."&iTestingId=", 5);
+ } else /* We are previewing the version */
+ {
+ $oTable = $oTest->CreateTestTable();
+ $oTable->AddRow($oTest->CreateTestTableRow(0, ""));
+ echo $oTable->GetString();
}
+
if($_SESSION['current']->isLoggedIn())
{
echo '<form method=post name=sMessage action=objectManager.php?'.
@@ -1040,7 +1050,8 @@ class version {
}
// Comments Section
- Comment::view_app_comments($this->iVersionId);
+ if($this->iVersionId)
+ Comment::view_app_comments($this->iVersionId);
}
public static function lookup_name($versionId)
diff --git a/include/version_queue.php b/include/version_queue.php
index 03fa3f1..e3eaa61 100644
--- a/include/version_queue.php
+++ b/include/version_queue.php
@@ -162,6 +162,7 @@ class version_queue
function getOutputEditorValues($aClean)
{
+ $this->oVersion->iAppId = $aClean['iAppId'];
$this->oVersion->getOutputEditorValues($aClean);
$this->oTestDataQueue->getOutputEditorValues($aClean);
}
@@ -214,9 +215,17 @@ class version_queue
return $this->oVersion->objectGetTableRow();
}
+ public function objectShowPreview()
+ {
+ return $this->oVersion->objectShowPreview();
+ }
+
function display()
{
- $this->oVersion->display();
+ $aVars = array();
+ $aVars['iTestingId'] = 0;
+
+ $this->oVersion->display($aVars, $this->oTestDataQueue->oTestData);
}
function objectMakeUrl()
More information about the wine-cvs
mailing list