summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-09-19 19:02:57 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-09-19 19:02:57 +0000
commit012686ea096ef0e470e6f0c20ab8ebdc9970b163 (patch)
tree0044e513595346cd494f1402090a868dbe9d7afe
parent6583ac5aeea1e1ac9ed458584f1a7a4498edce48 (diff)
downloadbrdo-012686ea096ef0e470e6f0c20ab8ebdc9970b163.tar.gz
brdo-012686ea096ef0e470e6f0c20ab8ebdc9970b163.tar.bz2
#141470 by chx: usability - add pager to taxonomy form, which makes this usable for freetagging vocabularies
-rw-r--r--modules/taxonomy/taxonomy.admin.inc44
1 files changed, 29 insertions, 15 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc
index ae8501368..b6734906e 100644
--- a/modules/taxonomy/taxonomy.admin.inc
+++ b/modules/taxonomy/taxonomy.admin.inc
@@ -177,28 +177,42 @@ function taxonomy_overview_terms($vocabulary) {
$page_increment = 25; // number of tids per page
$displayed_count = 0; // number of tids shown
- $tree = taxonomy_get_tree($vocabulary->vid);
- foreach ($tree as $term) {
- $total_entries++; // we're counting all-totals, not displayed
- if (($start_from && ($start_from * $page_increment) >= $total_entries) || ($displayed_count == $page_increment)) {
- continue;
+ if ($vocabulary->tags) {
+ // We are not calling taxonomy_get_tree because that might fail with a big
+ // number of tags in the freetagging vocabulary.
+ $results = pager_query(db_rewrite_sql('SELECT t.*, h.parent FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $page_increment, 0, NULL, $vid);
+ while ($term = db_fetch_object($results)) {
+ $rows[] = array(
+ l($term->name, "taxonomy/term/$term->tid"),
+ l(t('edit'), "admin/content/taxonomy/edit/term/$term->tid", array('query' => $destination)),
+ );
}
- $rows[] = array(str_repeat('--', $term->depth) .' '. l($term->name, "taxonomy/term/$term->tid"), l(t('edit'), "admin/content/taxonomy/edit/term/$term->tid", array('query' => $destination)));
- $displayed_count++; // we're counting tids displayed
}
+ else {
+ $tree = taxonomy_get_tree($vocabulary->vid);
+ foreach ($tree as $term) {
+ $total_entries++; // we're counting all-totals, not displayed
+ if (($start_from && ($start_from * $page_increment) >= $total_entries) || ($displayed_count == $page_increment)) {
+ continue;
+ }
+ $rows[] = array(str_repeat('--', $term->depth) .' '. l($term->name, "taxonomy/term/$term->tid"), l(t('edit'), "admin/content/taxonomy/edit/term/$term->tid", array('query' => $destination)));
+ $displayed_count++; // we're counting tids displayed
+ }
- if (empty($rows)) {
- $rows[] = array(array('data' => t('No terms available.'), 'colspan' => '2'));
- }
+ if (empty($rows)) {
+ $rows[] = array(array('data' => t('No terms available.'), 'colspan' => '2'));
+ }
- $GLOBALS['pager_page_array'][] = $start_from; // FIXME
- $GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1; // FIXME
+ $GLOBALS['pager_page_array'][] = $start_from; // FIXME
+ $GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1; // FIXME
+ }
- if ($total_entries >= $page_increment) {
- $rows[] = array(array('data' => theme('pager', NULL, $page_increment), 'colspan' => '2'));
+ $output .= theme('table', $header, $rows, array('id' => 'taxonomy'));
+ if ($vocabulary->tags || $total_entries >= $page_increment) {
+ $output .= theme('pager', NULL, $page_increment);
}
- return theme('table', $header, $rows, array('id' => 'taxonomy'));
+ return $output;
}