Add test results as part of submitting an application or version

This commit is contained in:
Tony Lambregts
2005-10-28 00:11:35 +00:00
committed by WineHQ
parent 696aab7ad8
commit 8ebccb4f2a
8 changed files with 666 additions and 324 deletions

View File

@@ -8,6 +8,7 @@ require(BASE."include/incl.php");
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 @@ if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isSuperMain
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 @@ if ($_REQUEST['sub'])
$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 @@ if ($_REQUEST['sub'])
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 @@ if ($_REQUEST['sub'])
{
$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 @@ if ($_REQUEST['sub'])
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 @@ else /* if ($_REQUEST['sub']) is not defined, display the main app queue page */
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("&nbsp;");
showAppList($hResult);
}
// get queued versions (only versions where application are not queued already)
@@ -443,43 +442,8 @@ else /* if ($_REQUEST['sub']) is not defined, display the main app queue page */
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("&nbsp;");
//show version list
showVersionList($hResult);
}
}

View File

@@ -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())
function get_vendor_from_keywords($sKeywords)
{
// 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;
$aKeywords = explode(" *** ",$sKeywords);
$iLastElt = (sizeOf($aKeywords)-1);
return($aKeywords[$iLastElt]);
}
/*
* User submitted an application
*/
if (isset($_REQUEST['appName']))
function newSubmition($errors)
{
$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']))
{
// 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"));
}
}
/*
* User wants to submit an application or version
*/
if (isset($_REQUEST['apptype']))
{
// 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 @@ if (isset($_REQUEST['apptype']))
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);
if($_REQUEST['apptype'] == 1 && (trim(strip_tags($_REQUEST['appDescription']))==""))
// 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();
}
}
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;
}
}
if(trim(strip_tags($_REQUEST['versionDescription']))=="")
{
$_REQUEST['versionDescription'] = GetDefaultVersionDescription();
}
$oApp = new Application();
$oApp->GetOutputEditorValues(); /* retrieve the values from the current $_REQUEST */
$oVersion = new Version();
$oVersion->GetOutputEditorValues(); /* retrieve the values from the current $_REQUEST */
/* output the appropriate editors depending on whether we are processing an */
/* application and a version or just a version */
if($_REQUEST['apptype'] == 1)
{
$oApp->OutputEditor($_REQUEST['appVendorName']);
}
$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";
// new application and version
if ($_REQUEST['apptype'] == 1)
{
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";
}
// 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";
//error no Id!
addmsg("Application Not Found!", "red");
redirect($_SERVER['PHP_SELF']);
}
echo '</table>',"\n";
echo "</form>";
// 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();
}
//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;
}
}
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')
{
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");
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 html_back_link(1,$_SERVER['PHP_SELF']);
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("&nbsp;");
}
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("&nbsp;");
//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>&nbsp',"\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">&nbsp',"\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("&nbsp;");
apidb_footer();
}
else
{
// error no sub!
addmsg("Internal Routine Not Found!!", "red");
redirect($_SERVER['PHP_SELF']);
}
}
apidb_footer();
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("&nbsp;");
}
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 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);
}
// 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("&nbsp;");
}
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();
}
?>

View File

@@ -286,7 +286,7 @@ if($_REQUEST['appId'])
}
if($_SESSION['current']->isLoggedIn())
{
echo '<form method="post" name="message" action="appsubmit.php?appId='.$oApp->iAppId.'&amp;apptype=2">';
echo '<form method="post" name="message" action="appsubmit.php?appId='.$oApp->iAppId.'&amp;apptype=version&amp;sub=view">';
echo '<input type=submit value="Submit new version" class="button">';
echo '</form>';
}

View File

@@ -257,10 +257,6 @@ class Application {
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 @@ class Application {
}
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 @@ class Application {
$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 @@ function GetDefaultApplicationDescription()
{
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("&nbsp;");
}
?>

View File

@@ -16,7 +16,7 @@ function global_sidebar_menu() {
$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 &amp; Documentation", BASE."help/");
$g->add("AppDB Stats", BASE."appdbStats.php");
$g->add("View Distributions (".getNumberOfDistributions().")", BASE."distributionView.php");

View File

@@ -34,7 +34,7 @@ function global_sidebar_login() {
}
$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

View File

@@ -805,9 +805,18 @@ class User {
}
/* 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? */

View File

@@ -8,6 +8,7 @@ require_once(BASE."include/comment.php");
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 @@ class Version {
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 @@ class Version {
$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 @@ class Version {
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 @@ class Version {
/**
* Update version.
* FIXME: Use compile_update_string instead of addslashes.
* Returns true on success and false on failure.
*/
function update()
{
@@ -393,7 +409,7 @@ class Version {
$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 @@ function GetDefaultVersionDescription()
<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("&nbsp;");
}
?>