Alexander Nicolaysen Sørnes : Support previewing applications

Chris Morgan cmorgan at winehq.org
Tue Oct 23 18:31:16 CDT 2007


Module: appdb
Branch: master
Commit: fb13cd7c13a9aaf2c3fef4ce468baabb73cad48b
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=fb13cd7c13a9aaf2c3fef4ce468baabb73cad48b

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Tue Oct 23 14:16:00 2007 +0200

Support previewing applications

---

 include/application.php       |   13 ++++++++++++-
 include/application_queue.php |   12 ++++++++++++
 include/version.php           |    7 +++----
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/include/application.php b/include/application.php
index 15bf660..386fd74 100644
--- a/include/application.php
+++ b/include/application.php
@@ -37,6 +37,7 @@ class Application {
     var $sSubmitTime;
     var $iSubmitterId;
     var $aVersionsIds;  // an array that contains the versionId of every version linked to this app.
+    var $aVersions; // Array of version objects belonging to this app
     var $iMaintainerRequest; /* Temporary variable for tracking maintainer
                                 requests on app submission.  Value denotes type of request */
 
@@ -45,6 +46,8 @@ class Application {
      */
     public function Application($iAppId = null, $oRow = null)
     {
+        $this->aVersions = array(); // Should always be an array
+
         // we are working on an existing application
         if(!$iAppId && !$oRow)
             return;
@@ -500,6 +503,10 @@ class Application {
             mail_appdb($sEmail, $sSubject ,$sMsg);
     } 
 
+    public function objectShowPreview()
+    {
+        return TRUE;
+    }
 
     /* output a html table and this applications values to the fields for editing */
     public function outputEditor($sVendorName = "")
@@ -801,7 +808,7 @@ class Application {
         echo html_frame_end("For more details and user comments, view the versions of this application.");
 
         // display versions
-        Version::displayList($this->aVersionsIds);
+        Version::displayList($this->getVersions());
 
         // display bundle
         $this->displayBundle();
@@ -1070,6 +1077,10 @@ class Application {
 
     public function getVersions($bIncludeObsolete = TRUE)
     {
+        /* If no id is set we cannot query for the versions, but perhaps objects are already cached? */
+        if(!$this->iAppId)
+            return $this->aVersions;
+
         $aVersions = array();
 
         $hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete);
diff --git a/include/application_queue.php b/include/application_queue.php
index 3aa82cb..883e126 100644
--- a/include/application_queue.php
+++ b/include/application_queue.php
@@ -152,6 +152,14 @@ class application_queue
         return $this->oApp->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
     }
 
+    public function objectShowPreview()
+    {
+        if($this->oApp->sName)
+            return TRUE;
+
+        return FALSE;
+    }
+
     function outputEditor()
     {
         /* We ask the user for the application name first so as to avoid duplicate
@@ -291,6 +299,10 @@ class application_queue
 
     function display()
     {
+        /* Cache the version object if it is not in the database */
+        if(!$this->oVersionQueue->objectGetId())
+            $this->oApp->aVersions = array($this->oVersionQueue->oVersion);
+
         $this->oApp->display();
     }
 
diff --git a/include/version.php b/include/version.php
index 63a5e03..8d49bf3 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1097,9 +1097,9 @@ class version {
     }
 
     // display the versions
-    public static function displayList($aVersionsIds)
+    public static function displayList($aVersions)
     {
-        if ($aVersionsIds)
+        if ($aVersions)
         {
             echo html_frame_start("","98%","",0);
 
@@ -1137,9 +1137,8 @@ class version {
             $oTable->SetHeader($oTableRow);
 
             $c = 0;
-            foreach($aVersionsIds as $iVersionId)
+            foreach($aVersions as $oVersion)
             {
-                $oVersion = new Version($iVersionId);
                 $oApp = new application($oVersion->iAppId);
                 if ($oVersion->sQueued == $oApp->sQueued)
                 {




More information about the wine-cvs mailing list