diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-07-10 19:27:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-07-10 19:27:52 +0000 |
commit | 58752cfaa2b182c53e26ee42983ff41d59597b4c (patch) | |
tree | 35fc59938cda1bcfc4866989d5fcc5254d77ec89 | |
parent | c45ca20d0ff7448f8edac7ca46becc0c8ea8ee03 (diff) | |
download | brdo-58752cfaa2b182c53e26ee42983ff41d59597b4c.tar.gz brdo-58752cfaa2b182c53e26ee42983ff41d59597b4c.tar.bz2 |
- Patch #72284 by me:
+ reorganized ?q=admin/settings
+ deprecated the _settings hook
32 files changed, 893 insertions, 554 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index db317764d..3ec0d810a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,14 +6,14 @@ Drupal x.x.x, xxxx-xx-xx (development version) - added support for a generic "sites/all" directory. - usability: * added support for auto-complete forms (AJAX) to user profiles. + * made it possible to instantly assign roles to newly created user accounts. * improved configurability of the contact forms. + * reorganized the settings pages. - block system: - * extended the block visibility settings with a role specific settings.. + * extended the block visibility settings with a role specific settings. - poll module: * optionally allow people to inspect all votes. * optionally allow people to cancel their vote. -- user module: - * made it possible to instantly assign roles to newly created user accounts. - distributed authentication: * added default server option. - fixed critical SQL issue, see SA-2006-005 diff --git a/UPGRADE.txt b/UPGRADE.txt index 1f36eba1e..c9b525951 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -4,7 +4,8 @@ UPGRADING --------- 1. Backup your database and Drupal directory - especially your - configuration file in 'sites/default/settings.php'. + sites-directory which contains your configuration file and + any added modules and themes. 2. Log on as the user with user ID 1. diff --git a/modules/aggregator.module b/modules/aggregator.module index 142c1c135..cab78b23a 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -75,6 +75,11 @@ function aggregator_menu($may_cache) { 'title' => t('list'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); + $items[] = array('path' => 'admin/settings/aggregator', + 'title' => t('RSS aggregator'), + 'callback' => 'aggregator_admin_settings', + 'type' => MENU_NORMAL_ITEM, + 'access' => $edit); $items[] = array('path' => 'aggregator', 'title' => t('news aggregator'), @@ -188,10 +193,7 @@ function aggregator_menu($may_cache) { return $items; } -/** - * Implementation of hook_settings(). - */ -function aggregator_settings() { +function aggregator_admin_settings() { $items = array(0 => t('none')) + drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items'); $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); @@ -218,7 +220,8 @@ function aggregator_settings() { '#options' => array('checkboxes' => t('checkboxes'), 'select' => t('multiple selector')), '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.') ); - return $form; + + return system_settings_form('aggregator_admin_settings', $form); } /** diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 142c1c135..cab78b23a 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -75,6 +75,11 @@ function aggregator_menu($may_cache) { 'title' => t('list'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); + $items[] = array('path' => 'admin/settings/aggregator', + 'title' => t('RSS aggregator'), + 'callback' => 'aggregator_admin_settings', + 'type' => MENU_NORMAL_ITEM, + 'access' => $edit); $items[] = array('path' => 'aggregator', 'title' => t('news aggregator'), @@ -188,10 +193,7 @@ function aggregator_menu($may_cache) { return $items; } -/** - * Implementation of hook_settings(). - */ -function aggregator_settings() { +function aggregator_admin_settings() { $items = array(0 => t('none')) + drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items'); $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); @@ -218,7 +220,8 @@ function aggregator_settings() { '#options' => array('checkboxes' => t('checkboxes'), 'select' => t('multiple selector')), '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.') ); - return $form; + + return system_settings_form('aggregator_admin_settings', $form); } /** diff --git a/modules/blogapi.module b/modules/blogapi.module index f4ebb618c..cdda5a2db 100644 --- a/modules/blogapi.module +++ b/modules/blogapi.module @@ -553,9 +553,11 @@ function blogapi_blogger_title(&$contents) { return $title; } -function blogapi_settings() { +function blogapi_admin_settings() { $form['blogapi_engine'] = array( - '#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0), + '#type' => 'select', + '#title' => t('XML-RPC Engine'), + '#default_value' => variable_get('blogapi_engine', 0), '#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'), '#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.') ); @@ -563,12 +565,15 @@ function blogapi_settings() { $node_types = node_get_types(); $defaults = isset($node_types['blog']) ? array('blog' => 1) : array(); $form['blogapi_node_types'] = array( - '#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE, - '#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types, + '#type' => 'checkboxes', + '#title' => t('Blog types'), + '#required' => TRUE, + '#default_value' => variable_get('blogapi_node_types', $defaults), + '#options' => $node_types, '#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).') ); - return $form; + return system_settings_form('blogapi_admin_settings', $form); } function blogapi_menu($may_cache) { @@ -582,7 +587,19 @@ function blogapi_menu($may_cache) { } if ($may_cache) { - $items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access content'), 'type' => MENU_CALLBACK); + $items[] = array( + 'path' => 'blogapi', + 'title' => t('RSD'), + 'callback' => 'blogapi_blogapi', + 'access' => user_access('access content'), + 'type' => MENU_CALLBACK); + $items[] = array( + 'path' => 'admin/settings/blogapi', + 'title' => t('blog APIs'), + 'callback' => 'blogapi_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM + ); } return $items; diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module index f4ebb618c..cdda5a2db 100644 --- a/modules/blogapi/blogapi.module +++ b/modules/blogapi/blogapi.module @@ -553,9 +553,11 @@ function blogapi_blogger_title(&$contents) { return $title; } -function blogapi_settings() { +function blogapi_admin_settings() { $form['blogapi_engine'] = array( - '#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0), + '#type' => 'select', + '#title' => t('XML-RPC Engine'), + '#default_value' => variable_get('blogapi_engine', 0), '#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'), '#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.') ); @@ -563,12 +565,15 @@ function blogapi_settings() { $node_types = node_get_types(); $defaults = isset($node_types['blog']) ? array('blog' => 1) : array(); $form['blogapi_node_types'] = array( - '#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE, - '#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types, + '#type' => 'checkboxes', + '#title' => t('Blog types'), + '#required' => TRUE, + '#default_value' => variable_get('blogapi_node_types', $defaults), + '#options' => $node_types, '#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).') ); - return $form; + return system_settings_form('blogapi_admin_settings', $form); } function blogapi_menu($may_cache) { @@ -582,7 +587,19 @@ function blogapi_menu($may_cache) { } if ($may_cache) { - $items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access content'), 'type' => MENU_CALLBACK); + $items[] = array( + 'path' => 'blogapi', + 'title' => t('RSD'), + 'callback' => 'blogapi_blogapi', + 'access' => user_access('access content'), + 'type' => MENU_CALLBACK); + $items[] = array( + 'path' => 'admin/settings/blogapi', + 'title' => t('blog APIs'), + 'callback' => 'blogapi_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM + ); } return $items; diff --git a/modules/comment.module b/modules/comment.module index 51ed7104a..6272aa436 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -77,7 +77,7 @@ function comment_help($section) { <li>control access for various comment module functions through access permissions <a href="%admin-access">administer >> access control</a>.</li> <li>administer comments <a href="%admin-comment-configure"> administer >> comments >> configure</a>.</li> </ul> -', array('%admin-access' => url('admin/access'), '%admin-comment-configure' => url('admin/comment/configure'))); +', array('%admin-access' => url('admin/access'), '%admin-settings-comment' => url('admin/settings/comment'))); $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%comment">Comment page</a>.', array('%comment' => 'http://drupal.org/handbook/modules/comment/')) .'</p>'; return $output; case 'admin/modules#description': @@ -87,8 +87,7 @@ function comment_help($section) { return t("<p>Below is a list of the latest comments posted to your site. Click on a subject to see the comment, the author's name to edit the author's user information , \"edit\" to modify the text, and \"delete\" to remove their submission.</p>"); case 'admin/comment/approval': return t("<p>Below is a list of the comments posted to your site that need approval. To approve a comment, click on \"edit\" and then change its \"moderation status\" to Approved. Click on a subject to see the comment, the author's name to edit the author's user information, \"edit\" to modify the text, and \"delete\" to remove their submission.</p>"); - case 'admin/comment/configure': - case 'admin/comment/configure/settings': + case 'admin/settings/comment': return t("<p>Comments can be attached to any node, and their settings are below. The display comes in two types: a \"flat list\" where everything is flush to the left side, and comments come in chronological order, and a \"threaded list\" where replies to other comments are placed immediately below and slightly indented, forming an outline. They also come in two styles: \"expanded\", where you see both the title and the contents, and \"collapsed\" where you only see the title. Preview comment forces a user to look at their comment by clicking on a \"Preview\" button before they can actually add the comment.</p>"); } } @@ -107,8 +106,6 @@ function comment_menu($may_cache) { // Tabs: $items[] = array('path' => 'admin/comment/list', 'title' => t('list'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); - $items[] = array('path' => 'admin/comment/configure', 'title' => t('configure'), - 'callback' => 'comment_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK); // Subtabs: $items[] = array('path' => 'admin/comment/list/new', 'title' => t('published comments'), @@ -118,8 +115,12 @@ function comment_menu($may_cache) { 'callback arguments' => array('approval'), 'type' => MENU_LOCAL_TASK); - $items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'), - 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); + $items[] = array( + 'path' => 'admin/settings/comments', + 'title' => t('comments'), + 'callback' => 'comment_admin_settings', + 'access' => $access, + 'type' => MENU_NORMAL_ITEM); $items[] = array('path' => 'comment/delete', 'title' => t('delete comment'), 'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK); @@ -361,7 +362,7 @@ function comment_user($type, $edit, &$user, $category = NULL) { /** * Menu callback; presents the comment settings page. */ -function comment_configure() { +function comment_admin_settings() { $form['viewing_options'] = array( '#type' => 'fieldset', '#title' => t('Viewing options'), @@ -448,7 +449,7 @@ function comment_configure() { '#options' => array(t('Display on separate page'), t('Display below post or comments')), ); - return system_settings_form('comment_settings_form', $form); + return system_settings_form('comment_admin_settings', $form); } /** diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 51ed7104a..6272aa436 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -77,7 +77,7 @@ function comment_help($section) { <li>control access for various comment module functions through access permissions <a href="%admin-access">administer >> access control</a>.</li> <li>administer comments <a href="%admin-comment-configure"> administer >> comments >> configure</a>.</li> </ul> -', array('%admin-access' => url('admin/access'), '%admin-comment-configure' => url('admin/comment/configure'))); +', array('%admin-access' => url('admin/access'), '%admin-settings-comment' => url('admin/settings/comment'))); $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%comment">Comment page</a>.', array('%comment' => 'http://drupal.org/handbook/modules/comment/')) .'</p>'; return $output; case 'admin/modules#description': @@ -87,8 +87,7 @@ function comment_help($section) { return t("<p>Below is a list of the latest comments posted to your site. Click on a subject to see the comment, the author's name to edit the author's user information , \"edit\" to modify the text, and \"delete\" to remove their submission.</p>"); case 'admin/comment/approval': return t("<p>Below is a list of the comments posted to your site that need approval. To approve a comment, click on \"edit\" and then change its \"moderation status\" to Approved. Click on a subject to see the comment, the author's name to edit the author's user information, \"edit\" to modify the text, and \"delete\" to remove their submission.</p>"); - case 'admin/comment/configure': - case 'admin/comment/configure/settings': + case 'admin/settings/comment': return t("<p>Comments can be attached to any node, and their settings are below. The display comes in two types: a \"flat list\" where everything is flush to the left side, and comments come in chronological order, and a \"threaded list\" where replies to other comments are placed immediately below and slightly indented, forming an outline. They also come in two styles: \"expanded\", where you see both the title and the contents, and \"collapsed\" where you only see the title. Preview comment forces a user to look at their comment by clicking on a \"Preview\" button before they can actually add the comment.</p>"); } } @@ -107,8 +106,6 @@ function comment_menu($may_cache) { // Tabs: $items[] = array('path' => 'admin/comment/list', 'title' => t('list'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); - $items[] = array('path' => 'admin/comment/configure', 'title' => t('configure'), - 'callback' => 'comment_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK); // Subtabs: $items[] = array('path' => 'admin/comment/list/new', 'title' => t('published comments'), @@ -118,8 +115,12 @@ function comment_menu($may_cache) { 'callback arguments' => array('approval'), 'type' => MENU_LOCAL_TASK); - $items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'), - 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); + $items[] = array( + 'path' => 'admin/settings/comments', + 'title' => t('comments'), + 'callback' => 'comment_admin_settings', + 'access' => $access, + 'type' => MENU_NORMAL_ITEM); $items[] = array('path' => 'comment/delete', 'title' => t('delete comment'), 'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK); @@ -361,7 +362,7 @@ function comment_user($type, $edit, &$user, $category = NULL) { /** * Menu callback; presents the comment settings page. */ -function comment_configure() { +function comment_admin_settings() { $form['viewing_options'] = array( '#type' => 'fieldset', '#title' => t('Viewing options'), @@ -448,7 +449,7 @@ function comment_configure() { '#options' => array(t('Display on separate page'), t('Display below post or comments')), ); - return system_settings_form('comment_settings_form', $form); + return system_settings_form('comment_admin_settings', $form); } /** diff --git a/modules/contact.module b/modules/contact.module index 2ff6546dd..2302d46d5 100644 --- a/modules/contact.module +++ b/modules/contact.module @@ -26,7 +26,7 @@ function contact_help($section) { case 'admin/modules#description': return t('Enables the use of both personal and site-wide contact forms.'); case 'admin/contact': - $output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/contact/settings'), '%form' => url('contact'))); + $output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/settings/contact'), '%form' => url('contact'))); if (!module_exist('menu')) { $menu_note = t('The menu item can be customized and configured only once the menu module has been <a href="%modules-page">enabled</a>.', array('%modules-page' => url('admin/modules'))); } @@ -55,43 +55,36 @@ function contact_menu($may_cache) { 'callback' => 'contact_admin_categories', 'access' => user_access('administer site configuration'), ); - $items[] = array('path' => 'admin/contact/category', - 'title' => t('categories'), - 'callback' => 'contact_admin_categories', - 'access' => user_access('administer site configuration'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - ); - $items[] = array('path' => 'admin/contact/category/list', + $items[] = array('path' => 'admin/contact/list', 'title' => t('list'), 'callback' => 'contact_admin_categories', 'access' => user_access('administer site configuration'), 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items[] = array('path' => 'admin/contact/category/add', + $items[] = array('path' => 'admin/contact/add', 'title' => t('add category'), 'callback' => 'contact_admin_edit', 'access' => user_access('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, ); - $items[] = array('path' => 'admin/contact/category/edit', + $items[] = array('path' => 'admin/contact/edit', 'title' => t('edit contact category'), 'callback' => 'contact_admin_edit', 'access' => user_access('administer site configuration'), 'type' => MENU_CALLBACK, ); - $items[] = array('path' => 'admin/contact/category/delete', + $items[] = array('path' => 'admin/contact/delete', 'title' => t('delete contact'), 'callback' => 'contact_admin_delete', 'access' => user_access('administer site configuration'), 'type' => MENU_CALLBACK, ); - $items[] = array('path' => 'admin/contact/settings', - 'title' => t('settings'), + $items[] = array('path' => 'admin/settings/contact', + 'title' => t('contact form'), 'callback' => 'contact_admin_settings', 'access' => user_access('administer site configuration'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 1, + 'type' => MENU_NORMAL_ITEM, ); $items[] = array('path' => 'contact', 'title' => t('contact'), @@ -154,7 +147,7 @@ function contact_admin_categories() { $result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category'); $rows = array(); while ($category = db_fetch_object($result)) { - $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/category/edit/'. $category->cid), l(t('delete'), 'admin/contact/category/delete/'. $category->cid)); + $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/edit/'. $category->cid), l(t('delete'), 'admin/contact/delete/'. $category->cid)); } $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2)); @@ -165,7 +158,7 @@ function contact_admin_categories() { * Category edit page. */ function contact_admin_edit($cid = NULL) { - if (arg(3) == "edit" && $cid > 0) { + if (arg(2) == "edit" && $cid > 0) { $edit = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid)); } $form['category'] = array('#type' => 'textfield', @@ -241,7 +234,7 @@ function contact_admin_edit_submit($form_id, $form_values) { $recipients[$key] = trim($recipient); } $form_values['recipients'] = implode(',', $recipients); - if (arg(3) == 'add') { + if (arg(2) == 'add') { db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']); drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category'])))); watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact')); @@ -277,16 +270,13 @@ function contact_admin_delete($cid = NULL) { * Process category delete form submission. */ function contact_admin_delete_submit($form_id, $form_values) { - db_query("DELETE FROM {contact} WHERE cid = %d", arg(4)); + db_query("DELETE FROM {contact} WHERE cid = %d", arg(3)); drupal_set_message(t('Category %category has been deleted.', array('%category' => theme('placeholder', $form_values['category'])))); watchdog('mail', t('Contact form: category %category deleted.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE); return 'admin/contact'; } -/** - * Settings tab. Using a form rather than hook_settings(). - */ function contact_admin_settings() { $form['contact_form_information'] = array('#type' => 'textarea', '#title' => t('Additional information'), @@ -311,7 +301,7 @@ function contact_admin_settings() { $form['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults'), ); - // Use system_settings_form for the callback. + return drupal_get_form('contact_admin_settings', $form, 'system_settings_form'); } diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 2ff6546dd..2302d46d5 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -26,7 +26,7 @@ function contact_help($section) { case 'admin/modules#description': return t('Enables the use of both personal and site-wide contact forms.'); case 'admin/contact': - $output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/contact/settings'), '%form' => url('contact'))); + $output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/settings/contact'), '%form' => url('contact'))); if (!module_exist('menu')) { $menu_note = t('The menu item can be customized and configured only once the menu module has been <a href="%modules-page">enabled</a>.', array('%modules-page' => url('admin/modules'))); } @@ -55,43 +55,36 @@ function contact_menu($may_cache) { 'callback' => 'contact_admin_categories', 'access' => user_access('administer site configuration'), ); - $items[] = array('path' => 'admin/contact/category', - 'title' => t('categories'), - 'callback' => 'contact_admin_categories', - 'access' => user_access('administer site configuration'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - ); - $items[] = array('path' => 'admin/contact/category/list', + $items[] = array('path' => 'admin/contact/list', 'title' => t('list'), 'callback' => 'contact_admin_categories', 'access' => user_access('administer site configuration'), 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items[] = array('path' => 'admin/contact/category/add', + $items[] = array('path' => 'admin/contact/add', 'title' => t('add category'), 'callback' => 'contact_admin_edit', 'access' => user_access('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, ); - $items[] = array('path' => 'admin/contact/category/edit', + $items[] = array('path' => 'admin/contact/edit', 'title' => t('edit contact category'), 'callback' => 'contact_admin_edit', 'access' => user_access('administer site configuration'), 'type' => MENU_CALLBACK, ); - $items[] = array('path' => 'admin/contact/category/delete', + $items[] = array('path' => 'admin/contact/delete', 'title' => t('delete contact'), 'callback' => 'contact_admin_delete', 'access' => user_access('administer site configuration'), 'type' => MENU_CALLBACK, ); - $items[] = array('path' => 'admin/contact/settings', - 'title' => t('settings'), + $items[] = array('path' => 'admin/settings/contact', + 'title' => t('contact form'), 'callback' => 'contact_admin_settings', 'access' => user_access('administer site configuration'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 1, + 'type' => MENU_NORMAL_ITEM, ); $items[] = array('path' => 'contact', 'title' => t('contact'), @@ -154,7 +147,7 @@ function contact_admin_categories() { $result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category'); $rows = array(); while ($category = db_fetch_object($result)) { - $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/category/edit/'. $category->cid), l(t('delete'), 'admin/contact/category/delete/'. $category->cid)); + $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/edit/'. $category->cid), l(t('delete'), 'admin/contact/delete/'. $category->cid)); } $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2)); @@ -165,7 +158,7 @@ function contact_admin_categories() { * Category edit page. */ function contact_admin_edit($cid = NULL) { - if (arg(3) == "edit" && $cid > 0) { + if (arg(2) == "edit" && $cid > 0) { $edit = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid)); } $form['category'] = array('#type' => 'textfield', @@ -241,7 +234,7 @@ function contact_admin_edit_submit($form_id, $form_values) { $recipients[$key] = trim($recipient); } $form_values['recipients'] = implode(',', $recipients); - if (arg(3) == 'add') { + if (arg(2) == 'add') { db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']); drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category'])))); watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact')); @@ -277,16 +270,13 @@ function contact_admin_delete($cid = NULL) { * Process category delete form submission. */ function contact_admin_delete_submit($form_id, $form_values) { - db_query("DELETE FROM {contact} WHERE cid = %d", arg(4)); + db_query("DELETE FROM {contact} WHERE cid = %d", arg(3)); drupal_set_message(t('Category %category has been deleted.', array('%category' => theme('placeholder', $form_values['category'])))); watchdog('mail', t('Contact form: category %category deleted.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE); return 'admin/contact'; } -/** - * Settings tab. Using a form rather than hook_settings(). - */ function contact_admin_settings() { $form['contact_form_information'] = array('#type' => 'textarea', '#title' => t('Additional information'), @@ -311,7 +301,7 @@ function contact_admin_settings() { $form['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults'), ); - // Use system_settings_form for the callback. + return drupal_get_form('contact_admin_settings', $form, 'system_settings_form'); } diff --git a/modules/drupal.module b/modules/drupal.module index 535950571..294bddb03 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -47,39 +47,31 @@ print drupal_client_page(); case 'admin/modules#description': return t('Lets you register your site with a central server and improve ranking of Drupal projects by posting information on your installed modules and themes; also enables users to log in using a Drupal ID.'); case 'admin/settings/drupal': - return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings'))); + return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">site information settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings/site-informationl'))); case 'user/help#drupal': return variable_get('drupal_authentication_service', 0) ? t("<p><a href=\"%Drupal\">Drupal</a> is the name of the software that powers %this-site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely log in to any Drupal site using a single <strong>Drupal ID</strong>.</p> <p>So please feel free to log in to your account here at %this-site with a username from another Drupal site. The format of a Drupal ID is similar to an e-mail address: <strong>username</strong>@<em>server</em>. An example of a valid Drupal ID is <strong>mwlily</strong>@<em>drupal.org</em>.</p>", array('%Drupal' => 'http://drupal.org', '%this-site' => '<em>'. variable_get('site_name', 'this web site') .'</em>')) : ''; } } -/** - * Implementation of hook_settings(). - */ -function drupal_settings() { +function drupal_sites_registry_settings() { // Check if all required fields are present if ((variable_get('site_name', 'drupal') == 'drupal') || (variable_get('site_name', 'drupal') == '')) { - form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings/site-information')))); } else if (variable_get('site_mail', ini_get('sendmail_from')) == '') { - form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">site information settings page</a>.', array('%url' => url('admin/settings/site-information')))); } else if (variable_get('site_slogan', '') == '') { - form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">site information settings page</a>.', array('%url' => url('admin/settings/site-information')))); } else if (variable_get('site_mission', '') == '') { - form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer » settings</a> page.' , array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">site information settings page</a>.' , array('%url' => url('admin/settings/site-information')))); } - $options = array('1' => t('Enabled'), '0' => t('Disabled')); - $form['drupal'] = array( - '#type' => 'fieldset', - '#title' => t('Post data to another site'), - '#tree' => FALSE - ); + $options = array('1' => t('Enabled'), '0' => t('Disabled')); - $form['drupal']['drupal_register'] = array( + $form['drupal_register'] = array( '#type' => 'radios', '#title' => t('Register with a Drupal server'), '#default_value' => variable_get('drupal_register', 0), @@ -87,14 +79,14 @@ function drupal_settings() { '#description' => t("If enabled, your Drupal site will register itself with the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will register itself with drupal.org. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://drupal.org/xmlrpc.php", "%drupal-sites" => "http://drupal.org/drupal-sites/")) ); - $form['drupal']['drupal_server'] = array( + $form['drupal_server'] = array( '#type' => 'textfield', '#title' => t('Drupal XML-RPC server'), '#default_value' => variable_get('drupal_server', 'http://drupal.org/xmlrpc.php'), '#description' => t('The URL of the Drupal XML-RPC server you wish to register with.') ); - $form['drupal']['drupal_system'] = array( + $form['drupal_system'] = array( '#type' => 'radios', '#title' => t('Send system information'), '#default_value' => variable_get('drupal_system', 0), @@ -102,21 +94,16 @@ function drupal_settings() { '#description' => t("If enabled, your site will send information on its installed components (modules, themes, and theme engines). This information can help in compiling statistics on usage of Drupal projects.") ); - $form['drupal']['drupal_statistics'] = array( + $form['drupal_statistics'] = array( '#type' => 'radios', '#title' => t('Send statistics'), '#default_value' => variable_get('drupal_statistics', 0), '#options' => $options, '#description' => t("If enabled, your site will send summary statistics on the number of registered users and the total number of posts. No private information will be sent. These data help to improve the ranking statistics of Drupal projects.") ); +; - $form['services'] = array( - '#type' => 'fieldset', - '#title' => t('Receive data from other sites'), - '#tree' => FALSE - ); - - $form['services']['drupal_client_service'] = array( + $form['drupal_client_service'] = array( '#type' => 'radios', '#title' => t('Allow other Drupal sites to register'), '#default_value' => variable_get('drupal_client_service', 0), @@ -124,13 +111,14 @@ function drupal_settings() { '#description' => t('If enabled, your Drupal site will allow other sites to register with your site and send information to this site. This functionality can be used to maintain a list of related sites.') ); - $form['distauth'] = array( - '#type' => 'fieldset', - '#title' => t('Distributed authentication'), - '#tree' => FALSE - ); + return system_settings_form('drupal_sites_registry_settings', $form); +} + +function drupal_distributed_authentication_settings() { - $form['distauth']['drupal_authentication_service'] = array( + $options = array('1' => t('Enabled'), '0' => t('Disabled')); + + $form['drupal_authentication_service'] = array( '#type' => 'radios', '#title' => t('Authentication service'), '#default_value' => variable_get('drupal_authentication_service', 0), @@ -138,14 +126,14 @@ function drupal_settings() { '#description' => t('If enabled, your Drupal site will accept logins with the user names of other Drupal sites, and likewise provide authentication for users logging into other Drupal sites, based on their user accounts here.') ); - $form['distauth']['drupal_default_da_server'] = array( + $form['drupal_default_da_server'] = array( '#type' => 'textfield', '#title' => t('Default authentication server'), '#default_value' => variable_get('drupal_default_da_server', ''), '#description' => t('The URL of the default Drupal authentication server. Omit the %http prefix (e.g. drupal.org, www.example.com, etc.). If the authentication service has been enabled, users registered at the server specified here, will not need to append the server to their user name when logging into your site. This enables users to provide a briefer, more familiar username in the login form.', array('%http' => theme('placeholder', 'http'))) ); - $form['distauth']['drupal_default_da_server_only'] = array( + $form['drupal_default_da_server_only'] = array( '#type' => 'radios', '#title' => t('Only allow authentication from default server'), '#default_value' => variable_get('drupal_default_da_server_only', 0), @@ -153,7 +141,7 @@ function drupal_settings() { '#description' => t('Only accept remote logins from the above specified default authentication server and not from any other server. Useful when an external system is the solitary authority on user accounts for this site. A common usage is to enable this setting and also enable an authentication module which talks to your company\'s directory server.') ); - return $form; + return system_settings_form('drupal_distributed_authentication_settings', $form); } /** @@ -359,6 +347,15 @@ function drupal_auth($username, $password, $server = FALSE) { function drupal_menu($may_cache) { $items = array(); if ($may_cache) { + $items[] = array('path' => 'admin/settings/sites-registry', + 'title' => t('sites registry'), + 'callback' => 'drupal_sites_registry_settings', + 'access' => user_access('administer site configuration')); + $items[] = array('path' => 'admin/settings/distributed-authentication', + 'title' => t('distributed authentication'), + 'callback' => 'drupal_distributed_authentication_settings', + 'access' => user_access('administer site configuration'));; + if (variable_get('drupal_authentication_service', 0)) { $items[] = array('path' => 'drupal', 'title' => t('Drupal'), 'callback' => 'drupal_page_help', 'access' => TRUE, diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index 535950571..294bddb03 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -47,39 +47,31 @@ print drupal_client_page(); case 'admin/modules#description': return t('Lets you register your site with a central server and improve ranking of Drupal projects by posting information on your installed modules and themes; also enables users to log in using a Drupal ID.'); case 'admin/settings/drupal': - return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings'))); + return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">site information settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings/site-informationl'))); case 'user/help#drupal': return variable_get('drupal_authentication_service', 0) ? t("<p><a href=\"%Drupal\">Drupal</a> is the name of the software that powers %this-site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely log in to any Drupal site using a single <strong>Drupal ID</strong>.</p> <p>So please feel free to log in to your account here at %this-site with a username from another Drupal site. The format of a Drupal ID is similar to an e-mail address: <strong>username</strong>@<em>server</em>. An example of a valid Drupal ID is <strong>mwlily</strong>@<em>drupal.org</em>.</p>", array('%Drupal' => 'http://drupal.org', '%this-site' => '<em>'. variable_get('site_name', 'this web site') .'</em>')) : ''; } } -/** - * Implementation of hook_settings(). - */ -function drupal_settings() { +function drupal_sites_registry_settings() { // Check if all required fields are present if ((variable_get('site_name', 'drupal') == 'drupal') || (variable_get('site_name', 'drupal') == '')) { - form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings/site-information')))); } else if (variable_get('site_mail', ini_get('sendmail_from')) == '') { - form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">site information settings page</a>.', array('%url' => url('admin/settings/site-information')))); } else if (variable_get('site_slogan', '') == '') { - form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">administer » settings</a> page.', array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">site information settings page</a>.', array('%url' => url('admin/settings/site-information')))); } else if (variable_get('site_mission', '') == '') { - form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer » settings</a> page.' , array('%url' => url('admin/settings')))); + form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">site information settings page</a>.' , array('%url' => url('admin/settings/site-information')))); } - $options = array('1' => t('Enabled'), '0' => t('Disabled')); - $form['drupal'] = array( - '#type' => 'fieldset', - '#title' => t('Post data to another site'), - '#tree' => FALSE - ); + $options = array('1' => t('Enabled'), '0' => t('Disabled')); - $form['drupal']['drupal_register'] = array( + $form['drupal_register'] = array( '#type' => 'radios', '#title' => t('Register with a Drupal server'), '#default_value' => variable_get('drupal_register', 0), @@ -87,14 +79,14 @@ function drupal_settings() { '#description' => t("If enabled, your Drupal site will register itself with the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will register itself with drupal.org. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://drupal.org/xmlrpc.php", "%drupal-sites" => "http://drupal.org/drupal-sites/")) ); - $form['drupal']['drupal_server'] = array( + $form['drupal_server'] = array( '#type' => 'textfield', '#title' => t('Drupal XML-RPC server'), '#default_value' => variable_get('drupal_server', 'http://drupal.org/xmlrpc.php'), '#description' => t('The URL of the Drupal XML-RPC server you wish to register with.') ); - $form['drupal']['drupal_system'] = array( + $form['drupal_system'] = array( '#type' => 'radios', '#title' => t('Send system information'), '#default_value' => variable_get('drupal_system', 0), @@ -102,21 +94,16 @@ function drupal_settings() { '#description' => t("If enabled, your site will send information on its installed components (modules, themes, and theme engines). This information can help in compiling statistics on usage of Drupal projects.") ); - $form['drupal']['drupal_statistics'] = array( + $form['drupal_statistics'] = array( '#type' => 'radios', '#title' => t('Send statistics'), '#default_value' => variable_get('drupal_statistics', 0), '#options' => $options, '#description' => t("If enabled, your site will send summary statistics on the number of registered users and the total number of posts. No private information will be sent. These data help to improve the ranking statistics of Drupal projects.") ); +; - $form['services'] = array( - '#type' => 'fieldset', - '#title' => t('Receive data from other sites'), - '#tree' => FALSE - ); - - $form['services']['drupal_client_service'] = array( + $form['drupal_client_service'] = array( '#type' => 'radios', '#title' => t('Allow other Drupal sites to register'), '#default_value' => variable_get('drupal_client_service', 0), @@ -124,13 +111,14 @@ function drupal_settings() { '#description' => t('If enabled, your Drupal site will allow other sites to register with your site and send information to this site. This functionality can be used to maintain a list of related sites.') ); - $form['distauth'] = array( - '#type' => 'fieldset', - '#title' => t('Distributed authentication'), - '#tree' => FALSE - ); + return system_settings_form('drupal_sites_registry_settings', $form); +} + +function drupal_distributed_authentication_settings() { - $form['distauth']['drupal_authentication_service'] = array( + $options = array('1' => t('Enabled'), '0' => t('Disabled')); + + $form['drupal_authentication_service'] = array( '#type' => 'radios', '#title' => t('Authentication service'), '#default_value' => variable_get('drupal_authentication_service', 0), @@ -138,14 +126,14 @@ function drupal_settings() { '#description' => t('If enabled, your Drupal site will accept logins with the user names of other Drupal sites, and likewise provide authentication for users logging into other Drupal sites, based on their user accounts here.') ); - $form['distauth']['drupal_default_da_server'] = array( + $form['drupal_default_da_server'] = array( '#type' => 'textfield', '#title' => t('Default authentication server'), '#default_value' => variable_get('drupal_default_da_server', ''), '#description' => t('The URL of the default Drupal authentication server. Omit the %http prefix (e.g. drupal.org, www.example.com, etc.). If the authentication service has been enabled, users registered at the server specified here, will not need to append the server to their user name when logging into your site. This enables users to provide a briefer, more familiar username in the login form.', array('%http' => theme('placeholder', 'http'))) ); - $form['distauth']['drupal_default_da_server_only'] = array( + $form['drupal_default_da_server_only'] = array( '#type' => 'radios', '#title' => t('Only allow authentication from default server'), '#default_value' => variable_get('drupal_default_da_server_only', 0), @@ -153,7 +141,7 @@ function drupal_settings() { '#description' => t('Only accept remote logins from the above specified default authentication server and not from any other server. Useful when an external system is the solitary authority on user accounts for this site. A common usage is to enable this setting and also enable an authentication module which talks to your company\'s directory server.') ); - return $form; + return system_settings_form('drupal_distributed_authentication_settings', $form); } /** @@ -359,6 +347,15 @@ function drupal_auth($username, $password, $server = FALSE) { function drupal_menu($may_cache) { $items = array(); if ($may_cache) { + $items[] = array('path' => 'admin/settings/sites-registry', + 'title' => t('sites registry'), + 'callback' => 'drupal_sites_registry_settings', + 'access' => user_access('administer site configuration')); + $items[] = array('path' => 'admin/settings/distributed-authentication', + 'title' => t('distributed authentication'), + 'callback' => 'drupal_distributed_authentication_settings', + 'access' => user_access('administer site configuration'));; + if (variable_get('drupal_authentication_service', 0)) { $items[] = array('path' => 'drupal', 'title' => t('Drupal'), 'callback' => 'drupal_page_help', 'access' => TRUE, diff --git a/modules/forum.module b/modules/forum.module index 07eba7922..785aab416 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -33,8 +33,6 @@ function forum_help($section) { return t('<p>Containers help you organize your forums. The job of a container is to hold, or contain, other forums that are related. For example, a container named "Food" might hold two forums named "Fruit" and "Vegetables".</p>'); case 'admin/forum/add/forum': return t('<p>A forum holds discussion topics that are related. For example, a forum named "Fruit" might contain topics titled "Apples" and "Bananas".</p>'); - case 'admin/forum/configure': - return t('This is where you can configure system-wide options for how your forums act and display.'); case 'node/add#forum': return t('Create a new topic for discussion in the forums.'); } @@ -75,11 +73,11 @@ function forum_menu($may_cache) { 'callback' => 'forum_form_forum', 'access' => user_access('administer forums'), 'type' => MENU_LOCAL_TASK); - $items[] = array('path' => 'admin/forum/configure', - 'title' => t('configure'), - 'callback' => 'forum_admin_configure', + $items[] = array('path' => 'admin/settings/forum', + 'title' => t('forums'), + 'callback' => 'forum_admin_settings', 'access' => user_access('administer forums'), - 'type' => MENU_LOCAL_TASK); + 'type' => MENU_NORMAL_ITEM); } elseif (is_numeric(arg(4))) { $term = taxonomy_get_term(arg(4)); @@ -172,10 +170,7 @@ function forum_taxonomy($op, $type, $term = NULL) { } } -/** - * Implementation of hook_settings - */ -function forum_admin_configure() { +function forum_admin_settings() { $form = array(); $number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500)); diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 07eba7922..785aab416 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -33,8 +33,6 @@ function forum_help($section) { return t('<p>Containers help you organize your forums. The job of a container is to hold, or contain, other forums that are related. For example, a container named "Food" might hold two forums named "Fruit" and "Vegetables".</p>'); case 'admin/forum/add/forum': return t('<p>A forum holds discussion topics that are related. For example, a forum named "Fruit" might contain topics titled "Apples" and "Bananas".</p>'); - case 'admin/forum/configure': - return t('This is where you can configure system-wide options for how your forums act and display.'); case 'node/add#forum': return t('Create a new topic for discussion in the forums.'); } @@ -75,11 +73,11 @@ function forum_menu($may_cache) { 'callback' => 'forum_form_forum', 'access' => user_access('administer forums'), 'type' => MENU_LOCAL_TASK); - $items[] = array('path' => 'admin/forum/configure', - 'title' => t('configure'), - 'callback' => 'forum_admin_configure', + $items[] = array('path' => 'admin/settings/forum', + 'title' => t('forums'), + 'callback' => 'forum_admin_settings', 'access' => user_access('administer forums'), - 'type' => MENU_LOCAL_TASK); + 'type' => MENU_NORMAL_ITEM); } elseif (is_numeric(arg(4))) { $term = taxonomy_get_term(arg(4)); @@ -172,10 +170,7 @@ function forum_taxonomy($op, $type, $term = NULL) { } } -/** - * Implementation of hook_settings - */ -function forum_admin_configure() { +function forum_admin_settings() { $form = array(); $number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500)); diff --git a/modules/node.module b/modules/node.module index 83c840a41..6eb5063f0 100644 --- a/modules/node.module +++ b/modules/node.module @@ -34,9 +34,6 @@ function node_help($section) { return $output; case 'admin/modules#description': return t('Allows content to be submitted to the site and displayed on pages.'); - case 'admin/node/configure': - case 'admin/node/configure/settings': - return t('<p>Settings for the core of Drupal. Almost everything is a node so these settings will affect most of the site.</p>'); case 'admin/node': return t('<p>Below is a list of all of the posts on your site. Other forms of content are listed elsewhere (e.g. <a href="%comments">comments</a>).</p><p>Clicking a title views the post, while clicking an author\'s name views their user information.</p>', array('%comments' => url('admin/comment'))); case 'admin/node/search': diff --git a/modules/node/node.module b/modules/node/node.module index 83c840a41..6eb5063f0 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -34,9 +34,6 @@ function node_help($section) { return $output; case 'admin/modules#description': return t('Allows content to be submitted to the site and displayed on pages.'); - case 'admin/node/configure': - case 'admin/node/configure/settings': - return t('<p>Settings for the core of Drupal. Almost everything is a node so these settings will affect most of the site.</p>'); case 'admin/node': return t('<p>Below is a list of all of the posts on your site. Other forms of content are listed elsewhere (e.g. <a href="%comments">comments</a>).</p><p>Clicking a title views the post, while clicking an author\'s name views their user information.</p>', array('%comments' => url('admin/comment'))); case 'admin/node/search': diff --git a/modules/path.module b/modules/path.module index b18226955..e437e72f5 100644 --- a/modules/path.module +++ b/modules/path.module @@ -29,9 +29,9 @@ function path_help($section) { <li>add a URL alias: <a href="%admin-path-add">administer >> url aliases >> add alias</a>.</li> <li>administer the list of URL aliases: <a href="%admin-path">administer >> url aliases</a>.</li> <li>read how to <a href="%external-http-drupal-org-node-15365">configure clean URLs</a> for your webserver. -<li>enable clean url\'s to remove the =? at <a href="%admin-settings">administer >> settings</a>.</li> +<li>enable clean url\'s to remove the =? at <a href="%admin-clean-url-settings">administer >> settings >> clean URLs</a>.</li> </ul> -', array('%admin-path-add' => url('admin/path/add'), '%admin-path' => url('admin/path'), '%external-http-drupal-org-node-15365' => 'http://drupal.org/node/15365', '%admin-settings' => url('admin/settings'))); +', array('%admin-path-add' => url('admin/path/add'), '%admin-path' => url('admin/path'), '%external-http-drupal-org-node-15365' => 'http://drupal.org/node/15365', '%admin-clean-url-settings' => url('admin/settings/clean-urls'))); $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%path">Path page</a>.', array('%path' => 'http://drupal.org/handbook/modules/path/')) .'</p>'; return $output; case 'admin/modules#description': diff --git a/modules/path/path.module b/modules/path/path.module index b18226955..e437e72f5 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -29,9 +29,9 @@ function path_help($section) { <li>add a URL alias: <a href="%admin-path-add">administer >> url aliases >> add alias</a>.</li> <li>administer the list of URL aliases: <a href="%admin-path">administer >> url aliases</a>.</li> <li>read how to <a href="%external-http-drupal-org-node-15365">configure clean URLs</a> for your webserver. -<li>enable clean url\'s to remove the =? at <a href="%admin-settings">administer >> settings</a>.</li> +<li>enable clean url\'s to remove the =? at <a href="%admin-clean-url-settings">administer >> settings >> clean URLs</a>.</li> </ul> -', array('%admin-path-add' => url('admin/path/add'), '%admin-path' => url('admin/path'), '%external-http-drupal-org-node-15365' => 'http://drupal.org/node/15365', '%admin-settings' => url('admin/settings'))); +', array('%admin-path-add' => url('admin/path/add'), '%admin-path' => url('admin/path'), '%external-http-drupal-org-node-15365' => 'http://drupal.org/node/15365', '%admin-clean-url-settings' => url('admin/settings/clean-urls'))); $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%path">Path page</a>.', array('%path' => 'http://drupal.org/handbook/modules/path/')) .'</p>'; return $output; case 'admin/modules#description': diff --git a/modules/profile.module b/modules/profile.module index 4a36e208b..a172f7b5b 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -60,7 +60,7 @@ function profile_menu($may_cache) { 'access' => user_access('access user profiles'), 'type' => MENU_SUGGESTED_ITEM); $items[] = array('path' => 'admin/settings/profile', - 'title' => t('profiles'), + 'title' => t('user profiles'), 'callback' => 'profile_admin_overview'); $items[] = array('path' => 'admin/settings/profile/add', 'title' => t('add field'), diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 4a36e208b..a172f7b5b 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -60,7 +60,7 @@ function profile_menu($may_cache) { 'access' => user_access('access user profiles'), 'type' => MENU_SUGGESTED_ITEM); $items[] = array('path' => 'admin/settings/profile', - 'title' => t('profiles'), + 'title' => t('user profiles'), 'callback' => 'profile_admin_overview'); $items[] = array('path' => 'admin/settings/profile/add', 'title' => t('add field'), diff --git a/modules/search.module b/modules/search.module index 30dc3a1e8..90d9af3ab 100644 --- a/modules/search.module +++ b/modules/search.module @@ -151,11 +151,18 @@ function search_menu($may_cache) { $items = array(); if ($may_cache) { - $items[] = array('path' => 'search', 'title' => t('search'), + $items[] = array('path' => 'search', + 'title' => t('search'), 'callback' => 'search_view', 'access' => user_access('search content'), 'type' => MENU_SUGGESTED_ITEM); - $items[] = array('path' => 'admin/settings/search/wipe', 'title' => t('Clear index'), + $items[] = array('path' => 'admin/settings/search', + 'title' => t('search'), + 'callback' => 'search_admin_settings', + 'access' => user_access('administer search'), + 'type' => MENU_CALLBACK); + $items[] = array('path' => 'admin/settings/search/wipe', + 'title' => t('clear index'), 'callback' => 'search_wipe_confirm', 'access' => user_access('administer search'), 'type' => MENU_CALLBACK); @@ -181,7 +188,7 @@ function search_menu($may_cache) { /** * Implementation of hook_validate(). */ -function search_settings_form_validate($form_id, &$form) { +function search_admin_settings_validate($form_id, &$form) { if ($_POST['op'] == t('Re-index site')) { drupal_goto('admin/settings/search/wipe'); } @@ -196,7 +203,7 @@ function search_settings_form_validate($form_id, &$form) { /** * Menu callback; displays the search module settings page. */ -function search_settings() { +function search_admin_settings() { // Collect some stats $remaining = 0; $total = 0; @@ -227,7 +234,8 @@ function search_settings() { // Per module settings $form = array_merge($form, module_invoke_all('search', 'admin')); - return $form; + + return system_settings_form('search_admin_settings', $form); } /** diff --git a/modules/search/search.module b/modules/search/search.module index 30dc3a1e8..90d9af3ab 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -151,11 +151,18 @@ function search_menu($may_cache) { $items = array(); if ($may_cache) { - $items[] = array('path' => 'search', 'title' => t('search'), + $items[] = array('path' => 'search', + 'title' => t('search'), 'callback' => 'search_view', 'access' => user_access('search content'), 'type' => MENU_SUGGESTED_ITEM); - $items[] = array('path' => 'admin/settings/search/wipe', 'title' => t('Clear index'), + $items[] = array('path' => 'admin/settings/search', + 'title' => t('search'), + 'callback' => 'search_admin_settings', + 'access' => user_access('administer search'), + 'type' => MENU_CALLBACK); + $items[] = array('path' => 'admin/settings/search/wipe', + 'title' => t('clear index'), 'callback' => 'search_wipe_confirm', 'access' => user_access('administer search'), 'type' => MENU_CALLBACK); @@ -181,7 +188,7 @@ function search_menu($may_cache) { /** * Implementation of hook_validate(). */ -function search_settings_form_validate($form_id, &$form) { +function search_admin_settings_validate($form_id, &$form) { if ($_POST['op'] == t('Re-index site')) { drupal_goto('admin/settings/search/wipe'); } @@ -196,7 +203,7 @@ function search_settings_form_validate($form_id, &$form) { /** * Menu callback; displays the search module settings page. */ -function search_settings() { +function search_admin_settings() { // Collect some stats $remaining = 0; $total = 0; @@ -227,7 +234,8 @@ function search_settings() { // Per module settings $form = array_merge($form, module_invoke_all('search', 'admin')); - return $form; + + return system_settings_form('search_admin_settings', $form); } /** diff --git a/modules/statistics.module b/modules/statistics.module index 522fb60ac..256d9c065 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -114,31 +114,61 @@ function statistics_menu($may_cache) { $access = user_access('access statistics'); if ($may_cache) { - $items[] = array('path' => 'admin/logs/hits', 'title' => t('recent hits'), - 'callback' => 'statistics_recent_hits', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/hits', + 'title' => t('recent hits'), + 'callback' => 'statistics_recent_hits', + 'access' => $access, 'weight' => 3); - $items[] = array('path' => 'admin/logs/pages', 'title' => t('top pages'), - 'callback' => 'statistics_top_pages', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/pages', + 'title' => t('top pages'), + 'callback' => 'statistics_top_pages', + 'access' => $access, 'weight' => 1); - $items[] = array('path' => 'admin/logs/visitors', 'title' => t('top visitors'), - 'callback' => 'statistics_top_visitors', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/visitors', + 'title' => t('top visitors'), + 'callback' => 'statistics_top_visitors', + 'access' => $access, 'weight' => 2); - $items[] = array('path' => 'admin/logs/referrers', 'title' => t('referrers'), - 'callback' => 'statistics_top_referrers', 'access' => $access); - $items[] = array('path' => 'admin/logs/access', 'title' => t('details'), - 'callback' => 'statistics_access_log', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/referrers', + 'title' => t('referrers'), + 'callback' => 'statistics_top_referrers', + 'access' => $access); + $items[] = array( + 'path' => 'admin/logs/access', + 'title' => t('details'), + 'callback' => 'statistics_access_log', + 'access' => $access, 'type' => MENU_CALLBACK); + $items[] = array( + 'path' => 'admin/settings/access-logging', + 'title' => t('access logging'), + 'callback' => 'statistics_access_logging_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM + ); } else { if (arg(0) == 'user' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) { - $items[] = array('path' => 'user/'. arg(1) .'/track/navigation', 'title' => t('track page visits'), - 'callback' => 'statistics_user_tracker', 'access' => $access, - 'type' => MENU_LOCAL_TASK, 'weight' => 2); + $items[] = array( + 'path' => 'user/'. arg(1) .'/track/navigation', + 'title' => t('track page visits'), + 'callback' => 'statistics_user_tracker', + 'access' => $access, + 'type' => MENU_LOCAL_TASK, + 'weight' => 2); } if (arg(0) == 'node' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) { - $items[] = array('path' => 'node/'. arg(1) .'/track', 'title' => t('track'), - 'callback' => 'statistics_node_tracker', 'access' => $access, - 'type' => MENU_LOCAL_TASK, 'weight' => 2); + $items[] = array( + 'path' => 'node/'. arg(1) .'/track', + 'title' => t('track'), + 'callback' => 'statistics_node_tracker', + 'access' => $access, + 'type' => MENU_LOCAL_TASK, + 'weight' => 2); } } @@ -333,22 +363,38 @@ function statistics_top_referrers() { return $output; } -/** - * Implementation of hook_settings(). - */ -function statistics_settings() { - // access log settings: +function statistics_access_logging_settings() { + // Access log settings: $options = array('1' => t('Enabled'), '0' => t('Disabled')); - $form['access'] = array('#type' => 'fieldset', '#title' => t('Access log settings')); - $form['access']['statistics_enable_access_log'] = array('#type' => 'radios', '#title' => t('Enable access log'), '#default_value' => variable_get('statistics_enable_access_log', 0), '#options' => $options, '#description' => t('Log each page access. Required for referrer statistics.')); + $form['access'] = array( + '#type' => 'fieldset', + '#title' => t('Access log settings')); + $form['access']['statistics_enable_access_log'] = array( + '#type' => 'radios', + '#title' => t('Enable access log'), + '#default_value' => variable_get('statistics_enable_access_log', 0), + '#options' => $options, + '#description' => t('Log each page access. Required for referrer statistics.')); $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); - $form['access']['statistics_flush_accesslog_timer'] = array('#type' => 'select', '#title' => t('Discard access logs older than'), '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200), '#options' => $period, '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.')); + $form['access']['statistics_flush_accesslog_timer'] = array( + '#type' => 'select', + '#title' => t('Discard access logs older than'), + '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200), + '#options' => $period, + '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.')); // count content views settings - $form['content'] = array('#type' => 'fieldset', '#title' => t('Content viewing counter settings')); - $form['content']['statistics_count_content_views'] = array('#type' => 'radios', '#title' => t('Count content views'), '#default_value' => variable_get('statistics_count_content_views', 0), '#options' => $options, '#description' => t('Increment a counter each time content is viewed.')); - - return $form; + $form['content'] = array( + '#type' => 'fieldset', + '#title' => t('Content viewing counter settings')); + $form['content']['statistics_count_content_views'] = array( + '#type' => 'radios', + '#title' => t('Count content views'), + '#default_value' => variable_get('statistics_count_content_views', 0), + '#options' => $options, + '#description' => t('Increment a counter each time content is viewed.')); + + return system_settings_form('statistics_access_logging_settings', $form); } /** diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 522fb60ac..256d9c065 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -114,31 +114,61 @@ function statistics_menu($may_cache) { $access = user_access('access statistics'); if ($may_cache) { - $items[] = array('path' => 'admin/logs/hits', 'title' => t('recent hits'), - 'callback' => 'statistics_recent_hits', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/hits', + 'title' => t('recent hits'), + 'callback' => 'statistics_recent_hits', + 'access' => $access, 'weight' => 3); - $items[] = array('path' => 'admin/logs/pages', 'title' => t('top pages'), - 'callback' => 'statistics_top_pages', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/pages', + 'title' => t('top pages'), + 'callback' => 'statistics_top_pages', + 'access' => $access, 'weight' => 1); - $items[] = array('path' => 'admin/logs/visitors', 'title' => t('top visitors'), - 'callback' => 'statistics_top_visitors', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/visitors', + 'title' => t('top visitors'), + 'callback' => 'statistics_top_visitors', + 'access' => $access, 'weight' => 2); - $items[] = array('path' => 'admin/logs/referrers', 'title' => t('referrers'), - 'callback' => 'statistics_top_referrers', 'access' => $access); - $items[] = array('path' => 'admin/logs/access', 'title' => t('details'), - 'callback' => 'statistics_access_log', 'access' => $access, + $items[] = array( + 'path' => 'admin/logs/referrers', + 'title' => t('referrers'), + 'callback' => 'statistics_top_referrers', + 'access' => $access); + $items[] = array( + 'path' => 'admin/logs/access', + 'title' => t('details'), + 'callback' => 'statistics_access_log', + 'access' => $access, 'type' => MENU_CALLBACK); + $items[] = array( + 'path' => 'admin/settings/access-logging', + 'title' => t('access logging'), + 'callback' => 'statistics_access_logging_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM + ); } else { if (arg(0) == 'user' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) { - $items[] = array('path' => 'user/'. arg(1) .'/track/navigation', 'title' => t('track page visits'), - 'callback' => 'statistics_user_tracker', 'access' => $access, - 'type' => MENU_LOCAL_TASK, 'weight' => 2); + $items[] = array( + 'path' => 'user/'. arg(1) .'/track/navigation', + 'title' => t('track page visits'), + 'callback' => 'statistics_user_tracker', + 'access' => $access, + 'type' => MENU_LOCAL_TASK, + 'weight' => 2); } if (arg(0) == 'node' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) { - $items[] = array('path' => 'node/'. arg(1) .'/track', 'title' => t('track'), - 'callback' => 'statistics_node_tracker', 'access' => $access, - 'type' => MENU_LOCAL_TASK, 'weight' => 2); + $items[] = array( + 'path' => 'node/'. arg(1) .'/track', + 'title' => t('track'), + 'callback' => 'statistics_node_tracker', + 'access' => $access, + 'type' => MENU_LOCAL_TASK, + 'weight' => 2); } } @@ -333,22 +363,38 @@ function statistics_top_referrers() { return $output; } -/** - * Implementation of hook_settings(). - */ -function statistics_settings() { - // access log settings: +function statistics_access_logging_settings() { + // Access log settings: $options = array('1' => t('Enabled'), '0' => t('Disabled')); - $form['access'] = array('#type' => 'fieldset', '#title' => t('Access log settings')); - $form['access']['statistics_enable_access_log'] = array('#type' => 'radios', '#title' => t('Enable access log'), '#default_value' => variable_get('statistics_enable_access_log', 0), '#options' => $options, '#description' => t('Log each page access. Required for referrer statistics.')); + $form['access'] = array( + '#type' => 'fieldset', + '#title' => t('Access log settings')); + $form['access']['statistics_enable_access_log'] = array( + '#type' => 'radios', + '#title' => t('Enable access log'), + '#default_value' => variable_get('statistics_enable_access_log', 0), + '#options' => $options, + '#description' => t('Log each page access. Required for referrer statistics.')); $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); - $form['access']['statistics_flush_accesslog_timer'] = array('#type' => 'select', '#title' => t('Discard access logs older than'), '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200), '#options' => $period, '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.')); + $form['access']['statistics_flush_accesslog_timer'] = array( + '#type' => 'select', + '#title' => t('Discard access logs older than'), + '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200), + '#options' => $period, + '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.')); // count content views settings - $form['content'] = array('#type' => 'fieldset', '#title' => t('Content viewing counter settings')); - $form['content']['statistics_count_content_views'] = array('#type' => 'radios', '#title' => t('Count content views'), '#default_value' => variable_get('statistics_count_content_views', 0), '#options' => $options, '#description' => t('Increment a counter each time content is viewed.')); - - return $form; + $form['content'] = array( + '#type' => 'fieldset', + '#title' => t('Content viewing counter settings')); + $form['content']['statistics_count_content_views'] = array( + '#type' => 'radios', + '#title' => t('Count content views'), + '#default_value' => variable_get('statistics_count_content_views', 0), + '#options' => $options, + '#description' => t('Increment a counter each time content is viewed.')); + + return system_settings_form('statistics_access_logging_settings', $form); } /** diff --git a/modules/system.module b/modules/system.module index b306b7e82..05a843bba 100644 --- a/modules/system.module +++ b/modules/system.module @@ -23,17 +23,15 @@ function system_help($section) { <ul> <li>activate your cron job on the cron page <a href="%file-cron">cron.php</a>.</li> <li>read how to <a href="%external-http-drupal-org-cron">configure cron jobs</a>.</li> -<li>administer cache settings in <a href="%admin-settings">administer >> settings</a>.</li> +<li>administer cache settings in <a href="%admin-settings">administer >> settings >> caching</a>.</li> </ul> -', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%admin-settings' => url('admin/settings'))); +', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%admin-settings' => url('admin/settings/caching'))); $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%system">System page</a>.', array('%system' => 'http://drupal.org/handbook/modules/system/')) .'</p>'; return $output; case 'admin/modules#description': return t('Handles general site configuration for administrators.'); case 'admin': return t('<p>Welcome to the administration section. Below are the most recent system events.</p>'); - case 'admin/settings': - return t('<p>General configuration options for your site. Set up the name of the site, e-mail address used in mail-outs, clean URL options, caching, etc.</p>'); case 'admin/themes': return t('<p>Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternately, to override these settings in a specific theme, click the "configure" link for the corresponding theme. Note that different themes may have different regions available for rendering content like blocks. If you want consistency in what your users see, you may wish to enable only one theme.</p>'); case 'admin/themes/settings': @@ -132,15 +130,59 @@ function system_menu($may_cache) { } // Modules: - $items[] = array('path' => 'admin/settings', 'title' => t('settings'), - 'callback' => 'system_site_settings', 'access' => $access); - foreach (module_list() as $name) { - if (module_hook($name, 'settings')) { - $items[] = array('path' => 'admin/settings/'. $name, 'title' => t($name)); - } - } $items[] = array('path' => 'admin/modules', 'title' => t('modules'), 'callback' => 'system_modules', 'access' => $access); + + // Settings: + $items[] = array( + 'path' => 'admin/settings', + 'title' => t('settings'), + 'callback' => 'system_settings_overview', + 'access' => $access); + $items[] = array( + 'path' => 'admin/settings/site-information', + 'title' => t('site information'), + 'callback' => 'system_site_information_settings'); + $items[] = array( + 'path' => 'admin/settings/error-reporting', + 'title' => t('error reporting'), + 'callback' => 'system_error_reporting_settings'); + $items[] = array( + 'path' => 'admin/settings/page-caching', + 'title' => t('page caching'), + 'callback' => 'system_page_caching_settings'); + $items[] = array( + 'path' => 'admin/settings/file-system', + 'title' => t('file system'), + 'callback' => 'system_file_system_settings'); + $items[] = array( + 'path' => 'admin/settings/image-toolkit', + 'title' => t('image toolkit'), + 'callback' => 'system_image_toolkit_settings'); + $items[] = array( + 'path' => 'admin/settings/rss-feed', + 'title' => t('RSS feeds'), + 'callback' => 'system_rss_feeds_settings'); + $items[] = array( + 'path' => 'admin/settings/date-time', + 'title' => t('date and time'), + 'callback' => 'system_date_time_settings'); + $items[] = array( + 'path' => 'admin/settings/site-status', + 'title' => t('site status'), + 'callback' => 'system_site_status_settings'); + $items[] = array( + 'path' => 'admin/settings/unicode', + 'title' => t('unicode'), + 'callback' => 'system_unicode_settings'); + $items[] = array( + 'path' => 'admin/settings/cron-status', + 'title' => t('cron status'), + 'callback' => 'system_cron_status'); + $items[] = array( + 'path' => 'admin/settings/clean-urls', + 'title' => t('clean URLs'), + 'callback' => 'system_clean_url_settings'); } return $items; @@ -245,44 +287,58 @@ function _system_zonelist() { return $zones; } -function system_view_general() { - // General settings: - $form['general'] = array( - '#type' => 'fieldset', '#title' => t('General settings'), - '#collapsible' => TRUE, '#collapsed' => TRUE - ); - $form['general']['site_name'] = array( - '#type' => 'textfield', '#title' => t('Name'), '#default_value' => variable_get('site_name', 'drupal'), - '#description' => t('The name of this web site.'), '#required' => TRUE +function system_site_information_settings() { + $form['site_name'] = array( + '#type' => 'textfield', + '#title' => t('Name'), + '#default_value' => variable_get('site_name', 'drupal'), + '#description' => t('The name of this web site.'), + '#required' => TRUE ); - $form['general']['site_mail'] = array( - '#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), + $form['site_mail'] = array( + '#type' => 'textfield', + '#title' => t('E-mail address'), + '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), '#description' => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.') ); - $form['general']['site_slogan'] = array( - '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''), + $form['site_slogan'] = array( + '#type' => 'textfield', + '#title' => t('Slogan'), + '#default_value' => variable_get('site_slogan', ''), '#description' => t('The slogan of this website. Some themes display a slogan when available.') ); - $form['general']['site_mission'] = array( - '#type' => 'textarea', '#title' => t('Mission'), '#default_value' => variable_get('site_mission', ''), + $form['site_mission'] = array( + '#type' => 'textarea', + '#title' => t('Mission'), + '#default_value' => variable_get('site_mission', ''), '#description' => t('Your site\'s mission statement or focus.') ); - $form['general']['site_footer'] = array( - '#type' => 'textarea', '#title' => t('Footer message'), '#default_value' => variable_get('site_footer', ''), + $form['site_footer'] = array( + '#type' => 'textarea', + '#title' => t('Footer message'), + '#default_value' => variable_get('site_footer', ''), '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.') ); - $form['general']['anonymous'] = array( - '#type' => 'textfield', '#title' => t('Anonymous user'), '#default_value' => variable_get('anonymous', 'Anonymous'), + $form['anonymous'] = array( + '#type' => 'textfield', + '#title' => t('Anonymous user'), + '#default_value' => variable_get('anonymous', 'Anonymous'), '#description' => t('The name used to indicate anonymous users.') ); - $form['general']['site_frontpage'] = array( - '#type' => 'textfield', '#title' => t('Default front page'), '#default_value' => variable_get('site_frontpage', 'node'), + $form['site_frontpage'] = array( + '#type' => 'textfield', + '#title' => t('Default front page'), + '#default_value' => variable_get('site_frontpage', 'node'), '#description' => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".') ); + return system_settings_form('system_site_information_settings', $form); +} + +function system_clean_url_settings() { // We check for clean URL support using an image on the client side. - $form['general']['clean_url'] = array( + $form['clean_url'] = array( '#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), @@ -292,29 +348,35 @@ function system_view_general() { if (!variable_get('clean_url', 0)) { if (strpos(request_uri(), '?q=') !== FALSE) { - $form['general']['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="%handbook">handbook page on Clean URLs</a> has additional troubleshooting information. %run-test', array('%handbook' => 'http://drupal.org/node/15365', '%run-test' => '<a href ="'. base_path() . 'admin/settings">'. t('Run the clean URL test') .'</a>')); - $form['general']['clean_url']['#attributes'] = array('disabled' => 'disabled'); + $form['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="%handbook">handbook page on Clean URLs</a> has additional troubleshooting information. %run-test', array('%handbook' => 'http://drupal.org/node/15365', '%run-test' => '<a href ="'. base_path() . 'admin/settings">'. t('Run the clean URL test') .'</a>')); + $form['clean_url']['#attributes'] = array('disabled' => 'disabled'); } else { - $form['general']['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You are welcome to enable/disable them as you wish.'); - $form['general']['#collapsed'] = FALSE; + $form['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You are welcome to enable/disable them as you wish.'); + $form['#collapsed'] = FALSE; } } - // Error handling: + return system_settings_form('system_clean_url_settings', $form); +} + +function system_error_reporting_settings() { - $form['errors'] = array( '#type' => 'fieldset', '#title' =>t('Error handling'), '#collapsible' => TRUE, '#collapsed' => TRUE ); - $form['errors']['site_403'] = array( - '#type' => 'textfield', '#title' => t('Default 403 (access denied) page'), '#default_value' => variable_get('site_403', ''), + $form['site_403'] = array( + '#type' => 'textfield', + '#title' => t('Default 403 (access denied) page'), + '#default_value' => variable_get('site_403', ''), '#description' => t('This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.') ); - $form['errors']['site_404'] = array( - '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), '#default_value' => variable_get('site_404', ''), + $form['site_404'] = array( + '#type' => 'textfield', + '#title' => t('Default 404 (not found) page'), + '#default_value' => variable_get('site_404', ''), '#description' => t('This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.') ); - $form['errors']['error_level'] = array( + $form['error_level'] = array( '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1), '#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')), '#description' => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.') @@ -322,33 +384,43 @@ function system_view_general() { $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval'); $period['1000000000'] = t('Never'); - $form['errors']['watchdog_clear'] = array( - '#type' => 'select', '#title' => t('Discard log entries older than'), '#default_value' => variable_get('watchdog_clear', 604800), '#options' => $period, + $form['watchdog_clear'] = array( + '#type' => 'select', + '#title' => t('Discard log entries older than'), + '#default_value' => variable_get('watchdog_clear', 604800), + '#options' => $period, '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.') ); + return system_settings_form('system_error_reporting_settings', $form); +} - // Caching: - $form['cache'] = array('#type' => 'fieldset', '#title' => t('Cache settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); +function system_page_caching_settings() { - $form['cache']['cache'] = array( - '#type' => 'radios', '#title' => t('Page cache'), '#default_value' => variable_get('cache', CACHE_DISABLED), + $form['cache'] = array( + '#type' => 'radios', + '#title' => t('Page cache'), + '#default_value' => variable_get('cache', CACHE_DISABLED), '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')), '#description' => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.") ); $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval'); $period[0] = t('none'); - $form['cache']['cache_lifetime'] = array( - '#type' => 'select', '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('cache_lifetime', 0), '#options' => $period, + $form['cache_lifetime'] = array( + '#type' => 'select', + '#title' => t('Minimum cache lifetime'), + '#default_value' => variable_get('cache_lifetime', 0), + '#options' => $period, '#description' => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.') ); + return system_settings_form('system_page_caching_settings', $form); +} - // File system: - $form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); +function system_file_system_settings() { - $form['files']['file_directory_path'] = array( + $form['file_directory_path'] = array( '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => file_directory_path(), @@ -357,7 +429,7 @@ function system_view_general() { '#after_build' => array('system_check_directory'), ); - $form['files']['file_directory_temp'] = array( + $form['file_directory_temp'] = array( '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => file_directory_temp(), @@ -366,35 +438,55 @@ function system_view_general() { '#after_build' => array('system_check_directory'), ); - $form['files']['file_downloads'] = array( - '#type' => 'radios', '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), + $form['file_downloads'] = array( + '#type' => 'radios', + '#title' => t('Download method'), + '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), '#description' => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.') ); - // Image handling: + return system_settings_form('system_file_system_settings', $form); +} + +function system_image_toolkit_settings() { $toolkits_available = image_get_available_toolkits(); if (count($toolkits_available) > 1) { - $form['image'] = array('#type' => 'fieldset', '#title' => t('Image handling'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['image']['image_toolkit'] = array( - '#type' => 'radios', '#title' => t('Select an image processing toolkit'), - '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available + $form['image_toolkit'] = array( + '#type' => 'radios', + '#title' => t('Select an image processing toolkit'), + '#default_value' => variable_get('image_toolkit', image_get_toolkit()), + '#options' => $toolkits_available ); + + return system_settings_form('system_image_toolkit_settings', $form); + } + else { + return '<p>'. t("No image toolkits found. Drupal will use PHP's built-in GD library for image handling.") .'</p>'; } +} - // Feed settings - $form['feed'] = array('#type' => 'fieldset', '#title' => t('RSS feed settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['feed']['feed_default_items'] = array( - '#type' => 'select', '#title' => t('Number of items per feed'), '#default_value' => variable_get('feed_default_items', 10), +function system_rss_feeds_settings() { + + $form['feed_default_items'] = array( + '#type' => 'select', + '#title' => t('Number of items per feed'), + '#default_value' => variable_get('feed_default_items', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('The default number of items to include in a feed.') ); - $form['feed']['feed_item_length'] = array( - '#type' => 'select', '#title' => t('Display of XML feed items'), '#default_value' => variable_get('feed_item_length','teaser'), + $form['feed_item_length'] = array( + '#type' => 'select', + '#title' => t('Display of XML feed items'), + '#default_value' => variable_get('feed_item_length','teaser'), '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')), '#description' => t('Global setting for the length of XML feed items that are output by default.') ); + return system_settings_form('system_rss_feeds_settings', $form); +} + +function system_date_time_settings() { // Date settings: $zones = _system_zonelist(); @@ -421,47 +513,60 @@ function system_view_general() { $datelongchoices[$f] = format_date(time(), 'custom', $f); } - $form['dates'] = array('#type' => 'fieldset', '#title' => t('Date settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['dates']['date_default_timezone'] = array( - '#type' => 'select', '#title' => t('Default time zone'), '#default_value' => variable_get('date_default_timezone', 0), - '#options' => $zones, '#description' => t('Select the default site time zone.') + $form['date_default_timezone'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => variable_get('date_default_timezone', 0), + '#options' => $zones, + '#description' => t('Select the default site time zone.') ); - $form['dates']['configurable_timezones'] = array( - '#type' => 'radios', '#title' => t('Configurable time zones'), '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')), + $form['configurable_timezones'] = array( + '#type' => 'radios', + '#title' => t('Configurable time zones'), + '#default_value' => variable_get('configurable_timezones', 1), + '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.') ); - $form['dates']['date_format_short'] = array( - '#type' => 'select', '#title' => t('Short date format'), '#default_value' => variable_get('date_format_short', $dateshort[0]), - '#options' => $dateshortchoices, '#description' => t('The short format of date display.') + $form['date_format_short'] = array( + '#type' => 'select', + '#title' => t('Short date format'), + '#default_value' => variable_get('date_format_short', $dateshort[0]), + '#options' => $dateshortchoices, + '#description' => t('The short format of date display.') ); - $form['dates']['date_format_medium'] = array( - '#type' => 'select', '#title' => t('Medium date format'), '#default_value' => variable_get('date_format_medium', $datemedium[0]), - '#options' => $datemediumchoices, '#description' => t('The medium sized date display.') + $form['date_format_medium'] = array( + '#type' => 'select', + '#title' => t('Medium date format'), + '#default_value' => variable_get('date_format_medium', $datemedium[0]), + '#options' => $datemediumchoices, + '#description' => t('The medium sized date display.') ); - $form['dates']['date_format_long'] = array( - '#type' => 'select', '#title' => t('Long date format'), '#default_value' => variable_get('date_format_long', $datelong[0]), - '#options' => $datelongchoices, '#description' => t('Longer date format used for detailed display.') + $form['date_format_long'] = array( + '#type' => 'select', + '#title' => t('Long date format'), + '#default_value' => variable_get('date_format_long', $datelong[0]), + '#options' => $datelongchoices, + '#description' => t('Longer date format used for detailed display.') ); - $form['dates']['date_first_day'] = array( - '#type' => 'select', '#title' => t('First day of week'), '#default_value' => variable_get('date_first_day', 0), + $form['date_first_day'] = array( + '#type' => 'select', + '#title' => t('First day of week'), + '#default_value' => variable_get('date_first_day', 0), '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), '#description' => t('The first day of the week for calendar views.') ); + return system_settings_form('system_date_time_settings', $form); +} - // Site off-line/maintenance settings - $form['site_status'] = array( - '#type' => 'fieldset', - '#title' => t('Site maintenance'), - '#collapsible' => TRUE, - '#collapsed' => TRUE); +function system_site_status_settings() { - $form['site_status']['site_offline'] = array( + $form['site_offline'] = array( '#type' => 'radios', '#title' => t('Site status'), '#default_value' => variable_get('site_offline', 0), @@ -469,31 +574,36 @@ function system_view_general() { '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="%user-login">user login</a> page.', array('%user-login' => url('user'))), ); - $form['site_status']['site_offline_message'] = array( + $form['site_offline_message'] = array( '#type' => 'textarea', '#title' => t('Site off-line message'), '#default_value' => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This Drupal site'))))), '#description' => t('Message to show visitors when the site is in off-line mode.') ); - // String handling: report status and errors. - $form['strings'] = array('#type' => 'fieldset', '#title' => t('String handling'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['strings'] = array_merge($form['strings'], unicode_settings()); + return system_settings_form('system_site_status_settings', $form); +} + +function system_unicode_settings() { + return system_settings_form('system_unicode_settings', unicode_settings()); +} - // Cron: report status and errors. - $form['cron'] = array('#type' => 'fieldset', '#title' => t('Cron jobs'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['cron'] = array_merge($form['cron'], system_cron_settings()); +function system_cron_status() { + $cron_last = variable_get('cron_last', NULL); - // Check database setup if necessary - if (function_exists('db_check_setup') && empty($_POST)) { - db_check_setup(); + if (is_numeric($cron_last)) { + $status = t('Cron is running. The last cron job ran %time ago.', array('%time' => format_interval(time() - $cron_last))); + } + else { + $status = t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="%url">configuring cron jobs</a>.', array('%url' => 'http://drupal.org/cron')); } - return $form; + + return $status; } /** * Checks the existence of the directory specified in $form_element. This - * function is called from the system_view_general form to check both the + * function is called from the system_settings form to check both the * file_directory_path and file_directory_temp directories. If validation * fails, the form element is flagged with an error from within the * file_check_directory function. @@ -507,23 +617,6 @@ function system_check_directory($form_element) { } /** - * Return the cron status and errors for admin/settings. - */ -function system_cron_settings() { - $cron_last = variable_get('cron_last', NULL); - - if (is_numeric($cron_last)) { - $status = t('Cron is running. The last cron job ran %time ago.', array('%time' => format_interval(time() - $cron_last))); - } - else { - $status = t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="%url">configuring cron jobs</a>.', array('%url' => 'http://drupal.org/cron')); - } - - $form['settings'] = array('#type' => 'item', '#value' => $status); - return $form; -} - -/** * Retrieves the current status of an array of files in the system table. */ function system_get_files_database(&$files, $type) { @@ -1029,17 +1122,27 @@ function system_modules_submit($form_id, $edit) { /** * Menu callback; displays a module's settings page. */ -function system_site_settings($module = NULL) { +function system_settings_overview() { - if ($module) { - $form = module_invoke($module, 'settings'); - } - else { - $form = system_view_general(); - $module = 'system'; - } + // Check database setup if necessary + if (function_exists('db_check_setup') && empty($_POST)) { + db_check_setup(); + } + + $output = '<ul>'; + $menu = menu_get_item(NULL, 'admin/settings'); + usort($menu['children'], '_menu_sort'); + foreach ($menu['children'] as $mid) { + $output .= ' <li>'. menu_item_link($mid) .'</li>'; + } + $output .= '</ul>'; + + // TODO: remove this: + foreach (module_implements('settings') as $module) { + drupal_set_message("$module settings inaccessible: module needs updating because the _settings hook has been deprecated."); + } - return system_settings_form($module . '_settings_form', $form); + return $output; } /** diff --git a/modules/system/system.module b/modules/system/system.module index b306b7e82..05a843bba 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -23,17 +23,15 @@ function system_help($section) { <ul> <li>activate your cron job on the cron page <a href="%file-cron">cron.php</a>.</li> <li>read how to <a href="%external-http-drupal-org-cron">configure cron jobs</a>.</li> -<li>administer cache settings in <a href="%admin-settings">administer >> settings</a>.</li> +<li>administer cache settings in <a href="%admin-settings">administer >> settings >> caching</a>.</li> </ul> -', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%admin-settings' => url('admin/settings'))); +', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%admin-settings' => url('admin/settings/caching'))); $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%system">System page</a>.', array('%system' => 'http://drupal.org/handbook/modules/system/')) .'</p>'; return $output; case 'admin/modules#description': return t('Handles general site configuration for administrators.'); case 'admin': return t('<p>Welcome to the administration section. Below are the most recent system events.</p>'); - case 'admin/settings': - return t('<p>General configuration options for your site. Set up the name of the site, e-mail address used in mail-outs, clean URL options, caching, etc.</p>'); case 'admin/themes': return t('<p>Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternately, to override these settings in a specific theme, click the "configure" link for the corresponding theme. Note that different themes may have different regions available for rendering content like blocks. If you want consistency in what your users see, you may wish to enable only one theme.</p>'); case 'admin/themes/settings': @@ -132,15 +130,59 @@ function system_menu($may_cache) { } // Modules: - $items[] = array('path' => 'admin/settings', 'title' => t('settings'), - 'callback' => 'system_site_settings', 'access' => $access); - foreach (module_list() as $name) { - if (module_hook($name, 'settings')) { - $items[] = array('path' => 'admin/settings/'. $name, 'title' => t($name)); - } - } $items[] = array('path' => 'admin/modules', 'title' => t('modules'), 'callback' => 'system_modules', 'access' => $access); + + // Settings: + $items[] = array( + 'path' => 'admin/settings', + 'title' => t('settings'), + 'callback' => 'system_settings_overview', + 'access' => $access); + $items[] = array( + 'path' => 'admin/settings/site-information', + 'title' => t('site information'), + 'callback' => 'system_site_information_settings'); + $items[] = array( + 'path' => 'admin/settings/error-reporting', + 'title' => t('error reporting'), + 'callback' => 'system_error_reporting_settings'); + $items[] = array( + 'path' => 'admin/settings/page-caching', + 'title' => t('page caching'), + 'callback' => 'system_page_caching_settings'); + $items[] = array( + 'path' => 'admin/settings/file-system', + 'title' => t('file system'), + 'callback' => 'system_file_system_settings'); + $items[] = array( + 'path' => 'admin/settings/image-toolkit', + 'title' => t('image toolkit'), + 'callback' => 'system_image_toolkit_settings'); + $items[] = array( + 'path' => 'admin/settings/rss-feed', + 'title' => t('RSS feeds'), + 'callback' => 'system_rss_feeds_settings'); + $items[] = array( + 'path' => 'admin/settings/date-time', + 'title' => t('date and time'), + 'callback' => 'system_date_time_settings'); + $items[] = array( + 'path' => 'admin/settings/site-status', + 'title' => t('site status'), + 'callback' => 'system_site_status_settings'); + $items[] = array( + 'path' => 'admin/settings/unicode', + 'title' => t('unicode'), + 'callback' => 'system_unicode_settings'); + $items[] = array( + 'path' => 'admin/settings/cron-status', + 'title' => t('cron status'), + 'callback' => 'system_cron_status'); + $items[] = array( + 'path' => 'admin/settings/clean-urls', + 'title' => t('clean URLs'), + 'callback' => 'system_clean_url_settings'); } return $items; @@ -245,44 +287,58 @@ function _system_zonelist() { return $zones; } -function system_view_general() { - // General settings: - $form['general'] = array( - '#type' => 'fieldset', '#title' => t('General settings'), - '#collapsible' => TRUE, '#collapsed' => TRUE - ); - $form['general']['site_name'] = array( - '#type' => 'textfield', '#title' => t('Name'), '#default_value' => variable_get('site_name', 'drupal'), - '#description' => t('The name of this web site.'), '#required' => TRUE +function system_site_information_settings() { + $form['site_name'] = array( + '#type' => 'textfield', + '#title' => t('Name'), + '#default_value' => variable_get('site_name', 'drupal'), + '#description' => t('The name of this web site.'), + '#required' => TRUE ); - $form['general']['site_mail'] = array( - '#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), + $form['site_mail'] = array( + '#type' => 'textfield', + '#title' => t('E-mail address'), + '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), '#description' => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.') ); - $form['general']['site_slogan'] = array( - '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''), + $form['site_slogan'] = array( + '#type' => 'textfield', + '#title' => t('Slogan'), + '#default_value' => variable_get('site_slogan', ''), '#description' => t('The slogan of this website. Some themes display a slogan when available.') ); - $form['general']['site_mission'] = array( - '#type' => 'textarea', '#title' => t('Mission'), '#default_value' => variable_get('site_mission', ''), + $form['site_mission'] = array( + '#type' => 'textarea', + '#title' => t('Mission'), + '#default_value' => variable_get('site_mission', ''), '#description' => t('Your site\'s mission statement or focus.') ); - $form['general']['site_footer'] = array( - '#type' => 'textarea', '#title' => t('Footer message'), '#default_value' => variable_get('site_footer', ''), + $form['site_footer'] = array( + '#type' => 'textarea', + '#title' => t('Footer message'), + '#default_value' => variable_get('site_footer', ''), '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.') ); - $form['general']['anonymous'] = array( - '#type' => 'textfield', '#title' => t('Anonymous user'), '#default_value' => variable_get('anonymous', 'Anonymous'), + $form['anonymous'] = array( + '#type' => 'textfield', + '#title' => t('Anonymous user'), + '#default_value' => variable_get('anonymous', 'Anonymous'), '#description' => t('The name used to indicate anonymous users.') ); - $form['general']['site_frontpage'] = array( - '#type' => 'textfield', '#title' => t('Default front page'), '#default_value' => variable_get('site_frontpage', 'node'), + $form['site_frontpage'] = array( + '#type' => 'textfield', + '#title' => t('Default front page'), + '#default_value' => variable_get('site_frontpage', 'node'), '#description' => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".') ); + return system_settings_form('system_site_information_settings', $form); +} + +function system_clean_url_settings() { // We check for clean URL support using an image on the client side. - $form['general']['clean_url'] = array( + $form['clean_url'] = array( '#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), @@ -292,29 +348,35 @@ function system_view_general() { if (!variable_get('clean_url', 0)) { if (strpos(request_uri(), '?q=') !== FALSE) { - $form['general']['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="%handbook">handbook page on Clean URLs</a> has additional troubleshooting information. %run-test', array('%handbook' => 'http://drupal.org/node/15365', '%run-test' => '<a href ="'. base_path() . 'admin/settings">'. t('Run the clean URL test') .'</a>')); - $form['general']['clean_url']['#attributes'] = array('disabled' => 'disabled'); + $form['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="%handbook">handbook page on Clean URLs</a> has additional troubleshooting information. %run-test', array('%handbook' => 'http://drupal.org/node/15365', '%run-test' => '<a href ="'. base_path() . 'admin/settings">'. t('Run the clean URL test') .'</a>')); + $form['clean_url']['#attributes'] = array('disabled' => 'disabled'); } else { - $form['general']['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You are welcome to enable/disable them as you wish.'); - $form['general']['#collapsed'] = FALSE; + $form['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You are welcome to enable/disable them as you wish.'); + $form['#collapsed'] = FALSE; } } - // Error handling: + return system_settings_form('system_clean_url_settings', $form); +} + +function system_error_reporting_settings() { - $form['errors'] = array( '#type' => 'fieldset', '#title' =>t('Error handling'), '#collapsible' => TRUE, '#collapsed' => TRUE ); - $form['errors']['site_403'] = array( - '#type' => 'textfield', '#title' => t('Default 403 (access denied) page'), '#default_value' => variable_get('site_403', ''), + $form['site_403'] = array( + '#type' => 'textfield', + '#title' => t('Default 403 (access denied) page'), + '#default_value' => variable_get('site_403', ''), '#description' => t('This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.') ); - $form['errors']['site_404'] = array( - '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), '#default_value' => variable_get('site_404', ''), + $form['site_404'] = array( + '#type' => 'textfield', + '#title' => t('Default 404 (not found) page'), + '#default_value' => variable_get('site_404', ''), '#description' => t('This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.') ); - $form['errors']['error_level'] = array( + $form['error_level'] = array( '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1), '#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')), '#description' => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.') @@ -322,33 +384,43 @@ function system_view_general() { $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval'); $period['1000000000'] = t('Never'); - $form['errors']['watchdog_clear'] = array( - '#type' => 'select', '#title' => t('Discard log entries older than'), '#default_value' => variable_get('watchdog_clear', 604800), '#options' => $period, + $form['watchdog_clear'] = array( + '#type' => 'select', + '#title' => t('Discard log entries older than'), + '#default_value' => variable_get('watchdog_clear', 604800), + '#options' => $period, '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.') ); + return system_settings_form('system_error_reporting_settings', $form); +} - // Caching: - $form['cache'] = array('#type' => 'fieldset', '#title' => t('Cache settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); +function system_page_caching_settings() { - $form['cache']['cache'] = array( - '#type' => 'radios', '#title' => t('Page cache'), '#default_value' => variable_get('cache', CACHE_DISABLED), + $form['cache'] = array( + '#type' => 'radios', + '#title' => t('Page cache'), + '#default_value' => variable_get('cache', CACHE_DISABLED), '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')), '#description' => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.") ); $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval'); $period[0] = t('none'); - $form['cache']['cache_lifetime'] = array( - '#type' => 'select', '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('cache_lifetime', 0), '#options' => $period, + $form['cache_lifetime'] = array( + '#type' => 'select', + '#title' => t('Minimum cache lifetime'), + '#default_value' => variable_get('cache_lifetime', 0), + '#options' => $period, '#description' => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.') ); + return system_settings_form('system_page_caching_settings', $form); +} - // File system: - $form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); +function system_file_system_settings() { - $form['files']['file_directory_path'] = array( + $form['file_directory_path'] = array( '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => file_directory_path(), @@ -357,7 +429,7 @@ function system_view_general() { '#after_build' => array('system_check_directory'), ); - $form['files']['file_directory_temp'] = array( + $form['file_directory_temp'] = array( '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => file_directory_temp(), @@ -366,35 +438,55 @@ function system_view_general() { '#after_build' => array('system_check_directory'), ); - $form['files']['file_downloads'] = array( - '#type' => 'radios', '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), + $form['file_downloads'] = array( + '#type' => 'radios', + '#title' => t('Download method'), + '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), '#description' => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.') ); - // Image handling: + return system_settings_form('system_file_system_settings', $form); +} + +function system_image_toolkit_settings() { $toolkits_available = image_get_available_toolkits(); if (count($toolkits_available) > 1) { - $form['image'] = array('#type' => 'fieldset', '#title' => t('Image handling'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['image']['image_toolkit'] = array( - '#type' => 'radios', '#title' => t('Select an image processing toolkit'), - '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available + $form['image_toolkit'] = array( + '#type' => 'radios', + '#title' => t('Select an image processing toolkit'), + '#default_value' => variable_get('image_toolkit', image_get_toolkit()), + '#options' => $toolkits_available ); + + return system_settings_form('system_image_toolkit_settings', $form); + } + else { + return '<p>'. t("No image toolkits found. Drupal will use PHP's built-in GD library for image handling.") .'</p>'; } +} - // Feed settings - $form['feed'] = array('#type' => 'fieldset', '#title' => t('RSS feed settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['feed']['feed_default_items'] = array( - '#type' => 'select', '#title' => t('Number of items per feed'), '#default_value' => variable_get('feed_default_items', 10), +function system_rss_feeds_settings() { + + $form['feed_default_items'] = array( + '#type' => 'select', + '#title' => t('Number of items per feed'), + '#default_value' => variable_get('feed_default_items', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('The default number of items to include in a feed.') ); - $form['feed']['feed_item_length'] = array( - '#type' => 'select', '#title' => t('Display of XML feed items'), '#default_value' => variable_get('feed_item_length','teaser'), + $form['feed_item_length'] = array( + '#type' => 'select', + '#title' => t('Display of XML feed items'), + '#default_value' => variable_get('feed_item_length','teaser'), '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')), '#description' => t('Global setting for the length of XML feed items that are output by default.') ); + return system_settings_form('system_rss_feeds_settings', $form); +} + +function system_date_time_settings() { // Date settings: $zones = _system_zonelist(); @@ -421,47 +513,60 @@ function system_view_general() { $datelongchoices[$f] = format_date(time(), 'custom', $f); } - $form['dates'] = array('#type' => 'fieldset', '#title' => t('Date settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['dates']['date_default_timezone'] = array( - '#type' => 'select', '#title' => t('Default time zone'), '#default_value' => variable_get('date_default_timezone', 0), - '#options' => $zones, '#description' => t('Select the default site time zone.') + $form['date_default_timezone'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => variable_get('date_default_timezone', 0), + '#options' => $zones, + '#description' => t('Select the default site time zone.') ); - $form['dates']['configurable_timezones'] = array( - '#type' => 'radios', '#title' => t('Configurable time zones'), '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')), + $form['configurable_timezones'] = array( + '#type' => 'radios', + '#title' => t('Configurable time zones'), + '#default_value' => variable_get('configurable_timezones', 1), + '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.') ); - $form['dates']['date_format_short'] = array( - '#type' => 'select', '#title' => t('Short date format'), '#default_value' => variable_get('date_format_short', $dateshort[0]), - '#options' => $dateshortchoices, '#description' => t('The short format of date display.') + $form['date_format_short'] = array( + '#type' => 'select', + '#title' => t('Short date format'), + '#default_value' => variable_get('date_format_short', $dateshort[0]), + '#options' => $dateshortchoices, + '#description' => t('The short format of date display.') ); - $form['dates']['date_format_medium'] = array( - '#type' => 'select', '#title' => t('Medium date format'), '#default_value' => variable_get('date_format_medium', $datemedium[0]), - '#options' => $datemediumchoices, '#description' => t('The medium sized date display.') + $form['date_format_medium'] = array( + '#type' => 'select', + '#title' => t('Medium date format'), + '#default_value' => variable_get('date_format_medium', $datemedium[0]), + '#options' => $datemediumchoices, + '#description' => t('The medium sized date display.') ); - $form['dates']['date_format_long'] = array( - '#type' => 'select', '#title' => t('Long date format'), '#default_value' => variable_get('date_format_long', $datelong[0]), - '#options' => $datelongchoices, '#description' => t('Longer date format used for detailed display.') + $form['date_format_long'] = array( + '#type' => 'select', + '#title' => t('Long date format'), + '#default_value' => variable_get('date_format_long', $datelong[0]), + '#options' => $datelongchoices, + '#description' => t('Longer date format used for detailed display.') ); - $form['dates']['date_first_day'] = array( - '#type' => 'select', '#title' => t('First day of week'), '#default_value' => variable_get('date_first_day', 0), + $form['date_first_day'] = array( + '#type' => 'select', + '#title' => t('First day of week'), + '#default_value' => variable_get('date_first_day', 0), '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), '#description' => t('The first day of the week for calendar views.') ); + return system_settings_form('system_date_time_settings', $form); +} - // Site off-line/maintenance settings - $form['site_status'] = array( - '#type' => 'fieldset', - '#title' => t('Site maintenance'), - '#collapsible' => TRUE, - '#collapsed' => TRUE); +function system_site_status_settings() { - $form['site_status']['site_offline'] = array( + $form['site_offline'] = array( '#type' => 'radios', '#title' => t('Site status'), '#default_value' => variable_get('site_offline', 0), @@ -469,31 +574,36 @@ function system_view_general() { '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="%user-login">user login</a> page.', array('%user-login' => url('user'))), ); - $form['site_status']['site_offline_message'] = array( + $form['site_offline_message'] = array( '#type' => 'textarea', '#title' => t('Site off-line message'), '#default_value' => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This Drupal site'))))), '#description' => t('Message to show visitors when the site is in off-line mode.') ); - // String handling: report status and errors. - $form['strings'] = array('#type' => 'fieldset', '#title' => t('String handling'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['strings'] = array_merge($form['strings'], unicode_settings()); + return system_settings_form('system_site_status_settings', $form); +} + +function system_unicode_settings() { + return system_settings_form('system_unicode_settings', unicode_settings()); +} - // Cron: report status and errors. - $form['cron'] = array('#type' => 'fieldset', '#title' => t('Cron jobs'), '#collapsible' => TRUE, '#collapsed' => TRUE); - $form['cron'] = array_merge($form['cron'], system_cron_settings()); +function system_cron_status() { + $cron_last = variable_get('cron_last', NULL); - // Check database setup if necessary - if (function_exists('db_check_setup') && empty($_POST)) { - db_check_setup(); + if (is_numeric($cron_last)) { + $status = t('Cron is running. The last cron job ran %time ago.', array('%time' => format_interval(time() - $cron_last))); + } + else { + $status = t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="%url">configuring cron jobs</a>.', array('%url' => 'http://drupal.org/cron')); } - return $form; + + return $status; } /** * Checks the existence of the directory specified in $form_element. This - * function is called from the system_view_general form to check both the + * function is called from the system_settings form to check both the * file_directory_path and file_directory_temp directories. If validation * fails, the form element is flagged with an error from within the * file_check_directory function. @@ -507,23 +617,6 @@ function system_check_directory($form_element) { } /** - * Return the cron status and errors for admin/settings. - */ -function system_cron_settings() { - $cron_last = variable_get('cron_last', NULL); - - if (is_numeric($cron_last)) { - $status = t('Cron is running. The last cron job ran %time ago.', array('%time' => format_interval(time() - $cron_last))); - } - else { - $status = t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="%url">configuring cron jobs</a>.', array('%url' => 'http://drupal.org/cron')); - } - - $form['settings'] = array('#type' => 'item', '#value' => $status); - return $form; -} - -/** * Retrieves the current status of an array of files in the system table. */ function system_get_files_database(&$files, $type) { @@ -1029,17 +1122,27 @@ function system_modules_submit($form_id, $edit) { /** * Menu callback; displays a module's settings page. */ -function system_site_settings($module = NULL) { +function system_settings_overview() { - if ($module) { - $form = module_invoke($module, 'settings'); - } - else { - $form = system_view_general(); - $module = 'system'; - } + // Check database setup if necessary + if (function_exists('db_check_setup') && empty($_POST)) { + db_check_setup(); + } + + $output = '<ul>'; + $menu = menu_get_item(NULL, 'admin/settings'); + usort($menu['children'], '_menu_sort'); + foreach ($menu['children'] as $mid) { + $output .= ' <li>'. menu_item_link($mid) .'</li>'; + } + $output .= '</ul>'; + + // TODO: remove this: + foreach (module_implements('settings') as $module) { + drupal_set_message("$module settings inaccessible: module needs updating because the _settings hook has been deprecated."); + } - return system_settings_form($module . '_settings_form', $form); + return $output; } /** diff --git a/modules/throttle.module b/modules/throttle.module index bd64b19ef..56f147e26 100644 --- a/modules/throttle.module +++ b/modules/throttle.module @@ -6,6 +6,22 @@ * Allows configuration of congestion control auto-throttle mechanism. */ +function throttle_menu($may_cache) { + $items = array(); + + if ($may_cache) { + $items[] = array( + 'path' => 'admin/settings/throttle', + 'title' => t('throttle'), + 'callback' => 'throttle_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM + ); + } + + return $items; +} + /** * Determine the current load on the site. * @@ -122,10 +138,7 @@ function throttle_help($section) { } } -/** - * Implementation of hook_settings(). - */ -function throttle_settings() { +function throttle_admin_settings() { _throttle_validate(variable_get('throttle_anonymous', ''), 'throttle_anonymous'); _throttle_validate(variable_get('throttle_user', ''), 'throttle_user'); $probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%'); @@ -154,5 +167,5 @@ function throttle_settings() { '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.') ); - return $form; + return system_settings_form('throttle_admin_settings', $form); } diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module index bd64b19ef..56f147e26 100644 --- a/modules/throttle/throttle.module +++ b/modules/throttle/throttle.module @@ -6,6 +6,22 @@ * Allows configuration of congestion control auto-throttle mechanism. */ +function throttle_menu($may_cache) { + $items = array(); + + if ($may_cache) { + $items[] = array( + 'path' => 'admin/settings/throttle', + 'title' => t('throttle'), + 'callback' => 'throttle_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM + ); + } + + return $items; +} + /** * Determine the current load on the site. * @@ -122,10 +138,7 @@ function throttle_help($section) { } } -/** - * Implementation of hook_settings(). - */ -function throttle_settings() { +function throttle_admin_settings() { _throttle_validate(variable_get('throttle_anonymous', ''), 'throttle_anonymous'); _throttle_validate(variable_get('throttle_user', ''), 'throttle_user'); $probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%'); @@ -154,5 +167,5 @@ function throttle_settings() { '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.') ); - return $form; + return system_settings_form('throttle_admin_settings', $form); } diff --git a/modules/upload.module b/modules/upload.module index fa1c6482e..c05562953 100644 --- a/modules/upload.module +++ b/modules/upload.module @@ -78,6 +78,11 @@ function upload_menu($may_cache) { 'access' => user_access('upload files'), 'type' => MENU_CALLBACK ); + $items[] = array('path' => 'admin/settings/uploads', + 'title' => t('file uploads'), + 'callback' => 'upload_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM); } else { // Add handlers for previewing new uploads. @@ -106,7 +111,7 @@ function upload_menu($may_cache) { return $items; } -function upload_settings() { +function upload_admin_settings() { $upload_extensions_default = variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps'); $upload_uploadsize_default = variable_get('upload_uploadsize_default', 1); $upload_usersize_default = variable_get('upload_usersize_default', 10); @@ -190,7 +195,7 @@ function upload_settings() { ); } - return $form; + return system_settings_form('upload_admin_settings', $form); } function upload_download() { diff --git a/modules/upload/upload.module b/modules/upload/upload.module index fa1c6482e..c05562953 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -78,6 +78,11 @@ function upload_menu($may_cache) { 'access' => user_access('upload files'), 'type' => MENU_CALLBACK ); + $items[] = array('path' => 'admin/settings/uploads', + 'title' => t('file uploads'), + 'callback' => 'upload_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM); } else { // Add handlers for previewing new uploads. @@ -106,7 +111,7 @@ function upload_menu($may_cache) { return $items; } -function upload_settings() { +function upload_admin_settings() { $upload_extensions_default = variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps'); $upload_uploadsize_default = variable_get('upload_uploadsize_default', 1); $upload_usersize_default = variable_get('upload_usersize_default', 10); @@ -190,7 +195,7 @@ function upload_settings() { ); } - return $form; + return system_settings_form('upload_admin_settings', $form); } function upload_download() { diff --git a/modules/user.module b/modules/user.module index 835102749..d1b2ab8db 100644 --- a/modules/user.module +++ b/modules/user.module @@ -696,7 +696,7 @@ function user_menu($may_cache) { 'callback' => 'user_admin', 'access' => $admin_access, 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'admin/settings/user', 'title' => t('users'), - 'callback' => 'user_configure'); + 'callback' => 'user_admin_settings'); // Admin access pages $items[] = array('path' => 'admin/access', 'title' => t('access control'), @@ -1218,7 +1218,7 @@ function user_register_submit($form_id, $form_values) { // The first user may login immediately, and receives a customized welcome e-mail. if ($account->uid == 1) { drupal_mail('user-register-admin', $mail, t('Drupal user account details for %s', array('%s' => $name)), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), $from); - drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings')))); + drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">site information settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings/site-information')))); user_authenticate($account->name, trim($pass)); // Set the installed schema version of the system module to the most recent version. @@ -1481,9 +1481,6 @@ function _user_mail_text($messageid, $variables = array()) { } } -function user_configure_settings() { -} - /** * Menu callback: check an access rule */ @@ -1918,7 +1915,7 @@ function user_admin_account() { return $output; } -function user_configure() { +function user_admin_settings() { // User registration settings. $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings')); $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.'))); @@ -1949,7 +1946,7 @@ function user_configure() { $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.')); $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#description' => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.')); - return system_settings_form('user_configure_settings', $form); + return system_settings_form('user_admin_settings', $form); } function user_admin() { @@ -2015,9 +2012,6 @@ function user_help($section) { </ul>', array('%permissions' => url('admin/access/permissions'))); case 'admin/user/search': return t('<p>Enter a simple pattern ("*" may be used as a wildcard match) to search for a username. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".</p>'); - case 'admin/user/configure': - case 'admin/user/configure/settings': - return t('<p>In order to use the full power of Drupal a visitor must sign up for an account. This page lets you setup how a user signs up, logs out, the guidelines from the system about user subscriptions, and the e-mails the system will send to the user.</p>'); case 'user/help#user': $site = variable_get('site_name', 'this website'); diff --git a/modules/user/user.module b/modules/user/user.module index 835102749..d1b2ab8db 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -696,7 +696,7 @@ function user_menu($may_cache) { 'callback' => 'user_admin', 'access' => $admin_access, 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'admin/settings/user', 'title' => t('users'), - 'callback' => 'user_configure'); + 'callback' => 'user_admin_settings'); // Admin access pages $items[] = array('path' => 'admin/access', 'title' => t('access control'), @@ -1218,7 +1218,7 @@ function user_register_submit($form_id, $form_values) { // The first user may login immediately, and receives a customized welcome e-mail. if ($account->uid == 1) { drupal_mail('user-register-admin', $mail, t('Drupal user account details for %s', array('%s' => $name)), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), $from); - drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings')))); + drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">site information settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings/site-information')))); user_authenticate($account->name, trim($pass)); // Set the installed schema version of the system module to the most recent version. @@ -1481,9 +1481,6 @@ function _user_mail_text($messageid, $variables = array()) { } } -function user_configure_settings() { -} - /** * Menu callback: check an access rule */ @@ -1918,7 +1915,7 @@ function user_admin_account() { return $output; } -function user_configure() { +function user_admin_settings() { // User registration settings. $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings')); $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.'))); @@ -1949,7 +1946,7 @@ function user_configure() { $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.')); $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#description' => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.')); - return system_settings_form('user_configure_settings', $form); + return system_settings_form('user_admin_settings', $form); } function user_admin() { @@ -2015,9 +2012,6 @@ function user_help($section) { </ul>', array('%permissions' => url('admin/access/permissions'))); case 'admin/user/search': return t('<p>Enter a simple pattern ("*" may be used as a wildcard match) to search for a username. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".</p>'); - case 'admin/user/configure': - case 'admin/user/configure/settings': - return t('<p>In order to use the full power of Drupal a visitor must sign up for an account. This page lets you setup how a user signs up, logs out, the guidelines from the system about user subscriptions, and the e-mails the system will send to the user.</p>'); case 'user/help#user': $site = variable_get('site_name', 'this website'); |