--- modules/taxonomy.module.orig	2004-04-01 09:12:37.000000000 -0500
+++ modules/taxonomy.module	2004-04-02 14:23:48.055514924 -0500
@@ -464,6 +464,21 @@ function taxonomy_get_children($tid, $vi
   return $children;
 }
 
+// hierarchy: list all children tids, to specified depth (0 is list all)
+function taxonomy_list_children($tid, $depth = 0, $current_depth = 0) {
+  $children = array();
+  if($tid && ($current_depth < $depth || !$depth)) {
+    // include self
+    $children[] = $tid;
+    $result = db_query("SELECT t.tid FROM {term_hierarchy} h, {term_data} t WHERE h.tid = t.tid AND parent = %d", $tid);
+    while ($term = db_fetch_object($result)) {
+      $children[] = $term->tid;
+      $children = array_merge($children, taxonomy_list_children($term->tid, $depth, $current_depth + 1));
+    }
+  }
+  return $children;
+}
+
 // hierarchy: get whole family, with tid, parent and depth; useful to show
 function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid") {
   static $children, $parents, $terms;
@@ -730,6 +745,30 @@ function taxonomy_page() {
       case "feed":
         taxonomy_feed($taxonomy);
       break;
+      case 'vocabulary':
+      case 'children':
+        $tids = $taxonomy->tids;
+        // Unset str_tids and tids, as we will rebuild them
+        unset($taxonomy->str_tids);
+        unset($taxonomy->tids);
+        if (arg(1) == 'vocabulary') {
+          $taxonomy->str_vocabs = check_query(arg(3));
+          $result = db_query('SELECT tid FROM {term_data} WHERE vid in (%s)', $taxonomy->str_vocabs);
+          while ($term = db_fetch_object($result)) {
+            $taxonomy->tids[] = $term->tid;
+          }
+        }
+        elseif (arg(1) == 'children') {
+          $taxonomy->depth = (arg(4) ? check_query(arg(4)) : 0);
+          $children = array();
+          foreach ($tids as $tid) {
+            $taxonomy->tids[] = $tid;
+            $children = array_merge($children, taxonomy_list_children($tid, $taxonomy->depth));
+          }
+        }
+        // build str_tids, set to 0 if no tids
+        $taxonomy->tids ? $taxonomy->str_tids = implode(",", $taxonomy->tids) : $taxonomy->str_tids = 0;
+        // Fall through and process tids
       default:
       // Build title:
       $sql = 'SELECT name FROM {term_data} WHERE tid IN (%s)';
