Add a dropdown list of vendors to the app submit page. Automatch the dropdown
vendor selection on the admin side of there is an exact or partial name match. Clear out the vendor field if a match is found. Display username when logging in to the db.
This commit is contained in:
committed by
Jeremy Newman
parent
1977ad6919
commit
c2a45094e2
@@ -184,7 +184,7 @@ function cmd_do_login()
|
|||||||
if($result == null)
|
if($result == null)
|
||||||
{
|
{
|
||||||
$current = $user;
|
$current = $user;
|
||||||
addmsg("You are successfully logged in.", "green");
|
addmsg("You are successfully logged in as '$user->username'.", "green");
|
||||||
redirect(apidb_fullurl("index.php"));
|
redirect(apidb_fullurl("index.php"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -84,13 +84,41 @@ if ($sub)
|
|||||||
//version
|
//version
|
||||||
echo '<tr valign=top><td class=color0><b>App Version</b></td><td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Version</b></td><td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td></tr>',"\n";
|
||||||
|
|
||||||
//vendor
|
//vendor/alt vendor fields
|
||||||
|
// try for an exact match
|
||||||
|
$query = "select * from vendor where vendorname = '$ob->queueVendor';";
|
||||||
|
$result = mysql_query($query);
|
||||||
|
if(!$result)
|
||||||
|
{
|
||||||
|
// try for a partial match
|
||||||
|
$query = "select * from vendor where vendorname like '%$ob->queueVendor%';";
|
||||||
|
$result = mysql_query($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the first match if we found one and clear out the vendor field,
|
||||||
|
// otherwise don't pick a vendor
|
||||||
|
if($result)
|
||||||
|
{
|
||||||
|
$ob->queueVendor = '';
|
||||||
|
|
||||||
|
//vendor field
|
||||||
|
echo '<tr valign=top><td class=color0><b>App Vendor</b></td><td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
|
||||||
|
|
||||||
|
$ob2 = mysql_fetch_object($result);
|
||||||
|
|
||||||
|
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
||||||
|
$x->make_option_list("altvendor","$ob2->vendorId","vendor","vendorId","vendorName");
|
||||||
|
echo '</td></tr>',"\n";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//vendor field
|
||||||
echo '<tr valign=top><td class=color0><b>App Vendor</b></td><td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Vendor</b></td><td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
|
||||||
|
|
||||||
//alt vendor
|
|
||||||
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
||||||
$x->make_option_list("altvendor","","vendor","vendorId","vendorName");
|
$x->make_option_list("altvendor","","vendor","vendorId","vendorName");
|
||||||
echo '</td></tr>',"\n";
|
echo '</td></tr>',"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//url
|
//url
|
||||||
echo '<tr valign=top><td class=color0><b>App URL</b></td><td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App URL</b></td><td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ function checkInput( $fields )
|
|||||||
$errors .= "<li>Please enter an application version.</li>\n";
|
$errors .= "<li>Please enter an application version.</li>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $fields['queueVendor']) )
|
// No vendor entered, and nothing in the list is selected
|
||||||
|
if ( empty( $fields['queueVendor']) and $fields['altvendor'] == '0' )
|
||||||
{
|
{
|
||||||
$errors .= "<li>Please enter a vendor.</li>\n";
|
$errors .= "<li>Please enter a vendor.</li>\n";
|
||||||
}
|
}
|
||||||
@@ -51,12 +52,11 @@ function checkInput( $fields )
|
|||||||
|
|
||||||
include("path.php");
|
include("path.php");
|
||||||
require(BASE."include/"."incl.php");
|
require(BASE."include/"."incl.php");
|
||||||
|
require(BASE."include/"."tableve.php");
|
||||||
global $current;
|
global $current;
|
||||||
|
|
||||||
if ($_REQUEST['queueName'])
|
if ($_REQUEST['queueName'])
|
||||||
{
|
{
|
||||||
// add to queue
|
|
||||||
|
|
||||||
// Check input and exit if we found errors
|
// Check input and exit if we found errors
|
||||||
$errors = checkInput($_REQUEST);
|
$errors = checkInput($_REQUEST);
|
||||||
if( !empty($errors) )
|
if( !empty($errors) )
|
||||||
@@ -65,9 +65,24 @@ if ($_REQUEST['queueName'])
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if the user picked the vendor we need to retrieve the vendor name */
|
||||||
|
/* and store it into the $queueVendor */
|
||||||
|
if($_REQUEST['altvendor'])
|
||||||
|
{
|
||||||
|
/* retrieve the actual name here */
|
||||||
|
$query = "select * from vendor where vendorId = '$altvendor';";
|
||||||
|
$result = mysql_query($query);
|
||||||
|
if($result)
|
||||||
|
{
|
||||||
|
$ob = mysql_fetch_object($result);
|
||||||
|
$_REQUEST['queueVendor'] = $ob->vendorName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// header
|
// header
|
||||||
apidb_header("Submit Application");
|
apidb_header("Submit Application");
|
||||||
|
|
||||||
|
// add to queue
|
||||||
$query = "INSERT INTO appQueue VALUES (null, '".
|
$query = "INSERT INTO appQueue VALUES (null, '".
|
||||||
addslashes($_REQUEST['queueName'])."', '".
|
addslashes($_REQUEST['queueName'])."', '".
|
||||||
addslashes($_REQUEST['queueVersion'])."', '".
|
addslashes($_REQUEST['queueVersion'])."', '".
|
||||||
@@ -88,7 +103,6 @@ if ($_REQUEST['queueName'])
|
|||||||
echo "<p>Your application has been submitted for Review. You should hear back\n";
|
echo "<p>Your application has been submitted for Review. You should hear back\n";
|
||||||
echo "soon about the status of your submission</p>\n";
|
echo "soon about the status of your submission</p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -122,6 +136,13 @@ else
|
|||||||
echo '<tr valign=top><td class=color0><b>App Name</b></td><td><input type=text name="queueName" value="" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Name</b></td><td><input type=text name="queueName" value="" size=20></td></tr>',"\n";
|
||||||
echo '<tr valign=top><td class=color0><b>App Version</b></td><td><input type=text name="queueVersion" value="" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Version</b></td><td><input type=text name="queueVersion" value="" size=20></td></tr>',"\n";
|
||||||
echo '<tr valign=top><td class=color0><b>App Vendor</b></td><td><input type=text name="queueVendor" value="" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Vendor</b></td><td><input type=text name="queueVendor" value="" size=20></td></tr>',"\n";
|
||||||
|
|
||||||
|
//alt vendor
|
||||||
|
$x = new TableVE("view");
|
||||||
|
echo '<tr valign=top><td class=color0> </td><td>',"\n";
|
||||||
|
$x->make_option_list("altvendor","","vendor","vendorId","vendorName");
|
||||||
|
echo '</td></tr>',"\n";
|
||||||
|
|
||||||
echo '<tr valign=top><td class=color0><b>App URL</b></td><td><input type=text name="queueURL" value="" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App URL</b></td><td><input type=text name="queueURL" value="" size=20></td></tr>',"\n";
|
||||||
echo '<tr valign=top><td class=color0><b>App Desc</b></td><td><textarea name="queueDesc" rows=10 cols=35></textarea></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Desc</b></td><td><textarea name="queueDesc" rows=10 cols=35></textarea></td></tr>',"\n";
|
||||||
echo '<tr valign=top><td class=color0><b>Email</b></td><td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
|
echo '<tr valign=top><td class=color0><b>Email</b></td><td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user