Here is a patch to allow custom (tree-like) theming of 'admin/content/taxonomy_fields' page

Index: D:\www\sites\all\modules\taxonomy_fields\taxonomy_fields.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_fields/taxonomy_fields.module,v
retrieving revision 1.1.2.1.2.7
diff -u -r1.1.2.1.2.7 taxonomy_fields.module
--- taxonomy_fields.module	3 May 2007 11:20:11 -0000	1.1.2.1.2.7
+++ taxonomy_fields.module	17 May 2007 05:42:42 -0000
@@ -159,21 +159,22 @@
  * Menu callback; lists all terms and fields used by taxonomy_fields.
  */
 function _taxonomy_fields_list(){
-	
+
 	//needs call because content.module could have changed database storage
 	taxonomy_fields_clear_terms_cache();
 
 	//output of all existing term-field-relations
-	$query=db_query("SELECT SUBSTRING(nfi.type_name,14) AS tid, tfa.ancestors, tf.universal, td.name, nfi.field_name, nfi.type_name, nfi.label, nfi.widget_type, nfi.weight, nf.type 
-		FROM {node_field_instance} nfi 
-		LEFT JOIN {taxonomy_fields} tf ON nfi.field_name=tf.field_name AND SUBSTRING(nfi.type_name,14)=tf.tid 
+	$query=db_query("SELECT SUBSTRING(nfi.type_name,14) AS tid, tf.universal, tfa.ancestors, td.vid, td.name, td.weight AS t_weight, th.parent, nfi.field_name, nfi.type_name, nfi.label, nfi.widget_type, nfi.weight, nf.type
+		FROM {node_field_instance} nfi
+		LEFT JOIN {taxonomy_fields} tf ON nfi.field_name=tf.field_name AND SUBSTRING(nfi.type_name,14)=tf.tid
 		LEFT JOIN {taxonomy_fields_ancestors} tfa ON SUBSTRING(nfi.type_name,14)=tfa.tid
-		LEFT JOIN {term_data} td ON SUBSTRING(nfi.type_name,14)=td.tid 
+		LEFT JOIN {term_data} td ON SUBSTRING(nfi.type_name,14)=td.tid
+    LEFT JOIN {term_hierarchy} th ON SUBSTRING(nfi.type_name,14)=th.tid
 		LEFT JOIN {node_field} nf ON nf.field_name=nfi.field_name
 		WHERE nfi.type_name LIKE 'term_related_%%' AND ((tf.delta IS NULL OR tf.delta=0 ) OR (tf.delta=1 AND tf.delta!=0))
-		ORDER BY td.name, nfi.weight");
-	$output.='<h3>Fields assigned to terms:</h3>';	
-	
+		ORDER BY td.vid, t_weight, td.name, nfi.weight");
+	$output.='<h3>Fields assigned to terms:</h3>';
+
 	$field_output=array();
 	while($field_list=db_fetch_object($query)){
 
@@ -196,6 +197,9 @@
 			$field_output[$field_list->tid]['rows'][$field_list->field_name][]=l(t('edit'), 'admin/content/taxonomy_fields/'.ltrim(strrchr($field_list->type_name,'_'),'_').'/fields/'.$field_list->field_name);
 			$field_output[$field_list->tid]['rows'][$field_list->field_name][]=l(t('remove'), 'admin/content/taxonomy_fields/'.ltrim(strrchr($field_list->type_name,'_'),'_').'/fields/'.$field_list->field_name.'/remove');
 			$field_output[$field_list->tid]['name']=$field_list->name;
+      $field_output[$field_list->tid]['vid'] = $field_list->vid;
+      $field_output[$field_list->tid]['weight'] = $field_list->t_weight;
+      $field_output[$field_list->tid]['parent'] = $field_list->parent;
 		}
 	}
 	if($field_output){

The code of theme function later ;-)

Nice module, great possibilities! Thanks!

CommentFileSizeAuthor
#2 screenshot_taxonomy_fields_patch_144659.png12.95 KBtema

Comments

tema’s picture

Take it!

<?php
function theme_taxonomy_fields_list_output($field_output) {
  $output = '';
  $header= array(t('Label'), t('Name'), t('Field type'), t('Widget type'), t('Weight'), t('Universal'), array('data' => t('Operations'), 'colspan' => 2));
  $root_terms = array();
  foreach ($field_output as $key => $value) {
    if (!empty($value['parent'])) {
      $field_output[$key]['rows'] = array_merge($field_output[$key]['rows'], _taxonomy_fields_list_ancestors_rows($field_output, $key));
      $field_output['children'][$value['parent']][] = $key;
    }
    else {
      $root_terms[$value['vid']][] = $key;
    }
  }
  foreach ($root_terms as $vid => $terms) {
    $voc = taxonomy_get_vocabulary($vid);
    $output .= '<h2 class="title">'. $voc->name ."</h2>\n<blockquote>\n";
    foreach ($terms as $tid) {
      $output .= theme('taxonomy_fields_list_term', $field_output, $tid);
    }
    $output .= "</blockquote>\n";
  }
  return $output;
}

function _taxonomy_fields_list_ancestors_rows($field_output, $tid) {
  $rows = array();
  $parent_tid = $field_output[$tid]['parent'];
  if (!empty($field_output[$parent_tid]['rows'])) {
    foreach ($field_output[$parent_tid]['rows'] as $field_name => $cols) {
      $cols[6] = array('data' => '<em>'. t('inherited') .'</em>', 'colspan' => 2);
      unset($cols[7]);
      $rows[$field_name] = $cols;
    }
  }
  if (!empty($field_output[$parent_tid]['parent'])) {
    $rows = array_merge($rows, _taxonomy_fields_list_ancestors_rows($field_output, $field_output[$parent_tid]['parent']));
  }
  return $rows;
}

function theme_taxonomy_fields_list_term($field_output, $tid) {
  $output .= '<h2>'. $field_output[$tid]['name'] . ($field_output[$tid]['ancestors'] ? ' <em>('. t('ancestors enabled') .')</em>' : '') ."</h2>\n";
  $links = array(
    array(
      'title' => t('Terms settings'),
      'href' => 'admin/content/taxonomy_fields/'. $tid,
    ),
    array(
      'title' => t('Display settings'),
      'href' => 'admin/content/taxonomy_fields/'. $tid. '/fields',
    ),
  );
  $output .= theme('links', $links);
  $output .= theme('table', $header, $field_output[$tid]['rows']);
  if (isset($field_output['children']) && isset($field_output['children'][$tid])) {
    $output .= "<blockquote>\n";
    foreach ($field_output['children'][$tid] as $child_id) {
      $output .= theme('taxonomy_fields_list_term', $field_output, $child_id);
    }
    $output .= "</blockquote>\n";
  }
  return $output;
}
?>
tema’s picture

StatusFileSize
new12.95 KB

A screen capture of modified 'admin/content/taxonomy_fields' page (sorry, in Russian :)

tema’s picture

My tipo: $header variable is declared in wrong function.

function theme_taxonomy_fields_list_output($field_output) {
  $output = '';
  $root_terms = array();
  foreach ($field_output as $key => $value) {
    if (!empty($value['parent'])) {
      $field_output[$key]['rows'] = array_merge($field_output[$key]['rows'], _taxonomy_fields_list_ancestors_rows($field_output, $key));
      $field_output['children'][$value['parent']][] = $key;
    }
    else {
      $root_terms[$value['vid']][] = $key;
    }
  }
  foreach ($root_terms as $vid => $terms) {
    $voc = taxonomy_get_vocabulary($vid);
    $output .= '<h2 class="title">'. $voc->name ."</h2>\n<blockquote>\n";
    foreach ($terms as $tid) {
      $output .= theme('taxonomy_fields_list_term', $field_output, $tid);
    }
    $output .= "</blockquote>\n<p>&nbsp;</p>";
  }
  return $output;
}

function _taxonomy_fields_list_ancestors_rows($field_output, $tid) {
  $rows = array();
  $parent_tid = $field_output[$tid]['parent'];
  if (!empty($field_output[$parent_tid]['rows'])) {
    foreach ($field_output[$parent_tid]['rows'] as $field_name => $cols) {
      $cols[6] = array('data' => '<em>'. t('inherited') .'</em>', 'colspan' => 2);
      unset($cols[7]);
      $rows[$field_name] = $cols;
    }
  }
  if (!empty($field_output[$parent_tid]['parent'])) {
    $rows = array_merge($rows, _taxonomy_fields_list_ancestors_rows($field_output, $field_output[$parent_tid]['parent']));
  }
  return $rows;
}

function theme_taxonomy_fields_list_term($field_output, $tid) {
  $output .= '<h2>'. $field_output[$tid]['name']. ($field_output[$tid]['ancestors'] ? ' <em>('. t('ancestors enabled') .')</em>' : '') ."</h2>\n";
  $links = array(
    array(
      'title' => t('Terms settings'),
      'href' => 'admin/content/taxonomy_fields/'. $tid,
    ),
    array(
      'title' => t('Display settings'),
      'href' => 'admin/content/taxonomy_fields/'. $tid. '/fields',
    ),
  );
  $output .= theme('links', $links);
  $header= array(t('Label'), t('Name'), t('Field type'), t('Widget type'), t('Weight'), t('Universal'), array('data' => t('Operations'), 'colspan' => 2));
  $output .= theme('table', $header, $field_output[$tid]['rows']);
  if (isset($field_output['children']) && isset($field_output['children'][$tid])) {
    $output .= "<blockquote>\n";
    foreach ($field_output['children'][$tid] as $child_id) {
      $output .= theme('taxonomy_fields_list_term', $field_output, $child_id);
    }
    $output .= "</blockquote>\n";
  }
  return $output;
}

For using this in template.php rename function 'theme_taxonomy_fields_list_output' to 'phptemplate_taxonomy_fields_list_output' or '[your_theme_name]_taxonomy_fields_list_output'.

boneless’s picture

cool stuff!

i'll implement it in the next version!

thanks a lot ;)

boneless’s picture

Status: Needs review » Closed (fixed)

included in 5.x-1.5
thanks again!