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:
@@ -224,10 +224,10 @@ if ($_REQUEST['sub'])
|
||||
if($oApp)
|
||||
{
|
||||
$oApp->OutputEditor($sVendor);
|
||||
$oVersion->OutputEditor(false);
|
||||
$oVersion->OutputEditor(false, false);
|
||||
} else
|
||||
{
|
||||
$oVersion->OutputEditor(true);
|
||||
$oVersion->OutputEditor(false, false);
|
||||
}
|
||||
|
||||
echo html_frame_start("Reply text", "90%", "", 0);
|
||||
@@ -238,11 +238,11 @@ if ($_REQUEST['sub'])
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
if ($oApp) //application
|
||||
{
|
||||
echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'" />';
|
||||
echo '<input type="hidden" name="apptype" value="application" />';
|
||||
echo '<input type=submit value=" Submit App Into Database " class=button> ',"\n";
|
||||
} else // app version
|
||||
{
|
||||
echo '<input type="hidden" name="versionId" value="'.$oVersion->iVersionId.'" />';
|
||||
echo '<input type="hidden" name="apptype" value="version" />';
|
||||
echo '<input type="submit" value=" Submit Version Into Database " class="button"> ',"\n";
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ if ($_REQUEST['sub'])
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'add')
|
||||
{
|
||||
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
|
||||
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
// add new vendor
|
||||
if($_REQUEST['appVendorName'])
|
||||
@@ -269,7 +269,7 @@ if ($_REQUEST['sub'])
|
||||
$oApp->GetOutputEditorValues();
|
||||
$oApp->update();
|
||||
$oApp->unQueue();
|
||||
} else if(is_numeric($_REQUEST['versionId']) && is_numeric($_REQUEST['appId'])) // version
|
||||
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->GetOutputEditorValues();
|
||||
@@ -296,7 +296,7 @@ if ($_REQUEST['sub'])
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'Delete')
|
||||
{
|
||||
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
|
||||
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
// get the queued versions that refers to the application entry we just removed
|
||||
// and delete them as we implicitly added a version entry when adding a new application
|
||||
@@ -314,7 +314,7 @@ if ($_REQUEST['sub'])
|
||||
// delete the application entry
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->delete();
|
||||
} else if(is_numeric($_REQUEST['versionId'])) // version
|
||||
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->delete();
|
||||
@@ -324,7 +324,7 @@ if ($_REQUEST['sub'])
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'Reject')
|
||||
{
|
||||
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
|
||||
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
// get the queued versions that refers to the application entry we just removed
|
||||
// and delete them as we implicitly added a version entry when adding a new application
|
||||
@@ -342,7 +342,7 @@ if ($_REQUEST['sub'])
|
||||
// delete the application entry
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->reject();
|
||||
} else if(is_numeric($_REQUEST['versionId'])) // version
|
||||
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->reject();
|
||||
@@ -474,7 +474,7 @@ else /* if ($_REQUEST['sub']) is not defined, display the main app queue page */
|
||||
echo " <td>".$sVendor."</td>\n";
|
||||
echo " <td>".$oApp->sName."</td>\n";
|
||||
echo " <td>".$oVersion->sName."</td>\n";
|
||||
echo " <td align=\"center\">[<a href=\"adminAppQueue.php?sub=view&versionId=".$oVersion->iVersionId."\">process</a>]</td>\n";
|
||||
echo " <td align=\"center\">[<a href=".$_SERVER['PHP_SELF']."?sub=view&versionId=".$oVersion->iVersionId.">process</a>]</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$c++;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ else
|
||||
|
||||
echo "<form method=\"post\" action=\"editAppFamily.php\">\n";
|
||||
|
||||
echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'">';
|
||||
|
||||
$oApp->OutputEditor("");
|
||||
|
||||
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">', "\n";
|
||||
|
||||
@@ -36,26 +36,19 @@ if(isset($_REQUEST['submit']))
|
||||
|
||||
echo "<form method=post action='editAppVersion.php'>\n";
|
||||
|
||||
$oVersion->OutputEditor(false); /* false = not allowing the user to modify the parent application */
|
||||
|
||||
echo '<input type="hidden" name="appId" value='.$oVersion->iAppId.' />';
|
||||
echo '<input type="hidden" name="versionId" value='.$oVersion->iVersionId.' />';
|
||||
|
||||
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", $oVersion->sTestedRating);
|
||||
echo '</td></tr>',"\n";
|
||||
echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
|
||||
make_bugzilla_version_list("maintainer_release", $oVersion->sTestedRelease);
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr><td colspan=2 align=center class=color3><input type="submit" name="submit" value="Update Database" /></td></tr>',"\n";
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
$oVersion->OutputEditor(true, true); /* false = not allowing the user to modify the parent application */
|
||||
else
|
||||
$oVersion->OutputEditor(false, true); /* false = not allowing the user to modify the parent application */
|
||||
|
||||
echo '<table border=0 cellpadding=2 cellspacing=0 width="100%">',"\n";
|
||||
echo '<tr><td colspan=2 align=center class=color2><input type="submit" name="submit" value="Update Database" /></td></tr>',"\n";
|
||||
echo html_table_end();
|
||||
echo html_frame_end();
|
||||
|
||||
echo "</form>";
|
||||
|
||||
echo "<br/><br/>\n";
|
||||
|
||||
// url edit form
|
||||
echo '<form enctype="multipart/form-data" action="editAppVersion.php" method="post">',"\n";
|
||||
echo '<input type=hidden name="appId" value='.$oVersion->iAppId.'>';
|
||||
|
||||
@@ -75,8 +75,8 @@ if ($_REQUEST['sub'])
|
||||
if (!$oApp) //app version
|
||||
{
|
||||
echo html_frame_start("Potential duplicate versions in the database","90%","",0);
|
||||
$oApp = new Application($oVersion->iAppId);
|
||||
display_versions($oApp->iAppId, $oApp->aVersionsIds);
|
||||
$oAppForVersion = new Application($oVersion->iAppId);
|
||||
display_versions($oAppForVersion->iAppId, $oAppForVersion->aVersionsIds);
|
||||
echo html_frame_end(" ");
|
||||
|
||||
//help
|
||||
@@ -142,27 +142,26 @@ if ($_REQUEST['sub'])
|
||||
if($oApp)
|
||||
{
|
||||
$oApp->OutputEditor($sVendor);
|
||||
$oVersion->OutputEditor(false);
|
||||
$oVersion->OutputEditor(false, false);
|
||||
} else
|
||||
{
|
||||
$oVersion->OutputEditor(true);
|
||||
$oVersion->OutputEditor(false, false);
|
||||
}
|
||||
|
||||
echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
|
||||
echo '<td><textarea name="replyText" style="width: 100%" rows="10" cols="35"></textarea></td></tr>',"\n";
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=2>\n";
|
||||
|
||||
if($oApp) // application
|
||||
{
|
||||
echo '<input type="hidden" name="apptype" value="application" />';
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'" />';
|
||||
echo '<input type=submit value=" Re-Submit App Into Database " class=button> ',"\n";
|
||||
echo '<input name="sub" type="submit" value="Delete" class="button" />',"\n";
|
||||
echo '</td></tr>',"\n";
|
||||
echo '</table></form>',"\n";
|
||||
} else // version
|
||||
{
|
||||
echo '<input type="hidden" name="apptype" value="version" />';
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
echo '<input type="hidden" name="versionId" value="'.$oVersion->iVersionId.'" />';
|
||||
echo '<input type="submit" value="Re-Submit Version Into Database " class="button"> ',"\n";
|
||||
echo '<input name="sub" type=submit value="Delete" class="button"></td></tr>',"\n";
|
||||
echo '</table></form>',"\n";
|
||||
@@ -173,7 +172,7 @@ if ($_REQUEST['sub'])
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'ReQueue')
|
||||
{
|
||||
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
|
||||
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
// get the queued versions that refers to the application entry we just removed
|
||||
// and delete them as we implicitly added a version entry when adding a new application
|
||||
@@ -184,19 +183,21 @@ if ($_REQUEST['sub'])
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oVersion = new Version($oRow->versionId);
|
||||
$oVersion->update($_REQUEST['versionName'], $_REQUEST['versionDescription'],null,null,$_REQUEST['appId']);
|
||||
$oVersion->GetOutputEditorValues();
|
||||
$oVersion->update();
|
||||
$oVersion->ReQueue();
|
||||
}
|
||||
}
|
||||
|
||||
// delete the application entry
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->update($_REQUEST['appName'], $_REQUEST['applicationDescription'], $_REQUEST['keywords'], $_REQUEST['webpage'], $_REQUEST['vendorId'], $_REQUEST['catId']);
|
||||
$oApp->GetOutputEditorValues();
|
||||
$oApp->update();
|
||||
$oApp->ReQueue();
|
||||
} else if(is_numeric($_REQUEST['versionId'])) // version
|
||||
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->update($_REQUEST['versionName'], $_REQUEST['versionDescription'],null,null,$_REQUEST['appId']);
|
||||
$oVersion->GetOutputEditorValues();
|
||||
$oVersion->update();
|
||||
$oVersion->ReQueue();
|
||||
}
|
||||
|
||||
@@ -204,7 +205,7 @@ if ($_REQUEST['sub'])
|
||||
}
|
||||
else if ($_REQUEST['sub'] == 'Delete')
|
||||
{
|
||||
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
|
||||
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
|
||||
{
|
||||
// get the queued versions that refers to the application entry we just removed
|
||||
// and delete them as we implicitly added a version entry when adding a new application
|
||||
@@ -222,7 +223,7 @@ if ($_REQUEST['sub'])
|
||||
// delete the application entry
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
$oApp->delete();
|
||||
} else if(is_numeric($_REQUEST['versionId'])) // version
|
||||
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oVersion->delete();
|
||||
|
||||
@@ -144,7 +144,8 @@ if (isset($_REQUEST['apptype']))
|
||||
$oApp->OutputEditor($_REQUEST['appVendorName']);
|
||||
}
|
||||
|
||||
$oVersion->OutputEditor(false); /* don't let the user change the parent application */
|
||||
$oVersion->OutputEditor(false, false); /* don't let the user change the parent application,
|
||||
don't display the rating and distribution dropdowns */
|
||||
|
||||
echo '<input type="hidden" name="apptype" value="'.$_REQUEST['apptype'].'">',"\n";
|
||||
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user