summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-08-10 05:44:17 +0000
committerDries Buytaert <dries@buytaert.net>2004-08-10 05:44:17 +0000
commitf99830a4985f4a69ef6ffe96a9f2aca734b450af (patch)
treece7637e89ee3fd12adab2927949173c0314a9713
parent119f41fb31c5644c403bb58e79e3b6720a8c657c (diff)
downloadbrdo-f99830a4985f4a69ef6ffe96a9f2aca734b450af.tar.gz
brdo-f99830a4985f4a69ef6ffe96a9f2aca734b450af.tar.bz2
- Patch by Al: improved the admin/help pages (first step).
-rw-r--r--includes/menu.inc14
-rw-r--r--includes/theme.inc4
-rw-r--r--misc/drupal.css4
-rw-r--r--modules/help.module54
-rw-r--r--modules/help/help.module54
5 files changed, 94 insertions, 36 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index d1aa3372c..53f1d2085 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -420,10 +420,16 @@ function menu_get_active_help() {
return;
}
- $return = module_invoke_all('help', $path);
- foreach ($return as $item) {
- if (!empty($item)) {
- $output .= $item ."\n";
+ foreach (module_list() as $name) {
+ if (module_hook($name, 'help')) {
+ if ($temp = module_invoke($name, 'help', $path)) {
+ $output .= $temp . "\n";
+ }
+ if (substr($path, 0, 6) == "admin/") {
+ if (module_invoke($name, 'help', 'admin/help#' . substr($path, 6))) {
+ $output .= theme("more_help_link", url('admin/help/' . substr($path, 6)));
+ }
+ }
}
}
return $output;
diff --git a/includes/theme.inc b/includes/theme.inc
index 36181fac0..f74700c5a 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -516,6 +516,10 @@ function theme_error($message) {
return '<div class="error">'. $message .'</div>';
}
+function theme_more_help_link($url) {
+ return '<div class="more-help-link">' . t('[<a href="%link">more help...</a>]', array('%link' => $url)) . '</div><hr />';
+}
+
/**
* Return code that emits an XML icon.
*/
diff --git a/misc/drupal.css b/misc/drupal.css
index f733bd238..4ca9f0c35 100644
--- a/misc/drupal.css
+++ b/misc/drupal.css
@@ -377,6 +377,10 @@ tr.light .form-item, tr.dark .form-item {
.user-login-block {
text-align: center;
}
+.more-help-link {
+ font-size: 0.85em;
+ text-align: right;
+}
tr td.watchdog-user {
background: #ffd;
}
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("
- <h3>Glossary</h3><dl>
+ <p>This guide explains what the various modules in <a href=\"%Drupal\">Drupal</a> do and how to configure them.</p>
+ <p>It is not a substitute for the <a href=\"%handbook\">Drupal handbook</a> 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.</p>
+ <h2>Help topics</h2>
+ <p>Help is available on the following items:</p>
+ %help_pages
+ <h2>Glossary of Drupal Terminology</h2><dl>
<dt>Block</dt><dd>A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.</dd>
<dt>Comment</dt><dd>A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.</dd>
<dt>Moderation</dt><dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.<dl>
@@ -36,11 +49,24 @@ function help_glossary() {
<dt>Unpublished</dt><dd>A node that is only viewable by administrators and moderators.</dd>
<dt>User</dt><dd>A person who has an account at your Drupal site, and is logged in with that account.</dd>
<dt>Visitor</dt><dd>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 <u>not</u> logged in with that account. Also termed \"anonymous user\".</dd>
- </dl>", array('%taxonomy' => url('admin/taxonomy/help')));
+ </dl>", 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 = '<ul>';
+ foreach (module_list() as $name) {
+ if (module_hook($name, 'help')) {
+ if (module_invoke($name, 'help', "admin/help#$name")) {
+ $output .= '<li>' . t("<a href=\"%url\">$name</a>", array('%url' => url("admin/help/$name"))) . '</li>';
+ }
+ }
+ }
+ $output .= '</ul>';
+ 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 .= "<h2><a id=\"$name\">". ucfirst($name) .' module</a></h2>';
- $output .= $temp;
- }
+ $name = arg(2);
+ if (module_hook($name, 'help')) {
+ $temp = module_invoke($name, 'help', "admin/help#$name");
+ if (!empty($temp)) {
+ $output .= $temp;
}
}
- $output = '<small>'. implode(' &middot; ', $links) .'</small><hr />'. $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("
- <h3>Glossary</h3><dl>
+ <p>This guide explains what the various modules in <a href=\"%Drupal\">Drupal</a> do and how to configure them.</p>
+ <p>It is not a substitute for the <a href=\"%handbook\">Drupal handbook</a> 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.</p>
+ <h2>Help topics</h2>
+ <p>Help is available on the following items:</p>
+ %help_pages
+ <h2>Glossary of Drupal Terminology</h2><dl>
<dt>Block</dt><dd>A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.</dd>
<dt>Comment</dt><dd>A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.</dd>
<dt>Moderation</dt><dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.<dl>
@@ -36,11 +49,24 @@ function help_glossary() {
<dt>Unpublished</dt><dd>A node that is only viewable by administrators and moderators.</dd>
<dt>User</dt><dd>A person who has an account at your Drupal site, and is logged in with that account.</dd>
<dt>Visitor</dt><dd>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 <u>not</u> logged in with that account. Also termed \"anonymous user\".</dd>
- </dl>", array('%taxonomy' => url('admin/taxonomy/help')));
+ </dl>", 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 = '<ul>';
+ foreach (module_list() as $name) {
+ if (module_hook($name, 'help')) {
+ if (module_invoke($name, 'help', "admin/help#$name")) {
+ $output .= '<li>' . t("<a href=\"%url\">$name</a>", array('%url' => url("admin/help/$name"))) . '</li>';
+ }
+ }
+ }
+ $output .= '</ul>';
+ 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 .= "<h2><a id=\"$name\">". ucfirst($name) .' module</a></h2>';
- $output .= $temp;
- }
+ $name = arg(2);
+ if (module_hook($name, 'help')) {
+ $temp = module_invoke($name, 'help', "admin/help#$name");
+ if (!empty($temp)) {
+ $output .= $temp;
}
}
- $output = '<small>'. implode(' &middot; ', $links) .'</small><hr />'. $output;
print theme('page', $output);
}