Move hidden fields used by application and version class into their OutputEditor() member functions. Fix broken old style calls to application and version update() functions that were passing parameters in. Fix broken application::CheckOutputEditorInput()

This commit is contained in:
Chris Morgan
2005-10-16 04:24:37 +00:00
committed by WineHQ
parent 93ab2587ef
commit 657167e8a5
7 changed files with 85 additions and 55 deletions

View File

@@ -419,6 +419,8 @@ class Application {
{
HtmlAreaLoaderScript(array("app_editor"));
echo '<input type="hidden" name="appId" value="'.$this->iAppId.'">';
echo html_frame_start("Application Form", "90%", "", 0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
echo '<tr valign=top><td class="color0"><b>Application name</b></td>',"\n";
@@ -464,20 +466,20 @@ class Application {
{
$errors = "";
if (empty($_REQUEST['appCatId']) && !$_REQUEST['appId'])
if (empty($_REQUEST['appCatId']))
$errors .= "<li>Please enter a category for your application.</li>\n";
if (strlen($_REQUEST['appName']) > 200 )
$errors .= "<li>Your application name is too long.</li>\n";
if (empty($_REQUEST['appName']) && !$_REQUEST['appId'])
if (empty($_REQUEST['appName']))
$errors .= "<li>Please enter an application name.</li>\n";
// No vendor entered, and nothing in the list is selected
if (empty($_REQUEST['appVendorName']) && !$_REQUEST['appVendorId'] && !$_REQUEST['appId'])
if (empty($_REQUEST['appVendorName']) && !$_REQUEST['appVendorId'])
$errors .= "<li>Please enter a vendor.</li>\n";
if (empty($_REQUEST['appDescription']) && !$_REQUEST['appId'])
if (empty($_REQUEST['appDescription']))
$errors .= "<li>Please enter a description of your application.</li>\n";
return $errors;
@@ -488,6 +490,7 @@ class Application {
{
if(get_magic_quotes_gpc())
{
$this->iAppId = stripslashes($_REQUEST['appId']);
$this->sName = stripslashes($_REQUEST['appName']);
$this->sDescription = stripslashes($_REQUEST['appDescription']);
$this->iCatId = stripslashes($_REQUEST['appCatId']);
@@ -496,6 +499,7 @@ class Application {
$this->sKeywords = stripslashes($_REQUEST['appKeywords']);
} else
{
$this->iAppId = $_REQUEST['appId'];
$this->sName = $_REQUEST['appName'];
$this->sDescription = $_REQUEST['appDescription'];
$this->iCatId = $_REQUEST['appCatId'];

View File

@@ -215,7 +215,7 @@ class Version {
if ($this->sTestedRating && ($this->sTestedRating!=$oVersion->sTestedRating))
{
$sUpdate = compile_update_string(array('maintainer_rating' => $this->sTestedRating));
if (!query_appdb("UPDATE appVersion SET ".$sUpdate."' WHERE versionId = ".$this->iVersionId))
if (!query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
return false;
if($this->sTestedRating != "")
@@ -491,12 +491,14 @@ class Version {
/* if $editParentApplication is true that means we need to display fields */
/* to let the user change the parent application of this version */
/* otherwise, if $editParentAppliation is false, we leave them out */
function OutputEditor($editParentApplication)
function OutputEditor($editParentApplication, $editRatingAndRelease)
{
HtmlAreaLoaderScript(array("version_editor"));
echo html_frame_start("Version Form", "90%", "", 0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
echo '<input type="hidden" name="versionId" value='.$this->iVersionId.' />';
if($editParentApplication)
{
// app parent
@@ -505,6 +507,9 @@ class Version {
echo '<td>',"\n";
$x->make_option_list("appId",$this->iAppId,"appFamily","appId","appName");
echo '</td></tr>',"\n";
} else
{
echo '<input type="hidden" name="appId" value='.$this->iAppId.' />';
}
// version name
@@ -526,6 +531,24 @@ class Version {
echo '</table>',"\n";
echo html_frame_end();
if($editRatingAndRelease)
{
echo html_frame_start("Info", "90%", "", 0);
echo "<table border=0 cellpadding=2 cellspacing=0>\n";
echo '<tr><td class="color4">Rating</td><td class="color0">',"\n";
make_maintainer_rating_list("maintainer_rating", $this->sTestedRating);
echo '</td></tr>',"\n";
echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
make_bugzilla_version_list("maintainer_release", $this->sTestedRelease);
echo '</td></tr>',"\n";
echo html_table_end();
echo html_frame_end();
} else
{
echo '<input type="hidden" name="maintainer_rating" value='.$this->sTestedRating.' />';
echo '<input type="hidden" name="maintainer_release" value='.$this->sTestedRelease.' />';
}
}
function CheckOutputEditorInput()
@@ -546,12 +569,22 @@ class Version {
{
if(get_magic_quotes_gpc())
{
$this->iAppId = stripslashes($_REQUEST['appId']);
$this->iVersionId = stripslashes($_REQUEST['versionId']);
$this->sName = stripslashes($_REQUEST['versionName']);
$this->sDescription = stripslashes($_REQUEST['versionDescription']);
$this->sTestedRating = stripslashes($_REQUEST['maintainer_rating']);
$this->sTestedRelease = stripslashes($_REQUEST['maintainer_release']);
} else
{
$this->iAppId = $_REQUEST['appId'];
$this->iVersionId = $_REQUEST['versionId'];
$this->sName = $_REQUEST['versionName'];
$this->sDescription = $_REQUEST['versionDescription'];
$this->sTestedRating = $_REQUEST['maintainer_rating'];
$this->sTestedRelease = $_REQUEST['maintainer_release'];
}
}
}