From f99830a4985f4a69ef6ffe96a9f2aca734b450af Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 10 Aug 2004 05:44:17 +0000 Subject: - Patch by Al: improved the admin/help pages (first step). --- modules/help.module | 54 ++++++++++++++++++++++++++++++++++-------------- modules/help/help.module | 54 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 76 insertions(+), 32 deletions(-) (limited to 'modules') diff --git a/modules/help.module b/modules/help.module index f386c177a..200bea791 100644 --- a/modules/help.module +++ b/modules/help.module @@ -6,22 +6,35 @@ */ function help_menu() { $items = array(); - $items[] = array('path' => 'admin/help/glossary', 'title' => t('glossary'), - 'callback' => 'help_glossary', - 'access' => user_access('access administration pages')); $items[] = array('path' => 'admin/help', 'title' => t('help'), - 'callback' => 'help_page', + 'callback' => 'help_main', 'access' => user_access('access administration pages'), 'weight' => 9); + + foreach (module_list() as $name) { + if (module_hook($name, 'help')) { + if (module_invoke($name, 'help', "admin/help#$name")) { + $items[] = array('path' => 'admin/help/' . $name, + 'title' => t($name), + 'callback' => 'help_page', + 'access' => user_access('access administration pages')); + } + } + } return $items; } /** * Menu callback; prints a page listing a glossary of Drupal terminology. */ -function help_glossary() { +function help_main() { $output = t(" -

Glossary

+

This guide explains what the various modules in Drupal do and how to configure them.

+

It is not a substitute for the Drupal handbook available online and should be used in conjunction with it. The online reference handbook might be more up-to-date and has helpful user-contributed comments. It is your definitive reference point for all Drupal documentation.

+

Help topics

+

Help is available on the following items:

+ %help_pages +

Glossary of Drupal Terminology

Block
A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.
Comment
A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.
Moderation
The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.
@@ -36,11 +49,24 @@ function help_glossary() {
Unpublished
A node that is only viewable by administrators and moderators.
User
A person who has an account at your Drupal site, and is logged in with that account.
Visitor
A person who does not have an account at your Drupal site or a person who has an account at your Drupal site but is not logged in with that account. Also termed \"anonymous user\".
-
", array('%taxonomy' => url('admin/taxonomy/help'))); +
", array('%Drupal' => 'http://drupal.org', '%handbook' => 'http://drupal.org/handbook', '%help_pages' => help_links_as_list(), '%taxonomy' => url('admin/taxonomy/help'))); print theme('page', $output); } +function help_links_as_list() { + $output = ''; + return $output; +} + /** * Implementation of hook_help(). */ @@ -55,17 +81,13 @@ function help_help($section) { * Menu callback; prints a page listing general help for all modules. */ function help_page() { - foreach (module_list() as $name) { - if (module_hook($name, 'help')) { - $temp = module_invoke($name, 'help', "admin/help#$name"); - if (!empty($temp)) { - $links[] = l($name, "admin/help#$name"); - $output .= "

". ucfirst($name) .' module

'; - $output .= $temp; - } + $name = arg(2); + if (module_hook($name, 'help')) { + $temp = module_invoke($name, 'help', "admin/help#$name"); + if (!empty($temp)) { + $output .= $temp; } } - $output = ''. implode(' · ', $links) .'
'. $output; print theme('page', $output); } diff --git a/modules/help/help.module b/modules/help/help.module index f386c177a..200bea791 100644 --- a/modules/help/help.module +++ b/modules/help/help.module @@ -6,22 +6,35 @@ */ function help_menu() { $items = array(); - $items[] = array('path' => 'admin/help/glossary', 'title' => t('glossary'), - 'callback' => 'help_glossary', - 'access' => user_access('access administration pages')); $items[] = array('path' => 'admin/help', 'title' => t('help'), - 'callback' => 'help_page', + 'callback' => 'help_main', 'access' => user_access('access administration pages'), 'weight' => 9); + + foreach (module_list() as $name) { + if (module_hook($name, 'help')) { + if (module_invoke($name, 'help', "admin/help#$name")) { + $items[] = array('path' => 'admin/help/' . $name, + 'title' => t($name), + 'callback' => 'help_page', + 'access' => user_access('access administration pages')); + } + } + } return $items; } /** * Menu callback; prints a page listing a glossary of Drupal terminology. */ -function help_glossary() { +function help_main() { $output = t(" -

Glossary

+

This guide explains what the various modules in Drupal do and how to configure them.

+

It is not a substitute for the Drupal handbook available online and should be used in conjunction with it. The online reference handbook might be more up-to-date and has helpful user-contributed comments. It is your definitive reference point for all Drupal documentation.

+

Help topics

+

Help is available on the following items:

+ %help_pages +

Glossary of Drupal Terminology

Block
A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.
Comment
A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.
Moderation
The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.
@@ -36,11 +49,24 @@ function help_glossary() {
Unpublished
A node that is only viewable by administrators and moderators.
User
A person who has an account at your Drupal site, and is logged in with that account.
Visitor
A person who does not have an account at your Drupal site or a person who has an account at your Drupal site but is not logged in with that account. Also termed \"anonymous user\".
-
", array('%taxonomy' => url('admin/taxonomy/help'))); +
", array('%Drupal' => 'http://drupal.org', '%handbook' => 'http://drupal.org/handbook', '%help_pages' => help_links_as_list(), '%taxonomy' => url('admin/taxonomy/help'))); print theme('page', $output); } +function help_links_as_list() { + $output = '
    '; + foreach (module_list() as $name) { + if (module_hook($name, 'help')) { + if (module_invoke($name, 'help', "admin/help#$name")) { + $output .= '
  • ' . t("$name", array('%url' => url("admin/help/$name"))) . '
  • '; + } + } + } + $output .= '
'; + return $output; +} + /** * Implementation of hook_help(). */ @@ -55,17 +81,13 @@ function help_help($section) { * Menu callback; prints a page listing general help for all modules. */ function help_page() { - foreach (module_list() as $name) { - if (module_hook($name, 'help')) { - $temp = module_invoke($name, 'help', "admin/help#$name"); - if (!empty($temp)) { - $links[] = l($name, "admin/help#$name"); - $output .= "

". ucfirst($name) .' module

'; - $output .= $temp; - } + $name = arg(2); + if (module_hook($name, 'help')) { + $temp = module_invoke($name, 'help', "admin/help#$name"); + if (!empty($temp)) { + $output .= $temp; } } - $output = ''. implode(' · ', $links) .'
'. $output; print theme('page', $output); } -- cgit v1.2.3