From c2a45094e2eed5ad1b31b5c6837823909c9cde5d Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Tue, 6 Apr 2004 21:26:10 +0000 Subject: [PATCH] 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. --- account.php | 2 +- admin/adminAppQueue.php | 40 ++++++++++++++++++++++++++++++++++------ appsubmit.php | 31 ++++++++++++++++++++++++++----- 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/account.php b/account.php index 4f46342..6f0ba9a 100644 --- a/account.php +++ b/account.php @@ -184,7 +184,7 @@ function cmd_do_login() if($result == null) { $current = $user; - addmsg("You are successfully logged in.", "green"); + addmsg("You are successfully logged in as '$user->username'.", "green"); redirect(apidb_fullurl("index.php")); } else diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index bdefe4d..94a32bf 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -84,13 +84,41 @@ if ($sub) //version echo 'App Version',"\n"; - //vendor - echo 'App Vendor',"\n"; + //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 'App Vendor',"\n"; - //alt vendor - echo ' ',"\n"; - $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); - echo '',"\n"; + $ob2 = mysql_fetch_object($result); + + echo ' ',"\n"; + $x->make_option_list("altvendor","$ob2->vendorId","vendor","vendorId","vendorName"); + echo '',"\n"; + } else + { + //vendor field + echo 'App Vendor',"\n"; + + echo ' ',"\n"; + $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); + echo '',"\n"; + } + //url echo 'App URL',"\n"; diff --git a/appsubmit.php b/appsubmit.php index c78d122..52c1481 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -23,7 +23,8 @@ function checkInput( $fields ) $errors .= "
  • Please enter an application version.
  • \n"; } - if ( empty( $fields['queueVendor']) ) + // No vendor entered, and nothing in the list is selected + if ( empty( $fields['queueVendor']) and $fields['altvendor'] == '0' ) { $errors .= "
  • Please enter a vendor.
  • \n"; } @@ -51,12 +52,11 @@ function checkInput( $fields ) include("path.php"); require(BASE."include/"."incl.php"); +require(BASE."include/"."tableve.php"); global $current; if ($_REQUEST['queueName']) { - // add to queue - // Check input and exit if we found errors $errors = checkInput($_REQUEST); if( !empty($errors) ) @@ -64,10 +64,25 @@ if ($_REQUEST['queueName']) errorpage("We found the following errors:","
    Please go back and correct them."); 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 apidb_header("Submit Application"); - + + // add to queue $query = "INSERT INTO appQueue VALUES (null, '". addslashes($_REQUEST['queueName'])."', '". addslashes($_REQUEST['queueVersion'])."', '". @@ -88,7 +103,6 @@ if ($_REQUEST['queueName']) echo "

    Your application has been submitted for Review. You should hear back\n"; echo "soon about the status of your submission

    \n"; } - } else { @@ -122,6 +136,13 @@ else echo 'App Name',"\n"; echo 'App Version',"\n"; echo 'App Vendor',"\n"; + + //alt vendor + $x = new TableVE("view"); + echo ' ',"\n"; + $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); + echo '',"\n"; + echo 'App URL',"\n"; echo 'App Desc',"\n"; echo 'Email',"\n";