--- taxonomy.module.cvs 2005-07-18 11:31:21.803345600 -0700
+++ taxonomy.module 2005-07-18 11:57:33.773728000 -0700
@@ -34,11 +34,9 @@
}
}
else {
- $links = array();
foreach (taxonomy_node_get_terms($node->nid) as $term) {
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
}
-
}
return $links;
}
@@ -362,8 +360,7 @@
$vid = arg(2);
- // Show all vocabularies and their terms. if vocabulary is "Free tagging",
- // don't show terms here, but instruct user to "view terms" instead.
+ // Show all vocabularies, but don't show terms here, but instruct user to "view terms" instead.
if (!$vid) {
$header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3'));
$vocabularies = taxonomy_get_vocabularies();
@@ -373,23 +370,9 @@
$node_type = node_invoke($type, 'node_name');
$types[] = $node_type ? $node_type : $type;
}
- $rows[] = array(''. check_plain($vocabulary->name) .'', implode(', ', $types), l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t('add term'), "admin/taxonomy/add/term/$vocabulary->vid"), l(t('view terms'), "admin/taxonomy/$vocabulary->vid"));
-
- // Show terms if non-free.
- if (!$vocabulary->tags) {
- $tree = taxonomy_get_tree($vocabulary->vid);
- if ($tree) {
- foreach ($tree as $term) {
- $rows[] = array(array('data' => _taxonomy_depth($term->depth) . ' ' . l($term->name, "taxonomy/term/$term->tid"), 'class' => 'term'), NULL, NULL, NULL, l(t('edit term'), "admin/taxonomy/edit/term/$term->tid"));
- }
- }
- else {
- $rows[] = array(array('data' => t('No terms available.'), 'colspan' => '5', 'class' => 'message'));
- }
- }
- elseif ($vocabulary->tags) {
- $rows[] = array(array('data' => t('This is a free tagging vocabulary:') . ' ' . l(t('view terms'), "admin/taxonomy/$vocabulary->vid") . '.', 'colspan' => '5', 'class' => 'message'));
- }
+ $rows[] = array(''. check_plain($vocabulary->name) .'', implode(', ', $types),
+ l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t('add term'), "admin/taxonomy/add/term/$vocabulary->vid"),
+ l(t('view terms'), "admin/taxonomy/$vocabulary->vid"));
}
if (!$rows) {
@@ -397,10 +380,11 @@
}
}
- // Free tagging vocabularies get their own terms pager
- // since there is a greater chance of 1000+ terms.
+ // Show vocabulary's terms with a pager
else {
- $header = array(t('Name'), array('data' => t('Operations'), 'width' => '60'));
+ $destination = drupal_get_destination();
+
+ $header = array(t('Name'), array('data' => t('Operations'), 'width' => '60'));
$vocabulary = taxonomy_get_vocabulary($vid);
if ($vocabulary->module == 'taxonomy') {
drupal_set_title(check_plain($vocabulary->name));
@@ -412,8 +396,8 @@
$tree = taxonomy_get_tree($vocabulary->vid);
foreach ($tree as $term) {
$total_entries++; // we're counting all-totals, not displayed
- if (($start_from && $start_from > $total_entries) || ($displayed_count == $page_increment)) { continue; }
- $rows[] = array(_taxonomy_depth($term->depth) . ' ' . check_plain($term->name), l(t('edit term'), "admin/taxonomy/edit/term/$term->tid"));
+ if (($start_from && $start_from >= $total_entries) || ($displayed_count == $page_increment)) { continue; }
+ $rows[] = array(_taxonomy_depth($term->depth) . ' ' . check_plain($term->name), l(t('edit term'), "admin/taxonomy/edit/term/$term->tid", array(), $destination));
$displayed_count++; // we're counting tids displayed
}
@@ -423,7 +407,10 @@
$GLOBALS['pager_from_array'][] = $start_from;
$GLOBALS['pager_total'][] = $total_entries;
- $rows[] = array(array('data' => theme('pager', NULL, $page_increment), 'colspan' => '2'));
+
+ if ($total_entries > $page_increment) {
+ $rows[] = array(array('data' => theme('pager', NULL, $page_increment), 'colspan' => '2'));
+ }
}
}
@@ -707,7 +694,7 @@
$result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE t.vid = %d AND h.tid = t.tid AND h.parent = %d ORDER BY weight, name', $vid, $tid);
}
else {
- $result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE h.tid = t.tid AND parent = %d ORDER BY weight', $tid);
+ $result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE h.tid = t.tid AND parent = %d ORDER BY weight, name', $tid);
}
$children = array();
while ($term = db_fetch_object($result)) {