diff -urN drupal-4.4.1/modules/taxonomy.module drupal4blog/modules/taxonomy.module
--- drupal-4.4.1/modules/taxonomy.module	Sun May  2 23:45:30 2004
+++ drupal4blog/modules/taxonomy.module	Fri May 21 13:28:42 2004
@@ -17,6 +17,12 @@
   }
 }
 
+function taxonomy_settings() {
+  $output = form_radios(t("Taxonomy Complexity"), "taxonomy_complex", variable_get("taxonomy_complex", 0), array(0 => t("Simple Taxonomy"), 1 => t("Nested Taxonomy"), 2 => t("Full Taxonomy Control")),t("Taxonomy is just a fancy word for Category. You can attach 'taxonomy' to your entries which will specify their categories. 'Simple Taxonomy' is easier to managed and sufficient for most people. 'Nested Taxonomy' enables hierarchical categories. 'Full Taxonomy Control' gives you complete control."));
+  $output .= form_textfield(t("Taxonomy title"), "taxonomy_block_title", variable_get("taxonomy_block_title", "Categories"), 70, 180, t("") . " " . t("Title of the Taxonomyblock, e.g. Categories"));
+  return $output;
+}
+
 function taxonomy_perm() {
   return array("administer taxonomy");
 }
@@ -60,6 +66,60 @@
   }
 }
 
+function _taxonomy_list_terms($vid) {
+  $tree = taxonomy_get_tree($vid);
+  if ($tree) {
+    $depth = 0;
+    $complex = variable_get("taxonomy_complex",0);
+    foreach($tree as $term) {
+      if ($complex) {
+        while ($depth < $term->depth) {
+          $output .= "<ul>"; $depth++;
+        }
+        while ($depth > $term->depth) {
+          $output .= "</ul>"; $depth--;
+        }
+      }
+
+      $output .= "<li>".l($term->name,"taxonomy/page/or/$term->tid")."</li>";
+    }
+    if ($complex) {
+      while ($depth) {
+        $output .= "</ul>";
+        $depth--;
+      }
+    }
+  }
+  return "<ul>".$output."</ul>";
+}
+
+function taxonomy_block($op = "list", $delta = 0) {
+  if ($op == "list") {
+    $block[0]['info'] = t("Taxonomy");
+    return $block;
+  }
+
+  $block["subject"] = variable_get("taxonomy_block_title","Categories");
+
+  if (variable_get("taxonomy_complex",0)<=1) {
+    $vocabularies = taxonomy_get_vocabulary_by_name("Category");
+    if ($vocabularies[0]) 
+      $block["content"] = _taxonomy_list_terms($vocabularies[0]->vid);
+
+    return $block;
+  }
+
+  $vocabularies = taxonomy_get_vocabularies();
+  foreach ($vocabularies as $vocabulary) {
+    $output .= "<ul><li>".$vocabulary->name."</li>";
+    $output .= _taxonomy_list_terms($vocabulary->vid);
+    $output .= "</ul>";
+    $block["content"] = $output;
+  }
+
+  return $block;
+}
+
 /*
 ** admin pages (form, save, overview)
 */
@@ -149,30 +209,34 @@
   $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this term.  Example: 'Linux'."));
   $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") .". ". t("A description of the term."));
 
-  if ($vocabulary->hierarchy) {
-    $parent = array_keys(taxonomy_get_parents($edit["tid"]));
-    $children = taxonomy_get_tree($vocabulary_id, $edit["tid"]);
-
-    // you can't be son of yourself nor of your children
-    foreach ($children as $child) {
-      $exclude[] = $child->tid;
-    }
-    $exclude[] = $edit["tid"];
-
-    if ($vocabulary->hierarchy == 1) {
-      $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent term"), "admin/taxonomy/help", NULL, NULL, "parent") .".", 0, "<". t("root") .">", $exclude);
-    }
-    elseif ($vocabulary->hierarchy == 2) {
-      $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent terms"), "admin/taxonomy/help", NULL, NULL, "parent") .".", 1, "<". t("root") .">", $exclude);
+  if (variable_get("taxonomy_complex",0)>0) {
+    if ($vocabulary->hierarchy) {
+      $parent = array_keys(taxonomy_get_parents($edit["tid"]));
+      $children = taxonomy_get_tree($vocabulary_id, $edit["tid"]);
+  
+      // you can't be son of yourself nor of your children
+      foreach ($children as $child) {
+        $exclude[] = $child->tid;
+      }
+      $exclude[] = $edit["tid"];
+  
+      if ($vocabulary->hierarchy == 1) {
+        $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent term"), "admin/taxonomy/help", NULL, NULL, "parent") .". Specify this to define sub-term.", 0, "<". t("root") .">", $exclude);
+      }
+      elseif ($vocabulary->hierarchy == 2) {
+        $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent terms"), "admin/taxonomy/help", NULL, NULL, "parent") .".", 1, "<". t("root") .">", $exclude);
+      }
+    }
+  
+    if (variable_get("taxonomy_complex",0)>1) {
+      if ($vocabulary->relations) {
+        $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") .". ", 1, "<". t("none") .">", array($edit["tid"]));
+      }
+    
+      $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t("<a href=\"%help-url\">Synonyms</a> of this term, one synonym per line.", array("%help-url" => url("admin/taxonomy/help", NULL, NULL, "synonyms"))));
+      $form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top."));
     }
   }
-
-  if ($vocabulary->relations) {
-    $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") .". ", 1, "<". t("none") .">", array($edit["tid"]));
-  }
-
-  $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t("<a href=\"%help-url\">Synonyms</a> of this term, one synonym per line.", array("%help-url" => url("admin/taxonomy/help", NULL, NULL, "synonyms"))));
-  $form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top."));
   $form .= form_hidden("vid", $vocabulary->vid);
   $form .= form_submit(t("Submit"));
 
@@ -186,21 +250,27 @@
 
 function taxonomy_save_term($edit) {
   if ($edit["tid"] && $edit["name"]) {
-    $data = array("name" => $edit["name"], "description" => $edit["description"], "weight" => $edit["weight"]);
-
-    db_query("UPDATE {term_data} SET ". _prepare_update($data) ." WHERE tid = %d", $edit["tid"]);
-    module_invoke_all("taxonomy", "update", "term", $edit);
-    $message = t("the term '%a' has been updated.", array("%a" => $edit["name"]));
+    if (_taxonomy_dup_term($edit["tid"],$edit["name"])) {
+      $message = t("the term '%a' already exist.",array("%a" => $edit["name"]));
+    } else {
+      $data = array("name" => $edit["name"], "description" => $edit["description"], "weight" => $edit["weight"]);
+      db_query("UPDATE {term_data} SET ". _prepare_update($data) ." WHERE tid = %d", $edit["tid"]);
+      module_invoke_all("taxonomy", "update", "term", $edit);
+      $message = t("the term '%a' has been updated.", array("%a" => $edit["name"]));
+    }
   }
   else if ($edit["tid"]) {
-    return taxonomy_del_term($edit["tid"]);
-  }
-  else {
-    $edit["tid"] = db_next_id("{term_data}_tid");
-    $data = array("tid" => $edit["tid"], "name" => $edit["name"], "description" => $edit["description"], "vid" => $edit["vid"], "weight" => $edit["weight"]);
-    db_query("INSERT INTO {term_data} ". _prepare_insert($data, 1) ." VALUES ". _prepare_insert($data, 2));
-    module_invoke_all("taxonomy", "insert", "term", $edit);
-    $message = t("created new term '%name'.", array("%name" => $edit["name"]));
+    $message = t("Please click 'Delete' if you wish to delete the term.");
+  } else {
+    if (_taxonomy_dup_term($edit["tid"],$edit["name"])) {
+      $message = t("the term '%name' already exist.", array("%name" => $edit["name"]));
+    } else {
+      $edit["tid"] = db_next_id("{term_data}_tid");
+      $data = array("tid" => $edit["tid"], "name" => $edit["name"], "description" => $edit["description"], "vid" => $edit["vid"], "weight" => $edit["weight"]);
+      db_query("INSERT INTO {term_data} ". _prepare_insert($data, 1) ." VALUES ". _prepare_insert($data, 2));
+      module_invoke_all("taxonomy", "insert", "term", $edit);
+      $message = t("created new term '%name'.", array("%name" => $edit["name"]));
+    }
   }
 
   // relations (seem very powerful, but I have to understand it completely)
@@ -255,6 +325,7 @@
 
   cache_clear_all();
 
+  drupal_set_message(t("deleted term '%name'.", array("%name" => $term->name)));
   return t("deleted term '%name'.", array("%name" => $term->name));
 }
 
@@ -271,6 +342,27 @@
 }
 
 function taxonomy_overview() {
+  if (variable_get("taxonomy_complex",0)<=1) {
+    $vocabularies = taxonomy_get_vocabulary_by_name("Category");
+    if (!$vocabularies[0]) {
+      $vid = db_next_id("{vocabulary}_vid");
+      db_query("INSERT INTO {vocabulary} VALUES (%d, '%s', '%s', %d, %d, %d, %d, '%s', %d)", $vid, "Category", "Categories for Blog Entries", 0, 1, 1, 0, 'blog', 0);
+      $vocabularies = taxonomy_get_vocabulary_by_name("Category");
+    }
+    $vid = $vocabularies[0]->vid;
+
+    $headers = array(t("name"), t("description"));
+
+    $tree = taxonomy_get_tree($vid);
+    if ($tree) {
+      foreach($tree as $term) {
+        $rows[] = array(l(_taxonomy_depth($term->depth)." ".$term->name, "admin/taxonomy/edit/term/$term->tid") , $term->description);
+      }
+    }
+    $rows[] = array(array("data" => l(t("add category"), "admin/taxonomy/add/term/$vid"), "colspan" => 2));;
+
+    return theme("table",$headers,$rows);
+  }
 
   $output .= "<h3>". t("Vocabularies overview") ."</h3>";
 
@@ -817,7 +909,7 @@
         taxonomy_save_term($edit);
         if (!$edit["tid"]) {
           // if INSERT show form again
-          $output .= taxonomy_form_term();
+          $output .= taxonomy_overview(); // taxonomy_form_term();
           break;
         }
         // else (UPDATE or DELETE) fall through
@@ -882,4 +974,26 @@
 
   return $output;
 }
+
+function taxonomy_blogadmin($type) {
+  $list = array();
+
+  if ($type == "block") {
+    if (user_access("administer taxonomy"))
+      $list[] = l(t("categories"), "admin/taxonomy");
+  } else if ($type == "options") {
+    if (user_access("administer site configuration")) {
+      $list[l(t("Category options"),"admin/system/modules/taxonomy")] = t("Configure category/taxonomy options");
+    }
+  }
+
+  return $list;
+}
+
+function _taxonomy_dup_term($tid,$name) {
+  $term = db_fetch_object(db_query("SELECT * FROM {term_data} WHERE tid=%d",$tid));
+  $result = db_fetch_object(db_query("SELECT * FROM {term_data} WHERE LOWER(name)=LOWER('%s') AND vid=%d",trim($name),$term->vid));
+  return $result;
+}
+
 ?>
