appdb/include application.php sidebar_admin.php

WineHQ wineowner at wine.codeweavers.com
Mon Apr 2 19:00:48 CDT 2007


ChangeSet ID:	31024
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/04/02 19:00:48

Modified files:
	include        : application.php sidebar_admin.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add and use application::objectGetEntriesCount()

Patch: http://cvs.winehq.org/patch.py?id=31024

Old revision  New revision  Changes     Path
 1.98          1.99          +31 -0      appdb/include/application.php
 1.36          1.37          +5 -1       appdb/include/sidebar_admin.php

Index: appdb/include/application.php
diff -u -p appdb/include/application.php:1.98 appdb/include/application.php:1.99
--- appdb/include/application.php:1.98	3 Apr 2007  0: 0:48 -0000
+++ appdb/include/application.php	3 Apr 2007  0: 0:48 -0000
@@ -913,6 +913,37 @@ class Application {
         echo "<p>To view a submission, click on its name. ".
              "From that page you can edit, delete or approve it into the AppDB.</p>\n";
     }
+
+    function objectGetEntriesCount($bQueued, $bRejected)
+    {
+        $sQueued = objectManager::getQueueString($bQueued, $bRejected);
+
+        if($bQueued && !application::canEdit())
+        {
+            /* Without edit rights users can only resubmit their rejected entries */
+            if(!$bRejected)
+                return FALSE;
+
+            $sQuery = "SELECT COUNT(appId) as count FROM appFamily WHERE
+                    submitterId = '?'
+                    AND
+                    queued = '?'";
+            $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
+                                        $sQueued);
+        } else
+        {
+            $sQuery = "SELECT COUNT(appId) as count FROM appFamily WHERE queued = '?'";
+            $hResult = query_parameters($sQuery, $sQueued);
+        }
+
+        if(!$hResult)
+            return FALSE;
+
+        if(!$oRow = mysql_fetch_object($hResult))
+            return FALSE;
+
+        return $oRow->count;
+    }
 }
 
 function get_vendor_from_keywords($sKeywords)
Index: appdb/include/sidebar_admin.php
diff -u -p appdb/include/sidebar_admin.php:1.36 appdb/include/sidebar_admin.php:1.37
--- appdb/include/sidebar_admin.php:1.36	3 Apr 2007  0: 0:48 -0000
+++ appdb/include/sidebar_admin.php	3 Apr 2007  0: 0:48 -0000
@@ -9,7 +9,7 @@ function global_admin_menu() {
 
     $g = new htmlmenu("Global Admin");
 
-    $g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount().")",
+    $g->add("View App Queue (".application::objectGetEntriesCount(true, false).")",
             BASE."objectManager.php?sClass=application&bIsQueue=true&sTitle=".
             "Application%20Queue");
     $g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")",
@@ -41,6 +41,10 @@ function global_admin_menu() {
 
     $g->addmisc("&nbsp;");
 
+    $g->add("View Rejected Applications (".application::objectGetEntriesCount(true,
+            true).")",
+            BASE."objectManager.php?sClass=application&bIsQueue=true&bIsRejected=true&".
+            "sTitle=Rejected%20Applications");
     $g->add("View Rejected Test Results (".testData::objectGetEntriesCount(true,
             true).")",
             BASE."objectManager.php?sClass=testData&bIsQueue=true&bIsRejected=true&".



More information about the wine-cvs mailing list