hasPriv("admin")) { errorpage("Insufficient privileges."); exit; } if ($_REQUEST['sub']) { if(is_numeric($_REQUEST['appId'])) { $oApp = new Application($_REQUEST['appId']); } elseif(is_numeric($_REQUEST['versionId'])) { $oVersion = new Version($_REQUEST['versionId']); } else { //error no Id! addmsg("Application Not Found!", "red"); redirect(apidb_fullurl("admin/adminAppQueue.php")); } //process according to sub flag if ($_REQUEST['sub'] == 'view') { $x = new TableVE("view"); apidb_header("Admin App Queue"); ?> ',"\n"; echo '',"\n"; echo html_back_link(1,'adminAppQueue.php'); if ($oVersion) //app version { echo html_frame_start("Potential duplicate versions in the database","90%","",0); $oApp = new Application($oVersion->iAppId); display_versions($oApp->iAppId, $oApp->aVersionsIds); echo html_frame_end(" "); //help echo "
\n\n"; echo "

This is the full view of the application version waiting to be approved. \n"; echo "If you approve this application version 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 him know the item was deleted.

\n\n"; echo "
\n\n"; echo html_frame_start("New Version Form",400,"",0); echo "\n"; //app parent echo '',"\n"; //version echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '
Application',"\n"; $x->make_option_list("appId",$oVersion->iAppId,"appFamily","appId","appName"); echo '
Version name
Description

email Text
' ,"\n"; echo ''; echo ' ',"\n"; echo '
',"\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(" "); //help 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 "

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 echo html_frame_start("New Application Form",400,"",0); echo "\n"; //category echo '',"\n"; //name echo '',"\n"; echo '',"\n"; /* * vendor/alt vendor fields * if user selected a predefined vendorId: */ $iVendorId = $oApp->iVendorId; /* * If not, 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 * N.B. The vendor string is the last word of the keywords field ! */ if(!$iVendorId) { $sVendor = get_vendor_from_keywords($oApp->sKeywords); $sQuery = "SELECT vendorId FROM vendor WHERE vendorname = '".$sVendor."';"; $hResult = query_appdb($sQuery); if($hResult) { $oRow = mysql_fetch_object($hResult); $iVendorId = $oRow->vendorId; } } /* * try for a partial match */ if(!$iVendorId) { $sQuery = "select * from vendor where vendorname like '%$ob->queueVendor%';"; $hResult = query_appdb($sQuery); if($hResult) { $oRow = mysql_fetch_object($hResult); $iVendorId = $oRow->vendorId; } } //vendor field if($iVendorId) $sVendor = ""; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; //url echo '',"\n"; echo '',"\n"; //desc echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '
Category',"\n"; $x->make_option_list("catId",$oApp->iCatId,"appCategory","catId","catName"); echo '
App Name
App Vendor
 ',"\n"; $x->make_option_list("vendorId", $iVendorId ,"vendor","vendorId","vendorName"); echo '
App URL
Description

email Text
' ,"\n"; echo ''; echo ' ',"\n"; echo '
',"\n"; } echo html_frame_end(" "); echo html_back_link(1,'adminAppQueue.php'); } else if ($_REQUEST['sub'] == 'add') { if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application { // add new vendor if($sVendor) { $oVendor = new Vendor(); $oVendor->create($sVendor); } $oApp = new Application($_REQUEST['appId']); $oApp->update($_REQUEST['appName'], $_REQUEST['description'], $_REQUEST['keywords'], $_REQUEST['webpage'], $_REQUEST['vendorId'], $_REQUEST['catId']); $oApp->unQueue(); } else if(is_numeric($_REQUEST['versionId']) && is_numeric($_REQUEST['appId'])) // version { $oVersion = new Version($_REQUEST['versionId']); $oVersion->update($_REQUEST['versionName'], $_REQUEST['versionDescription'],null,null,$_REQUEST['appId']); $oVersion->unQueue(); } redirect(apidb_fullurl("admin/adminAppQueue.php")); } else if ($_REQUEST['sub'] == 'Delete') { if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application { // delete the application entry $oApp = new Application($_REQUEST['appId']); $oApp->delete(); // get the queued versions that refers to the application entry we just removed // and delete them as we implicitly added a version entry when adding a new application $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';"; $hResult = query_appdb($sQuery); if($hResult) { while($oRow = mysql_fetch_object($hResult)) { $oVersion = new Version($oRow->versionId); $oVersion->delete(); } } } else if(is_numeric($_REQUEST['versionId'])) // version { $oVersion = new Version($_REQUEST['versionId']); $oVersion->delete(); } redirect(apidb_fullurl("admin/adminAppQueue.php")); } else { //error no sub! addmsg("Internal Routine Not Found!!", "red"); redirect(apidb_fullurl("admin/adminAppQueue.php")); } } else { apidb_header("Admin App Queue"); // get queued apps $sQuery = "SELECT appId FROM appFamily WHERE queued = 'true'"; $hResult = query_appdb($sQuery); if(!$hResult || !mysql_num_rows($hResult)) { //no apps in queue echo html_frame_start("Application Queue","90%"); echo '

The Application Queue is empty.

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

This is the list of applications waiting for your approval, or to be rejected.

\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 echo html_frame_start("","90%","",0); echo ""; $c = 1; while($oRow = mysql_fetch_object($hResult)) { $oApp = new Application($oRow->appId); $oSubmitter = new User($oApp->iSubmitterId); if($oApp->iVendorId) { $oVendor = new Vendor($oApp->iVendorId); $sVendor = $oVendor->sName; } else { $sVendor = get_vendor_from_keywords($oApp->sKeywords); } if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n\n"; $c++; } echo "
Submission Date Submitter Vendor Application Action
".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."\n"; echo $oSubmitter->sEmail ? "sEmail."\">":""; echo $oSubmitter->sRealname; echo $oSubmitter->sEmail ? "":""; echo " ".$sVendor."".$oApp->sName."[iAppId."\">process]
\n\n"; echo html_frame_end(" "); } // get queued versions (only versions where application are not queued already) $sQuery = "SELECT versionId FROM appVersion, appFamily WHERE appFamily.appId = appVersion.appId and appFamily.queued = 'false' AND appVersion.queued = 'true'"; $hResult = query_appdb($sQuery); if(!$hResult || !mysql_num_rows($hResult)) { //no apps in queue echo html_frame_start("Version Queue","90%"); echo '

The Version Queue is empty.

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

This is the list of versions waiting for your approval, or to be rejected.

\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 "

Note that versions linked to application that have not been yet approved are not displayed in this list.

\n"; echo "the AppDB.
\n"; echo "
\n\n"; //show applist echo html_frame_start("","90%","",0); echo ""; $c = 1; while($oRow = mysql_fetch_object($hResult)) { $oVersion = new Version($oRow->versionId); $oApp = new Application($oVersion->iAppId); $oSubmitter = new User($oVersion->iSubmitterId); $oVendor = new Vendor($oApp->iVendorId); $sVendor = $oVendor->sName; 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 Date Submitter Vendor Application Version Action
".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."\n"; echo $oSubmitter->sEmail ? "sEmail."\">":""; echo $oSubmitter->sRealname; echo $oSubmitter->sEmail ? "":""; echo " ".$sVendor."".$oApp->sName."".$oVersion->sName."[iVersionId."\">process]
\n\n"; echo html_frame_end(" "); } } apidb_footer(); ?>