diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index bede150..43d5c68 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -9,13 +9,6 @@ require_once(BASE."include/tableve.php"); require_once(BASE."include/application.php"); require_once(BASE."include/testData.php"); -function get_vendor_from_keywords($sKeywords) -{ - $aKeywords = explode(" *** ",$sKeywords); - $iLastElt = (sizeOf($aKeywords)-1); - return($aKeywords[$iLastElt]); -} - /* allows the admin to click on a row and mark the current application as a duplicate */ /* of the selected application */ function outputSearchTableForDuplicateFlagging($currentAppId, $hResult) @@ -421,30 +414,6 @@ else /* if ($aClean['sSub']) is not defined, display the main app queue page */ { apidb_header("Admin App Queue"); - // get queued apps that the current user should see - $hResult = $_SESSION['current']->getAppQueueQuery(true); /* query for the app family */ - - 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 - Application::showList($hResult); - - } - // get queued versions (only versions where application are not queued already) $hResult = $_SESSION['current']->getAppQueueQuery(false); /* query for the app version */ diff --git a/appsubmit.php b/appsubmit.php index 1d6dbfa..9ea9fe9 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -33,13 +33,6 @@ require_once(BASE."include/tableve.php"); require_once(BASE."include/application.php"); require_once(BASE."include/testData.php"); -function get_vendor_from_keywords($sKeywords) -{ - $aKeywords = explode(" *** ",$sKeywords); - $iLastElt = (sizeOf($aKeywords)-1); - return($aKeywords[$iLastElt]); -} - function newSubmission($errors) { global $aClean; diff --git a/include/application.php b/include/application.php index ca91732..dcee5b3 100644 --- a/include/application.php +++ b/include/application.php @@ -42,32 +42,34 @@ class Application { /** * constructor, fetches the data. */ - function Application($iAppId = null) + function Application($iAppId = null, $oRow = null) { // we are working on an existing application if(is_numeric($iAppId)) { - /* fetch this applications information */ - $sQuery = "SELECT * - FROM appFamily - WHERE appId = '?'"; - if($hResult = query_parameters($sQuery, $iAppId)) + if(!$oRow) { - $oRow = mysql_fetch_object($hResult); - if($oRow) - { - $this->iAppId = $iAppId; - $this->iVendorId = $oRow->vendorId; - $this->iCatId = $oRow->catId; - $this->iSubmitterId = $oRow->submitterId; - $this->sSubmitTime = $oRow->submitTime; - $this->sDate = $oRow->submitTime; - $this->sName = $oRow->appName; - $this->sKeywords = $oRow->keywords; - $this->sDescription = $oRow->description; - $this->sWebpage = $oRow->webPage; - $this->sQueued = $oRow->queued; - } + /* fetch this applications information */ + $sQuery = "SELECT * + FROM appFamily + WHERE appId = '?'"; + if($hResult = query_parameters($sQuery, $iAppId)) + $oRow = mysql_fetch_object($hResult); + } + + if($oRow) + { + $this->iAppId = $iAppId; + $this->iVendorId = $oRow->vendorId; + $this->iCatId = $oRow->catId; + $this->iSubmitterId = $oRow->submitterId; + $this->sSubmitTime = $oRow->submitTime; + $this->sDate = $oRow->submitTime; + $this->sName = $oRow->appName; + $this->sKeywords = $oRow->keywords; + $this->sDescription = $oRow->description; + $this->sWebpage = $oRow->webPage; + $this->sQueued = $oRow->queued; } /* fetch versions of this application, if there are any */ @@ -829,6 +831,87 @@ class Application { $this->sName.""; return $sLink; } + + function objectGetEntries($bQueued) + { + $sQuery = "SELECT * FROM appFamily WHERE + appFamily.queued = '?'"; + + if($bQueued && !application::canEdit()) + { + $sQuery .= "AND appFamily.submitterId = '?'"; + $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", + $_SESSION['current']->iUserId); + } else + { + $hResult = query_parameters($sQuery, $bQueued ? "true" : "false"); + } + + if(!$hResult) + return FALSE; + + return $hResult; + } + + function objectGetHeader() + { + $aCells = array( + "Submission Date", + "Submitter", + "Vendor", + "Application"); + + return $aCells; + } + + function objectGetInstanceFromRow($oRow) + { + return new application($oRow->appId, $oRow); + } + + function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel) + { + $oUser = new user($this->iSubmitterId); + $oVendor = new vendor($this->iVendorId); + if(!$oVendor->sName) + $oVendor->sName = get_vendor_from_keywords($this->sKeywords); + + $aCells = array( + print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)), + $oUser->sRealname, + $oVendor->sName, + $this->sName); + + if($this->canEdit() || $oObject->bQueued) + $aCells[] = "[ iAppId\">". + "$sEditLinkLabel ]"; + + echo html_tr($aCells, $sClass); + } + + function canEdit() + { + if($_SESSION['current']->hasPriv("admin")) + return TRUE; + else + return FALSE; + } + + function objectDisplayQueueProcessingHelp() + { + 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 the AppDB.

\n"; + } +} + +function get_vendor_from_keywords($sKeywords) +{ + $aKeywords = explode(" *** ",$sKeywords); + $iLastElt = (sizeOf($aKeywords)-1); + return($aKeywords[$iLastElt]); } ?> diff --git a/include/sidebar_admin.php b/include/sidebar_admin.php index 39cdab3..67b233f 100644 --- a/include/sidebar_admin.php +++ b/include/sidebar_admin.php @@ -14,8 +14,10 @@ function global_admin_menu() { "false&sAction=add&sTitle=Add%20Vendor"); $g->addmisc(" "); - $g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/". - $_SESSION['current']->getQueuedVersionCount().")", + $g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount().")", + BASE."objectManager.php?sClass=application&bIsQueue=true&sTitle=". + "Application%20Queue"); + $g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")", BASE."admin/adminAppQueue.php"); $g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true", "screenshot").")",