Use objectManager to submit and process applications. Remove now unused appsubmit.php
admin/adminAppQueue.php
This commit is contained in:
committed by
WineHQ
parent
3a3aa89f4e
commit
b11cce6711
@@ -1,372 +0,0 @@
|
||||
<?php
|
||||
/*************************************/
|
||||
/* code to View and approve new Apps */
|
||||
/*************************************/
|
||||
|
||||
require("path.php");
|
||||
require(BASE."include/incl.php");
|
||||
require_once(BASE."include/tableve.php");
|
||||
require_once(BASE."include/application.php");
|
||||
require_once(BASE."include/testData.php");
|
||||
|
||||
/* allows the admin to click on a row and mark the current application as a duplicate */
|
||||
/* of the selected application */
|
||||
function outputSearchTableForDuplicateFlagging($currentAppId, $hResult)
|
||||
{
|
||||
if(($hResult == null) || (mysql_num_rows($hResult) == 0))
|
||||
{
|
||||
// do nothing, we have no results
|
||||
} else
|
||||
{
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
|
||||
|
||||
$c = 0;
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
//skip if a NONAME
|
||||
if ($oRow->appName == "NONAME") { continue; }
|
||||
|
||||
//set row color
|
||||
$sBgColor = ($c % 2) ? 'color0' : 'color1';
|
||||
|
||||
//count versions
|
||||
$query = query_parameters("SELECT count(*) as versions FROM appVersion WHERE ".
|
||||
"appId = '?' AND versionName != 'NONAME'",
|
||||
$oRow->appId);
|
||||
$oVersionCount = mysql_fetch_object($query);
|
||||
|
||||
//display row
|
||||
echo "<tr class=$sBgColor>\n";
|
||||
/* map the merging of the current app to the app we are displaying in the table */
|
||||
echo " <td>".html_ahref($oRow->appName,"adminAppQueue.php?sSub=duplicate&sAppType=application&iAppId=".$currentAppId."&iAppIdMergeTo=".$oRow->appId)."</td>\n";
|
||||
echo " <td>$oVersionCount->versions versions </td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c++;
|
||||
|
||||
//set row color
|
||||
$sBgColor = ($c % 2) ? 'color0' : 'color1';
|
||||
|
||||
/* add the versions to the table */
|
||||
$oApp = new Application($oRow->appId);
|
||||
foreach($oApp->aVersionsIds as $iVersionId)
|
||||
{
|
||||
$oVersion = new Version($iVersionId);
|
||||
echo "<tr class=$sBgColor><td></td><td>".$oVersion->sName."</td></tr>\n";
|
||||
}
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
echo html_frame_end();
|
||||
}
|
||||
}
|
||||
|
||||
//deny access if not logged in or not a super maintainer of any applications
|
||||
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isSuperMaintainer())
|
||||
util_show_error_page_and_exit("Insufficient privileges.");
|
||||
|
||||
$oTest = new testData($aClean['iTestingId']);
|
||||
|
||||
if ($aClean['sSub'])
|
||||
{
|
||||
if($aClean['sAppType'] == 'application')
|
||||
{
|
||||
/* make sure the user is authorized to view this application request */
|
||||
if(!$_SESSION['current']->hasPriv("admin"))
|
||||
util_show_error_page_and_exit("Insufficient privileges.");
|
||||
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
|
||||
/* Check that the application actually exists */
|
||||
if(!$oApp->iAppId)
|
||||
util_show_error_page_and_exit("There is no application with that ID.");
|
||||
|
||||
// if we are processing a queued application there MUST be an implicitly queued
|
||||
// version to go along with it.
|
||||
$hResult = query_parameters("SELECT versionId from appVersion where appId='?';", $aClean['iAppId']);
|
||||
$oVersionRow = mysql_fetch_object($hResult);
|
||||
|
||||
$oVersion = new Version($oVersionRow->versionId);
|
||||
|
||||
}
|
||||
else if($aClean['sAppType'] == 'version')
|
||||
{
|
||||
/* make sure the user has permission to view this version */
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
util_show_error_page_and_exit("Insufficient privileges.");
|
||||
|
||||
} else
|
||||
{
|
||||
//error no Id!
|
||||
util_show_error_page_and_exit("Application Not Found!");
|
||||
}
|
||||
|
||||
// Get the Testing results if they exist
|
||||
|
||||
$hResult = query_parameters("SELECT testingId from testResults where versionId='?'", $oVersion->iVersionId);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$oTest = new testData($oRow->testingId);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oTest = new testData();
|
||||
}
|
||||
|
||||
if($aClean['sSub'] == 'add')
|
||||
{
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
$oTest = new testData($aClean['iTestingId']);
|
||||
$oVersion->GetOutputEditorValues($aClean);
|
||||
$oTest->GetOutputEditorValues($aClean);
|
||||
if ($aClean['sAppType'] == "application") // application
|
||||
{
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
$oApp->GetOutputEditorValues($aClean); // load the values from $aClean
|
||||
// add new vendor
|
||||
if($aClean['sVendorName'] and !$aClean['iAppVendorId'])
|
||||
{
|
||||
$oVendor = new Vendor();
|
||||
$oVendor->getOutputEditorValues($aClean);
|
||||
$oVendor->sWebpage = $aClean['sAppWebpage'];
|
||||
$oVendor->create();
|
||||
$oApp->iVendorId = $oVendor->iVendorId;
|
||||
}
|
||||
$oApp->update(true);
|
||||
$oApp->unQueue();
|
||||
}
|
||||
$oVersion->update(true);
|
||||
$oVersion->unQueue();
|
||||
$oTest->update(true);
|
||||
$oTest->unQueue();
|
||||
|
||||
downloadurl::processFormSingle($oVersion->iVersionId, $aClean, TRUE);
|
||||
|
||||
if($oVersion->sQueued == "rejected")
|
||||
$sIsRejected = "true";
|
||||
else
|
||||
$sIsRejected = "false";
|
||||
|
||||
util_redirect_and_exit(BASE."objectManager.php?sClass=".$aClean['sAppType'].
|
||||
"&bIsQueue=true&bIsRejected=$sIsRejected&sTitle=".
|
||||
$aClean['sAppType']."%20Queue");
|
||||
}
|
||||
else if ($aClean['sSub'] == 'duplicate')
|
||||
{
|
||||
if(is_numeric($aClean['iAppIdMergeTo']))
|
||||
{
|
||||
/* move this version submission under the existing app */
|
||||
$oVersion->iAppId = $aClean['iAppIdMergeTo'];
|
||||
$oVersion->update();
|
||||
|
||||
/* delete the appId that is the duplicate */
|
||||
$aClean['sReplyText'] = "Your Vesion information was moved to an existing Application";
|
||||
$oAppDelete = new Application($oApp->iAppId);
|
||||
$oAppDelete->delete();
|
||||
}
|
||||
|
||||
/* redirect back to the main page */
|
||||
util_redirect_and_exit(BASE."objectManager.php?sClass=application&".
|
||||
"bIsQueue=true&sTitle=Application%20Queue");
|
||||
}
|
||||
else if ($aClean['sSub'] == 'movetest')
|
||||
{
|
||||
if(is_numeric($aClean['iVersionIdMergeTo']))
|
||||
{
|
||||
// move this Test submission under the existing version
|
||||
$oTest->iVersionId = $aClean['iVersionIdMergeTo'];
|
||||
$oTest->update();
|
||||
|
||||
// delete the Version entry
|
||||
$aClean['sReplyText'] = "Your Test results were moved to existing version";
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
$oVersion->delete();
|
||||
}
|
||||
|
||||
// redirect back to the main page
|
||||
util_redirect_and_exit(BASE."objectManager.php?sClass=version_queue&".
|
||||
"bIsQueue=true&sTitle=Version%20Queue");
|
||||
}
|
||||
else if ($aClean['sSub'] == 'Delete')
|
||||
{
|
||||
|
||||
if (($aClean['sAppType'] == "application") && is_numeric($aClean['iAppId'])) // application
|
||||
{
|
||||
// delete the application entry
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
$oApp->delete();
|
||||
|
||||
} else if(($aClean['sAppType'] == "version") && is_numeric($aClean['iVersionId'])) // version
|
||||
|
||||
{
|
||||
// delete the Version entry
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
$oVersion->delete();
|
||||
}
|
||||
|
||||
util_redirect_and_exit(BASE."objectManager.php?sClass=".$aClean['sAppType'].
|
||||
"&bIsQueue=true&sTitle=".$aClean['sAppType']."%20Queue");
|
||||
}
|
||||
else if ($aClean['sSub'] == 'Reject')
|
||||
{
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
$oTest = new testData($aClean['iTestingId']);
|
||||
$oVersion->GetOutputEditorValues($aClean);
|
||||
$oTest->GetOutputEditorValues($aClean);
|
||||
if ($aClean['sAppType'] == "application") // application
|
||||
{
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
$oApp->GetOutputEditorValues($aClean); // load the values from $aClean
|
||||
$oApp->update(true);
|
||||
$oApp->reject();
|
||||
}
|
||||
$oVersion->update(true);
|
||||
$oVersion->reject();
|
||||
$oTest->update(true);
|
||||
$oTest->reject();
|
||||
util_redirect_and_exit(BASE."objectManager.php?sClass=".$aClean['sAppType'].
|
||||
"&bIsQueue=true&sTitle=".$aClean['sAppType']."%20Queue");
|
||||
}
|
||||
|
||||
//process according to sub flag
|
||||
if ($aClean['sSub'] == 'view')
|
||||
{
|
||||
$x = new TableVE("view");
|
||||
apidb_header("Admin App Queue");
|
||||
|
||||
echo '<form name="sQform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
|
||||
echo '<input type="hidden" name="sSub" value="add">',"\n";
|
||||
|
||||
if($oVersion->sQueued == "rejected")
|
||||
$sIsRejected = "true";
|
||||
else
|
||||
$sIsRejected = "false";
|
||||
|
||||
echo html_back_link(1,BASE."objectManager.php?sClass=".$aClean['sAppType']."&bIsQueue=true&".
|
||||
"bIsRejected=$sIsRejected&sTitle=".$aClean['sAppType']."%20Queue");
|
||||
|
||||
if (!$oApp) //app version
|
||||
{
|
||||
// Version handling moved to objectManager
|
||||
|
||||
} else // application
|
||||
{
|
||||
echo html_frame_start("Potential duplicate applications in the database", "90%", "", 0);
|
||||
perform_search_and_output_results($oApp->sName);
|
||||
echo html_frame_end(" ");
|
||||
|
||||
echo html_frame_start("Delete application as duplicate of this application:","90%","",0);
|
||||
echo "Clicking on an entry in this table will delete this application.";
|
||||
echo " It will also modify the version";
|
||||
echo " application to have an appId of the existing application and keep it queued for processing";
|
||||
$hResult = searchForApplication($oApp->sName);
|
||||
outputSearchTableForDuplicateFlagging($oApp->iAppId, $hResult);
|
||||
$hResult = searchForApplicationFuzzy($oApp->sName, 60);
|
||||
outputSearchTableForDuplicateFlagging($oApp->iAppId, $hResult);
|
||||
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 waiting to be approved. \n";
|
||||
echo "You need to pick a category before submitting \n";
|
||||
echo "it into the database. If you approve this application,\n";
|
||||
echo "an email will be sent to the author of the submission.<p>\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";
|
||||
|
||||
/*
|
||||
* 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);
|
||||
$hResult = query_parameters("SELECT vendorId FROM vendor WHERE vendorname = '?'",
|
||||
$sVendor);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$iVendorId = $oRow->vendorId;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* try for a partial match
|
||||
*/
|
||||
if(!$iVendorId)
|
||||
{
|
||||
$hResult = query_parameters("SELECT * from vendor where vendorname like '%?%'", $sVendor);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$iVendorId = $oRow->vendorId;
|
||||
}
|
||||
}
|
||||
|
||||
//vendor field
|
||||
if($iVendorId)
|
||||
{
|
||||
$sVendor = "";
|
||||
$oApp->iVendorId = $iVendorId;
|
||||
}
|
||||
}
|
||||
|
||||
/* output the appropriate editors depending on whether we are processing an application */
|
||||
/* and a version or just a version */
|
||||
if($oApp)
|
||||
$oApp->outputEditor($sVendor);
|
||||
|
||||
$oVersion->outputEditor(false, false);
|
||||
|
||||
echo downloadurl::outputEditorSingle($oVersion->iVersionId, $aClean);
|
||||
|
||||
$oTest->outputEditor($aClean['sDistribution']);
|
||||
|
||||
echo html_frame_start("Reply text", "90%", "", 0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
|
||||
echo '<td><textarea name="sReplyText" style="width: 100%" cols="80" rows="10"></textarea></td></tr>',"\n";
|
||||
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
if ($oApp) //application
|
||||
{
|
||||
echo '<input type="hidden" name="sAppType" value="application" />';
|
||||
echo '<input type=submit value=" Submit App Into Database " class=button> ',"\n";
|
||||
} else // app version
|
||||
{
|
||||
echo '<input type="hidden" name="sAppType" value="version" />';
|
||||
echo '<input type="submit" value=" Submit Version Into Database " class="button"> ',"\n";
|
||||
}
|
||||
|
||||
echo '<input name="sSub" type="submit" value="Delete" class="button" />',"\n";
|
||||
echo '<input name="sSub" type="submit" value="Reject" class="button" />',"\n";
|
||||
echo '</td></tr>',"\n";
|
||||
echo '</table>',"\n";
|
||||
echo '</form>',"\n";
|
||||
echo html_frame_end();
|
||||
echo html_back_link(1,BASE."objectManager.php?sClass=".$aClean['sAppType']."&bIsQueue=true&".
|
||||
"bIsRejected=$sIsRejected&sTitle=".$aClean['sAppType']."%20Queue");
|
||||
}
|
||||
else
|
||||
{
|
||||
//error no sub!
|
||||
util_show_error_page_and_exit("Internal Routine Not Found!!");
|
||||
}
|
||||
}
|
||||
|
||||
apidb_footer();
|
||||
?>
|
||||
432
appsubmit.php
432
appsubmit.php
@@ -1,432 +0,0 @@
|
||||
<?php
|
||||
/************************************/
|
||||
/* code to Submit and Resubmit Apps */
|
||||
/************************************/
|
||||
|
||||
/**
|
||||
* Submit new applications or versions.
|
||||
*
|
||||
* Optional parameters:
|
||||
* - sAppType,
|
||||
* - sSub,
|
||||
* - iAppId, application identifier
|
||||
* - iVersionId, version identifier
|
||||
* - iTestingId,
|
||||
* - sVendorName,
|
||||
* - iVendorId,
|
||||
* - sAppWebpage,
|
||||
* - sAppKeywords,
|
||||
* - iDistributionId,
|
||||
* OR
|
||||
* - sDistribution,
|
||||
*
|
||||
* TODO:
|
||||
* - move and rename functions in their respective modules
|
||||
* - rename sAppType by bIsApplication
|
||||
* - rename sSub by iAction and use integer constants to replace "Submit", "view", "delete"
|
||||
*/
|
||||
|
||||
// application environment
|
||||
require("path.php");
|
||||
require(BASE."include/incl.php");
|
||||
require_once(BASE."include/tableve.php");
|
||||
require_once(BASE."include/application.php");
|
||||
require_once(BASE."include/testData.php");
|
||||
|
||||
function newSubmission($errors)
|
||||
{
|
||||
global $aClean;
|
||||
// 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 the\n";
|
||||
echo "database. The application will be reviewed by an AppDB Administrator,\n";
|
||||
echo "and you will be notified via e-mail if it is added to the database or rejected.</p>\n";
|
||||
echo "<p><h2>Before continuing, please ensure that you have</h2>\n";
|
||||
echo "<ul>\n";
|
||||
if ($aClean['sAppType'] == "application")
|
||||
{
|
||||
echo " <li>Searched for this application in the database. Duplicate submissions will be rejected</li>\n";
|
||||
echo " <li>Really want to submit an application instead of a new version of an application\n";
|
||||
echo " that is already in the database. If this is the case, browse to the application\n";
|
||||
echo " and click on ‘Submit new version’</li>\n";
|
||||
}
|
||||
echo " <li>Entered a valid version for this application. This is the application\n";
|
||||
echo " version, NOT the Wine version (which goes in the test results section of the template)</li>\n";
|
||||
echo " <li>Tested this application under Wine. There are tens of thousands of applications\n";
|
||||
echo " for Windows, we do not need placeholder entries in the database. Please enter as complete \n";
|
||||
echo " as possible test results in the version template provided below</li>\n";
|
||||
echo "</ul></p>";
|
||||
echo "<p>Please do not forget to mention which Wine version you used, how well it worked\n";
|
||||
echo "and if any workarounds were needed. Having app descriptions just sponsoring the app\n";
|
||||
echo "(yes, some vendors want to use the appdb for this) or saying ‘I haven’t tried this app with Wine’ ";
|
||||
echo "will not help Wine development or Wine users.</p>\n";
|
||||
echo "<b><span style=\"color:red\">Please only submit applications/versions that you have tested.\n";
|
||||
echo "Submissions without test information or not using the provided template will be rejected.\n";
|
||||
echo "If you are unable to 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 will 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>";
|
||||
}
|
||||
|
||||
function promptForAppName()
|
||||
{
|
||||
apidb_header("Enter app name");
|
||||
|
||||
echo "First, please enter the name of the application you wish to add. ";
|
||||
echo "This will allow you to determine whether there is already an entry for it ";
|
||||
echo "in the database.\n";
|
||||
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">\n";
|
||||
echo "<input type=\"text\" name=\"sAppName\" size=\"60\" />\n";
|
||||
echo "<input type=\"submit\" value=\"Proceed\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"sSub\" value=\"view\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"sAppType\" value=\"application\" />\n";
|
||||
echo "</form>\n";
|
||||
}
|
||||
|
||||
//deny access if not logged on
|
||||
if(!$_SESSION['current']->isLoggedIn())
|
||||
util_show_error_page_and_exit("Insufficient privileges to create application. Are you sure you are logged in?");
|
||||
|
||||
if ($aClean['sSub'])
|
||||
{
|
||||
if($aClean['sAppType'] == 'application')
|
||||
{
|
||||
$oApp = new Application( $aClean['iAppId']);
|
||||
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
|
||||
$hResult = query_parameters("Select versionId from appVersion where appId='?'",
|
||||
$aClean['iAppId']);
|
||||
$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))
|
||||
{
|
||||
util_show_error_page_and_exit("Insufficient privileges.");
|
||||
}
|
||||
$oVersion = new Version($oRow->versionId);
|
||||
} else
|
||||
{
|
||||
$oVersion = new Version();
|
||||
}
|
||||
|
||||
}
|
||||
else if($aClean['sAppType'] == 'version')
|
||||
{
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
|
||||
// make sure the user has permission to view this version
|
||||
if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion) &&
|
||||
(($oVersion->queued=="false")?true:false) &&
|
||||
!$_SESSION['current']->isVersionSubmitter($oVersion->versionId))
|
||||
{
|
||||
util_show_error_page_and_exit("Insufficient privileges.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//error no Id!
|
||||
addmsg("Application Not Found!", "red");
|
||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
||||
}
|
||||
|
||||
// Get the Test results if they exist
|
||||
$hResult = query_parameters("Select testingId from testResults where versionId = '?'",
|
||||
$oVersion->iVersionId);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$oTest = new testData($oRow->testingId);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oTest = new testData();
|
||||
}
|
||||
|
||||
//process according to sub flag
|
||||
if ($aClean['sSub'] == 'Submit')
|
||||
{
|
||||
$errors = "";
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
$oTest = new testData($aClean['iTestingId']);
|
||||
$errors .= $oVersion->CheckOutputEditorInput($aClean);
|
||||
$errors .= $oTest->CheckOutputEditorInput($aClean);
|
||||
$oVersion->GetOutputEditorValues($aClean);
|
||||
$oTest->GetOutputEditorValues($aClean);
|
||||
if ($aClean['sAppType'] == "application") // application
|
||||
{
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
$errors .= $oApp->CheckOutputEditorInput($aClean);
|
||||
$oApp->GetOutputEditorValues($aClean); // load the values from $aClean
|
||||
|
||||
if(empty($errors))
|
||||
{
|
||||
if($aClean['sVendorName'])
|
||||
{
|
||||
$aClean['iVendorId']="";
|
||||
//FIXME: fix this when we fix vendor submission
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
$oVendor = new Vendor();
|
||||
$oVendor->getOutputEditorValues($aClean);
|
||||
$oVendor->sWebpage = $aClean['sAppWebpage'];
|
||||
$oVendor->create();
|
||||
$oApp->iVendorId = $oVendor->iVendorId;
|
||||
}
|
||||
}
|
||||
//FIXME: remove this when we fix vendor submission
|
||||
$oApp->sKeywords = $aClean['sAppKeywords']." *** ".$aClean['sVendorName'];
|
||||
if($oApp->iAppId)
|
||||
{
|
||||
$oApp->update();
|
||||
$oApp->ReQueue();
|
||||
} else
|
||||
{
|
||||
$oApp->create();
|
||||
}
|
||||
$oVersion->iAppId = $oApp->iAppId;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we have errors go back to 'view' mode */
|
||||
if(!empty($errors))
|
||||
{
|
||||
$aClean['sSub'] = 'view';
|
||||
}
|
||||
else
|
||||
{
|
||||
if($oVersion->iVersionId)
|
||||
{
|
||||
$oVersion->update();
|
||||
$oVersion->ReQueue();
|
||||
}
|
||||
else
|
||||
{
|
||||
$oVersion->create();
|
||||
}
|
||||
if(!$aClean['iDistributionId'])
|
||||
{
|
||||
$sDistribution = $aClean['sDistribution'];
|
||||
if( !empty($sDistribution) )
|
||||
{
|
||||
$oDistribution = new distribution();
|
||||
$oDistribution->sName = $sDistribution;
|
||||
$oDistribution->create();
|
||||
$oTest->iDistributionId = $oDistribution->iDistributionId;
|
||||
}
|
||||
}
|
||||
$oTest->iVersionId = $oVersion->iVersionId;
|
||||
if($oTest->iTestingId)
|
||||
{
|
||||
$oTest->update(true);
|
||||
$oTest->ReQueue();
|
||||
} else
|
||||
{
|
||||
$oTest->create();
|
||||
}
|
||||
|
||||
downloadurl::processFormSingle($oVersion->iVersionId, $aClean);
|
||||
|
||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
||||
}
|
||||
}
|
||||
if ($aClean['sSub'] == 'Delete')
|
||||
{
|
||||
if (($aClean['sAppType'] == "application") && $aClean['iAppId']) // 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
|
||||
$hResult = query_parameters("SELECT versionId FROM appVersion WHERE appVersion.appId = '?'
|
||||
AND appVersion.queued = 'rejected';", $aClean['iAppId']);
|
||||
if($hResult)
|
||||
{
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oVersion = new Version($oRow->versionId);
|
||||
$oVersion->delete();
|
||||
}
|
||||
}
|
||||
|
||||
// delete the application entry
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
$oApp->delete();
|
||||
} else if(($aClean['sAppType'] == "version") && $aClean['iVersionId']) // version
|
||||
{
|
||||
$oVersion = new Version($aClean['iVersionId']);
|
||||
$oVersion->delete();
|
||||
}
|
||||
|
||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
||||
}
|
||||
|
||||
if ($aClean['sSub'] == 'view' &&
|
||||
($aClean['sAppName'] || $aClean['iAppId'] || $aClean['sAppType'] != "application"))
|
||||
{
|
||||
/* The appname is already entered in the potential duplicates step */
|
||||
if(!$oApp->sName)
|
||||
$oApp->sName = $aClean['sAppName'];
|
||||
|
||||
$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="sSub" value="Submit">',"\n";
|
||||
|
||||
echo html_back_link(1,$_SERVER['PHP_SELF']);
|
||||
|
||||
if($aClean['sAppType'] == '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($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 e-mail 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
|
||||
{
|
||||
newSubmission('');
|
||||
}
|
||||
// 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 = '".$aClean['sVendorName']."';";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$iVendorId = $oRow->vendorId;
|
||||
}
|
||||
}
|
||||
|
||||
// try for a partial match
|
||||
if(!$iVendorId)
|
||||
{
|
||||
$hResult = query_parameters("select * from vendor where vendorname like '%?%'",
|
||||
$aClean['sVendorName']);
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$iVendorId = $oRow->vendorId;
|
||||
}
|
||||
}
|
||||
//vendor field
|
||||
if($iVendorId)
|
||||
$aClean['sVendorName'] = "";
|
||||
} else //app version
|
||||
{
|
||||
if($oVersion->iVersionId)
|
||||
{
|
||||
$oAppForVersion = new Application($oVersion->iAppId);
|
||||
echo html_frame_start("Potential duplicate versions in the database for application: ".$oAppForVersion->sName,"90%","",0);
|
||||
Version::display_approved($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 e-mail 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
|
||||
{
|
||||
newSubmission($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($aClean['sAppType'] == 'application')
|
||||
$oApp->outputEditor($aClean['sVendorName']);
|
||||
|
||||
$oVersion->outputEditor(false, false);
|
||||
|
||||
echo downloadurl::outputEditorSingle($iVersionId, $aClean);
|
||||
|
||||
$oTest->outputEditor($aClean['sDistribution'],true);
|
||||
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=2>\n";
|
||||
|
||||
if($aClean['sAppType'] == 'application') // application
|
||||
{
|
||||
echo '<input type="hidden" name="sAppType" value="application" />';
|
||||
if($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="sSub" 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="sAppType" value="version" />';
|
||||
echo '<input type="hidden" name="iAppId" value="'.$aClean['iAppId'].'" />';
|
||||
if($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="sSub" 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 if ($aClean['sSub'] == 'view' && !$aClean['sAppName'])
|
||||
{
|
||||
promptForAppName();
|
||||
} else
|
||||
{
|
||||
// error no sub!
|
||||
addmsg("Internal Routine Not Found!!", "red");
|
||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
||||
}
|
||||
}
|
||||
else // if ($aClean['sSub']) is not defined, display the main app queue page
|
||||
{
|
||||
/* Displaying of the app queue is now done by objectManager, so redirect to the
|
||||
front page instead */
|
||||
util_redirect_and_exit(BASE);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -41,10 +41,10 @@ Application vendor should be set correctly. If the vendor is missing, please con
|
||||
Keywords are used by the search engine. You don't need to repeat the application's name but you are encouraged to provide some keywords in this field.
|
||||
</li>
|
||||
<li>
|
||||
Description should describe the application in a general manner (what it does). THe Wine and version specific considerations go in version-specific pages (described below). If you want to add more than a short sentence, please add a cariage return after the first sentence as it will be used when showing the application summary in the search engine, top-25 page and so on. <br />You are encouraged to make use of the template provided for application description; you can copy/paste this template from the "<a href="../appsubmit.php?iAppType=application">Submit application page</a>".
|
||||
Description should describe the application in a general manner (what it does). The Wine and version specific considerations go in version-specific pages (described below). If you want to add more than a short sentence, please add a cariage return after the first sentence as it will be used when showing the application summary in the search engine, top-25 page and so on.
|
||||
</li>
|
||||
<li>
|
||||
Webpage should contain the home page for this application. Please remember that an URL starts with http://.
|
||||
Webpage should contain the home page for this application. Please remember that a URL starts with http://.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
@@ -57,8 +57,7 @@ You can edit a version page by clicking on the "Edit Version" button in any vers
|
||||
Version name should be checked against official version name. However if you feel that two minor revisions of an application will share the same problems or success, you are encouraged to use wildcards in the version number to avoid cluttering the database with hundreds of versions. For example if you know that Adobe Acrobat 6.0, 6.01 and 6.1 are about the same application, just choose 6.x as a version name. You can however use the full version name in an history table in the description field (see below).
|
||||
</li>
|
||||
<li>
|
||||
Description should describe the application version and not be a repetition of the application description. Please use a short sentence as the first line of your description to describe what this version is, and then add a carriage return after this first sentence as it will be used when showing version summary, in the application page for example. <br />You are encouraged to make use of the template provided for version description; you can copy/paste this template from the "<a href="../appsubmit.php?sAppType=version">Submit version page</a>".<br />
|
||||
As you'll see in this template, useful information to place in this field is the specification of what works and what doesn't in wine. You can also add what is called an history table to keep track of improvements and regression. Using the html editor, described later in this document, and the provided template, it is easy to produce such a table which will contains columns with the version number, wine version, installs, runs, ratings. You can then use the styles drop down list of the editor to set the color of the row according to the rating (gold, silver, bronze or garbage). You can see an example <a href="../appview.php?iVersionId=2602">here</a>.
|
||||
Description should describe the application version and not be a repetition of the application description. Please use a short sentence as the first line of your description to describe what this version is, and then add a carriage return after this first sentence as it will be used when showing version summary, in the application page for example. <br />
|
||||
</li>
|
||||
<li>
|
||||
Rating lets you rate how this version ran with the latest Wine version you tested. For rating definitions, please see this <a href="index.php?sTopic=maintainer_ratings">page</a>.
|
||||
|
||||
@@ -10,6 +10,7 @@ require_once(BASE."include/url.php");
|
||||
require_once(BASE."include/util.php");
|
||||
require_once(BASE."include/mail.php");
|
||||
require_once(BASE."include/maintainer.php");
|
||||
require_once(BASE."include/tableve.php");
|
||||
|
||||
define("PLATINUM_RATING", "Platinum");
|
||||
define("GOLD_RATING", "Gold");
|
||||
@@ -377,7 +378,9 @@ class Application {
|
||||
$sMsg = "The application you submitted (".$this->sName.") has been rejected by ".$_SESSION['current']->sRealname.".";
|
||||
$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."appsubmit.php?sub=view&apptype=application&appId=".$this->iAppId."\n";
|
||||
$sMsg .= APPDB_ROOT."objectManager.php?sClass=application_queue".
|
||||
"&bIsQueue=true&bIsRejected=true&iId=".$this->iAppId."&sTitle=".
|
||||
"Edit+Application\n";
|
||||
$sMsg .= "Reason given:\n";
|
||||
break;
|
||||
case "delete":
|
||||
@@ -480,7 +483,9 @@ class Application {
|
||||
break;
|
||||
case "reject":
|
||||
$sSubject = $this->sName." has been rejected by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= APPDB_ROOT."appsubmit.php?sAppType=application&sSub=view&iAppId=".$this->iAppId."\n";
|
||||
$sMsg .= APPDB_ROOT."objectManager.php?sClass=application_queue".
|
||||
"&bIsQueue=true&bIsRejected=true&iId=".$this->iAppId."&sTitle=".
|
||||
"Edit+Application\n";
|
||||
|
||||
// if sReplyText is set we should report the reason the application was rejected
|
||||
if($aClean['sReplyText'])
|
||||
@@ -499,12 +504,16 @@ class Application {
|
||||
|
||||
|
||||
/* output a html table and this applications values to the fields for editing */
|
||||
function outputEditor($sVendorName)
|
||||
function outputEditor($sVendorName = "")
|
||||
{
|
||||
HtmlAreaLoaderScript(array("app_editor"));
|
||||
|
||||
echo '<input type="hidden" name="iAppId" value="'.$this->iAppId.'">';
|
||||
|
||||
/* Used to distinguish between the first step of entering an application
|
||||
name and the full editor displayed here */
|
||||
echo '<input type="hidden" name="bMainAppForm" value="true" />'."\n";
|
||||
|
||||
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";
|
||||
@@ -518,12 +527,14 @@ class Application {
|
||||
|
||||
// vendor name
|
||||
echo '<tr valign=top><td class="color0"><b>Vendor</b></td>',"\n";
|
||||
echo '<td><input size="20" type=text name="sVendorName" value="'.$sVendorName.'"></td></tr>',"\n";
|
||||
echo '<td>If it is not on the list please add it using the form below</td></tr>',"\n";
|
||||
|
||||
// alt vendor
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class="color0"> </td><td>',"\n";
|
||||
$x->make_option_list("iAppVendorId", $this->iVendorId,"vendor","vendorId","vendorName");
|
||||
$x->make_option_list("iAppVendorId",
|
||||
$this->iVendorId,"vendor","vendorId","vendorName",
|
||||
array("vendor.queued", "false"));
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
// url
|
||||
@@ -855,20 +866,11 @@ class Application {
|
||||
$sVendor,
|
||||
$this->sName);
|
||||
|
||||
/* If the user has global edit rights canEdit() will return true even if
|
||||
the appId is not defined, in which case he should use adminAppQueue.
|
||||
This will soon be replaced by a unified objectManager link */
|
||||
$oApp = new application();
|
||||
if($oApp->canEdit())
|
||||
/* Display an edit link if the user has proper permissions */
|
||||
if($this->canEdit())
|
||||
{
|
||||
$aCells[] = "[ <a href=\"".BASE."admin/adminAppQueue.php?sAppType=".
|
||||
"application&sSub=view&iAppId=$this->iAppId\">".
|
||||
"$sEditLinkLabel</a> ]";
|
||||
} else if($this->canEdit())
|
||||
{
|
||||
$aCells[] = "[ <a href=\"".BASE."appsubmit.php?sAppType=".
|
||||
"application&sSub=view&iAppId=$this->iAppId\">".
|
||||
"$sEditLinkLabel</a> ]";
|
||||
$aCells[] = "[ <a href=\"".$oObject->makeUrl("edit", $this->iAppId,
|
||||
"Edit Application")."\">$sEditLinkLabel</a> ]";
|
||||
}
|
||||
|
||||
echo html_tr($aCells, $sClass);
|
||||
@@ -911,6 +913,38 @@ class Application {
|
||||
"From that page you can edit, delete or approve it into the AppDB.</p>\n";
|
||||
}
|
||||
|
||||
function objectDisplayAddItemHelp()
|
||||
{
|
||||
/* We don't display the full help on the page where you only input the app name */
|
||||
if(!$this->sName)
|
||||
{
|
||||
echo "<p>First, please enter the name of the application you wish to add. ";
|
||||
echo "This will allow you to determine whether there is already ";
|
||||
echo "an entry for it in the database.</p>\n";
|
||||
} else
|
||||
{
|
||||
echo "<p>This page is for submitting new applications to be added to the\n";
|
||||
echo "database. The application will be reviewed by an AppDB Administrator,\n";
|
||||
echo "and you will be notified via e-mail if it is added to the database or rejected.</p>\n";
|
||||
echo "<p><h2>Before continuing, please ensure that you have</h2>\n";
|
||||
echo "<ul>\n";
|
||||
echo " <li>Entered a valid version for this application. This is the application\n";
|
||||
echo " version, NOT the Wine version (which goes in the test results section of the template)</li>\n";
|
||||
echo " <li>Tested this application under Wine. There are tens of thousands of applications\n";
|
||||
echo " for Windows, we do not need placeholder entries in the database. Please enter as complete \n";
|
||||
echo " as possible test results in the version template provided below</li>\n";
|
||||
echo "</ul></p>";
|
||||
echo "<p>Please do not forget to mention which Wine version you used, how well it worked\n";
|
||||
echo "and if any workarounds were needed. Having app descriptions just sponsoring the app\n";
|
||||
echo "(yes, some vendors want to use the appdb for this) or saying ‘I haven’t tried this app with Wine’ ";
|
||||
echo "will not help Wine development or Wine users.</p>\n";
|
||||
echo "<b><span style=\"color:red\">Please only submit applications/versions that you have tested.\n";
|
||||
echo "Submissions without test information or not using the provided template will be rejected.\n";
|
||||
echo "If you are unable to 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 will 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>";
|
||||
}
|
||||
}
|
||||
function objectGetEntriesCount($bQueued, $bRejected)
|
||||
{
|
||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||
@@ -941,6 +975,25 @@ class Application {
|
||||
|
||||
return $oRow->count;
|
||||
}
|
||||
|
||||
function objectMoveChildren($iNewId)
|
||||
{
|
||||
/* Keep track of how many children we have moved */
|
||||
$iCount = 0;
|
||||
|
||||
foreach($this->aVersionsIds as $iVersionId)
|
||||
{
|
||||
$oVersion = new version($iVersionId);
|
||||
$oVersion->iAppId = $iNewId;
|
||||
if($oVersion->update())
|
||||
$iCount++;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If no errors occured we return the number of moved children */
|
||||
return $iCount;
|
||||
}
|
||||
}
|
||||
|
||||
function get_vendor_from_keywords($sKeywords)
|
||||
|
||||
313
include/application_queue.php
Normal file
313
include/application_queue.php
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class for submitting/processing applications
|
||||
*/
|
||||
|
||||
class application_queue
|
||||
{
|
||||
var $oVersionQueue;
|
||||
var $oApp;
|
||||
var $oVendor;
|
||||
|
||||
function application_queue($iAppId = null)
|
||||
{
|
||||
$this->oApp = new application($iAppId);
|
||||
|
||||
/* If this is an existing application then there must be a version
|
||||
accompanying it */
|
||||
if($iAppId)
|
||||
{
|
||||
/* Normal users do not get a aVersionsIds property, so we have to fetch
|
||||
the versionId manually. Normal users only have access to rejected
|
||||
applications */
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
$iVersionId = $this->oApp->aVersionsIds[0];
|
||||
} else if($this->oApp->sQueued == "rejected")
|
||||
{
|
||||
$sQuery = "SELECT versionId FROM appVersion WHERE appId = '?' LIMIT 1";
|
||||
$hResult = query_parameters($sQuery, $this->oApp->iAppId);
|
||||
if($hResult)
|
||||
{
|
||||
if($oRow = mysql_fetch_object($hResult))
|
||||
$iVersionId = $oRow->versionId;
|
||||
}
|
||||
}
|
||||
$iVendorId = $this->oApp->iVendorId;
|
||||
}
|
||||
else
|
||||
{
|
||||
$iVersionId = null;
|
||||
$iVendorId = null;
|
||||
}
|
||||
|
||||
$this->oVendor = new vendor($iVendorId);
|
||||
|
||||
$this->oVersionQueue = new version_queue($iVersionId);
|
||||
}
|
||||
|
||||
function create()
|
||||
{
|
||||
$bSuccess = TRUE;
|
||||
|
||||
/* Create a new vendor if an existing one was not selected, and
|
||||
assign the application to it */
|
||||
if(!$this->oApp->iVendorId)
|
||||
{
|
||||
$this->oVendor->create();
|
||||
$this->oApp->iVendorId = $this->oVendor->iVendorId;
|
||||
}
|
||||
|
||||
if(!$this->oApp->create())
|
||||
$bSuccess = FALSE;
|
||||
|
||||
/* Assign the version to the new application */
|
||||
$this->oVersionQueue->oVersion->iAppId = $this->oApp->iAppId;
|
||||
|
||||
if(!$this->oVersionQueue->create())
|
||||
$bSuccess = FALSE;
|
||||
|
||||
return $bSuccess;
|
||||
}
|
||||
|
||||
function update()
|
||||
{
|
||||
$bSucess = TRUE;
|
||||
|
||||
/* If the vendor was already un-queued then the edit vendor form would not
|
||||
have been displayed, and so the vendor name will not be set. Thus only
|
||||
update the vendor if the name is set */
|
||||
if($this->oVendor->sName)
|
||||
$this->oVendor->update();
|
||||
|
||||
if(!$this->oApp->update())
|
||||
$bSuccess = FALSE;
|
||||
|
||||
if(!$this->oVersionQueue->update())
|
||||
$bSuccess = FALSE;
|
||||
|
||||
return $bSuccess;
|
||||
}
|
||||
|
||||
function unQueue()
|
||||
{
|
||||
/* The vendor is not necessarily queued, as it could have existed on
|
||||
beforehand */
|
||||
if($this->oVendor->sQueued != "false")
|
||||
$this->oVendor->unQueue();
|
||||
|
||||
$this->oApp->unQueue();
|
||||
$this->oVersionQueue->unQueue();
|
||||
}
|
||||
|
||||
function reQueue()
|
||||
{
|
||||
$this->oApp->reQueue();
|
||||
$this->oVersionQueue->reQueue();
|
||||
}
|
||||
|
||||
function reject()
|
||||
{
|
||||
$this->oVersionQueue->reject();
|
||||
$this->oApp->reject();
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
$bSuccess = TRUE;
|
||||
|
||||
if(!$this->oApp->delete())
|
||||
$bSuccess = FALSE;
|
||||
|
||||
if(!$this->oVersionQueue->delete())
|
||||
$bSuccess = FALSE;
|
||||
|
||||
return $bSuccess;
|
||||
}
|
||||
|
||||
function outputEditor()
|
||||
{
|
||||
/* We ask the user for the application name first so as to avoid duplicate
|
||||
submissons; a list of potential duplicates is displayed on the next page */
|
||||
if(!$this->oApp->sName)
|
||||
{
|
||||
echo "<input type=\"text\" name=\"sAppName\" size=\"60\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"sSub\" value=\"view\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"sAppType\" value=\"application\" />\n";
|
||||
} else
|
||||
{
|
||||
/* Show potential duplicates */
|
||||
echo html_frame_start("Potential duplicate applications in the ".
|
||||
"database","90%","",0);
|
||||
$this->displayDuplicates();
|
||||
echo html_frame_end(" ");
|
||||
|
||||
$this->oApp->outputEditor();
|
||||
|
||||
/* We need to accept vendors submitted using the old
|
||||
keyword hack. This should be removed soon */
|
||||
if(!$this->oVendor->sName && $this->oApp->iAppId)
|
||||
{
|
||||
$this->oVendor->sName = get_vendor_from_keywords(
|
||||
$this->oApp->sKeywords);
|
||||
}
|
||||
|
||||
/* Display the new vendor form for new applications or if we
|
||||
are processing an application and the vendor is queued */
|
||||
if(!$this->oApp->iAppId || $this->oVendor->sQueued != "false")
|
||||
{
|
||||
echo html_frame_start("New Vendor", "90%");
|
||||
$this->oVendor->outputEditor();
|
||||
echo html_frame_end();
|
||||
}
|
||||
|
||||
$this->oVersionQueue->oVersion->outputEditor();
|
||||
|
||||
global $aClean;
|
||||
|
||||
echo $this->oVersionQueue->oDownloadUrl->outputEditorSingle(
|
||||
$this->oVersionQueue->Oversion->iVersionId, $aClean);
|
||||
|
||||
$this->oVersionQueue->oTestDataQueue->outputEditor();
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputEditorValues($aClean)
|
||||
{
|
||||
$this->oApp->getOutputEditorValues($aClean);
|
||||
$this->oVersionQueue->getOutputEditorValues($aClean);
|
||||
$this->oVendor->getOutputEditorValues($aClean);
|
||||
}
|
||||
|
||||
function checkOutputEditorInput($aClean)
|
||||
{
|
||||
/* We want outputEditor() to be called again so we can display the main
|
||||
app form. No erros are displayed since we only return TRUE */
|
||||
if($this->oApp->sName && !$aClean['bMainAppForm'])
|
||||
return TRUE;
|
||||
|
||||
$sErrors = $this->oApp->checkOutputEditorInput($aClean);
|
||||
$sErrors .= $this->oVersionQueue->checkOutputEditorInput($aClean);
|
||||
return $sErrors;
|
||||
}
|
||||
|
||||
function canEdit()
|
||||
{
|
||||
return $this->oApp->canEdit();
|
||||
}
|
||||
|
||||
function mustBeQueued()
|
||||
{
|
||||
return $this->oApp->mustBeQueued();
|
||||
}
|
||||
|
||||
function displayDuplicates()
|
||||
{
|
||||
echo "<b>Like matches</b>\n";
|
||||
$this->displayDuplicateTable(searchForApplication($this->oApp->sName));
|
||||
echo "<br /><b>Fuzzy matches</b>\n";
|
||||
$this->displayDuplicateTable(searchForApplicationFuzzy($this->oApp->sName, 60));
|
||||
}
|
||||
|
||||
function displayDuplicateTable($hResult)
|
||||
{
|
||||
/* Exit if the MySQL handle is invalid */
|
||||
if($hResult === FALSE)
|
||||
return FALSE;
|
||||
|
||||
/* There's no point in displaying an empty table */
|
||||
if($hResult === null ||mysql_num_rows($hResult) == 0)
|
||||
{
|
||||
echo "No matches.<br />\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$aHeader = array(
|
||||
"Application name",
|
||||
"Description",
|
||||
"No. versions"
|
||||
);
|
||||
|
||||
/* We can only move data if the current application already exists, and
|
||||
we have admin privileges */
|
||||
if($this->oApp->iAppId && $_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
$bCanMove = TRUE;
|
||||
$aHeader[] = array("Move data", 'width="80"');
|
||||
} else
|
||||
{
|
||||
$bCanMove = FALSE;
|
||||
}
|
||||
|
||||
echo "<table>";
|
||||
echo html_tr($aHeader, "color4");
|
||||
|
||||
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
|
||||
{
|
||||
$oApp = new application($oRow->appId);
|
||||
$aCells = array(
|
||||
$oApp->objectMakeLink(),
|
||||
util_trim_description($oApp->sDescription),
|
||||
sizeof($oApp->aVersionsIds)
|
||||
);
|
||||
|
||||
if($bCanMove)
|
||||
{
|
||||
$aCells[] = "<a href=\"objectManager.php?sClass=application_queue&".
|
||||
"bIsQueue=true&sAction=moveChildren&iId=".
|
||||
$this->oApp->iAppId."&iNewId=".$oApp->iAppId.
|
||||
"\">Move data</a>";
|
||||
}
|
||||
echo html_tr($aCells, ($i % 2) ? "color0" : "color1");
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
$this->oApp->display();
|
||||
}
|
||||
|
||||
function objectMakeUrl()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function objectMakeLink()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $bRejected)
|
||||
{
|
||||
return $this->oApp->objectGetEntries($bQueued, $bRejected);
|
||||
}
|
||||
|
||||
function objectGetHeader()
|
||||
{
|
||||
return $this->oApp->objectGetHeader();
|
||||
}
|
||||
|
||||
function objectGetInstanceFromRow($oRow)
|
||||
{
|
||||
return application::objectGetInstanceFromRow($oRow);
|
||||
}
|
||||
|
||||
function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
|
||||
{
|
||||
return $this->oApp->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel);
|
||||
}
|
||||
|
||||
function objectMoveChildren($iNewId)
|
||||
{
|
||||
return $this->oApp->objectMoveChildren($iNewId);
|
||||
}
|
||||
|
||||
function objectDisplayAddItemHelp()
|
||||
{
|
||||
$this->oApp->objectDisplayAddItemHelp();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -25,7 +25,8 @@ function global_sidebar_menu()
|
||||
$g->add("Downloadable Apps", BASE."browse_downloadable.php");
|
||||
$g->add("Browse Apps by Rating", BASE."browse_by_rating.php");
|
||||
$g->add("Top 25", BASE."votestats.php");
|
||||
$g->add("Submit Application", BASE."appsubmit.php?sSub=view&sAppType=application");
|
||||
$g->add("Submit Application", BASE."objectManager.php?sClass=application_queue&".
|
||||
"sTitle=Submit+Application&sAction=add");
|
||||
$g->add("Help & Documentation", BASE."help/");
|
||||
$g->add("AppDB Stats", BASE."appdbStats.php");
|
||||
$g->add("View Distributions (".distribution::objectGetEntriesCount(false, false).")", BASE."objectManager.php?sClass=distribution&bIsQueue=false&sTitle=View%20Distributions");
|
||||
|
||||
@@ -10,7 +10,7 @@ function global_admin_menu() {
|
||||
$g = new htmlmenu("Global Admin");
|
||||
|
||||
$g->add("View App Queue (".application::objectGetEntriesCount(true, false).")",
|
||||
BASE."objectManager.php?sClass=application&bIsQueue=true&sTitle=".
|
||||
BASE."objectManager.php?sClass=application_queue&bIsQueue=true&sTitle=".
|
||||
"Application%20Queue");
|
||||
$g->add("View Version Queue (".version::objectGetEntriesCount(true, false).")",
|
||||
BASE."objectManager.php?sClass=version_queue&bIsQueue=true&sTitle=".
|
||||
@@ -44,8 +44,8 @@ function global_admin_menu() {
|
||||
|
||||
$g->add("View Rejected Applications (".application::objectGetEntriesCount(true,
|
||||
true).")",
|
||||
BASE."objectManager.php?sClass=application&bIsQueue=true&bIsRejected=true&".
|
||||
"sTitle=Rejected%20Applications");
|
||||
BASE."objectManager.php?sClass=application_queue&bIsQueue=true&bIsRejected=".
|
||||
"true&sTitle=Rejected%20Applications");
|
||||
$g->add("View Rejected Versions (".version::objectGetEntriesCount(true, true).")",
|
||||
BASE."objectManager.php?sClass=version_queue&bIsQueue=true&".
|
||||
"bIsRejected=true&sTitle=Rejected%20Versions");
|
||||
|
||||
@@ -44,7 +44,7 @@ function global_sidebar_login() {
|
||||
if($iAppsRejected && !$_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
$g->add("Review Rejected Apps ($iAppsRejected)", BASE."objectManager.php?".
|
||||
"sClass=application&bIsQueue=true&bIsRejected=true&sTitle=".
|
||||
"sClass=application_queue&bIsQueue=true&bIsRejected=true&sTitle=".
|
||||
"Rejected+Applications", "center");
|
||||
}
|
||||
|
||||
|
||||
@@ -465,8 +465,9 @@ class Version {
|
||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected by ".$_SESSION['current']->sRealname.".";
|
||||
$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."appsubmit.php?sSub=view&sAppType=version&iVersionId=".$this->iVersionId."\n";
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= APPDB_ROOT."objectManager.php?sClass=version_queue".
|
||||
"&bIsQueue=true&bIsRejected=true&iId=".$this->iVersionId."&".
|
||||
"sTitle=Edit+Version\n";
|
||||
break;
|
||||
case "delete":
|
||||
$sSubject = "Submitted version deleted";
|
||||
@@ -538,7 +539,9 @@ class Version {
|
||||
break;
|
||||
case "reject":
|
||||
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' has been rejected by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= APPDB_ROOT."appsubmit.php?sAppType=application&sSub=view&iVersionId=".$this->iVersionId."\n";
|
||||
$sMsg .= APPDB_ROOT."objectManager.php?sClass=version_queue".
|
||||
"&bIsQueue=true&bIsRejected=true&iId=".$this->iVersionId."&".
|
||||
"sTitle=Edit+Version\n";
|
||||
|
||||
// if sReplyText is set we should report the reason the version was rejected
|
||||
if($aClean['sReplyText'])
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
require_once('path.php');
|
||||
require_once(BASE.'include/incl.php');
|
||||
require_once(BASE.'include/objectManager.php');
|
||||
/* require_once(BASE.'include/application_queue.php'); */
|
||||
require_once(BASE.'include/application_queue.php');
|
||||
require_once(BASE.'include/version_queue.php');
|
||||
require_once(BASE.'include/testData_queue.php');
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ require_once(BASE.'include/application.php');
|
||||
require_once(BASE.'include/maintainer.php');
|
||||
require_once(BASE.'include/testData_queue.php');
|
||||
require_once(BASE.'include/version_queue.php');
|
||||
require_once(BASE.'include/application_queue.php');
|
||||
|
||||
/* internal function */
|
||||
function test_class($sClassName, $aTestMethods)
|
||||
@@ -135,6 +136,7 @@ function test_object_methods()
|
||||
);
|
||||
|
||||
$aTestClasses = array("application",
|
||||
"application_queue",
|
||||
"distribution",
|
||||
"maintainer",
|
||||
"screenshot",
|
||||
|
||||
Reference in New Issue
Block a user