diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-03-01 20:07:48 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-03-01 20:07:48 +0000 |
commit | 3123d7e6ec459e1c1d0e7fc8f03167ffba912084 (patch) | |
tree | bd16ac66299881d5d6d8b62d678c85195a4c4570 /modules | |
parent | a4befbb68b03e1a44a4aea38d7db763f7ecddd3c (diff) | |
download | brdo-3123d7e6ec459e1c1d0e7fc8f03167ffba912084.tar.gz brdo-3123d7e6ec459e1c1d0e7fc8f03167ffba912084.tar.bz2 |
- Patch #18045 by JonBob: the node type admin page uses an unclear callback name, and uses arg() where it is not necessary. The attached patch cleans this up by unifying node_types() with node_types_configure().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/node.module | 48 | ||||
-rw-r--r-- | modules/node/node.module | 48 |
2 files changed, 48 insertions, 48 deletions
diff --git a/modules/node.module b/modules/node.module index d9bf59def..a28779ca7 100644 --- a/modules/node.module +++ b/modules/node.module @@ -669,7 +669,7 @@ function node_menu($may_cache) { $items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); $items[] = array('path' => 'admin/node/configure/types', 'title' => t('content types'), - 'callback' => 'node_types', + 'callback' => 'node_types_configure', 'access' => user_access('administer nodes'), 'type' => MENU_LOCAL_TASK); if (module_exist('search')) { @@ -717,8 +717,6 @@ function node_menu($may_cache) { else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) { $items[] = array('path' => 'admin/node/configure/types/'. arg(4), 'title' => t("'%name' content type", array('%name' => node_invoke(arg(4), 'node_name'))), - 'callback' => 'node_types_configure', - 'access' => user_access('administer nodes'), 'type' => MENU_CALLBACK); } } @@ -942,32 +940,34 @@ function node_admin_nodes() { return form($output, 'post', url('admin/node/action')); } -function node_types() { - $header = array(t('Type'), t('Operations')); - - $rows = array(); - foreach (node_list() as $type) { - $rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type)); - } +/** + * Menu callback; presents each node type configuration page. + */ +function node_types_configure($type = NULL) { + if (isset($type)) { + // Go to the listing page when we submit this form, system_settings_save() calls drupal_goto(). + if ($_POST['op']) { + $_GET['q'] = 'admin/node/configure/types'; + } + system_settings_save(); - print theme('page', theme('table', $header, $rows)); -} + $group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name')))); + $group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name')))); + $output = form_group(t('Submission form'), $group); + $output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings'))); -function node_types_configure() { - // Go to the listing page when we submit this form, system_settings_save() calls drupal_goto(). - if ($_POST['op']) { - $_GET['q'] = 'admin/node/configure/types'; + print theme('page', system_settings_form($output)); } - system_settings_save(); - - $type = arg(4); + else { + $header = array(t('Type'), t('Operations')); - $group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name')))); - $group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name')))); - $output = form_group(t('Submission form'), $group); - $output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings'))); + $rows = array(); + foreach (node_list() as $type) { + $rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type)); + } - print theme('page', system_settings_form($output)); + print theme('page', theme('table', $header, $rows)); + } } /** diff --git a/modules/node/node.module b/modules/node/node.module index d9bf59def..a28779ca7 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -669,7 +669,7 @@ function node_menu($may_cache) { $items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); $items[] = array('path' => 'admin/node/configure/types', 'title' => t('content types'), - 'callback' => 'node_types', + 'callback' => 'node_types_configure', 'access' => user_access('administer nodes'), 'type' => MENU_LOCAL_TASK); if (module_exist('search')) { @@ -717,8 +717,6 @@ function node_menu($may_cache) { else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) { $items[] = array('path' => 'admin/node/configure/types/'. arg(4), 'title' => t("'%name' content type", array('%name' => node_invoke(arg(4), 'node_name'))), - 'callback' => 'node_types_configure', - 'access' => user_access('administer nodes'), 'type' => MENU_CALLBACK); } } @@ -942,32 +940,34 @@ function node_admin_nodes() { return form($output, 'post', url('admin/node/action')); } -function node_types() { - $header = array(t('Type'), t('Operations')); - - $rows = array(); - foreach (node_list() as $type) { - $rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type)); - } +/** + * Menu callback; presents each node type configuration page. + */ +function node_types_configure($type = NULL) { + if (isset($type)) { + // Go to the listing page when we submit this form, system_settings_save() calls drupal_goto(). + if ($_POST['op']) { + $_GET['q'] = 'admin/node/configure/types'; + } + system_settings_save(); - print theme('page', theme('table', $header, $rows)); -} + $group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name')))); + $group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name')))); + $output = form_group(t('Submission form'), $group); + $output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings'))); -function node_types_configure() { - // Go to the listing page when we submit this form, system_settings_save() calls drupal_goto(). - if ($_POST['op']) { - $_GET['q'] = 'admin/node/configure/types'; + print theme('page', system_settings_form($output)); } - system_settings_save(); - - $type = arg(4); + else { + $header = array(t('Type'), t('Operations')); - $group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name')))); - $group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name')))); - $output = form_group(t('Submission form'), $group); - $output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings'))); + $rows = array(); + foreach (node_list() as $type) { + $rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type)); + } - print theme('page', system_settings_form($output)); + print theme('page', theme('table', $header, $rows)); + } } /** |