### Eclipse Workspace Patch 1.0
#P drupalcvs
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.428
diff -u -r1.428 forum.module
--- modules/forum/forum.module	21 Nov 2007 14:02:23 -0000	1.428
+++ modules/forum/forum.module	25 Nov 2007 21:49:55 -0000
@@ -92,7 +92,8 @@
   $items['admin/content/forum'] = array(
     'title' => 'Forums',
     'description' => 'Control forums and their hierarchy and change forum settings.',
-    'page callback' => 'forum_overview',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('forum_overview'),
     'access arguments' => array('administer forums'),
     'file' => 'forum.admin.inc',
   );
@@ -362,9 +363,14 @@
     }
   }
   // Hide multiple parents select from forum terms.
-  if ($form_id == 'taxonomy_form_term') {
+  elseif ($form_id == 'taxonomy_form_term') {
     unset($form['advanced']['parent']);
   }
+  // Add validation to the normal taxonomy terms overview form.
+  elseif ($form_id == 'taxonomy_overview_terms') {
+    include_once(drupal_get_path('module', 'forum') .'/forum.admin.inc');
+    $form['#validate'] = isset($form['#validate']) ? $form['#validate'][] = 'forum_overview_validate' : array('forum_overview_validate');
+  }
 }
 
 /**
Index: modules/forum/forum.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v
retrieving revision 1.1
diff -u -r1.1 forum.admin.inc
--- modules/forum/forum.admin.inc	24 Jul 2007 18:08:54 -0000	1.1
+++ modules/forum/forum.admin.inc	25 Nov 2007 21:49:55 -0000
@@ -214,26 +214,44 @@
 /**
  * Returns an overview list of existing forums and containers
  */
-function forum_overview() {
-  $header = array(t('Name'), t('Operations'));
+function forum_overview(&$form_state) {
+  include_once(drupal_get_path('module', 'taxonomy') .'/taxonomy.admin.inc');
 
   $vid = variable_get('forum_nav_vocabulary', '');
-  $tree = taxonomy_get_tree($vid);
-  if ($tree) {
-    foreach ($tree as $term) {
-      if (in_array($term->tid, variable_get('forum_containers', array()))) {
-        $rows[] = array(str_repeat(' -- ', $term->depth) .' '. l($term->name, 'forum/'. $term->tid), l(t('edit container'), 'admin/content/forum/edit/container/'. $term->tid));
+  $vocabulary = taxonomy_vocabulary_load($vid);
+  $form = taxonomy_overview_terms($form_state, $vocabulary);
+  drupal_set_title('Forums');
+
+  foreach (element_children($form) as $key) {
+    if (isset($form[$key]['#term'])) {
+      $term = $form[$key]['#term'];
+      $form[$key]['view']['#value'] = l($term['name'], 'forum/'. $term['tid']);
+      if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
+        $form[$key]['edit']['#value'] = l(t('edit container'), 'admin/content/forum/edit/container/'. $term['tid']);
       }
       else {
-        $rows[] = array(str_repeat(' -- ', $term->depth) .' '. l($term->name, 'forum/'. $term->tid), l(t('edit forum'), 'admin/content/forum/edit/forum/'. $term->tid));
-       }
-
+        $form[$key]['edit']['#value'] = l(t('edit forum'), 'admin/content/forum/edit/forum/'. $term['tid']);
+      }
     }
   }
-  else {
-    $rows[] = array(array('data' => '<em>'. t('There are no existing containers or forums. You may add some on the <a href="@container">add container</a> or <a href="@forum">add forum</a> pages.', array('@container' => url('admin/content/forum/add/container'), '@forum' => url('admin/content/forum/add/forum'))) .'</em>', 'colspan' => 2));
+
+  $form['#theme'] = 'taxonomy_overview_terms';
+  $form['#submit'] = array('taxonomy_overview_terms_submit'); // Use the existing taxonomy overview submit handler.
+  $form['#validate'] = array('taxonomy_overview_terms_validate', 'forum_overview_validate');
+  $form['#empty_text'] = '<em>'. t('There are no existing containers or forums. You may add some on the <a href="@container">add container</a> or <a href="@forum">add forum</a> pages.', array('@container' => url('admin/content/forum/add/container'), '@forum' => url('admin/content/forum/add/forum'))) .'</em>';
+  return $form;
+}
+
+/**
+ * Validate term list to prevent containers being children of forums. 
+ */
+function forum_overview_validate($form, &$form_state) {
+  $containers = variable_get('forum_containers', array());
+  foreach ($form_state['values'] as $key => $value) {
+    if (isset($value['parent']) && $value['parent'] != 0 && in_array($value['tid'], $containers) && !in_array($value['parent'], $containers)) {
+      form_set_error($key .'][parent', t('The container %container can only be placed within another container, not underneath a forum.', array('%container' => $form[$key]['#term']['name'])));
+    }
   }
-  return theme('table', $header, $rows);
 }
 
 /**
