From c3a6f3dc545bf3befe8b1bad8ece4695d660128b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 19 Jun 2004 09:57:13 +0000 Subject: - Patch #8632 by Mohse: made the taxonomy select menus more flexible. Specifically, it lets you edit more than one node's taxonomy within the same form. This patch also removes the behavior where taxonomy remembers your last choice for a given vocab and automatically selects it for you. That is poor behavior. If someone changes a date or author in a node, he is likely to inadvertently add taxo terms using with this 'feature'. --- modules/taxonomy/taxonomy.module | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'modules/taxonomy') diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 9b27d6db5..f907edf64 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -311,7 +311,7 @@ function taxonomy_overview() { /** * Generate a form element for selecting terms from a vocabulary. */ -function taxonomy_form($vid, $value = 0, $error = array(), $help = NULL) { +function taxonomy_form($vid, $value = 0, $error = array(), $help = NULL, $name = 'taxonomy') { $vocabulary = taxonomy_get_vocabulary($vid); $help = ($help) ? $help : $vocabulary->help; if ($vocabulary->required) { @@ -323,7 +323,7 @@ function taxonomy_form($vid, $value = 0, $error = array(), $help = NULL) { $help .= $error['taxonomy']; - return _taxonomy_term_select($vocabulary->name, 'taxonomy', $value, $vid, $help, intval($vocabulary->multiple), $blank); + return _taxonomy_term_select($vocabulary->name, $name, $value, $vid, $help, intval($vocabulary->multiple), $blank); } /** @@ -350,7 +350,7 @@ function taxonomy_get_vocabularies($type = '', $key = 'vid') { /** * Generate a form for selecting terms to associate with a node. */ -function taxonomy_node_form($type, $node = '', $error = array()) { +function taxonomy_node_form($type, $node = '', $error = array(), $help = NULL, $name = 'taxonomy') { if (!$node->taxonomy) { if ($node->nid) { $terms = array_keys(taxonomy_node_get_terms($node->nid)); @@ -365,7 +365,7 @@ function taxonomy_node_form($type, $node = '', $error = array()) { $c = db_query("SELECT * FROM {vocabulary} WHERE nodes LIKE '%%%s%%' ORDER BY weight, name", $type); while ($vocabulary = db_fetch_object($c)) { - $result[] .= taxonomy_form($vocabulary->vid, $terms, $error); + $result[] = taxonomy_form($vocabulary->vid, $terms, $error, $help, $name); } return $result ? $result : array(); } @@ -673,19 +673,6 @@ function taxonomy_get_term($tid) { function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) { $tree = taxonomy_get_tree($vocabulary_id); - - // We store the last selected ID in a session variable: - if (!$value) { - $value = $_SESSION['vocabulary']["$vocabulary_id"]; - } - else { - $_SESSION['vocabulary']["$vocabulary_id"] = $value; - } - - if ($blank) { - $options[] = array('tid' => 0, 'name' => $blank); - } - if ($tree) { foreach ($tree as $term) { if (!in_array($term->tid, $exclude)) { -- cgit v1.2.3