Index: term_queue.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/term_queue/term_queue.admin.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 term_queue.admin.inc
--- term_queue.admin.inc	28 Oct 2008 16:16:34 -0000	1.1.2.1
+++ term_queue.admin.inc	9 Feb 2009 18:39:06 -0000
@@ -54,6 +54,16 @@ function term_queue_form(&$form_state, $
     '#default_value' => $edit['description'],
     '#description' => t('Description of the term queue; can be used by modules.'),
   );
+  $vocabs = taxonomy_get_vocabularies();
+  foreach ($vocabs as $vocab) {
+    $options[$vocab->vid] = $vocab->name;
+  }
+  $form['vocabulary'] = array('#type' => 'checkboxes',
+    '#title' => t('Vocabulary'),
+    '#options' => $options,
+    '#default_value' => $edit['vocabulary'] ? $edit['vocabulary'] : array(),
+    '#description' => t('If set, this queue will allow terms from the checked vocabularies. If blank, all vocabularies are allowed.'),
+  );
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
   $form['cancel'] = array(
     '#type' => 'markup', 
@@ -143,11 +153,17 @@ function term_queue_delete_form_submit($
 function term_queue_add_term_form(&$form_state, $queue) {
 
   drupal_set_title(t('%queue', array('%queue' => $queue->title)));
+  
+  if (array_keys($queue->vocabulary) != array_keys($queue->vocabulary, 0)) {
+    $check_vocab = TRUE;
+  }
 
   $vocab_terms = array();
   $vocabs = taxonomy_get_vocabularies();
   foreach ($vocabs as $vid => $vocab) {
-    $vocab_terms[$vid] = taxonomy_get_tree($vid);
+    if (!$check_vocab || in_array($vid, $queue->vocabulary)) {
+      $vocab_terms[$vid] = taxonomy_get_tree($vid);
+    }
   }
   
   $options = array();
@@ -171,7 +187,7 @@ function term_queue_add_term_form(&$form
     $form['tid'] = array(
       '#type' => 'textfield',
       '#title' => t('Term'),
-      '#autocomplete_path' => 'term_queue/autocomplete',
+      '#autocomplete_path' => 'term_queue/autocomplete/' . $queue->qid,
       '#description' => t('Begin typing the term name and choices will appear.  Terms are displayed as "termname (category)"'),
     );
   }
@@ -350,14 +366,28 @@ function term_queue_delete_term_form_sub
  * Callback for the term name autocomplete.
  *
  */
-function term_queue_autocomplete_term($string = '') {
+function term_queue_autocomplete_term($queue, $string = '') {
+  if (array_keys($queue->vocabulary) != array_keys($queue->vocabulary, 0)) {
+    $check_vocab = TRUE;
+    $in = "AND td.vid IN (%s)";
+    $vids = array();
+    foreach ($queue->vocabulary as $vid => $vocab) {
+      if ($vocab) {
+        $vids[] = $vid;
+      }
+    }
+  }
+  
   $matches = array();
   if($string) {
     $sql = "SELECT td.tid, td.name as termname, v.name as category FROM {term_data} td ";
     $sql .= "JOIN {vocabulary} v ON v.vid = td.vid ";
-    $sql .= "WHERE td.name LIKE '%s%' LIMIT 20";
+    $sql .= "WHERE td.name LIKE '%s%' $in LIMIT 20";
     $params = array("$string");
 
+    if ($check_vocab) {
+      array_push($params, implode(', ', $vids));
+    }
     $result = db_query($sql, $params);
 
     while($term = db_fetch_object($result)) {
Index: term_queue.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/term_queue/term_queue.install,v
retrieving revision 1.1
diff -u -p -r1.1 term_queue.install
--- term_queue.install	25 Sep 2008 17:56:55 -0000	1.1
+++ term_queue.install	9 Feb 2009 18:39:06 -0000
@@ -45,6 +45,11 @@ function term_queue_schema() {
         'not null' => TRUE,
         'description' => t('The description of a queue')
       ),
+      'vocabulary' => array(
+        'type' => 'text',
+        'description' => t('Serialized array of vocabularies this queue may draw from'),
+        'serialize' => TRUE,
+      ),
     ),
     'primary key' => array('qid'),
   );
Index: term_queue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/term_queue/term_queue.module,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 term_queue.module
--- term_queue.module	28 Oct 2008 16:16:34 -0000	1.1.2.1
+++ term_queue.module	9 Feb 2009 18:39:06 -0000
@@ -129,9 +129,10 @@ function term_queue_menu() {
     'file' => 'term_queue.admin.inc',
   );
 
-  $items['term_queue/autocomplete'] = array(
+  $items['term_queue/autocomplete/%term_queue'] = array(
     'title' => t('term auto complete'),
     'page callback' => 'term_queue_autocomplete_term',
+    'page arguments' => array(2, 3),
     'access arguments' => array('administer term queue'),
     'file' => 'term_queue.admin.inc',
     'type' => MENU_CALLBACK,
@@ -196,6 +197,9 @@ function term_queue_load($qid) {
 
   if (!isset($queues[$qid])) {
     $queues[$qid] = db_fetch_object(db_query('SELECT * FROM {term_queue} WHERE qid=%d', $qid));
+    if ($queues[$qid]->vocabulary) {
+      $queues[$qid]->vocabulary = unserialize($queues[$qid]->vocabulary);
+    }
   }
 
   return $queues[$qid];
