? 302440-2.patch ? taxonomy_list_plus_test.patch ? taxonomy_term_load.patch ? term.patch ? term_edit.patch ? unappaproved.patch ? sites/default/files ? sites/default/settings.php Index: modules/forum/forum.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v retrieving revision 1.12 diff -u -p -r1.12 forum.admin.inc --- modules/forum/forum.admin.inc 16 Jul 2008 21:59:26 -0000 1.12 +++ modules/forum/forum.admin.inc 9 Sep 2008 16:59:51 -0000 @@ -160,7 +160,7 @@ function forum_form_container(&$form_sta * @param $tid ID of the term to be deleted */ function forum_confirm_delete(&$form_state, $tid) { - $term = taxonomy_get_term($tid); + $term = taxonomy_term_load($tid); $form['tid'] = array('#type' => 'value', '#value' => $tid); $form['name'] = array('#type' => 'value', '#value' => $term->name); Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.462 diff -u -p -r1.462 forum.module --- modules/forum/forum.module 6 Sep 2008 08:36:20 -0000 1.462 +++ modules/forum/forum.module 9 Sep 2008 16:59:51 -0000 @@ -224,7 +224,7 @@ function forum_nodeapi(&$node, $op, $tea foreach ($node->taxonomy as $term) { if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) { if (in_array($term, $containers)) { - $term = taxonomy_get_term($term); + $term = taxonomy_term_load($term); form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => $term->name))); } } @@ -565,7 +565,7 @@ function forum_get_topics($tid, $sortby, } } - $term = taxonomy_get_term($tid); + $term = taxonomy_term_load($tid); $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d"); $sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,'); Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.27 diff -u -p -r1.27 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 16 Jul 2008 21:59:28 -0000 1.27 +++ modules/taxonomy/taxonomy.admin.inc 9 Sep 2008 16:59:51 -0000 @@ -233,9 +233,9 @@ function taxonomy_admin_vocabulary_edit( /** * Page to edit a vocabulary term. */ -function taxonomy_admin_term_edit($tid) { - if ($term = (array)taxonomy_get_term($tid)) { - return drupal_get_form('taxonomy_form_term', taxonomy_vocabulary_load($term['vid']), $term); +function taxonomy_admin_term_edit($term) { + if (isset($term)) { + return drupal_get_form('taxonomy_form_term', taxonomy_vocabulary_load($term->vid), (array)$term); } return drupal_not_found(); } @@ -835,7 +835,7 @@ function taxonomy_term_confirm_parents(& * @see taxonomy_term_confirm_delete_submit() */ function taxonomy_term_confirm_delete(&$form_state, $tid) { - $term = taxonomy_get_term($tid); + $term = taxonomy_term_load($tid); $form['type'] = array('#type' => 'value', '#value' => 'term'); $form['name'] = array('#type' => 'value', '#value' => $term->name); Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.425 diff -u -p -r1.425 taxonomy.module --- modules/taxonomy/taxonomy.module 24 Jul 2008 16:25:19 -0000 1.425 +++ modules/taxonomy/taxonomy.module 9 Sep 2008 16:59:51 -0000 @@ -142,9 +142,10 @@ function taxonomy_menu() { 'type' => MENU_CALLBACK, ); - $items['admin/content/taxonomy/edit/term'] = array( + $items['admin/content/taxonomy/edit/term/%taxonomy_term'] = array( 'title' => 'Edit term', 'page callback' => 'taxonomy_admin_term_edit', + 'page arguments' => array(5), 'access arguments' => array('administer taxonomy'), 'type' => MENU_CALLBACK, ); @@ -156,6 +157,18 @@ function taxonomy_menu() { 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); + $items['taxonomy/term/%/view'] = array( + 'title' => 'View', + 'type' => MENU_DEFAULT_LOCAL_TASK, + ); + $items['taxonomy/term/%taxonomy_term/edit'] = array( + 'title' => 'Edit term', + 'page callback' => 'taxonomy_admin_term_edit', + 'page arguments' => array(2), + 'access arguments' => array('administer taxonomy'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 10, + ); $items['taxonomy/autocomplete'] = array( 'title' => 'Autocomplete taxonomy', @@ -386,7 +399,7 @@ function taxonomy_del_term($tid) { } } - $term = (array) taxonomy_get_term($tid); + $term = (array) taxonomy_term_load($tid); db_query('DELETE FROM {term_data} WHERE tid = %d', $tid); db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid); @@ -579,13 +592,13 @@ function taxonomy_preview_terms($node) { $taxonomy['tags'] = $term; } else { - $taxonomy[$tid] = taxonomy_get_term($tid); + $taxonomy[$tid] = taxonomy_term_load($tid); } } } // A 'Single select' field returns the term id. elseif ($term) { - $taxonomy[$term] = taxonomy_get_term($term); + $taxonomy[$term] = taxonomy_term_load($term); } } } @@ -767,7 +780,7 @@ function taxonomy_get_parents($tid, $key function taxonomy_get_parents_all($tid) { $parents = array(); if ($tid) { - $parents[] = taxonomy_get_term($tid); + $parents[] = taxonomy_term_load($tid); $n = 0; while ($parent = taxonomy_get_parents($parents[$n]->tid)) { $parents = array_merge($parents, $parent); @@ -1005,14 +1018,15 @@ function taxonomy_vocabulary_load($vid) * @return Object * A term object. Results are statically cached. */ -function taxonomy_get_term($tid) { +function taxonomy_term_load($tid) { static $terms = array(); - if (!isset($terms[$tid])) { + if (!isset($terms[$tid]) && is_numeric($tid)) { $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid)); + return $terms[$tid]; } - return $terms[$tid]; + return FALSE; } function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) { @@ -1080,7 +1094,7 @@ function taxonomy_select_nodes($tids = a $depth = NULL; } foreach ($tids as $index => $tid) { - $term = taxonomy_get_term($tid); + $term = taxonomy_term_load($tid); $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth); $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree)); } Index: modules/taxonomy/taxonomy.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v retrieving revision 1.12 diff -u -p -r1.12 taxonomy.pages.inc --- modules/taxonomy/taxonomy.pages.inc 21 Aug 2008 19:36:38 -0000 1.12 +++ modules/taxonomy/taxonomy.pages.inc 9 Sep 2008 16:59:51 -0000 @@ -51,7 +51,7 @@ function taxonomy_term_page($str_tids = $channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $title; // Only display the description if we have a single term, to avoid clutter and confusion. if (count($tids) == 1) { - $term = taxonomy_get_term($tids[0]); + $term = taxonomy_term_load($tids[0]); // HTML will be removed from feed description, so no need to filter here. $channel['description'] = $term->description; } @@ -92,7 +92,7 @@ function theme_taxonomy_term_page($tids, // Only display the description if we have a single term, to avoid clutter and confusion. if (count($tids) == 1) { - $term = taxonomy_get_term($tids[0]); + $term = taxonomy_term_load($tids[0]); $description = $term->description; // Check that a description is set.