From 657167e8a5125a96b649155e4cadc47de6a0b136 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Sun, 16 Oct 2005 04:24:37 +0000 Subject: [PATCH] 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() --- admin/adminAppQueue.php | 24 +++++++++++----------- admin/editAppFamily.php | 2 -- admin/editAppVersion.php | 27 +++++++++---------------- admin/resubmitRejectedApps.php | 35 ++++++++++++++++---------------- appsubmit.php | 3 ++- include/application.php | 12 +++++++---- include/version.php | 37 ++++++++++++++++++++++++++++++++-- 7 files changed, 85 insertions(+), 55 deletions(-) diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 053c52f..c3d5999 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -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 '' ,"\n"; if ($oApp) //application { - echo ''; + echo ''; echo ' ',"\n"; } else // app version { - echo ''; + echo ''; echo ' ',"\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,14 +269,14 @@ 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(); $oVersion->update(); $oVersion->unQueue(); } - + redirect(apidb_fullurl("admin/adminAppQueue.php")); } else if ($_REQUEST['sub'] == 'duplicate') @@ -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 " ".$sVendor."\n"; echo " ".$oApp->sName."\n"; echo " ".$oVersion->sName."\n"; - echo " [iVersionId."\">process]\n"; + echo " [iVersionId.">process]\n"; echo "\n\n"; $c++; } diff --git a/admin/editAppFamily.php b/admin/editAppFamily.php index df60572..ef3e561 100644 --- a/admin/editAppFamily.php +++ b/admin/editAppFamily.php @@ -46,8 +46,6 @@ else echo "
\n"; - echo ''; - $oApp->OutputEditor(""); echo '', "\n"; diff --git a/admin/editAppVersion.php b/admin/editAppVersion.php index d2a8ba7..48b3c9b 100644 --- a/admin/editAppVersion.php +++ b/admin/editAppVersion.php @@ -36,26 +36,19 @@ if(isset($_REQUEST['submit'])) echo "\n"; - $oVersion->OutputEditor(false); /* false = not allowing the user to modify the parent application */ - - echo ''; - echo ''; - - echo html_frame_start("Info", "90%", "", 0); - echo "
\n"; - echo '',"\n"; - echo '',"\n"; - - echo '',"\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 '
Rating',"\n"; - make_maintainer_rating_list("maintainer_rating", $oVersion->sTestedRating); - echo '
Release',"\n"; - make_bugzilla_version_list("maintainer_release", $oVersion->sTestedRelease); - echo '
',"\n"; + echo '',"\n"; echo html_table_end(); - echo html_frame_end(); + echo ""; + echo "

\n"; + // url edit form echo '',"\n"; echo ''; diff --git a/admin/resubmitRejectedApps.php b/admin/resubmitRejectedApps.php index ad23d24..3097ff8 100644 --- a/admin/resubmitRejectedApps.php +++ b/admin/resubmitRejectedApps.php @@ -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 '',"\n"; - echo '',"\n"; + echo "
email Text
\n"; if($oApp) // application { + echo ''; echo '',"\n"; echo '
' ,"\n"; - echo ''; echo ' ',"\n"; echo '',"\n"; echo '
',"\n"; } else // version { + echo ''; echo '' ,"\n"; - echo ''; echo ' ',"\n"; echo '',"\n"; echo '',"\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(); @@ -363,5 +364,5 @@ else // if ($_REQUEST['sub']) is not defined, display the main app queue page } } -apidb_footer(); +apidb_footer(); ?> diff --git a/appsubmit.php b/appsubmit.php index cdc6ba3..5efcaa3 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -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 '',"\n"; diff --git a/include/application.php b/include/application.php index ac27023..525d356 100644 --- a/include/application.php +++ b/include/application.php @@ -419,6 +419,8 @@ class Application { { HtmlAreaLoaderScript(array("app_editor")); + echo ''; + echo html_frame_start("Application Form", "90%", "", 0); echo "\n"; echo '',"\n"; @@ -464,20 +466,20 @@ class Application { { $errors = ""; - if (empty($_REQUEST['appCatId']) && !$_REQUEST['appId']) + if (empty($_REQUEST['appCatId'])) $errors .= "
  • Please enter a category for your application.
  • \n"; if (strlen($_REQUEST['appName']) > 200 ) $errors .= "
  • Your application name is too long.
  • \n"; - if (empty($_REQUEST['appName']) && !$_REQUEST['appId']) + if (empty($_REQUEST['appName'])) $errors .= "
  • Please enter an application name.
  • \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 .= "
  • Please enter a vendor.
  • \n"; - if (empty($_REQUEST['appDescription']) && !$_REQUEST['appId']) + if (empty($_REQUEST['appDescription'])) $errors .= "
  • Please enter a description of your application.
  • \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']; diff --git a/include/version.php b/include/version.php index 8e63076..63ce756 100644 --- a/include/version.php +++ b/include/version.php @@ -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 "
    Application name
    \n"; + echo ''; + if($editParentApplication) { // app parent @@ -505,6 +507,9 @@ class Version { echo '',"\n"; + } else + { + echo ''; } // version name @@ -526,6 +531,24 @@ class Version { echo '
    ',"\n"; $x->make_option_list("appId",$this->iAppId,"appFamily","appId","appName"); echo '
    ',"\n"; echo html_frame_end(); + + if($editRatingAndRelease) + { + echo html_frame_start("Info", "90%", "", 0); + echo "\n"; + echo '',"\n"; + echo '',"\n"; + echo html_table_end(); + echo html_frame_end(); + } else + { + echo ''; + echo ''; + } } 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']; } } }
    Rating',"\n"; + make_maintainer_rating_list("maintainer_rating", $this->sTestedRating); + echo '
    Release',"\n"; + make_bugzilla_version_list("maintainer_release", $this->sTestedRelease); + echo '