[AppDB] good to go
Tony Lambregts
tony.lambregts at gmail.com
Thu Oct 27 00:43:10 CDT 2005
Change Log: Get test results as part of application and version submition.
files changed:
appsubmit.php
appview.php
admin/adminAppQueue.php
include/application.php
include/version.php
include/testResults.php
include/sidebar.php
include/sidebar_login.php
include/user.php
-------------- next part --------------
Index: appsubmit.php
===================================================================
RCS file: /home/wine/appdb/appsubmit.php,v
retrieving revision 1.33
diff -u -r1.33 appsubmit.php
--- appsubmit.php 16 Oct 2005 04:24:37 -0000 1.33
+++ appsubmit.php 27 Oct 2005 05:41:27 -0000
@@ -1,89 +1,25 @@
<?php
/************************************/
-/* code to Submit a new application */
+/* code to Submit and Resubmit Apps */
/************************************/
+
include("path.php");
-require(BASE."include/incl.php");
-require(BASE."include/tableve.php");
-require(BASE."include/mail.php");
-require(BASE."include/application.php");
+require_once(BASE."include/incl.php");
+require_once(BASE."include/tableve.php");
+require_once(BASE."include/application.php");
+require_once(BASE."include/mail.php");
+require_once(BASE."include/testResults.php");
-if(!$_SESSION['current']->isLoggedIn())
-{
- // you must be logged in to submit app
- apidb_header("Please login");
- echo "To submit an application to the database you must be logged in. Please <a href=\"account.php?cmd=login\">login now</a> or create a <a href=\"account.php?cmd=new\">new account</a>.","\n";
- exit;
-}
-
-/*
- * User submitted an application
- */
-if (isset($_REQUEST['appName']))
-{
- $errors = "";
-
- // Check input and exit if we found errors
- $oApplication = new Application();
- $errors .= $oApplication->CheckOutputEditorInput();
-
- $oVersion = new Version();
- $errors .= $oVersion->CheckOutputEditorInput();
-
- if(empty($errors))
- {
- if($_REQUEST['appVendorName'])
- {
- $_REQUEST['vendorId']="";
- //FIXME: fix this when we fix vendor submission
- if($_SESSION['current']->hasPriv("admin"))
- {
- $oVendor = new Vendor();
- $oVendor->create($_REQUEST['appVendorName'],$_REQUEST['appWebpage']);
- }
- }
- $oApplication->GetOutputEditorValues(); /* load the values from $_REQUEST */
-
- //FIXME: remove this when we fix vendor submission
- $oApplication->sKeywords = $_REQUEST['appKeywords']." *** ".$_REQUEST['appVendorName'];
-
- $oApplication->create();
- $oVersion->GetOutputEditorValues();
- $oVersion->iAppId = $oApplication->iAppId; /* get the iAppId from the application that was just created */
- $oVersion->create();
-
- redirect(apidb_fullurl("index.php"));
- }
-
-}
-
-/*
- * User submitted a version
- */
-elseif (isset($_REQUEST['versionName']) && is_numeric($_REQUEST['appId']))
+function get_vendor_from_keywords($sKeywords)
{
- // Check input and exit if we found errors
-
- $oVersion = new Version();
- $errors = $oVersion->CheckOutputEditorInput();
-
- if(empty($errors))
- {
- $oVersion->GetOutputEditorValues();
- $oVersion->create();
- redirect(apidb_fullurl("index.php"));
- }
+ $aKeywords = explode(" *** ",$sKeywords);
+ $iLastElt = (sizeOf($aKeywords)-1);
+ return($aKeywords[$iLastElt]);
}
-/*
- * User wants to submit an application or version
- */
-if (isset($_REQUEST['apptype']))
+function newSubmition($errors)
{
- // header
- apidb_header("Submit Application");
-
// show add to queue form
echo '<form name="newApp" action="appsubmit.php" method="post">'."\n";
echo "<p>This page is for submitting new applications to be added to this\n";
@@ -114,55 +50,393 @@
echo "If you can't see the in-browser editors below please try Firefox, Mozilla or Opera browsers.\n</span></b>";
echo "<p>After your application has been added you'll be able to submit screenshots for it, post";
echo " messages in its forums or become a maintainer to help others trying to run the application.</p>";
- if(!empty($errors))
+}
+//deny access if not logged on
+if(!$_SESSION['current']->isLoggedIn())
+{
+ errorpage("Insufficient privilages to create application. Are you sure you are logged in");
+ exit;
+}
+
+
+if ($_REQUEST['sub'])
+{
+ if($_REQUEST['apptype'] == 'application')
{
- echo '<font color="red">',"\n";
- echo '<p class="red"> We found the following errors:</p><ul>'.$errors.'</ul>Please correct them.';
- echo '</font><br />',"\n";
- echo '<p></p>',"\n";
- }
+ $oApp = new Application($_REQUEST['appId']);
+ if($oApp->iAppId)
+ {
+ // if we are processing a queued application there MUST be an implicitly queued
+ // version to go along with it. Find this version so we can display its information
+ // during application processing so the admin can make a better choice about
+ // whether to accept or reject the overall application
+ $sQuery = "Select versionId from appVersion where appId='".$_REQUEST['appId']."';";
+ $hResult = query_appdb($sQuery);
+ $oRow = mysql_fetch_object($hResult);
+
+ // make sure the user has permission to view this version
+ if(!$_SESSION['current']->hasPriv("admin") &&
+ (($oApp->queued=="false")?true:false) &&
+ !$_SESSION['current']->isVersionSubmitter($oApp->AppId))
+ {
+ errorpage("Insufficient privileges.");
+ exit;
+ }
+
+ $oVersion = new Version($oRow->versionId);
+ } else
+ {
+ $oVersion = new Version();
+ }
- if($_REQUEST['apptype'] == 1 && (trim(strip_tags($_REQUEST['appDescription']))==""))
+ }
+ else if($_REQUEST['apptype'] == 'version')
{
- $_REQUEST['appDescription'] = GetDefaultApplicationDescription();
+ $oVersion = new Version($_REQUEST['versionId']);
+
+ // make sure the user has permission to view this version
+ if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion->versionId) &&
+ (($oVersion->queued=="false")?true:false) &&
+ !$_SESSION['current']->isVersionSubmitter($oVersion->versionId))
+ {
+ errorpage("Insufficient privileges.");
+ exit;
+ }
+ }
+ else
+ {
+ //error no Id!
+ addmsg("Application Not Found!", "red");
+ redirect($_SERVER['PHP_SELF']);
}
- if(trim(strip_tags($_REQUEST['versionDescription']))=="")
+ // Get the Testing results if they exist
+ $sQuery = "Select testingId from testResults where versionId='".$oVersion->iVersionId."';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ $oRow = mysql_fetch_object($hResult);
+ $oTest = new testdata($oRow->testingId);
+ }
+ else
{
- $_REQUEST['versionDescription'] = GetDefaultVersionDescription();
+ $oTest = new testResult();
}
- $oApp = new Application();
- $oApp->GetOutputEditorValues(); /* retrieve the values from the current $_REQUEST */
- $oVersion = new Version();
- $oVersion->GetOutputEditorValues(); /* retrieve the values from the current $_REQUEST */
+ //process according to sub flag
+ if ($_REQUEST['sub'] == 'Submit')
+ {
+ $errors = "";
+ $oVersion = new Version($_REQUEST['versionId']);
+ $oTest = new testData($_REQUEST['iTestingId']);
+ $errors .= $oVersion->CheckOutputEditorInput();
+ $errors .= $oTest->CheckOutputEditorInput();
+ $oVersion->GetOutputEditorValues();
+ $oTest->GetOutputEditorValues();
+ if ($_REQUEST['apptype'] == "application") // application
+ {
+ $oApp = new Application($_REQUEST['appId']);
+ $errors .= $oApp->CheckOutputEditorInput();
+ $oApp->GetOutputEditorValues(); // load the values from $_REQUEST
+
+ if(empty($errors))
+ {
+ if($_REQUEST['appVendorName'])
+ {
+ $_REQUEST['vendorId']="";
+ //FIXME: fix this when we fix vendor submission
+ if($_SESSION['current']->hasPriv("admin"))
+ {
+ $oVendor = new Vendor();
+ $oVendor->create($_REQUEST['appVendorName'],$_REQUEST['appWebpage']);
+ }
+ }
+ //FIXME: remove this when we fix vendor submission
+ $oApp->sKeywords = $_REQUEST['appKeywords']." *** ".$_REQUEST['appVendorName'];
+ if(is_numeric($oApp->iAppId))
+ {
+ $oApp->update();
+ $oApp->ReQueue();
+ } else
+ {
+ $oApp->create();
+ }
+ $oVersion->iAppId = $oApp->iAppId;
+ }
+ }
- /* output the appropriate editors depending on whether we are processing an */
- /* application and a version or just a version */
- if($_REQUEST['apptype'] == 1)
+ if(!empty($errors))
+ {
+ addmsg("we've got Errors???:".$errors.":");
+ $_REQUEST['sub'] = 'view';
+ }
+ else
+ {
+ if(is_numeric($oVersion->iVersionId))
+ {
+ $oVersion->update();
+ $oVersion->ReQueue();
+ }
+ else
+ {
+ $oVersion->create();
+ }
+
+ $sDistribution = trim($_REQUEST['sDistribution']);
+ if(!empty($sDistribution))
+ {
+ $oDistribution = new distribution();
+ $oDistribution->sName = $sDistribution;
+ $oDistribution->create();
+ $oTest->iDistributionId = $oDistribution->iDistributionId;
+ }
+ $oTest->iVersionId = $oVersion->iVersionId;
+ if(is_numeric($oTest->iTestingId))
+ {
+ $oTest->update(true);
+ $oTest->ReQueue();
+ } else
+ {
+ $oTest->create();
+ }
+ redirect($_SERVER['PHP_SELF']);
+ }
+ }
+ if ($_REQUEST['sub'] == 'Delete')
{
- $oApp->OutputEditor($_REQUEST['appVendorName']);
+ 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
+ $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'rejected';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $oVersion = new Version($oRow->versionId);
+ $oVersion->delete();
+ }
+ }
+
+ // delete the application entry
+ $oApp = new Application($_REQUEST['appId']);
+ $oApp->delete();
+ } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
+ {
+ $oVersion = new Version($_REQUEST['versionId']);
+ $oVersion->delete();
+ }
+
+ redirect($_SERVER['PHP_SELF']);
}
+ if ($_REQUEST['sub'] == 'view')
+ {
+ $x = new TableVE("view");
+ apidb_header("Application Queue");
- $oVersion->OutputEditor(false, false); /* don't let the user change the parent application,
- don't display the rating and distribution dropdowns */
+ echo '<form name="qform" action="'.$_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data">',"\n";
+ echo '<input type="hidden" name="sub" value="Submit">',"\n";
- echo '<input type="hidden" name="apptype" value="'.$_REQUEST['apptype'].'">',"\n";
+ echo html_back_link(1,$_SERVER['PHP_SELF']);
- // new application and version
- if ($_REQUEST['apptype'] == 1)
+ if($_REQUEST['apptype'] == 'application') // application
+ {
+ if ($oApp->sName != "")
+ {
+ echo html_frame_start("Potential duplicate applications in the database","90%","",0);
+ perform_search_and_output_results($oApp->sName);
+ echo html_frame_end(" ");
+ }
+ if(is_numeric($oApp->iAppId))
+ {
+
+ //help
+ echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
+ echo "<p>This is the full view of the rejected application. \n";
+ echo "You need to pick a category before submitting \n";
+ echo "it into the database.\n";
+ echo "<p>Click delete to remove the selected item from the queue. An email will automatically be sent to the\n";
+ echo "submitter to let them know the item was deleted.</p>\n\n";
+ echo "</td></tr></table></div>\n\n";
+ } else
+ {
+ newSubmition();
+ }
+ // vendor/alt vendor fields
+ // if user selected a predefined vendorId:
+ $iVendorId = $oApp->iVendorId;
+
+ // If not, try for an exact match
+ // Use the first match if we found one and clear out the vendor field,
+ // otherwise don't pick a vendor
+ // N.B. The vendor string is the last word of the keywords field !
+ if(!$iVendorId)
+ {
+ $sVendor = get_vendor_from_keywords($oApp->sKeywords);
+ $sQuery = "SELECT vendorId FROM vendor WHERE vendorname = '".$_REQUEST['appVendorName']."';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ $oRow = mysql_fetch_object($hResult);
+ $iVendorId = $oRow->vendorId;
+ }
+ }
+
+ // try for a partial match
+ if(!$iVendorId)
+ {
+ $sQuery = "select * from vendor where vendorname like '%".$_REQUEST['appVendorName']."%';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ $oRow = mysql_fetch_object($hResult);
+ $iVendorId = $oRow->vendorId;
+ }
+ }
+ //vendor field
+ if($iVendorId)
+ $_REQUEST['appVendorName'] = "";
+ } else //app version
+ {
+ if(is_numeric($oVersion->iVersionId))
+ {
+ echo html_frame_start("Potential duplicate versions in the database","90%","",0);
+ $oAppForVersion = new Application($oVersion->iAppId);
+ display_versions($oAppForVersion->iAppId, $oAppForVersion->aVersionsIds);
+ echo html_frame_end(" ");
+
+ //help
+ echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
+ echo "<p>This is the full view of the application version that has been Rejected. \n";
+
+ echo "<b>App Version</b> This type of application will be nested under the selected application parent.\n";
+ echo "<p>Click delete to remove the selected item from the queue an email will automatically be sent to the\n";
+ echo "submitter to let him know the item was deleted.</p>\n\n";
+ echo "</td></tr></table></div>\n\n";
+ } else
+ {
+ newSubmition($errors);
+ }
+ }
+ if(!empty($errors))
+ {
+ echo '<font color="red">',"\n";
+ echo '<p class="red"> We found the following errors:</p><ul>'.$errors.'</ul>Please correct them.';
+ echo '</font><br />',"\n";
+ echo '<p></p>',"\n";
+ }
+ if(!($oTest->sTestedDate))
+ $oTest->sTestedDate = date('Y-m-d H:i:s');
+
+ if($_REQUEST['apptype'] == 'application')
+ {
+ $oApp->OutputEditor($_REQUEST['appVendorName']);
+ $oVersion->OutputEditor(false, false);
+ } else
+ {
+ $oVersion->OutputEditor(false, false);
+ }
+
+ $oTest->OutputEditor($_REQUEST['sDistribution'],true);
+
+ echo "<table width='100%' border=0 cellpadding=2 cellspacing=2>\n";
+
+ if($_REQUEST['apptype'] == 'application') // application
+ {
+ echo '<input type="hidden" name="apptype" value="application" />';
+ if(is_numeric($oApp->iAppId))
+ {
+ echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
+ echo '<input type=submit value=" Re-Submit App Into Database " class=button> ',"\n";
+ echo '<input name="sub" type="submit" value="Delete" class="button" />',"\n";
+ } else
+ {
+ echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
+ echo '<input type=submit value="Submit New Application" class="button"> </td></tr>',"\n";
+ }
+ } else // version
+ {
+ echo '<input type="hidden" name="apptype" value="version" />';
+ echo '<input type="hidden" name="appId" value="'.$_REQUEST['appId'].'" />';
+ if(is_numeric($oVersion->iVersionId))
+ {
+ echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
+ 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";
+ }
+ else
+ {
+ echo '<tr valign=top><td class="color3" align="center" colspan="2">',"\n";
+ echo '<input type=submit value="Submit New Version" class="button"> </td></tr>',"\n";
+ }
+ }
+ echo '</table></form>',"\n";
+ echo html_back_link(1, $_SERVER['PHP_SELF']);
+ echo html_frame_end(" ");
+ apidb_footer();
+ }
+ else
{
- echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
- echo '<input type=submit value="Submit New Application" class="button"> </td></tr>',"\n";
+ // error no sub!
+ addmsg("Internal Routine Not Found!!", "red");
+ redirect($_SERVER['PHP_SELF']);
+ }
+}
+else // if ($_REQUEST['sub']) is not defined, display the main app queue page
+{
+ apidb_header("Resubmit application");
+
+ // get queued apps that the current user should see
+ $hResult = $_SESSION['current']->getAppRejectQueueQuery(true); // query for the app family
+
+ if(!$hResult || !mysql_num_rows($hResult))
+ {
+ //no apps in queue
+ echo html_frame_start("Application Queue","90%");
+ echo '<p><b>The Resubmit Application Queue is empty.</b></p>',"\n";
+ echo html_frame_end(" ");
}
- // new version
else
{
- echo '<tr valign=top><td class="color3" align="center" colspan="2">',"\n";
- echo '<input type=submit value="Submit New Version" class="button"> </td></tr>',"\n";
+ //help
+ echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
+ echo "<p>This is the list of applications waiting for re-submition, or to be deleted.</p>\n";
+ echo "<p>To view a submission, click on its name. From that page you can delete or edit and\n";
+ echo "re-submit it into the AppDB .<br>\n";
+ echo "</td></tr></table></div>\n\n";
+
+ //show applist
+ showAppList($hResult);
}
- echo '</table>',"\n";
- echo "</form>";
+
+ // get queued versions (only versions where application are not queued already)
+ $hResult = $_SESSION['current']->getAppRejectQueueQuery(false); // query for the app version
+
+ if(!$hResult || !mysql_num_rows($hResult))
+ {
+ //no apps in queue
+ echo html_frame_start("Version Queue","90%");
+ echo '<p><b>The Resubmit Version Queue is empty.</b></p>',"\n";
+ echo html_frame_end(" ");
+ }
+ else
+ {
+ //help
+ echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
+ echo "<p>This is the list of versions waiting for re-submition or deletion.</p>\n";
+ echo "<p>To view a submission, click on its name. From that page you can delete or edit and re-submit it into \n";
+ echo "the AppDB .<br>\n";
+ echo "<p>Note that versions linked to application that have not been yet approved are not displayed in this list.</p>\n";
+ echo "the AppDB.<br>\n";
+ echo "</td></tr></table></div>\n\n";
+
+ //show Version list
+ showVersionList($hResult);
+
+
+ }
+ apidb_footer();
}
-apidb_footer();
+
?>
Index: appview.php
===================================================================
RCS file: /home/wine/appdb/appview.php,v
retrieving revision 1.74
diff -u -r1.74 appview.php
--- appview.php 17 Oct 2005 03:59:24 -0000 1.74
+++ appview.php 27 Oct 2005 05:41:29 -0000
@@ -286,7 +286,7 @@
}
if($_SESSION['current']->isLoggedIn())
{
- echo '<form method="post" name="message" action="appsubmit.php?appId='.$oApp->iAppId.'&apptype=2">';
+ echo '<form method="post" name="message" action="appsubmit.php?appId='.$oApp->iAppId.'&apptype=version&sub=view">';
echo '<input type=submit value="Submit new version" class="button">';
echo '</form>';
}
Index: admin/adminAppQueue.php
===================================================================
RCS file: /home/wine/appdb/admin/adminAppQueue.php,v
retrieving revision 1.46
diff -u -r1.46 adminAppQueue.php
--- admin/adminAppQueue.php 16 Oct 2005 04:24:38 -0000 1.46
+++ admin/adminAppQueue.php 27 Oct 2005 05:41:29 -0000
@@ -8,6 +8,7 @@
require(BASE."include/tableve.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
+require_once(BASE."include/testResults.php");
function get_vendor_from_keywords($sKeywords)
@@ -76,10 +77,11 @@
errorpage("Insufficient privileges.");
exit;
}
+$oTest = new testData($_REQUEST['iTestingId']);
if ($_REQUEST['sub'])
{
- if(is_numeric($_REQUEST['appId']))
+ if($_REQUEST['apptype'] == 'application')
{
/* make sure the user is authorized to view this application request */
if(!$_SESSION['current']->hasPriv("admin"))
@@ -90,23 +92,16 @@
$oApp = new Application($_REQUEST['appId']);
- /* if we are processing a queued application there MUST be an implicitly queued */
- /* version to go along with it. Find this version so we can display its information */
- /* during application processing so the admin can make a better choice about */
- /* whether to accept or reject the overall application */
+ // if we are processing a queued application there MUST be an implicitly queued
+ // version to go along with it.
$sQuery = "Select versionId from appVersion where appId='".$_REQUEST['appId']."';";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
- /* make sure the user has permission to view this version */
- if(!$_SESSION['current']->hasAppVersionModifyPermission($oRow->versionId))
- {
- errorpage("Insufficient privileges.");
- exit;
- }
-
$oVersion = new Version($oRow->versionId);
- } elseif(is_numeric($_REQUEST['versionId']))
+
+ }
+ else if($_REQUEST['apptype'] == 'version')
{
/* make sure the user has permission to view this version */
if(!$_SESSION['current']->hasAppVersionModifyPermission($_REQUEST['versionId']))
@@ -123,6 +118,142 @@
redirect(apidb_fullurl("admin/adminAppQueue.php"));
}
+ // Get the Testing results if they exist
+ $sQuery = "Select testingId from testResults where versionId='".$oVersion->iVersionId."';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ $oRow = mysql_fetch_object($hResult);
+ $oTest = new testdata($oRow->testingId);
+ }
+ else
+ {
+ $oTest = new testResult();
+ }
+
+ if($_REQUEST['sub'] == 'add')
+ {
+ if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
+ {
+ // add new vendor
+ if($_REQUEST['appVendorName'])
+ {
+ $oVendor = new Vendor();
+ $oVendor->create($_REQUEST['appVendorName'],$_REQUEST['appWebpage']);
+ }
+
+ $oApp = new Application($_REQUEST['appId']);
+ $oApp->GetOutputEditorValues();
+ $oApp->update();
+ $oApp->unQueue();
+ } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
+ {
+ $oVersion = new Version($_REQUEST['versionId']);
+ $oVersion->GetOutputEditorValues();
+ $oVersion->update();
+ $oVersion->unQueue();
+ foreach($oVersion->aVersionIds as $iTestingId)
+ {
+ $oTest = new Version($iTestingId);
+ $oTest->GetOutputEditorValues();
+ $oTest->iVersionId = $oVersion->iVersionId;
+ $oTest->iVersionId = $oVersion->iVersionId;
+ $oTest->Update();
+ $oTest->unQueue();
+ }
+ }
+
+ redirect(apidb_fullurl("admin/adminAppQueue.php"));
+ }
+ else if ($_REQUEST['sub'] == 'duplicate')
+ {
+ if(is_numeric($_REQUEST['appIdMergeTo']))
+ {
+ /* move this version submission under the existing app */
+ $oVersion->iAppId = $_REQUEST['appIdMergeTo'];
+ $oVersion->update();
+
+ /* delete the appId that is the duplicate */
+ $oApp->delete();
+ }
+
+ /* redirect back to the main page */
+ redirect(apidb_fullurl("admin/adminAppQueue.php"));
+ }
+ else if ($_REQUEST['sub'] == 'Delete')
+ {
+
+ 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
+ $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $oVersion = new Version($oRow->versionId);
+ $oVersion->delete();
+ }
+ }
+
+ // delete the application entry
+ $oApp = new Application($_REQUEST['appId']);
+ $oApp->delete();
+
+ } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
+ {
+ $oVersion = new Version($_REQUEST['versionId']);
+ $oVersion->delete();
+ }
+ foreach($oVersion->aVersionIds as $iTestingId)
+ {
+ $oTest = new Version($iTestingId);
+ $oTest->delete();
+ }
+
+ redirect(apidb_fullurl("admin/adminAppQueue.php"));
+ }
+ else if ($_REQUEST['sub'] == 'Reject')
+ {
+ 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
+ $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';";
+ $hResult = query_appdb($sQuery);
+ if($hResult)
+ {
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $oVersion = new Version($oRow->versionId);
+ $oVersion->reject(true);
+ }
+ }
+
+ // delete the application entry
+ $oApp = new Application($_REQUEST['appId']);
+ $oApp->reject();
+ } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
+ {
+ $oVersion = new Version($_REQUEST['versionId']);
+ $oVersion->reject();
+
+ }
+ foreach($oVersion->aVersionIds as $iTestingId)
+ {
+ $oTest = new Version($iTestingId);
+ $oTest->GetOutputEditorValues();
+ $oTest->iVersionId = $oVersion->iVersionId;
+ $oTest->Update();
+ $oTest->reject();
+ }
+
+
+ redirect(apidb_fullurl("admin/adminAppQueue.php"));
+ }
+
//process according to sub flag
if ($_REQUEST['sub'] == 'view')
{
@@ -229,6 +360,7 @@
{
$oVersion->OutputEditor(false, false);
}
+ $oTest->OutputEditor($_REQUEST['sDistribution']);
echo html_frame_start("Reply text", "90%", "", 0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
@@ -254,102 +386,6 @@
echo html_frame_end();
echo html_back_link(1,'adminAppQueue.php');
}
- else if ($_REQUEST['sub'] == 'add')
- {
- if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
- {
- // add new vendor
- if($_REQUEST['appVendorName'])
- {
- $oVendor = new Vendor();
- $oVendor->create($_REQUEST['appVendorName'],$_REQUEST['appWebpage']);
- }
-
- $oApp = new Application($_REQUEST['appId']);
- $oApp->GetOutputEditorValues();
- $oApp->update();
- $oApp->unQueue();
- } 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')
- {
- if(is_numeric($_REQUEST['appIdMergeTo']))
- {
- /* move this version submission under the existing app */
- $oVersion->iAppId = $_REQUEST['appIdMergeTo'];
- $oVersion->update();
-
- /* delete the appId that is the duplicate */
- $oApp->delete();
- }
-
- /* redirect back to the main page */
- redirect(apidb_fullurl("admin/adminAppQueue.php"));
- }
- else if ($_REQUEST['sub'] == 'Delete')
- {
- 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
- $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';";
- $hResult = query_appdb($sQuery);
- if($hResult)
- {
- while($oRow = mysql_fetch_object($hResult))
- {
- $oVersion = new Version($oRow->versionId);
- $oVersion->delete();
- }
- }
-
- // delete the application entry
- $oApp = new Application($_REQUEST['appId']);
- $oApp->delete();
- } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
- {
- $oVersion = new Version($_REQUEST['versionId']);
- $oVersion->delete();
- }
-
- redirect(apidb_fullurl("admin/adminAppQueue.php"));
- }
- else if ($_REQUEST['sub'] == 'Reject')
- {
- 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
- $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';";
- $hResult = query_appdb($sQuery);
- if($hResult)
- {
- while($oRow = mysql_fetch_object($hResult))
- {
- $oVersion = new Version($oRow->versionId);
- $oVersion->reject(true);
- }
- }
-
- // delete the application entry
- $oApp = new Application($_REQUEST['appId']);
- $oApp->reject();
- } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
- {
- $oVersion = new Version($_REQUEST['versionId']);
- $oVersion->reject();
- }
-
- redirect(apidb_fullurl("admin/adminAppQueue.php"));
- }
else
{
//error no sub!
@@ -381,45 +417,8 @@
echo "</td></tr></table></div>\n\n";
//show applist
- echo html_frame_start("","90%","",0);
- echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
- <tr class=color4>
- <td>Submission Date</td>
- <td>Submitter</td>
- <td>Vendor</td>
- <td>Application</td>
- <td align=\"center\">Action</td>
- </tr>";
-
- $c = 1;
- while($oRow = mysql_fetch_object($hResult))
- {
- $oApp = new Application($oRow->appId);
- $oSubmitter = new User($oApp->iSubmitterId);
- if($oApp->iVendorId)
- {
- $oVendor = new Vendor($oApp->iVendorId);
- $sVendor = $oVendor->sName;
- } else
- {
- $sVendor = get_vendor_from_keywords($oApp->sKeywords);
- }
- if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
- echo "<tr class=\"$bgcolor\">\n";
- echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
- echo " <td>\n";
- echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
- echo $oSubmitter->sRealname;
- echo $oSubmitter->sEmail ? "</a>":"";
- echo " </td>\n";
- echo " <td>".$sVendor."</td>\n";
- echo " <td>".$oApp->sName."</td>\n";
- echo " <td align=\"center\">[<a href=\"adminAppQueue.php?sub=view&appId=".$oApp->iAppId."\">process</a>]</td>\n";
- echo "</tr>\n\n";
- $c++;
- }
- echo "</table>\n\n";
- echo html_frame_end(" ");
+ showAppList($hResult);
+
}
// get queued versions (only versions where application are not queued already)
@@ -443,43 +442,8 @@
echo "the AppDB.<br>\n";
echo "</td></tr></table></div>\n\n";
- //show applist
- echo html_frame_start("","90%","",0);
- echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
- <tr class=color4>
- <td>Submission Date</td>
- <td>Submitter</td>
- <td>Vendor</td>
- <td>Application</td>
- <td>Version</td>
- <td align=\"center\">Action</td>
- </tr>";
-
- $c = 1;
- while($oRow = mysql_fetch_object($hResult))
- {
- $oVersion = new Version($oRow->versionId);
- $oApp = new Application($oVersion->iAppId);
- $oSubmitter = new User($oVersion->iSubmitterId);
- $oVendor = new Vendor($oApp->iVendorId);
- $sVendor = $oVendor->sName;
- if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
- echo "<tr class=\"$bgcolor\">\n";
- echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oVersion->sSubmitTime))."</td>\n";
- echo " <td>\n";
- echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
- echo $oSubmitter->sRealname;
- echo $oSubmitter->sEmail ? "</a>":"";
- echo " </td>\n";
- echo " <td>".$sVendor."</td>\n";
- echo " <td>".$oApp->sName."</td>\n";
- echo " <td>".$oVersion->sName."</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++;
- }
- echo "</table>\n\n";
- echo html_frame_end(" ");
+ //show version list
+ showVersionList($hResult);
}
}
Index: include/application.php
===================================================================
RCS file: /home/wine/appdb/include/application.php,v
retrieving revision 1.37
diff -u -r1.37 application.php
--- include/application.php 26 Oct 2005 23:54:43 -0000 1.37
+++ include/application.php 27 Oct 2005 05:41:30 -0000
@@ -257,10 +257,6 @@
if(!$_SESSION['current']->canUnQueueApplication())
return;
- // If we are not in the queue, we can't move the application out of the queue.
- if(!$this->sQueued == 'true')
- return false;
-
$sUpdate = compile_update_string(array('queued' => "false",
'keywords'=> str_replace(" *** ","",$this->sKeywords) ));
if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
@@ -298,11 +294,7 @@
}
function ReQueue()
{
- if(!$_SESSION->canRequeueApplication())
- return false;
-
- // If we are not in the rejected, we can't move the application into the queue.
- if(!$this->sQueued == 'rejected')
+ if(!$_SESSION['current']->canRequeueApplication($this))
return false;
$sUpdate = compile_update_string(array('queued' => "true"));
@@ -336,7 +328,7 @@
$sMsg = "The application you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
$sMsg .= "Clicking on the link in this email will allow you to modify and resubmit the application. ";
$sMsg .= "A link to your queue of applications and versions will also show up on the left hand side of the Appdb site once you have logged in. ";
- $sMsg .= APPDB_ROOT."admin/resubmitRejectedApps.php?sub=view&appId=".$this->iAppId."\n";
+ $sMsg .= APPDB_ROOT."appsubmit.php?sub=view&apptype=applicationappId=".$this->iAppId."\n";
$sMsg .= "Reason given:\n";
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
}
@@ -562,4 +554,48 @@
{
return "<p>Enter a description of the application here</p>";
}
+
+function showAppList($hResult)
+{
+ //show applist
+ echo html_frame_start("","90%","",0);
+ echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
+ <tr class=color4>
+ <td>Submission Date</td>
+ <td>Submitter</td>
+ <td>Vendor</td>
+ <td>Application</td>
+ <td align=\"center\">Action</td>
+ </tr>";
+
+ $c = 1;
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $oApp = new Application($oRow->appId);
+ $oSubmitter = new User($oApp->iSubmitterId);
+ if($oApp->iVendorId)
+ {
+ $oVendor = new Vendor($oApp->iVendorId);
+ $sVendor = $oVendor->sName;
+ } else
+ {
+ $sVendor = get_vendor_from_keywords($oApp->sKeywords);
+ }
+ if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
+ echo "<tr class=\"$bgcolor\">\n";
+ echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
+ echo " <td>\n";
+ echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
+ echo $oSubmitter->sRealname;
+ echo $oSubmitter->sEmail ? "</a>":"";
+ echo " </td>\n";
+ echo " <td>".$sVendor."</td>\n";
+ echo " <td>".$oApp->sName."</td>\n";
+ echo " <td align=\"center\">[<a href=".$_SERVER['PHP_SELF']."?apptype=application&sub=view&appId=".$oApp->iAppId.">process</a>]</td>\n";
+ echo "</tr>\n\n";
+ $c++;
+ }
+ echo "</table>\n\n";
+ echo html_frame_end(" ");
+}
?>
Index: include/version.php
===================================================================
RCS file: /home/wine/appdb/include/version.php,v
retrieving revision 1.39
diff -u -r1.39 version.php
--- include/version.php 26 Oct 2005 02:14:17 -0000 1.39
+++ include/version.php 27 Oct 2005 05:41:31 -0000
@@ -8,6 +8,7 @@
require_once(BASE."include/url.php");
require_once(BASE."include/screenshot.php");
require_once(BASE."include/bugs.php");
+//require_once(BASE."include/testResults.php");
/**
* Version class for handling versions.
@@ -28,6 +29,7 @@
var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot linked to this version
var $aUrlsIds; // an array that contains the screenshotId of every url linked to this version
var $aBuglinkIds; // an array that contains the buglinkId of every bug linked to this version
+ var $aTestingIds; // an array that contains the buglinkId of every bug linked to this version
/**
* constructor, fetches the data.
@@ -130,6 +132,22 @@
$this->aBuglinkIds[] = $oRow->linkId;
}
}
+
+ /*
+ * We fetch Test ResultsIds.
+ */
+ $this->aTestingIds = array();
+ $sQuery = "SELECT *
+ FROM testResults
+ WHERE versionId = ".$iVersionId."
+ ORDER BY testingId";
+ if($hResult = query_appdb($sQuery))
+ {
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $this->aTestingIds[] = $oRow->linkId;
+ }
+ }
}
}
@@ -160,7 +178,7 @@
if(query_appdb("INSERT INTO appVersion $sFields VALUES $sValues", "Error while creating a new version."))
{
$this->iVersionId = mysql_insert_id();
- $this->version($this->iVersionId);
+ $this->Version($this->iVersionId);
$this->SendNotificationMail();
return true;
}
@@ -173,8 +191,6 @@
/**
* Update version.
- * FIXME: Use compile_update_string instead of addslashes.
- * Returns true on success and false on failure.
*/
function update()
{
@@ -393,7 +409,7 @@
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected. ";
$sMsg .= "Clicking on the link in this email will allow you to modify and resubmit the version. ";
$sMsg .= "A link to your queue of applications and versions will also show up on the left hand side of the Appdb site once you have logged in. ";
- $sMsg .= APPDB_ROOT."admin/resubmitRejectedApps.php?sub=view&versionId=".$this->iVersionId."\n";
+ $sMsg .= APPDB_ROOT."appsubmit.php?sub=view&apptype=version&versionId=".$this->iVersionId."\n";
$sMsg .= "Reason given:\n";
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
}
@@ -606,4 +622,47 @@
<td class=\"bronze\">3.21</td><td class=\"bronze\">20040615</td><td class=\"bronze\">yes</td><td class=\"bronze\">yes</td><td class=\"bronze\">Bronze</td>
</tr></tbody></table></p><p><br /></p>";
}
+
+function showVersionList($hResult)
+{
+ //show applist
+ echo html_frame_start("","90%","",0);
+ echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
+ <tr class=color4>
+ <td>Submission Date</td>
+ <td>Submitter</td>
+ <td>Vendor</td>
+ <td>Application</td>
+ <td>Version</td>
+ <td align=\"center\">Action</td>
+ </tr>";
+
+ $c = 1;
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $oVersion = new Version($oRow->versionId);
+ $oApp = new Application($oVersion->iAppId);
+ $oSubmitter = new User($oVersion->iSubmitterId);
+ $oVendor = new Vendor($oApp->iVendorId);
+ $sVendor = $oVendor->sName;
+ if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
+ echo "<tr class=\"$bgcolor\">\n";
+ echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oVersion->sSubmitTime))."</td>\n";
+ echo " <td>\n";
+ echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
+ echo $oSubmitter->sRealname;
+ echo $oSubmitter->sEmail ? "</a>":"";
+ echo " </td>\n";
+ echo " <td>".$sVendor."</td>\n";
+ echo " <td>".$oApp->sName."</td>\n";
+ echo " <td>".$oVersion->sName."</td>\n";
+ echo " <td align=\"center\">[<a href=".$_SERVER['PHP_SELF']."?apptype=version&sub=view&versionId=".$oVersion->iVersionId.">process</a>]</td>\n";
+ echo "</tr>\n\n";
+ $c++;
+ }
+ echo "</table>\n\n";
+ echo html_frame_end(" ");
+
+}
+
?>
Index: include/sidebar.php
===================================================================
RCS file: /home/wine/appdb/include/sidebar.php,v
retrieving revision 1.15
diff -u -r1.15 sidebar.php
--- include/sidebar.php 25 Oct 2005 00:47:32 -0000 1.15
+++ include/sidebar.php 27 Oct 2005 05:41:32 -0000
@@ -16,7 +16,7 @@
$g->add("Screenshots", BASE."viewScreenshots.php");
$g->add("Browse Apps", BASE."appbrowse.php");
$g->add("Top 25", BASE."votestats.php");
- $g->add("Submit Application", BASE."appsubmit.php?apptype=1");
+ $g->add("Submit Application", BASE."appsubmit.php?sub=view&apptype=application");
$g->add("Help & Documentation", BASE."help/");
$g->add("AppDB Stats", BASE."appdbStats.php");
$g->add("View Distributions (".getNumberOfDistributions().")", BASE."distributionView.php");
Index: include/sidebar_login.php
===================================================================
RCS file: /home/wine/appdb/include/sidebar_login.php,v
retrieving revision 1.12
diff -u -r1.12 sidebar_login.php
--- include/sidebar_login.php 15 Aug 2005 03:44:03 -0000 1.12
+++ include/sidebar_login.php 27 Oct 2005 05:41:33 -0000
@@ -34,7 +34,7 @@
}
$appsRejected = $_SESSION['current']->getAllRejectedApps();
if($appsRejected)
- $g->addmisc("<a href='".BASE."admin/resubmitRejectedApps.php?'>Review Rejected Apps</a>", "center");
+ $g->addmisc("<a href='".BASE."appsubmit.php?'>Review Rejected Apps</a>", "center");
}
else
Index: include/user.php
===================================================================
RCS file: /home/wine/appdb/include/user.php,v
retrieving revision 1.59
diff -u -r1.59 user.php
--- include/user.php 26 Oct 2005 22:54:30 -0000 1.59
+++ include/user.php 27 Oct 2005 05:41:33 -0000
@@ -805,9 +805,18 @@
}
/* Can this user Requeue an application? */
- function canRequeueApplication()
+ function canRequeueApplication($oApp)
{
- return $this->hasPriv("admin");
+ if($oApp->sQueued == 'false')
+ return false;
+
+ if($this->hasPriv("admin"))
+ return true;
+
+ if(($oApp->sQueued != 'false') && ($oApp->iSubmitterId == $this->iUserId))
+ return true;
+
+ return false;
}
/* Can the user reject application? */
More information about the wine-patches
mailing list