Support previewing applications

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-10-23 14:16:00 +02:00
committed by Chris Morgan
parent 58ef8e62e5
commit fb13cd7c13
3 changed files with 27 additions and 5 deletions

View File

@@ -37,6 +37,7 @@ class Application {
var $sSubmitTime; var $sSubmitTime;
var $iSubmitterId; var $iSubmitterId;
var $aVersionsIds; // an array that contains the versionId of every version linked to this app. 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 var $iMaintainerRequest; /* Temporary variable for tracking maintainer
requests on app submission. Value denotes type of request */ requests on app submission. Value denotes type of request */
@@ -45,6 +46,8 @@ class Application {
*/ */
public function Application($iAppId = null, $oRow = null) public function Application($iAppId = null, $oRow = null)
{ {
$this->aVersions = array(); // Should always be an array
// we are working on an existing application // we are working on an existing application
if(!$iAppId && !$oRow) if(!$iAppId && !$oRow)
return; return;
@@ -500,6 +503,10 @@ class Application {
mail_appdb($sEmail, $sSubject ,$sMsg); mail_appdb($sEmail, $sSubject ,$sMsg);
} }
public function objectShowPreview()
{
return TRUE;
}
/* output a html table and this applications values to the fields for editing */ /* output a html table and this applications values to the fields for editing */
public function outputEditor($sVendorName = "") 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."); echo html_frame_end("For more details and user comments, view the versions of this application.");
// display versions // display versions
Version::displayList($this->aVersionsIds); Version::displayList($this->getVersions());
// display bundle // display bundle
$this->displayBundle(); $this->displayBundle();
@@ -1070,6 +1077,10 @@ class Application {
public function getVersions($bIncludeObsolete = TRUE) 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(); $aVersions = array();
$hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete); $hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete);

View File

@@ -152,6 +152,14 @@ class application_queue
return $this->oApp->objectGetMail($sAction, $bMailSubmitter, $bParentAction); return $this->oApp->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
} }
public function objectShowPreview()
{
if($this->oApp->sName)
return TRUE;
return FALSE;
}
function outputEditor() function outputEditor()
{ {
/* We ask the user for the application name first so as to avoid duplicate /* We ask the user for the application name first so as to avoid duplicate
@@ -291,6 +299,10 @@ class application_queue
function display() 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(); $this->oApp->display();
} }

View File

@@ -1097,9 +1097,9 @@ class version {
} }
// display the versions // display the versions
public static function displayList($aVersionsIds) public static function displayList($aVersions)
{ {
if ($aVersionsIds) if ($aVersions)
{ {
echo html_frame_start("","98%","",0); echo html_frame_start("","98%","",0);
@@ -1137,9 +1137,8 @@ class version {
$oTable->SetHeader($oTableRow); $oTable->SetHeader($oTableRow);
$c = 0; $c = 0;
foreach($aVersionsIds as $iVersionId) foreach($aVersions as $oVersion)
{ {
$oVersion = new Version($iVersionId);
$oApp = new application($oVersion->iAppId); $oApp = new application($oVersion->iAppId);
if ($oVersion->sQueued == $oApp->sQueued) if ($oVersion->sQueued == $oApp->sQueued)
{ {