From 823673a1969532063d6b915d62d42ee779a58c7b Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Mon, 8 May 2006 15:12:25 +0000 Subject: [PATCH] - Patch #62332 by Zen: added missing add term link on admin/taxonomy page and got rid of some crufty code. --- modules/taxonomy.module | 42 +++++++++----------------------- modules/taxonomy/taxonomy.module | 42 +++++++++----------------------- 2 files changed, 22 insertions(+), 62 deletions(-) diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 010a2027c383..0f6b310eb3ad 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -122,46 +122,26 @@ function taxonomy_menu($may_cache) { */ function taxonomy_overview_vocabularies() { $vocabularies = taxonomy_get_vocabularies(); + $rows = array(); foreach ($vocabularies as $vocabulary) { $types = array(); foreach ($vocabulary->nodes as $type) { $node_type = node_get_name($type); $types[] = $node_type ? $node_type : $type; } - $form[$vocabulary->vid]['name'] = array('#value' => check_plain($vocabulary->name)); - $form[$vocabulary->vid]['type'] = array('#value' => implode(', ', $types)); - $form[$vocabulary->vid]['edit'] = array('#value' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid")); - $form[$vocabulary->vid]['list'] = array('#value' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid")); - $form[$vocabulary->vid]['add'] = array('#value' => l(t('add terms'), "admin/taxonomy/$vocabulary->vid/add/term")); - } - - return drupal_get_form('taxonomy_overview_vocabularies', $form); -} - -/** - * Theme overview vocabularies. - */ -function theme_taxonomy_overview_vocabularies($form) { - $rows = array(); - foreach (element_children($form) as $key) { - if (isset($form[$key]['name'])) { - $row = array(); - $row[] = form_render($form[$key]['name']); - $row[] = form_render($form[$key]['type']); - $row[] = form_render($form[$key]['edit']); - $row[] = form_render($form[$key]['list']); - $row[] = form_render($form[$key]['add']); - $rows[] = $row; - } - } - if (!$rows) { + $rows[] = array('name' => check_plain($vocabulary->name), + 'type' => implode(', ', $types), + 'edit' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), + 'list' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"), + 'add' => l(t('add terms'), "admin/taxonomy/$vocabulary->vid/add/term") + ); + } + if (empty($rows)) { $rows[] = array(array('data' => t('No categories available.'), 'colspan' => '5', 'class' => 'message')); } $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3')); - $output = theme('table', $header, $rows, array('id' => 'taxonomy')); - $output .= form_render($form); - return $output; + return theme('table', $header, $rows, array('id' => 'taxonomy')); } /** @@ -1211,7 +1191,7 @@ function taxonomy_node_update_index(&$node) { * An string of term ids, separated by plus or comma. * comma (,) means AND * plus (+) means OR - * + * * @return an associative array with an <code>operator</code> key (either 'and' * or 'or') and an array, <code>tids</code>, containing the term ids. */ diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 010a2027c383..0f6b310eb3ad 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -122,46 +122,26 @@ function taxonomy_menu($may_cache) { */ function taxonomy_overview_vocabularies() { $vocabularies = taxonomy_get_vocabularies(); + $rows = array(); foreach ($vocabularies as $vocabulary) { $types = array(); foreach ($vocabulary->nodes as $type) { $node_type = node_get_name($type); $types[] = $node_type ? $node_type : $type; } - $form[$vocabulary->vid]['name'] = array('#value' => check_plain($vocabulary->name)); - $form[$vocabulary->vid]['type'] = array('#value' => implode(', ', $types)); - $form[$vocabulary->vid]['edit'] = array('#value' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid")); - $form[$vocabulary->vid]['list'] = array('#value' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid")); - $form[$vocabulary->vid]['add'] = array('#value' => l(t('add terms'), "admin/taxonomy/$vocabulary->vid/add/term")); - } - - return drupal_get_form('taxonomy_overview_vocabularies', $form); -} - -/** - * Theme overview vocabularies. - */ -function theme_taxonomy_overview_vocabularies($form) { - $rows = array(); - foreach (element_children($form) as $key) { - if (isset($form[$key]['name'])) { - $row = array(); - $row[] = form_render($form[$key]['name']); - $row[] = form_render($form[$key]['type']); - $row[] = form_render($form[$key]['edit']); - $row[] = form_render($form[$key]['list']); - $row[] = form_render($form[$key]['add']); - $rows[] = $row; - } - } - if (!$rows) { + $rows[] = array('name' => check_plain($vocabulary->name), + 'type' => implode(', ', $types), + 'edit' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), + 'list' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"), + 'add' => l(t('add terms'), "admin/taxonomy/$vocabulary->vid/add/term") + ); + } + if (empty($rows)) { $rows[] = array(array('data' => t('No categories available.'), 'colspan' => '5', 'class' => 'message')); } $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3')); - $output = theme('table', $header, $rows, array('id' => 'taxonomy')); - $output .= form_render($form); - return $output; + return theme('table', $header, $rows, array('id' => 'taxonomy')); } /** @@ -1211,7 +1191,7 @@ function taxonomy_node_update_index(&$node) { * An string of term ids, separated by plus or comma. * comma (,) means AND * plus (+) means OR - * + * * @return an associative array with an <code>operator</code> key (either 'and' * or 'or') and an array, <code>tids</code>, containing the term ids. */ -- GitLab