Allow download urls on version submission
This commit is contained in:
committed by
WineHQ
parent
dde9a6a19b
commit
8afd6878d8
@@ -193,6 +193,9 @@ if ($aClean['sSub'])
|
||||
$oVersion->unQueue();
|
||||
$oTest->update(true);
|
||||
$oTest->unQueue();
|
||||
|
||||
downloadurl::processFormSingle($oVersion->iVersionId, $aClean, TRUE);
|
||||
|
||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
||||
}
|
||||
else if ($aClean['sSub'] == 'duplicate')
|
||||
@@ -377,6 +380,8 @@ if ($aClean['sSub'])
|
||||
|
||||
$oVersion->outputEditor(false, false);
|
||||
|
||||
echo downloadurl::outputEditorSingle($oVersion->iVersionId, $aClean);
|
||||
|
||||
$oTest->outputEditor($aClean['sDistribution']);
|
||||
|
||||
echo html_frame_start("Reply text", "90%", "", 0);
|
||||
|
||||
@@ -216,6 +216,9 @@ if ($aClean['sSub'])
|
||||
{
|
||||
$oTest->create();
|
||||
}
|
||||
|
||||
downloadurl::processFormSingle($oVersion->iVersionId, $aClean);
|
||||
|
||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
||||
}
|
||||
}
|
||||
@@ -351,6 +354,8 @@ if ($aClean['sSub'])
|
||||
|
||||
$oVersion->outputEditor(false, false);
|
||||
|
||||
echo downloadurl::outputEditorSingle($iVersionId, $aClean);
|
||||
|
||||
$oTest->outputEditor($aClean['sDistribution'],true);
|
||||
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=2>\n";
|
||||
|
||||
@@ -53,7 +53,7 @@ class appData
|
||||
}
|
||||
|
||||
/* Get appData for a given version/application, optionally filter by type */
|
||||
function getData($iId, $sType, $bIsVersion = TRUE)
|
||||
function getData($iId, $sType, $bIsVersion = TRUE, $bQueued = FALSE)
|
||||
{
|
||||
$iAppId = 0;
|
||||
$iVersionId = 0;
|
||||
@@ -63,7 +63,9 @@ class appData
|
||||
else
|
||||
$iAppId = $iId;
|
||||
|
||||
$hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND versionId = '?' AND TYPE = '?'", $iAppId, $iVersionId, $sType);
|
||||
$hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND
|
||||
versionId = '?' AND TYPE = '?' AND queued = '?'",
|
||||
$iAppId, $iVersionId, $sType, $bQueued ? "true" : "false");
|
||||
|
||||
if(!$hResult || !mysql_num_rows($hResult))
|
||||
return FALSE;
|
||||
|
||||
@@ -222,6 +222,50 @@ class downloadurl
|
||||
}
|
||||
}
|
||||
|
||||
/* Output an editor for a single new URL */
|
||||
function outputEditorSingle($iVersionId = NULL, $aValues = NULL)
|
||||
{
|
||||
if($iVersionId)
|
||||
{
|
||||
if($hResult = appData::getData($iVersionId, "downloadurl",
|
||||
TRUE, TRUE))
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$sDownloadUrlUrl = $oRow->url;
|
||||
$sDownloadUrlDescription = $oRow->description;
|
||||
}
|
||||
} else
|
||||
{
|
||||
$sDownloadUrlUrl = $aValues["sDownloadUrlUrl"];
|
||||
$sDownloadUrlDescription = $aValues["sDownloadUrlDescription"];
|
||||
}
|
||||
|
||||
$sReturn .= html_frame_start("Download URL","90%");
|
||||
$sReturn .= html_table_begin("");
|
||||
|
||||
$sReturn .= "A place where this version can be downloaded for free".
|
||||
" (if applicable). You can add more links later.<br />";
|
||||
|
||||
$sReturn .= html_tr(array(
|
||||
array("Download URL", "valign=\"top\""),
|
||||
array("<input type=\"text\" name=\"sDownloadUrlUrl\" ".
|
||||
"value=\"$sDownloadUrlUrl\" size=\"60\" />",
|
||||
"class=\"color4\"")),
|
||||
"color0");
|
||||
|
||||
$sReturn .= html_tr(array(
|
||||
array("Download URL Description", "valign=\"top\""),
|
||||
array("<input type=\"text\" name=\"sDownloadUrlDescription\" ".
|
||||
"value=\"$sDownloadUrlDescription\" size=\"60\" />",
|
||||
"class=\"color4\"")),
|
||||
"color0");
|
||||
|
||||
$sReturn .= html_table_end();
|
||||
$sReturn .= html_frame_end("nbsp;");
|
||||
|
||||
return $sReturn;
|
||||
}
|
||||
|
||||
function create()
|
||||
{
|
||||
if(!$this->sUrl or !$this->sDescription or !$this->iVersionId)
|
||||
@@ -255,6 +299,42 @@ class downloadurl
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Process a form made only for submitting one URL */
|
||||
function processFormSingle($iVersionId, $aValues, $bUnQueue = FALSE)
|
||||
{
|
||||
if($hResult = appData::getData($iVersionId, "downloadurl", TRUE, TRUE))
|
||||
$iId = mysql_fetch_object($hResult)->id;
|
||||
|
||||
$oDownloadurl = new downloadurl($iId);
|
||||
|
||||
$oDownloadurl->sDescription = $aValues['sDownloadUrlDescription'];
|
||||
$oDownloadurl->sUrl = $aValues['sDownloadUrlUrl'];
|
||||
$oDownloadurl->iVersionId = $iVersionId;
|
||||
|
||||
if($iId)
|
||||
$oDownloadurl->update();
|
||||
else
|
||||
$oDownloadurl->create();
|
||||
|
||||
if($bUnQueue)
|
||||
$oDownloadurl->unQueue();
|
||||
}
|
||||
|
||||
function unQueue()
|
||||
{
|
||||
if(!$this->canEdit($this->iVersionId))
|
||||
return FALSE;
|
||||
|
||||
$hResult = query_parameters("UPDATE appData SET queued = '?'
|
||||
WHERE id = '?'",
|
||||
"false", $this->iId);
|
||||
|
||||
if(!$hResult)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
if(!downloadurl::canEdit($this->iVersionId))
|
||||
|
||||
Reference in New Issue
Block a user