diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-26 19:46:52 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-26 19:46:52 +0000 |
commit | e6a88be5d127f41837137a0d00980c8d8115ab1e (patch) | |
tree | a32f57bcd84cc290d0203c850d5b1c5ae676a3a4 /modules/forum | |
parent | 9a96837b89a0f6b2b5b2c99063e5faeda53d88c6 (diff) | |
download | brdo-e6a88be5d127f41837137a0d00980c8d8115ab1e.tar.gz brdo-e6a88be5d127f41837137a0d00980c8d8115ab1e.tar.bz2 |
#193333 by quicksketch et al: taxonomy drag and drop support
Diffstat (limited to 'modules/forum')
-rw-r--r-- | modules/forum/forum.admin.inc | 35 | ||||
-rw-r--r-- | modules/forum/forum.module | 3 |
2 files changed, 23 insertions, 15 deletions
diff --git a/modules/forum/forum.admin.inc b/modules/forum/forum.admin.inc index 099dae094..6b0bcb8f8 100644 --- a/modules/forum/forum.admin.inc +++ b/modules/forum/forum.admin.inc @@ -214,26 +214,33 @@ function forum_admin_settings() { /** * 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)); - } - return theme('table', $header, $rows); + + // The form needs to have submit and validate handlers set explicitly. + $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'); + $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; } /** diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 6647daff6..46f0a9615 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -92,7 +92,8 @@ function forum_menu() { $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', ); |