When processing an application automatically perform a search of the

database for the application name and display a table at the top of the
page. This makes it easier to determine if the submission is a duplicate.  Remove
obsolete comments for admins.  Add a 'back' link to the top of the page
to make it easier to go back without scrolling to the bottom of the page.
This commit is contained in:
Chris Morgan
2005-05-14 00:42:25 +00:00
committed by WineHQ
parent 342bd66485
commit 5f6053ab41
3 changed files with 71 additions and 62 deletions

View File

@@ -52,6 +52,8 @@ if ($_REQUEST['sub'])
echo '<form name="qform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
echo '<input type="hidden" name="sub" value="add">',"\n";
echo html_back_link(1,'adminAppQueue.php');
if ($oVersion) //app version
{
//help
@@ -91,20 +93,17 @@ if ($_REQUEST['sub'])
echo '</table></form>',"\n";
} else // application
{
echo html_frame_start("Potential duplicate applications in the database","90%","",0);
$hResult = searchForApplication($oApp->sName);
outputSearchTableForhResult($oApp->sName, $hResult);
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 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>There are two kinds of applications in this database:</p>\n";
echo "<ol>\n";
echo " <li><b>App Family</b> This is a parent group application, that will have multiple versions under it.<br>\n";
echo " To add this submission as a Family, choose 'Application' from the type drop down. Then set the category.\n";
echo " The version and app parent fields will be ignored in this type.<br>\n";
echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.</li><p>\n";
echo " <li><b>App Version</b> This type of application will be nested under the selected application parent.\n";
echo " The category, name, and vendor fields will be ignored.</li>\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";

View File

@@ -301,4 +301,66 @@ function outputTopXRowAppsFromRating($rating, $num_apps)
}
}
/* search the database and return a hResult from the query_appdb() */
function searchForApplication($search_words)
{
$sQuery = "SELECT *
FROM appFamily
WHERE appName != 'NONAME'
AND queued = 'false'
AND (appName LIKE '%".addslashes($search_words)."%'
OR keywords LIKE '%".addslashes($search_words)."%')
ORDER BY appName";
$hResult = query_appdb($sQuery);
return $hResult;
}
function outputSearchTableForhResult($search_words, $hResult)
{
if(mysql_num_rows($hResult) == 0)
{
// do something
echo html_frame_start("","98%");
echo "No matches found for '". urlencode($search_words) . "'\n";
echo html_frame_end();
} else
{
echo html_frame_start("","98%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n";
echo " <td><font color=white>Application Name</font></td>\n";
echo " <td><font color=white>Description</font></td>\n";
echo " <td><font color=white>No. Versions</font></td>\n";
echo "</tr>\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 "<tr class=$bgcolor>\n";
echo " <td>".html_ahref($ob->appName,"appview.php?appId=$ob->appId")."</td>\n";
echo " <td>".trim_description($ob->description)."</td>\n";
echo " <td>$y->versions &nbsp;</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "<tr><td colspan=3 class=color4><font color=white>$c match(es) found</font></td></tr>\n";
echo "</table>\n\n";
echo html_frame_end();
}
}
?>

View File

@@ -10,62 +10,10 @@ include("path.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
$sQuery = "SELECT *
FROM appFamily
WHERE appName != 'NONAME'
AND queued = 'false'
AND (appName LIKE '%".addslashes($_REQUEST['q'])."%'
OR keywords LIKE '%".addslashes($_REQUEST['q'])."%')
ORDER BY appName";
$hResult = query_appdb($sQuery);
apidb_header("Search Results");
if(mysql_num_rows($hResult) == 0)
{
// do something
echo html_frame_start("","98%");
echo "No matches found for ". urlencode($_REQUEST['q']) . "\n";
echo html_frame_end();
}
else
{
echo html_frame_start("","98%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n";
echo " <td><font color=white>Application Name</font></td>\n";
echo " <td><font color=white>Description</font></td>\n";
echo " <td><font color=white>No. Versions</font></td>\n";
echo "</tr>\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 "<tr class=$bgcolor>\n";
echo " <td>".html_ahref($ob->appName,"appview.php?appId=$ob->appId")."</td>\n";
echo " <td>".trim_description($ob->description)."</td>\n";
echo " <td>$y->versions &nbsp;</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "<tr><td colspan=3 class=color4><font color=white>$c match(es) found</font></td></tr>\n";
echo "</table>\n\n";
}
$hResult = searchForApplication($_REQUEST['q']);
outputSearchTableForhResult($_REQUEST['q'], $hResult);
apidb_footer();
?>