- Modified patch by mikeryan: make it possible to administer system vocabularies.

4.7.x
Dries Buytaert 2005-04-12 19:18:57 +00:00
parent c9c947619f
commit dea2bd2123
2 changed files with 34 additions and 38 deletions

View File

@ -366,30 +366,28 @@ function taxonomy_overview() {
$header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3')); $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3'));
$vocabularies = taxonomy_get_vocabularies(); $vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) { foreach ($vocabularies as $vocabulary) {
if ($vocabulary->module == 'taxonomy') { $types = array();
$types = array(); foreach ($vocabulary->nodes as $type) {
foreach ($vocabulary->nodes as $type) { $node_type = node_invoke($type, 'node_name');
$node_type = node_invoke($type, 'node_name'); $types[] = $node_type ? $node_type : $type;
$types[] = $node_type ? $node_type : $type; }
} $rows[] = array('<strong>'.check_plain($vocabulary->name).'</strong>', 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"));
$rows[] = array('<strong>'.check_plain($vocabulary->name).'</strong>', 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. // Show terms if non-free.
if (!$vocabulary->tags) { if (!$vocabulary->tags) {
$tree = taxonomy_get_tree($vocabulary->vid); $tree = taxonomy_get_tree($vocabulary->vid);
if ($tree) { if ($tree) {
foreach ($tree as $term) { foreach ($tree as $term) {
$rows[] = array(array('data' => _taxonomy_depth($term->depth) . ' ' . check_plain($term->name), 'class' => 'term'), NULL, NULL, NULL, l(t('edit term'), "admin/taxonomy/edit/term/$term->tid")); $rows[] = array(array('data' => _taxonomy_depth($term->depth) . ' ' . check_plain($term->name), '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) { else {
$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(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'));
}
} }
if (!$rows) { if (!$rows) {

View File

@ -366,30 +366,28 @@ function taxonomy_overview() {
$header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3')); $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3'));
$vocabularies = taxonomy_get_vocabularies(); $vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) { foreach ($vocabularies as $vocabulary) {
if ($vocabulary->module == 'taxonomy') { $types = array();
$types = array(); foreach ($vocabulary->nodes as $type) {
foreach ($vocabulary->nodes as $type) { $node_type = node_invoke($type, 'node_name');
$node_type = node_invoke($type, 'node_name'); $types[] = $node_type ? $node_type : $type;
$types[] = $node_type ? $node_type : $type; }
} $rows[] = array('<strong>'.check_plain($vocabulary->name).'</strong>', 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"));
$rows[] = array('<strong>'.check_plain($vocabulary->name).'</strong>', 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. // Show terms if non-free.
if (!$vocabulary->tags) { if (!$vocabulary->tags) {
$tree = taxonomy_get_tree($vocabulary->vid); $tree = taxonomy_get_tree($vocabulary->vid);
if ($tree) { if ($tree) {
foreach ($tree as $term) { foreach ($tree as $term) {
$rows[] = array(array('data' => _taxonomy_depth($term->depth) . ' ' . check_plain($term->name), 'class' => 'term'), NULL, NULL, NULL, l(t('edit term'), "admin/taxonomy/edit/term/$term->tid")); $rows[] = array(array('data' => _taxonomy_depth($term->depth) . ' ' . check_plain($term->name), '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) { else {
$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(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'));
}
} }
if (!$rows) { if (!$rows) {