diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 3e9e75c..f303191 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -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); diff --git a/appsubmit.php b/appsubmit.php index 31b8a7a..e539612 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -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 "\n"; diff --git a/include/appData.php b/include/appData.php index 95bbc5d..deacba7 100644 --- a/include/appData.php +++ b/include/appData.php @@ -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; diff --git a/include/downloadurl.php b/include/downloadurl.php index 9588327..38db4c1 100644 --- a/include/downloadurl.php +++ b/include/downloadurl.php @@ -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.
"; + + $sReturn .= html_tr(array( + array("Download URL", "valign=\"top\""), + array("", + "class=\"color4\"")), + "color0"); + + $sReturn .= html_tr(array( + array("Download URL Description", "valign=\"top\""), + array("", + "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))