hasAppVersionModifyPermission($oRow->versionId) &&
(($oRow->queued=="false")?true:false) &&
!$_SESSION['current']->isVersionSubmitter($oRow->versionId))
{
errorpage("Insufficient privileges.");
exit;
}
$oVersion = new Version($oRow->versionId);
} elseif(is_numeric($_REQUEST['versionId']))
{
// make sure the user has permission to view this version
if(!$_SESSION['current']->hasAppVersionModifyPermission($_REQUEST['versionId'])&&
(($oRow->queued=="false")?true:false) &&
!$_SESSION['current']->isVersionSubmitter($oRow->versionId))
{
errorpage("Insufficient privileges.");
exit;
}
$oVersion = new Version($_REQUEST['versionId']);
} else
{
//error no Id!
addmsg("Application Not Found!", "red");
redirect($_SERVER['PHP_SELF']);
}
//process according to sub flag
if ($_REQUEST['sub'] == 'view')
{
$x = new TableVE("view");
apidb_header("Admin Rejected App Queue");
echo '
This is the full view of the rejected application. \n";
echo "You need to pick a category before submitting \n";
echo "it into the database.\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";
// 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 '%".$sVendor."%';";
$hResult = query_appdb($sQuery);
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
$iVendorId = $oRow->vendorId;
}
}
//vendor field
if($iVendorId)
$sVendor = "";
echo '
',"\n";
}
echo html_frame_end(" ");
echo html_back_link(1,$_SERVER['PHP_SELF']);
}
else if ($_REQUEST['sub'] == 'ReQueue')
{
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
{
// 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 = 'rejected';";
$hResult = query_appdb($sQuery);
if($hResult)
{
while($oRow = mysql_fetch_object($hResult))
{
$oVersion = new Version($oRow->versionId);
$oVersion->update($_REQUEST['versionName'], $_REQUEST['versionDescription'],null,null,$_REQUEST['appId']);
$oVersion->ReQueue();
}
}
// delete the application entry
$oApp = new Application($_REQUEST['appId']);
$oApp->update($_REQUEST['appName'], $_REQUEST['applicationDescription'], $_REQUEST['keywords'], $_REQUEST['webpage'], $_REQUEST['vendorId'], $_REQUEST['catId']);
$oApp->ReQueue();
} else if(is_numeric($_REQUEST['versionId'])) // version
{
$oVersion = new Version($_REQUEST['versionId']);
$oVersion->update($_REQUEST['versionName'], $_REQUEST['versionDescription'],null,null,$_REQUEST['appId']);
$oVersion->ReQueue();
}
redirect($_SERVER['PHP_SELF']);
}
else if ($_REQUEST['sub'] == 'Delete')
{
if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
{
// 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 = 'rejected';";
$hResult = query_appdb($sQuery);
if($hResult)
{
while($oRow = mysql_fetch_object($hResult))
{
$oVersion = new Version($oRow->versionId);
$oVersion->delete();
}
}
// delete the application entry
$oApp = new Application($_REQUEST['appId']);
$oApp->delete();
} else if(is_numeric($_REQUEST['versionId'])) // version
{
$oVersion = new Version($_REQUEST['versionId']);
$oVersion->delete();
}
redirect($_SERVER['PHP_SELF']);
}
else
{
// error no sub!
addmsg("Internal Routine Not Found!!", "red");
redirect($_SERVER['PHP_SELF']);
}
}
else // if ($_REQUEST['sub']) is not defined, display the main app queue page
{
apidb_header("Resubmit application");
// get queued apps that the current user should see
$hResult = $_SESSION['current']->getAppRejectQueueQuery(true); // query for the app family
if(!$hResult || !mysql_num_rows($hResult))
{
//no apps in queue
echo html_frame_start("Application Queue","90%");
echo '
\n\n";
echo html_frame_end(" ");
}
// get queued versions (only versions where application are not queued already)
$hResult = $_SESSION['current']->getAppRejectQueueQuery(false); // query for the app version
if(!$hResult || !mysql_num_rows($hResult))
{
//no apps in queue
echo html_frame_start("Version Queue","90%");
echo '