diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php
index 9f33a92..715f41d 100644
--- a/admin/adminAppQueue.php
+++ b/admin/adminAppQueue.php
@@ -17,6 +17,59 @@ function get_vendor_from_keywords($sKeywords)
return($aKeywords[$iLastElt]);
}
+/* 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 "
\n\n";
+
+ $c = 0;
+ while($ob = mysql_fetch_object($hResult))
+ {
+ //skip if a NONAME
+ if ($ob->appName == "NONAME") { continue; }
+
+ //set row color
+ $bgcolor = ($c % 2) ? 'color0' : 'color1';
+
+ //count versions
+ $query = query_appdb("SELECT count(*) as versions FROM appVersion WHERE appId = $ob->appId AND versionName != 'NONAME'");
+ $y = mysql_fetch_object($query);
+
+ //display row
+ echo "
\n";
+ /* map the merging of the current app to the app we are displaying in the table */
+ echo "
\n\n";
+
+ $c++;
+
+ //set row color
+ $bgcolor = ($c % 2) ? 'color0' : 'color1';
+
+ /* add the versions to the table */
+ $oApp = new Application($ob->appId);
+ foreach($oApp->aVersionsIds as $iVersionId)
+ {
+ $oVersion = new Version($iVersionId);
+ echo "
".$oVersion->sName."
\n";
+ }
+
+ $c++;
+ }
+
+ echo "
\n\n";
+ echo html_frame_end();
+ }
+}
+
//deny access if not logged in
if(!$_SESSION['current']->hasPriv("admin"))
{
@@ -29,6 +82,16 @@ if ($_REQUEST['sub'])
if(is_numeric($_REQUEST['appId']))
{
$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 */
+ $sQuery = "Select versionId from appVersion where appId='".$_REQUEST['appId']."';";
+ $hResult = query_appdb($sQuery);
+ $oRow = mysql_fetch_object($hResult);
+
+ $oVersion = new Version($oRow->versionId);
} elseif(is_numeric($_REQUEST['versionId']))
{
$oVersion = new Version($_REQUEST['versionId']);
@@ -54,7 +117,7 @@ if ($_REQUEST['sub'])
echo html_back_link(1,'adminAppQueue.php');
- if ($oVersion) //app version
+ if (!$oApp) //app version
{
echo html_frame_start("Potential duplicate versions in the database","90%","",0);
$oApp = new Application($oVersion->iAppId);
@@ -83,7 +146,6 @@ if ($_REQUEST['sub'])
echo '
Version name
',"\n";
echo '
',"\n";
-
echo '
Description
',"\n";
echo '
',"\n";
@@ -102,6 +164,16 @@ if ($_REQUEST['sub'])
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 "
\n\n";
echo "
This is the full view of the application waiting to be approved. \n";
@@ -178,10 +250,18 @@ if ($_REQUEST['sub'])
echo '
App URL
',"\n";
echo '
',"\n";
- //desc
-
- echo '
Description
',"\n";
- echo '
',"\n";
+ // application desc
+ echo '
Application Description
',"\n";
+ echo '
',"\n";
+
+ // version name
+ echo '
Version name
',"\n";
+ echo '
',"\n";
+
+ // version description
+ echo '
Version Description
',"\n";
+ echo '
',"\n";
+
echo '
email Text
',"\n";
echo '
',"\n";
@@ -189,7 +269,8 @@ if ($_REQUEST['sub'])
echo '
' ,"\n";
echo '';
echo ' ',"\n";
- echo '
',"\n";
+ echo '',"\n";
+ echo '',"\n";
echo '
',"\n";
}
@@ -208,7 +289,7 @@ if ($_REQUEST['sub'])
}
$oApp = new Application($_REQUEST['appId']);
- $oApp->update($_REQUEST['appName'], $_REQUEST['description'], $_REQUEST['keywords'], $_REQUEST['webpage'], $_REQUEST['vendorId'], $_REQUEST['catId']);
+ $oApp->update($_REQUEST['appName'], $_REQUEST['applicationDescription'], $_REQUEST['keywords'], $_REQUEST['webpage'], $_REQUEST['vendorId'], $_REQUEST['catId']);
$oApp->unQueue();
} else if(is_numeric($_REQUEST['versionId']) && is_numeric($_REQUEST['appId'])) // version
{
@@ -219,6 +300,21 @@ if ($_REQUEST['sub'])
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->update(null, null, null, null, $_REQUEST['appIdMergeTo']);
+
+ /* 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 (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
@@ -254,7 +350,7 @@ if ($_REQUEST['sub'])
redirect(apidb_fullurl("admin/adminAppQueue.php"));
}
}
-else
+else /* if ($_REQUEST['sub']) is not defined, display the main app queue page */
{
apidb_header("Admin App Queue");
// get queued apps