downloadurl: Add more objectManager functions. Allow us to unqueue queued downloadurls that are

currently stuck in limbo.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-05-31 02:40:01 +00:00
committed by WineHQ
parent b2b950cb10
commit cb18a07f60
2 changed files with 77 additions and 1 deletions

View File

@@ -57,8 +57,21 @@ class downloadurl
}
/* Output an editor for Download URL fields */
function outputEditor($oVersion, $sFormAction)
function outputEditor($oVersion = null, $sFormAction = null)
{
/* If we do not get any parameters we try to behave like a proper objectManager
object, by only showing an editor for one entry instead of several. This
code is sort of hacky, and should be fixed once the rest of the downloadurl
code is fully adapted to the objectManager */
if(!$oVersion && !$sFormAction)
{
global $aClean;
echo downloadurl::outputEditorSingle($this->iVersionId);
}
if(!$oVersion || !$sFormAction)
return FALSE;
/* Check for correct permissions */
if(!downloadurl::canEdit($oVersion->iVersionId))
return FALSE;
@@ -356,6 +369,64 @@ class downloadurl
return TRUE;
}
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
{
return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
"downloadurl");
}
function objectGetHeader()
{
return appData::objectGetHeader("downloadurl");
}
/* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */
function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
{
$oAppData = new AppData();
$oAppData->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel);
}
function objectGetInstanceFromRow($oRow)
{
return new appData($oRow->id, $oRow);
}
function getOutputEditorValues($aClean)
{
$this->sUrl = $aClean['sDownloadUrlUrl'];
$this->sDescription = $aClean['sDownloadUrlDescription'];
}
function mustBeQueued()
{
if($this)
{
$oAppData = new appData();
$oAppData->iVersionId = $this->iVersionId;
$oAppData->iAppId = NULL;
return $oAppData->mustBeQueued();
} else
return appData::mustBeQueued();
}
function allowAnonymousSubmissions()
{
return FALSE;
}
function objectMakeLink()
{
/* FIXME: not implemented */
return TRUE;
}
function objectMakeUrl()
{
/* FIXME: not implemented */
return TRUE;
}
}
?>

View File

@@ -49,6 +49,10 @@ function test_class($sClassName, $aTestMethods)
$oTestObject->sName = "Silly test distribution";
$oTestObject->sUrl = "http://appdb.winehq.org/";
break;
case "downloadurl":
$oTestObject->sUrl = "http://appdb.winehq.org/";
$oTestObject->sDescription = "DANGER";
$oTestObject->iVersionId = 65000; // Just needs to be != 0
case "maintainer":
$iAppId = 65555;
$oApp = new application();
@@ -139,6 +143,7 @@ function test_object_methods()
$aTestClasses = array("application",
"application_queue",
"distribution",
"downloadurl",
"maintainer",
"screenshot",
"testData",