diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 16dae02..a24d58b 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -1,7 +1,6 @@ Application Not Found!

',"\n"; - echo html_frame_end(" "); + echo html_frame_start("Error","300"); + echo '

Application Not Found!

',"\n"; + echo html_frame_end(" "); } //process according to sub flag if ($sub == 'view' && $queueId) { - $x = new TableVE("view"); + $x = new TableVE("view"); //help - echo "
\n\n"; - echo "

This is the full view of the application waiting to be approved. You need to pick a category before submitting \n"; - echo "it into the database. If you approve this application, an email will be sent to the author of the submission.

\n"; - echo "

There are two kinds of applications in this database:

\n"; - echo "
    \n"; - echo "
  1. App Family This is a parent group application, that will have multiple versions under it.
    \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.
    \n"; - echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.
  2. \n"; - echo "

  3. App Version This type of application will be nested under the selected application parent. The category,\n"; - echo " name, and vendor fields will be ignored.
  4. \n"; - echo "
\n\n"; + echo "
\n\n"; + echo "

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.

\n"; + echo "

There are two kinds of applications in this database:

\n"; + echo "
    \n"; + echo "
  1. App Family This is a parent group application, that will have multiple versions under it.
    \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.
    \n"; + echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.
  2. \n"; + echo "

  3. App Version This type of application will be nested under the selected application parent.\n"; + echo " The category, name, and vendor fields will be ignored.
  4. \n"; + echo "
\n\n"; //view application details - echo html_frame_start("New Application Form",400,"",0); - echo "\n"; - - //type - echo '',"\n"; - - //category - echo '',"\n"; - - //app parent - echo '',"\n"; - - //name - echo '',"\n"; + echo html_frame_start("New Application Form",400,"",0); + echo "
Type',"\n"; - echo '',"\n"; - echo '
Category',"\n"; - $x->make_option_list("cat","","appCategory","catId","catName"); - echo '
App Parent',"\n"; - $x->make_option_list("appParent","","appFamily","appId","appName"); - echo '
App Name
\n"; + + //type + echo '',"\n"; + + //category - //version - echo '',"\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%';"; + $query = "select * from appCategory where catId = '$ob->queueCatId';"; $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 '',"\n"; - - $ob2 = mysql_fetch_object($result); - - echo '',"\n"; + } else + { + echo '',"\n"; + } + //app parent + echo '',"\n"; - } else - { - //vendor field - echo '',"\n"; - - echo '',"\n"; - } + + //name + echo '',"\n"; + echo '',"\n"; + + //version + echo '',"\n"; + echo '',"\n"; + + //vendor/alt vendor fields + // 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 + $query = "select * from vendor where vendorname = '$ob->queueVendor';"; + $result = mysql_query($query); + $checkvendor = 0; + if($result) + { + $ob2 = mysql_fetch_object($result); + $checkvendor = $ob2->vendorId; + } + if(!$checkvendor) + { + // try for a partial match + $query = "select * from vendor where vendorname like '%$ob->queueVendor%';"; + $result = mysql_query($query); + if($result) + { + $ob2 = mysql_fetch_object($result); + $checkvendor = $ob2->vendorId; + } + } + if(checkvendor) + { + $ob->queueVendor = ''; - - //url - echo '',"\n"; - - //desc - echo '',"\n"; - - //echo '',"\n"; - //echo '',"\n"; - - echo '',"\n"; - echo '
Type',"\n"; + echo '',"\n"; + echo '
App Version
App Vendor
 ',"\n"; - $x->make_option_list("altvendor","$ob2->vendorId","vendor","vendorId","vendorName"); + if($result) + { + + $ob2 = mysql_fetch_object($result); + + echo '
Category',"\n"; + $x->make_option_list("cat",stripslashes($ob2->catId),"appCategory","catId","catName"); + echo '
Category',"\n"; + $x->make_option_list("cat","","appCategory","catId","catName"); + echo '
App Parent',"\n"; + $x->make_option_list("appParent","","appFamily","appId","appName"); echo '
App Vendor
 ',"\n"; - $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); - echo '
App Name
App Version
App URL
App Desc
Email
Image
',"\n"; - echo '',"\n"; - echo '',"\n"; + //vendor field + echo 'App Vendor',"\n"; + echo '',"\n"; + + echo ' ',"\n"; + $x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName"); + echo '',"\n"; + } else + { + //vendor field + echo 'App Vendor',"\n"; + echo '',"\n"; + + echo ' ',"\n"; + $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); + echo '',"\n"; + } + + + //url + echo 'App URL',"\n"; + echo '',"\n"; + + //desc + echo 'App Desc',"\n"; + echo '',"\n"; + + //echo 'Email,"\n"; + //echo '',"\n"; + //echo 'Image,"\n"; + //echo '',"\n"; - echo html_frame_end(" "); - echo html_back_link(1,'adminAppQueue.php'); + echo '' ,"\n"; + echo ' ',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + + echo html_frame_end(" "); + echo html_back_link(1,'adminAppQueue.php'); } else if ($sub == 'add' && $queueId) { //add item to main db - $statusMessage = ""; - $goodtogo = 0; - if ($type == 'app') - { - //process as application family - if ($altvendor == 0 && $queueVendor) - { - //add new vendor - mysql_query("INSERT into vendor VALUES (null, '".addslashes($queueVendor)."', '');"); - $altvendor = mysql_insert_id(); - } - - $query = "INSERT into appFamily VALUES (null, '". - addslashes($queueName)."', $altvendor, '', '". - addslashes($queueDesc)."', '". - addslashes($queueURL)."', $cat);"; - - if (mysql_query($query)) - { - //get the id of the app just added - $appParent = mysql_insert_id(); + $statusMessage = ""; + $goodtogo = 0; + if ($type == 'app') + { + //process as application family + if ($altvendor == 0 && $queueVendor) + { + //add new vendor + mysql_query("INSERT into vendor VALUES (null, '".addslashes($queueVendor)."', '');"); + $altvendor = mysql_insert_id(); + } + + $query = "INSERT into appFamily VALUES (null, '". + addslashes($queueName)."', $altvendor, '', '". + addslashes($queueDesc)."', '". + addslashes($queueURL)."', $cat);"; + + if (mysql_query($query)) + { + //get the id of the app just added + $appParent = mysql_insert_id(); - //delete queue item - mysql_query("DELETE from appQueue where queueId = $queueId;"); - - //set ver if not set - if (!$queueVersion) - $queueVersion = '1.0'; - if (!$queueDesc) - $queueDesc = 'released version'; - - $verQuery = "INSERT into appVersion VALUES (null, $appParent, '". - addslashes($queueVersion)."', '', '". - addslashes($queueDesc)."', '". - addslashes($queueURL)."', 0.0, 0.0);"; - - //Now add a version - if (mysql_query($verQuery)) - { - //successful - $statusMessage = "

The application $queueName was successfully added into the database

\n"; - $goodtogo = 1; - } - else - { - //error - $statusMessage = "

Database Error!
".mysql_error()."

\n"; - $statusMessage .= "

Note: The application family was successfully added.

\n"; - } - - } - else - { - //error - $statusMessage = "

Database Error!
".mysql_error()."

\n"; - } - } - else if ($type == 'ver') - { - //process as application version - if ($appParent) - { - $query = "INSERT into appVersion VALUES (null, $appParent, '". - addslashes($queueVersion)."', '', '". - addslashes($queueDesc)."', '". - addslashes($queueURL)."', 0.0, 0.0);"; - - if (mysql_query($query)) - { - //successful - $statusMessage = "

The application $queueName was successfully added into the database

\n"; - mysql_query("DELETE from appQueue where queueId = $queueId;"); - $goodtogo = 1; - - } - else - { - //error - $statusMessage = "

Database Error!
".mysql_error()."

\n"; - } - } - else - { - $statusMessage = "

Error
You did not pick an application Parent!

\n"; - } - - } - - //Send Status Email - if ($ob->queueEmail && $goodtogo) - { - $ms = "Application Database Status Report\n"; - $ms .= "----------------------------------\n\n"; - $ms .= "Your application ".stripslashes($ob->queueName)." has been entered "; - $ms .= "into the application database.\n\n"; - $ms .= "Thanks!\n"; - - mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms); - } - + //delete queue item + mysql_query("DELETE from appQueue where queueId = $queueId;"); + + //set ver if not set + if (!$queueVersion) + $queueVersion = '1.0'; + if (!$queueDesc) + $queueDesc = 'released version'; + + $verQuery = "INSERT into appVersion VALUES (null, $appParent, '". + addslashes($queueVersion)."', '', '". + addslashes($queueDesc)."', '". + addslashes($queueURL)."', 0.0, 0.0);"; + + //Now add a version + if (mysql_query($verQuery)) + { + //successful + $statusMessage = "

The application $queueName was successfully added into the database

\n"; + $goodtogo = 1; + } + else + { + //error + $statusMessage = "

Database Error!
".mysql_error()."

\n"; + $statusMessage .= "

Note: The application family was successfully added.

\n"; + } + + } + else + { + //error + $statusMessage = "

Database Error!
".mysql_error()."

\n"; + } + } + else if ($type == 'ver') + { + //process as application version + if ($appParent) + { + $query = "INSERT into appVersion VALUES (null, $appParent, '". + addslashes($queueVersion)."', '', '". + addslashes($queueDesc)."', '". + addslashes($queueURL)."', 0.0, 0.0);"; + + if (mysql_query($query)) + { + //successful + $statusMessage = "

The application $queueName was successfully added into the database

\n"; + mysql_query("DELETE from appQueue where queueId = $queueId;"); + $goodtogo = 1; + + } + else + { + //error + $statusMessage = "

Database Error!
".mysql_error()."

\n"; + } + } + else + { + $statusMessage = "

Error
You did not pick an application Parent!

\n"; + } + + } + + //Send Status Email + if ($ob->queueEmail && $goodtogo) + { + $ms = "Application Database Status Report\n"; + $ms .= "----------------------------------\n\n"; + $ms .= "Your application ".stripslashes($ob->queueName)." has been entered "; + $ms .= "into the application database.\n\n"; + $ms .= "Thanks!\n"; + + mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms); + } + //done - echo html_frame_start("Submit Application","300"); - echo "

$statusMessage

\n"; - echo html_frame_end(" "); - echo html_back_link(1,'adminAppQueue.php'); + echo html_frame_start("Submit Application","300"); + echo "

$statusMessage

\n"; + echo html_frame_end(" "); + echo html_back_link(1,'adminAppQueue.php'); } else if ($sub == 'delete' && $queueId) { @@ -255,12 +286,12 @@ if ($sub) if(!$result) { //error - echo "

Internal Error: unable to delete selected application!

\n"; + echo "

Internal Error: unable to delete selected application!

\n"; } else { //success - echo "

Application was successfully deleted from the Queue.

\n"; + echo "

Application was successfully deleted from the Queue.

\n"; } echo html_frame_end(" "); echo html_back_link(1,'adminAppQueue.php'); @@ -268,17 +299,17 @@ if ($sub) else { //error no sub! - echo html_frame_start("Error","300"); - echo '

Internal Routine Not Found!

',"\n"; - echo html_frame_end(" "); - echo html_back_link(1,'adminAppQueue.php'); + echo html_frame_start("Error","300"); + echo '

Internal Routine Not Found!

',"\n"; + echo html_frame_end(" "); + echo html_back_link(1,'adminAppQueue.php'); } } else { //get available apps $query = "SELECT queueId, queueName, queueVendor,". - "queueEmail,". + "queueVersion, queueEmail,". "UNIX_TIMESTAMP(submitTime) as submitTime ". "from appQueue;"; $result = mysql_query($query); @@ -286,52 +317,52 @@ else if(!$result || !mysql_num_rows($result)) { //no apps in queue - echo html_frame_start("","90%"); - echo '

The Application Queue is empty.

',"\n"; - echo '

There is nothing for you to do. Check back later.

',"\n"; - echo html_frame_end(" "); + echo html_frame_start("","90%"); + echo '

The Application Queue is empty.

',"\n"; + echo '

There is nothing for you to do. Check back later.

',"\n"; + echo html_frame_end(" "); } else { //help - echo "
\n\n"; + echo "
\n\n"; echo "

This is the list of applications waiting for your approval, or to be annihilated from existence.

\n"; echo "

To view a submission, click on its name. From that page you can edit, and approve it into the AppDB.
\n"; echo "Click the delete link 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.

\n"; - echo "
\n\n"; + echo "submitter to let them know the item was deleted.

\n"; + echo "
\n\n"; //show applist - echo html_frame_start("","90%","",0); - echo "\n\n"; - - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n\n"; + echo html_frame_start("","90%","",0); + echo "
Submission DateApplication NameVersionVendorSubmitter Email 
\n\n"; - $c = 1; - while($ob = mysql_fetch_object($result)) + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + + $c = 1; + while($ob = mysql_fetch_object($result)) { - if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n\n"; - $c++; - } - echo "
Submission DateApplication NameVersionVendorSubmitter Email 
".date("Y-n-t h:i:sa", $ob->submitTime)."  $ob->queueName".stripslashes($ob->queueVersion)."  ".stripslashes($ob->queueVendor)."  ".stripslashes($ob->queueEmail)."  [delete]
\n\n"; - echo html_frame_end(" "); + if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } + echo "\n"; + echo " ".date("Y-n-t h:i:sa", $ob->submitTime)."  \n"; + echo " $ob->queueName\n"; + echo " ".stripslashes($ob->queueVersion)."  \n"; + echo " ".stripslashes($ob->queueVendor)."  \n"; + echo " ".stripslashes($ob->queueEmail)."  \n"; + echo " [delete]\n"; + echo "\n\n"; + $c++; + } + echo "\n\n"; + echo html_frame_end(" "); } - + } echo ""; diff --git a/appsubmit.php b/appsubmit.php index 59720ce..7700eb6 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -91,7 +91,9 @@ if ($_REQUEST['queueName']) addslashes($_REQUEST['queueEmail'])."', '". addslashes($_REQUEST['queueURL'])."', '". addslashes($_REQUEST['queueImage'])."',". - "NOW());"; + "NOW()".",". + addslashes($_REQUEST['queueCatId']).");"; + mysql_query($query); if ($error = mysql_error()) @@ -136,8 +138,17 @@ else echo "\n"; echo '',"\n"; echo '',"\n"; + + // app Category + $w = new TableVE("view"); + echo '',"\n"; + + echo '',"\n"; + //alt vendor $x = new TableVE("view"); echo '
App Name
App Version
Category',"\n"; + $w->make_option_list("queueCatId","","appCategory","catId","catName"); + echo '
App Vendor
 ',"\n"; diff --git a/tables/appdb_tables.sql b/tables/appdb_tables.sql index 922c601..e392c35 100644 --- a/tables/appdb_tables.sql +++ b/tables/appdb_tables.sql @@ -73,6 +73,7 @@ create table appQueue ( queueURL varchar(100), queueImage varchar(100) not null, submitTime timestamp, + queueCatId int, key(queueId) );