diff options
author | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-09-23 08:10:40 +0000 |
---|---|---|
committer | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-09-23 08:10:40 +0000 |
commit | 030f9741b7e21c44f5c054dbc3b5649e08f1fa47 (patch) | |
tree | 5cf598b218d02ce168e3bfb9fee4c64679987677 | |
parent | 88d14981f22e14b46b5755e21eb74bea20a7ca00 (diff) | |
download | brdo-030f9741b7e21c44f5c054dbc3b5649e08f1fa47.tar.gz brdo-030f9741b7e21c44f5c054dbc3b5649e08f1fa47.tar.bz2 |
#84076 by edkwh. Interim fix for being able to delete forums and forum containers.
-rw-r--r-- | modules/forum/forum.module | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 9ed0b9d05..685d9ad87 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -62,14 +62,14 @@ function forum_menu($may_cache) { 'weight' => -10); $items[] = array('path' => 'admin/content/forum/add/container', 'title' => t('add container'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('forum_form_container'), + 'callback' => 'forum_form_main', + 'callback arguments' => array('container'), 'access' => user_access('administer forums'), 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'admin/content/forum/add/forum', 'title' => t('add forum'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('forum_form_forum'), + 'callback' => 'forum_form_main', + 'callback arguments' => array('forum'), 'access' => user_access('administer forums'), 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'admin/content/forum/settings', @@ -86,14 +86,14 @@ function forum_menu($may_cache) { if ($term) { $items[] = array('path' => 'admin/content/forum/edit/container', 'title' => t('edit container'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('forum_form_container', (array)$term), + 'callback' => 'forum_form_main', + 'callback arguments' => array('container', (array)$term), 'access' => user_access('administer forums'), 'type' => MENU_CALLBACK); $items[] = array('path' => 'admin/content/forum/edit/forum', 'title' => t('edit forum'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('forum_form_forum', (array)$term), + 'callback' => 'forum_form_main', + 'callback arguments' => array('forum', (array)$term), 'access' => user_access('administer forums'), 'type' => MENU_CALLBACK); } @@ -443,10 +443,6 @@ function forum_delete(&$node) { */ function forum_form_container($edit = array()) { // Handle a delete operation. - if ($_POST['op'] == t('Delete') || $_POST['confirm']) { - return forum_confirm_delete($edit['tid']); - } - $form['name'] = array( '#title' => t('Container name'), '#type' => 'textfield', @@ -485,17 +481,26 @@ function forum_form_container($edit = array()) { return $form; } +function forum_form_main($type, $edit = array()) { + if ($_POST['op'] == t('Delete') || $_POST['confirm']) { + return drupal_get_form('forum_confirm_delete', $edit['tid']); + } + switch ($type) { + case 'forum': + return drupal_get_form('forum_form_forum', $edit); + break; + case 'container': + return drupal_get_form('forum_form_container', $edit); + break; + } +} + /** * Returns a form for adding a forum to the forum vocabulary * * @param $edit Associative array containing a forum term to be added or edited. */ function forum_form_forum($edit = array()) { - // Handle a delete operation. - if ($_POST['op'] == t('Delete') || $_POST['confirm']) { - return forum_confirm_delete($edit['tid']); - } - $form['name'] = array('#type' => 'textfield', '#title' => t('Forum name'), '#default_value' => $edit['name'], @@ -568,7 +573,7 @@ function forum_confirm_delete($tid) { $form['tid'] = array('#type' => 'value', '#value' => $tid); $form['name'] = array('#type' => 'value', '#value' => $term->name); - return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/content/forums', t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'), t('Delete'), t('Cancel')); + return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/content/forum', t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'), t('Delete'), t('Cancel')); } /** |