Allow marking versions as obsolete

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-09-08 22:52:00 +00:00
committed by WineHQ
parent 4d65a32e17
commit d2a53b510c
4 changed files with 130 additions and 22 deletions

View File

@@ -96,10 +96,15 @@ class Application {
}
}
function _internal_retrieve_all_versions()
function _internal_retrieve_all_versions($bIncludeObsolete = TRUE)
{
if(!$bIncludeObsolete)
$sObsolete = " AND obsoleteBy = '0'";
else
$sObsolete = "";
$sQuery = "SELECT versionId FROM appVersion WHERE
appId = '?'";
appId = '?'$sObsolete";
$hResult = query_parameters($sQuery, $this->iAppId);
return $hResult;
}
@@ -986,11 +991,11 @@ class Application {
return $oRow->count;
}
function getVersions()
function getVersions($bIncludeObsolete = TRUE)
{
$aVersions = array();
$hResult = $this->_internal_retrieve_all_versions();
$hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete);
while($oRow = mysql_fetch_object($hResult))
$aVersions[] = new version($oRow->versionId);
@@ -998,6 +1003,29 @@ class Application {
return $aVersions;
}
/* Make a drop-down list of this application's versions. Optionally set the default
versionId, a version to exclude and whether to not show obsolete versions */
function makeVersionDropDownList($sVarName, $iCurrentId = null, $iExclude = null, $bIncludeObsolete = TRUE)
{
$sMsg = "<select name=\"$sVarName\">\n";
foreach($this->getVersions() as $oVersion)
{
if($oVersion->sQueued != "false" || $oVersion->iVersionId == $iExclude ||
(!$bIncludeObsolete && $oVersion->iObsoleteBy))
continue;
$sMsg .= "<option value=\"".$oVersion->iVersionId."\"";
if($oVersion->iVersionId == $iCurrentId)
$sMsg .= " selected=\"selected\"";
$sMsg .= ">".$oVersion->sName."</option>\n";
}
$sMsg .= "</select>\n";
return $sMsg;
}
function objectGetChildren()
{
$aChildren = array();