Download & Extend

Count in queue_link()

Project:Drupal core
Version:7.x-dev
Component:other
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

Here is a patch to show the number of stories waiting in the queue directly in the menu. I use it regularly and I always end up repatching drupal at each upgrade, so I guessed I might try my luck at integrating it here. :)

Index: misc/drupal.css
===================================================================
RCS file: /home/anarcat/cvs/drupal/core/misc/drupal.css,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 drupal.css
--- misc/drupal.css     5 Nov 2003 04:02:25 -0000       1.1.1.1
+++ misc/drupal.css     19 Nov 2003 18:19:11 -0000
@@ -299,3 +299,6 @@
   list-style-type: square;
   list-style-image: url(menu-leaf.gif);
}
+.unrated {
+  color: red;
+}
Index: modules/queue.module
===================================================================
RCS file: /home/anarcat/cvs/drupal/core/modules/queue.module,v
retrieving revision 1.8
diff -u -r1.8 queue.module
--- modules/queue.module        5 Nov 2003 06:28:12 -0000       1.8
+++ modules/queue.module        19 Nov 2003 18:16:46 -0000
@@ -35,7 +35,13 @@
function queue_link($type) {
   if ($type == "system") {
     if (user_access("access submission queue")) {
-      menu("queue", t("view submissions"), "queue_page", 1);
+      global $user;
+      $text = t("view submissions") . " (";
+      if ($user->uid) {
+        $text .= queue_count_unrated($user) . "/";
+      }
+      $text .= queue_count() . ")";
+      menu("queue", $text, "queue_page", 1);
     }
   }

@@ -44,6 +50,13 @@

function queue_count() {
   $result = db_query("SELECT COUNT(nid) FROM {node} WHERE moderate = 1");
+  return ($result) ? db_result($result, 0) : 0;
+}
+
+function queue_count_unrated($user) {
+  $result = db_query("SELECT COUNT(nid) FROM {node} WHERE moderate = 1 " .
+                    "AND users NOT LIKE '%" . $user->uid . "=%' AND uid != " .
+                    $user->uid );
   return ($result) ? db_result($result, 0) : 0;
}

Comments

#1

aarghh... forgot the last part and drupal keeps on stripping the embeded html tags. I'll send the proper patch to drupal-devel.

#2

this is how it used to work, and people found that link too wide and inconsistent. use the queue_block instead

#3

who exactly "found that link too wide and inconsistent"? /i/ don't, but would much appreciate to get this feature back into core. using the queue_block seems a little overkill if you just want 1 (or 2) numbers ...

#4

Looks like this was removed here.

I'm not opposed to restoring this feature.

#5

BTW, the patch is now for_review/0154.anarcat.queue-link-counts.patch.

About that removal... The commitlog doesn't mention anything about purposefully removing the indicator in the first place! The commit log is:

- Committed the admin menu integration patch. Thanks Adrian, Stefan and others.

Seems like the number was dropped by mistake...

Also... The problem is that getting this to work requires patching a core file. Since I feel the acceptance would be better if there was a toggle, I've changed my patch to put a tick box in the queue setting to disable the indicator. I've also cleaned up the patch a bit.

Thanks,

A.

#6

Version:4.3.0» x.y.z
Component:queue.module» other

#7

Version:x.y.z» 7.x-dev

Feature request moving to cvs.

#8

Status:active» closed (won't fix)

Queue module is no longer part of Drupal.

nobody click here