diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 2128263..6396db1 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -5,6 +5,7 @@ include("path.php"); require(BASE."include/"."incl.php"); require(BASE."include/"."tableve.php"); +require(BASE."include/"."application.php"); //deny access if not logged in if(!loggedin()) @@ -18,8 +19,6 @@ else if (!havepriv("admin")) exit; } -apidb_header("Admin App Queue"); -echo '
',"\n"; if ($sub) { @@ -34,16 +33,22 @@ if ($sub) else { //error no Id! - echo html_frame_start("Error","300"); - echo '

Application Not Found!

',"\n"; - echo html_frame_end(" "); + addmsg("Application Not Found!", "red"); + redirect(apidb_fullurl("admin/adminAppQueue.php")); + exit; } //process according to sub flag if ($sub == 'view' && $queueId) { $x = new TableVE("view"); - If ($ob->queueCatId == -1) + apidb_header("Admin App Queue"); + echo '',"\n"; + + echo '',"\n"; + echo '',"\n"; + + If ($ob->queueCatId == -1) //app version { //help echo "
\n\n"; @@ -52,6 +57,8 @@ if ($sub) echo "an email will be sent to the author of the submission.

\n"; echo " App Version This type of application will be nested under the selected application parent.\n"; + echo "

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.

\n\n"; echo "
\n\n"; echo '',"\n"; @@ -68,23 +75,6 @@ if ($sub) echo 'App Version',"\n"; 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 '' ,"\n"; - echo ' ',"\n"; - echo '',"\n"; - } else { @@ -103,6 +93,8 @@ if ($sub) echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.

\n"; echo "

  • 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.
  • \n"; + echo "

    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.

    \n\n"; echo "\n\n"; //view application details @@ -142,7 +134,8 @@ if ($sub) //version echo 'App Version',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; //vendor/alt vendor fields // try for an exact match @@ -173,7 +166,8 @@ if ($sub) //vendor field echo 'App Vendor',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; echo ' ',"\n"; $x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName"); @@ -182,33 +176,32 @@ if ($sub) { //vendor field echo 'App Vendor',"\n"; - echo '',"\n"; + echo '',"\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 '' ,"\n"; - echo ' ',"\n"; - echo '',"\n"; } - echo '',"\n"; - echo '',"\n"; + //url + echo 'App URL',"\n"; + echo '',"\n"; + + //desc + echo 'App Desc',"\n"; + echo '',"\n"; + + //email message text + if ($ob->queueEmail) + { + echo 'email Text',"\n"; + echo '',"\n"; + } + echo '' ,"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo '',"\n"; echo html_frame_end(" "); echo html_back_link(1,'adminAppQueue.php'); @@ -237,7 +230,6 @@ if ($sub) { //get the id of the app just added $appParent = mysql_insert_id(); - //delete queue item mysql_query("DELETE from appQueue where queueId = $queueId;"); @@ -246,7 +238,7 @@ if ($sub) $queueVersion = '1.0'; if (!$queueDesc) $queueDesc = 'released version'; - + $verQuery = "INSERT into appVersion VALUES (null, $appParent, '". addslashes($queueVersion)."', '', '". addslashes($queueDesc)."', '". @@ -256,7 +248,8 @@ if ($sub) if (mysql_query($verQuery)) { //successful - $statusMessage = "

    The application $queueName was successfully added into the database

    \n"; + $appVersion = mysql_insert_id(); + addmsg("The application $queueName was successfully added into the database", "green"); $goodtogo = 1; } else @@ -264,6 +257,7 @@ if ($sub) //error $statusMessage = "

    Database Error!
    ".mysql_error()."

    \n"; $statusMessage .= "

    Note: The application family was successfully added.

    \n"; + addmsg($statusMessage, "red"); } } @@ -271,6 +265,7 @@ if ($sub) { //error $statusMessage = "

    Database Error!
    ".mysql_error()."

    \n"; + addmsg($statusMessage, "red"); } } else if ($type == 'ver') @@ -278,7 +273,7 @@ if ($sub) //process as application version if ($appParent) { - $query = "INSERT into appVersion VALUES (null, $appParent, '". + $query = "INSERT into appVersion VALUES (null, $appParent, '". addslashes($queueVersion)."', '', '". addslashes($queueDesc)."', '". addslashes($queueURL)."', 0.0, 0.0);"; @@ -286,7 +281,9 @@ if ($sub) if (mysql_query($query)) { //successful + $appVersion = mysql_insert_id(); $statusMessage = "

    The application $queueName was successfully added into the database

    \n"; + addmsg($statusMessage,Green); mysql_query("DELETE from appQueue where queueId = $queueId;"); $goodtogo = 1; @@ -295,11 +292,15 @@ if ($sub) { //error $statusMessage = "

    Database Error!
    ".mysql_error()."

    \n"; + addmsg($statusMessage,red); } } else { - $statusMessage = "

    Error
    You did not pick an application Parent!

    \n"; + addmsg("You did not pick an application Parent!",red); + redirect(apidb_fullurl("admin/adminAppQueue.php?cat=view&queueId=$queueId")); + exit; + } } @@ -307,51 +308,96 @@ if ($sub) //Send Status Email if ($ob->queueEmail && $goodtogo) { + $fullAppName = lookupAppName($appParent)." Version: ".lookupVersionName($appParent, $appVersion); + + $ms = "Application Database Status Report\n"; + $ms .= "----------------------------------\n\n"; + $ms .= "Your application: ".$fullAppName." has been entered "; + $ms .= "into the application database.\n\n"; + $ms .= APPDB_ROOT."appView.php?appId=$appParent&versionId=$appVersion"."\n\n"; + $ms .= "Thanks!\n\n"; + $ms .= $emailtext; + + mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms); + } + if ($goodtogo) + { + $email = getNotifyEmailAddressList($appParent, $appVersion); + if($email) + { + $fullAppName = "Application: ".lookupAppName($appParent). + " Version: ".lookupVersionName($appParent, $appVersion); + $ms = APPDB_ROOT."appview.php?appId=$appParent&versionId=$appVersion"."\n\n"; + $ms .= "New Application added to database:\n\n"; + $ms .= $fullAppName."\n\n"; + $ms .= STANDARD_NOTIFY_FOOTER; + + mail(stripslashes($email), "[AppDB] NEW ".$fullAppName ,$ms); + + } else + { + $email = "no one"; + } + addmsg("mesage sent to: ".$email, green); + + } + //done + addmsg("Veiw App", "green"); + redirect(apidb_fullurl("admin/adminAppQueue.php")); + exit; + } + else if ($sub == 'Delete' && $queueId) + { + //delete main item + $query = "DELETE from appQueue where queueId = $queueId;"; + $result = mysql_query($query); + if(!$result) + { + //error + addmsg("Internal Error: unable to delete selected application!", "red"); + redirect(apidb_fullurl("admin/adminAppQueue.php?appId=$appId&versionId=$versionId")); + } + else + { + //Send Status Email + if ($ob->queueEmail) + { + if($ob->queueCatId == -1) //app version + { + $fullAppName = lookupAppName($appParent)." Version: ".$ob->queueVersion; + } else + { + $fullAppName = $ob->queueName." Version: ".$ob->queueVersion; + } + $ms = "Application Database Status Report\n"; $ms .= "----------------------------------\n\n"; - $ms .= "Your application ".stripslashes($ob->queueName)." has been entered "; + $ms .= "Your application: ".$fullAppName." has not been entered "; $ms .= "into the application database.\n\n"; - $ms .= "Thanks!\n"; - + $ms .= "Sorry!\n\n"; + $ms .= $emailtext; + mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms); + } + //success + addmsg("Application was successfully deleted from the Queue.", "green"); + redirect(apidb_fullurl("admin/adminAppQueue.php?appId=$appId&versionId=$versionId")); } - - //done - 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) - { - //delete main item - $query = "DELETE from appQueue where queueId = $queueId;"; - $result = mysql_query($query); - echo html_frame_start("Delete Application: $ob->queueName",400,"",0); - if(!$result) - { - //error - echo "

    Internal Error: unable to delete selected application!

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

    Application was successfully deleted from the Queue.

    \n"; - } - echo html_frame_end(" "); - echo html_back_link(1,'adminAppQueue.php'); } 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'); + addmsg("Internal Routine Not Found!!", "red"); + redirect(apidb_fullurl("admin/adminAppQueue.php")); + } + exit; } else { + apidb_header("Admin App Queue"); + echo '',"\n"; + //get available apps $query = "SELECT queueId, queueName, queueVendor,". "queueVersion, queueEmail, queueCatId,". @@ -372,9 +418,8 @@ else //help 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 "

    To view a submission, click on its name. From that page you can edit, delete or approve it into \n"; + echo "the AppDB .
    \n"; echo "

    \n\n"; //show applist @@ -415,18 +460,16 @@ else 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 "
    "; + apidb_footer(); + } -echo ""; -apidb_footer(); - - ?>