? .DS_Store ? drupal7-feature_help-system.patch ? help_soc.tmproj ? misc/.DS_Store ? modules/.DS_Store ? modules/help/.DS_Store ? modules/help/help ? modules/help/old.inc ? sites/.DS_Store ? sites/default/.DS_Store ? sites/default/files ? sites/default/settings.php Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.788 diff -u -p -r1.788 common.inc --- includes/common.inc 21 Aug 2008 19:36:36 -0000 1.788 +++ includes/common.inc 23 Aug 2008 14:40:44 -0000 @@ -2924,7 +2924,7 @@ function drupal_common_theme() { 'arguments' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => NULL), ), 'more_help_link' => array( - 'arguments' => array('url' => NULL), + 'arguments' => array('module' => NULL, 'topic' => NULL, 'title' => 'More help', 'popup' => 1, 'attributes' => NULL), ), 'xml_icon' => array( 'arguments' => array('url' => NULL), Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.284 diff -u -p -r1.284 menu.inc --- includes/menu.inc 22 Aug 2008 12:46:24 -0000 1.284 +++ includes/menu.inc 23 Aug 2008 14:41:10 -0000 @@ -1224,7 +1224,7 @@ function menu_get_active_help() { // Add "more help" link on admin pages if the module provides a // standalone help page. if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#' . $arg[2], $empty_arg) && $help) { - $output .= theme("more_help_link", url('admin/help/' . $arg[2])); + $output .= theme("more_help_link", $arg[2]); } } } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.432 diff -u -p -r1.432 theme.inc --- includes/theme.inc 16 Aug 2008 21:05:49 -0000 1.432 +++ includes/theme.inc 23 Aug 2008 14:41:26 -0000 @@ -1196,6 +1196,54 @@ function theme_help() { } /** + * Returns code that emits a 'more help' link with an icon, to view the topic, optionally in a popup. + * + * @param $module + * The module that owns this help topic. + * @param $topic + * Optional identifier for the topic. + * @param $title + * Optional title or label for the link. Default is "More help". + * @param $popup + * Optional boolean value to open the link in a popup. + * @param $attributes + * An array of attributes to include in hyperlink. + */ +function theme_more_help_link($module, $topic = NULL, $title = 'More help', $popup = TRUE, $attributes = array()) { + if (module_exists('help')) { + static $js_added = FALSE; + if ($popup) { + $popup_class = !empty($attributes['class']) ? $attributes['class'] . ' help-link-popup' : 'help-link-popup'; + // Set a class for links to be opened in a popup; degrades in the absence of JS. + $attributes += array('class' => $popup_class); + } + + // Fetch the topic information. + drupal_function_exists('help_get_topic'); + $info = help_get_topic($module, $topic); + + // Return empty is the specified topic doesn't exist. + if (isset($topic) && !$info) { + return; + } + + // Set the topic title as hyperlink title attribute. + $attributes += array('title' => $info['title']); + + if (!$js_added) { + // Include the javascript for launching popup for hyperlinks with class 'help-link-popup'. + drupal_add_js('modules/help/help.js', 'module'); + $js_added = TRUE; + } + } + + // Trim the trailing slash if no topic is specified. + $output = l(t($title), trim("admin/help/$module/$topic", '/'), array('attributes' => $attributes)); + + return ''; +} + +/** * Return a themed submenu, typically displayed under the tabs. * * @param $links @@ -1524,13 +1572,6 @@ function theme_item_list($items = array( } /** - * Returns code that emits the 'more help'-link. - */ -function theme_more_help_link($url) { - return ''; -} - -/** * Return code that emits an XML icon. * * For most use cases, this function has been superseded by theme_feed_icon(). Index: modules/help/gradient.png =================================================================== RCS file: modules/help/gradient.png diff -N modules/help/gradient.png Binary files /dev/null and gradient.png differ Index: modules/help/help-popup.css =================================================================== RCS file: modules/help/help-popup.css diff -N modules/help/help-popup.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/help/help-popup.css 23 Aug 2008 14:41:30 -0000 @@ -0,0 +1,154 @@ +/* $Id: help-popup.css,v 1.4 2008/04/28 20:40:59 merlinofchaos Exp $ */ + +body { + margin: 0; + padding: 0; + background: #edf5fa; + font: 12px/170% Verdana, sans-serif; + color: #494949; +} + +input { + font: 12px/100% Verdana, sans-serif; + color: #494949; +} + +textarea, select { + font: 12px/160% Verdana, sans-serif; + color: #494949; +} + +h1, h2, h3, h4, h5, h6 { + margin: 0; + padding: 0; + font-weight: normal; + font-family: Helvetica, Arial, sans-serif; +} + +h1 { + font-size: 170%; +} + +h2 { + font-size: 160%; + line-height: 130%; +} + +h3 { + font-size: 140%; +} + +h4 { + font-size: 130%; +} + +h5 { + font-size: 120%; +} + +h6 { + font-size: 110%; +} + +ul, ol, quote, code, fieldset { + margin: .5em 0; +} + +p { + margin: 0.6em 0 1.2em; + padding: 0; +} + +a:link, a:visited { + color: #027AC6; + text-decoration: none; +} + +a:hover { + color: #0062A0; + text-decoration: underline; +} + +a:active, a.active { + color: #5895be; +} + +hr { + margin: 0; + padding: 0; + border: none; + height: 1px; + background: #5294c1; +} + +ol li, ul li { + margin: 0.4em 0 0.4em .5em; /* LTR */ +} + + +#content { + margin: .5em 1em 1em 1em; +} + +#content #page-title { + margin-bottom: .5em; +} + +#content #toc { + background: #FFFFFF url(gradient.png) repeat-x scroll 0% 100%; + border: 1px solid #D0EBFF; + display: table; + margin: 5px 10px; + padding: 5px 10px 5px 30px; +} + +#content #toc-block { + background: #FFFFFF url(gradient.png) repeat-x scroll 0% 100%; + border: 1px solid #D0EBFF; + float: right; + margin: 10px; + padding: 5px 10px; +} + +ol#toc li, ul#toc li { + margin: 0; +} + +div.admin-panel { + background: #FFFFFF url(gradient.png) repeat-x scroll 0% 100%; + border: 1px solid #D0EBFF; + margin: 5px 0; + padding: 1em 1em 1.5em; +} + +div.admin-panel .description { + color: #898989; + font-size: 0.92em; + line-height: 150%; + margin-bottom: 1em; +} + +div.admin-panel .body { + margin: 0; + padding: 0; +} + +div#breadcrumb { + padding-left: 1em; + background-color: white; + border-bottom: 1px solid #ccc; + height: 2em; +} + +div#breadcrumb .breadcrumb { + padding: 0; + margin: 0; +} + +code, pre { + border: 1px solid #444; + background: #f1f1f1; + margin: 1em; + padding: .2em; + display: block; +} Index: modules/help/help-popup.tpl.php =================================================================== RCS file: modules/help/help-popup.tpl.php diff -N modules/help/help-popup.tpl.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/help/help-popup.tpl.php 23 Aug 2008 14:41:30 -0000 @@ -0,0 +1,35 @@ + + + + + <?php print $title; ?> + + + + + + +
+ + + +
+

+
+ + +
+ +
+
+ + + +
+ + Index: modules/help/help.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.admin.inc,v retrieving revision 1.6 diff -u -p -r1.6 help.admin.inc --- modules/help/help.admin.inc 14 Apr 2008 17:48:37 -0000 1.6 +++ modules/help/help.admin.inc 23 Aug 2008 14:41:35 -0000 @@ -7,70 +7,594 @@ */ /** - * Menu callback; prints a page listing a glossary of Drupal terminology. + * Menu callback; prints a page displaying available help topics for modules. */ -function help_main() { - // Add CSS - drupal_add_css(drupal_get_path('module', 'help') . '/help.css', 'module', 'all', FALSE); - $output = '

' . t('Help topics') . '

' . t('Help is available on the following items:') . '

' . help_links_as_list(); - return $output; +function help_index_page() { + if (!empty($_GET['popup'])) { + print help_by_module(); + return; + } + else { + return help_topic_page('help', 'welcome-page', FALSE); + } } /** - * Menu callback; prints a page listing general help for a module. + * Menu callback; prints a page displaying available help topics for modules. */ -function help_page($name) { +function help_by_module() { $output = ''; - if (module_hook($name, 'help')) { - $module = drupal_parse_info_file(drupal_get_path('module', $name) . '/' . $name . '.info'); - drupal_set_title($module['name']); - - $temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg()); - if (empty($temp)) { - $output .= t("No help is available for module %module.", array('%module' => $module['name'])); + $breadcrumb = array(); + $menu_items = array(); + $items = array(); + + $topics = help_get_topics(); + help_get_topic_hierarchy($topics); + + $modules = module_rebuild_cache(); + foreach ($modules as $file) { + $module = $file->name; + if (empty($topics[$module]) || $module == 'help') { + continue; + } + + // Fetch help links. + $items = help_get_tree($topics, $topics[$module]['']['children'], array(), 0); + + // Sort. + ksort($items); + + $menu_items[$file->info['name']] = array($file->info['description'], $items); + } + + if (!empty($_GET['popup'])) { + $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing. + drupal_set_breadcrumb(array_reverse($breadcrumb)); + drupal_add_css(drupal_get_path('module', 'system') . '/admin.css'); + print theme('help_popup', theme('help_by_module', $menu_items)); + return; + } + + $breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb)); + drupal_set_breadcrumb($breadcrumb); + + $output .= theme('help_by_module', $menu_items); + return $output; +} + +/** + * Menu callback; prints a page with help topic for a module. + */ +function help_topic_page($module, $topic = NULL, $bells_and_whistles = TRUE) { + $info = help_get_topic($module, $topic); + if (isset($topic) && !$info) { + return drupal_not_found(); + } + + $popup = !empty($_GET['popup']); + + drupal_set_title($info['title']); + + // Set up breadcrumb. + $breadcrumb = array(); + + $parent = $info; + $pmodule = $module; + + // Loop checker. + $checked = array(); + while (!empty($parent['parent'])) { + if (strpos($parent['parent'], '%')) { + list($pmodule, $ptopic) = explode('%', $parent['parent']); } else { - $output .= $temp; + $ptopic = $parent['parent']; } - // Only print list of administration pages if the module in question has - // any such pages associated to it. - $admin_tasks = system_get_module_admin_tasks($name); - if (!empty($admin_tasks)) { - ksort($admin_tasks); - $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name']))); + if (!empty($checked[$pmodule][$ptopic])) { + break; + } + $checked[$pmodule][$ptopic] = TRUE; + + $parent = help_get_topic($pmodule, $ptopic); + if (!$parent) { + break; + } + + $breadcrumb[] = help_l($parent['title'], "admin/help/$pmodule/$ptopic"); + } + + $breadcrumb[] = help_l(help_get_module_name($pmodule), "admin/help/$pmodule"); + $breadcrumb[] = help_l(t('Help'), "admin/help"); + + if (!isset($topic)) { + $topic = 'about'; + drupal_set_title(t('About @module', array('@module' => help_get_module_name($module)))); + } + $output = help_view_topic($module, $topic, $popup, $bells_and_whistles); + if (empty($output)) { + if ($topic == 'about') { + $output = help_view_module($module, $popup); } + else { + $output = t('Missing help topic.'); + } + } + if ($popup) { + $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing. + drupal_set_breadcrumb(array_reverse($breadcrumb)); + print theme('help_popup', $output); + return; } + + if ($bells_and_whistles) { + $breadcrumb[] = help_l('Administer', 'admin'); + $breadcrumb[] = l('Home', ''); + drupal_set_breadcrumb(array_reverse($breadcrumb)); + } + + drupal_add_css(drupal_get_path('module', 'help') . '/help.css'); return $output; } -function help_links_as_list() { - $empty_arg = drupal_help_arg(); - $module_info = module_rebuild_cache(); - - $modules = array(); - foreach (module_implements('help', TRUE) as $module) { - if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) { - $modules[$module] = $module_info[$module]->info['name']; - } - } - asort($modules); - - // Output pretty four-column list - $count = count($modules); - $break = ceil($count / 4); - $output = '
'; +} + +/** + * Build a tree of help topics. + */ +function help_get_tree($topics, $topic_ids, $tree_parents = array(), $max_depth = -1, $depth = 0) { + uasort($topic_ids, '_help_uasort'); + $items = array(); + foreach ($topic_ids as $info) { + list($module, $topic) = $info; + $item = help_l($topics[$module][$topic]['title'], "admin/help/$module/$topic"); + if (!empty($tree_parents) && $topic == end($tree_parents)) { + $children = !empty($topics[$module][$topic]['children']) ? $topics[$module][$topic]['children'] : array(); + $item .= theme('item_list', help_get_tree($topics, $children, $tree_parents, $max_depth, $depth + 1)); + } + else if (empty($tree_parents) && !empty($topics[$module][$topic]['children']) && ($max_depth == -1 || $depth < $max_depth)) { + $item .= theme('item_list', help_get_tree($topics, $topics[$module][$topic]['children'], $tree_parents, $max_depth, $depth + 1)); + } + + $items[] = $item; + } + + return $items; +} + +/** + * Build a hierarchy for a single module's topics. + */ +function help_get_topic_hierarchy(&$topics) { + foreach ($topics as $module => $module_topics) { + foreach ($module_topics as $topic => $info) { + $parent_module = $module; + // We have a blank topic that we don't want parented to + // itself. + if (!$topic) { + continue; + } + + if (empty($info['parent'])) { + $parent = ''; + } + else if (strpos($info['parent'], '%')) { + list($parent, $parent_module) = explode($info['parent'], '%'); + if (empty($topics[$parent_module][$parent])) { + // If it doesn't exist, top level. + $parent = ''; + } + } + else { + $parent = $info['parent']; + if (empty($module_topics[$parent])) { + // If it doesn't exist, top level. + $parent = ''; + } + } + + if (!isset($topics[$parent_module][$parent]['children'])) { + $topics[$parent_module][$parent]['children'] = array(); + } + $topics[$parent_module][$parent]['children'][] = array($module, $topic); + $topics[$module][$topic]['_parent'] = array($parent_module, $parent); + } + } +} + +/** + * Get the information for a single help topic. + */ +function help_get_topic($module, $topic) { + $topics = help_get_topics(); + if (!empty($topics[$module][$topic])) { + return $topics[$module][$topic]; + } +} + +/** + * Helper function for help_get_topics() to check for default existence of default help file. + */ +function _help_check_default_file(&$info, $module, &$path) { + if (isset($path) && file_exists($path . '/about.html') && empty($info['about'])) { + $info['about'] = array( + 'title' => t('About @module', array('@module' => help_get_module_name($module))), + 'file' => 'about', + 'weight' => -20, + ); + } + else if (empty($info) && empty($path)) { + $info = array(); + $module_path = drupal_get_path('module', $module); + if (file_exists("$module_path/help/about.html")) { + $path = "$module_path/help"; + _help_check_default_file($info, $module, $path); + } + } +} + +/** + * Search the system for all available help topics. + */ +function help_get_topics() { + static $topics = NULL; + if (!isset($topics)) { + $topics = array(); + + foreach (module_list() as $module) { + $module_path = drupal_get_path('module', $module); + $info = array(); + $path = ''; + if (file_exists("$module_path/help/$module.help")) { + $path = "$module_path/help"; + $info = parse_ini_file("./$module_path/help/$module.help", TRUE); + _help_check_default_file($info, $module, $path); + } + else { + _help_check_default_file($info, $module, $path); + } + + if (!empty($info)) { + // Get translated titles: + global $language; + if (file_exists("$module_path/translations/help/$language->language/$module.help")) { + $translation = drupal_parse_info_file("$module_path/translations/help/$language->language/$module.help", TRUE); + } + $settings = array(); + if (!empty($info['help settings'])) { + $settings = $info['help settings']; + unset($info['help settings']); + } + + foreach ($info as $name => $topic) { + // Each topic should have a name, a title, a file and of course the path. + $file = !empty($topic['file']) ? $topic['file'] : $name; + $topics[$module][$name] = array( + 'name' => $name, + 'title' => !empty($translation[$name]['title']) ? $translation[$name]['title'] : $topic['title'], + 'weight' => isset($topic['weight']) ? $topic['weight'] : 0, + 'parent' => isset($topic['parent']) ? $topic['parent'] : 0, + 'file' => $file . '.html', // require extension + 'path' => $path, // not in .help file + 'line break' => isset($topic['line break']) ? $topic['line break'] : (isset($settings['line break']) ? $settings['line break'] : FALSE), + 'navigation' => isset($topic['navigation']) ? $topic['navigation'] : (isset($settings['navigation']) ? $settings['navigation'] : TRUE), + 'css' => isset($topic['css']) ? $topic['css'] : (isset($settings['css']) ? $settings['css'] : NULL), + ); + } + } + $path = ''; + $info = array(); + } + } + return $topics; +} + +/** + * Helper function to sort topics array with a custom comparison. + */ +function _help_uasort($id_a, $id_b) { + $topics = help_get_topics(); + + list($module_a, $topic_a) = $id_a; + $a = $topics[$module_a][$topic_a]; + + list($module_b, $topic_b) = $id_b; + $b = $topics[$module_b][$topic_b]; + + $a_weight = isset($a['weight']) ? $a['weight'] : 0; + $b_weight = isset($b['weight']) ? $b['weight'] : 0; + if ($a_weight != $b_weight) { + return ($a_weight < $b_weight) ? -1 : 1; + } + + if ($a['title'] != $b['title']) { + return ($a['title'] < $b['title']) ? -1 : 1; + } + return 0; +} + +/** + * Load and render a help topic. + */ +function help_get_topic_filename($module, $topic) { + init_theme(); + global $language; + + $info = help_get_topic($module, $topic); + if (empty($info)) { + return; + } + + // Search paths: + $paths = array( + path_to_theme() . '/help', // Allow theme override. + drupal_get_path('module', $module) . "/translations/help/$language->language", // Translations. + $info['path'], // In same directory as .inc file. + ); + + foreach ($paths as $path) { + if (file_exists("./$path/$info[file]")) { + return "./$path/$info[file]"; + } + } +} + +/** + * Small helper function to get a module's proper name. + */ +function help_get_module_name($module) { + $info = db_fetch_object(db_query("SELECT * FROM {system} WHERE name = :name", array(':name' => $module))); + $info = unserialize($info->info); + return t($info['name']); +} + +/** + * Format a link while preserving popup query. + */ +function help_l($text, $dest, $options = array()) { + if (!empty($_GET['popup'])) { + if (empty($options['query'])) { + $options['query'] = array(); + } + + if (is_array($options['query'])) { + $options['query'] += array('popup' => TRUE); + } + else { + $options['query'] += '&popup=1'; + } + } + + return l($text, $dest, $options); +} + +/** + * Format a URL while preserving popup query. + */ +function help_url($dest, $options = array()) { + if (!empty($_GET['popup'])) { + if (empty($options['query'])) { + $options['query'] = array(); + } + + $options['query'] += array('popup' => TRUE); + } + + return url($dest, $options); +} + +function theme_help_by_module($menu_items) { + $stripe = 0; + $output = ''; + $container = array('left' => '', 'right' => ''); + $flip = array('left' => 'right', 'right' => 'left'); + $position = 'left'; + + // Iterate over all modules + foreach ($menu_items as $module => $block) { + list($description, $items) = $block; + + // Output links + if (count($items)) { + $block = array(); + $block['title'] = $module; + $block['content'] = theme('item_list', $items); + $block['description'] = t($description); + + if ($block_output = theme('admin_block', $block)) { + if (!isset($block['position'])) { + // Perform automatic striping. + $block['position'] = $position; + $position = $flip[$position]; + } + $container[$block['position']] .= $block_output; + } + } + } + + $output = '
'; + foreach ($container as $id => $data) { + $output .= '
'; + $output .= $data; + $output .= '
'; + } + $output .= '
'; return $output; } +/** + * Fill in a bunch of page variables for our specialized popup page. + */ +function template_preprocess_help_popup(&$variables) { + // Add favicon. + if (theme_get_setting('toggle_favicon')) { + drupal_set_html_head(''); + } + + global $theme; + // Construct page title. + if (drupal_get_title()) { + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + } + else { + $head_title = array(variable_get('site_name', 'Drupal')); + if (variable_get('site_slogan', '')) { + $head_title[] = variable_get('site_slogan', ''); + } + } + + $module_path = drupal_get_path('module', 'help'); + drupal_add_css($module_path . '/help-popup.css'); + drupal_add_css($module_path . '/help.css'); + + $variables['head_title'] = implode(' | ', $head_title); + $variables['base_path'] = base_path(); + $variables['front_page'] = url(); + $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); + $variables['feed_icons'] = drupal_get_feeds(); + $variables['head'] = drupal_get_html_head(); + $variables['language'] = $GLOBALS['language']; + $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; + $variables['logo'] = theme_get_setting('logo'); + $variables['messages'] = theme('status_messages'); + $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); + $variables['css'] = drupal_add_css(); + $css = drupal_add_css(); + + // Remove theme css. + foreach ($css as $media => $types) { + if (isset($css[$media]['theme'])) { + $css[$media]['theme'] = array(); + } + } + + $variables['styles'] = drupal_get_css($css); + $variables['scripts'] = drupal_get_js(); + $variables['title'] = drupal_get_title(); + // Closure should be filled last. + $variables['closure'] = theme('closure'); +} Index: modules/help/help.js =================================================================== RCS file: modules/help/help.js diff -N modules/help/help.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/help/help.js 23 Aug 2008 14:41:35 -0000 @@ -0,0 +1,11 @@ +// $Id: $ + +Drupal.behaviors.help = function() { + $('.help-link-popup').each(function() { + $(this).bind('click', function() { + var url = this.href + (this.href.indexOf('?') != -1 ? '&' : '?') + "popup=1"; + window.open(url, 'help_window', 'width=600,height=550,scrollbars,resizable'); + return false; + }); + }); +} Index: modules/help/help.module =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.module,v retrieving revision 1.81 diff -u -p -r1.81 help.module --- modules/help/help.module 6 May 2008 12:18:47 -0000 1.81 +++ modules/help/help.module 23 Aug 2008 14:41:35 -0000 @@ -7,35 +7,11 @@ */ /** - * Implementation of hook_menu(). - */ -function help_menu() { - $items['admin/help'] = array( - 'title' => 'Help', - 'page callback' => 'help_main', - 'access arguments' => array('access administration pages'), - 'weight' => 9, - ); - - foreach (module_implements('help', TRUE) as $module) { - $items['admin/help/' . $module] = array( - 'title' => $module, - 'page callback' => 'help_page', - 'page arguments' => array(2), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); - } - - return $items; -} - -/** * Implementation of hook_help(). */ function help_help($path, $arg) { switch ($path) { - case 'admin/help': + case 'admin/help/by-module': $output = '

' . t('This guide provides context sensitive help on the use and configuration of Drupal and its modules, and is a supplement to the more extensive online Drupal handbook. The online handbook may contain more up-to-date information, is annotated with helpful user-contributed comments, and serves as the definitive reference point for all Drupal documentation.', array('@drupal' => 'http://drupal.org', '@handbook' => 'http://drupal.org/handbook')) . '

'; return $output; case 'admin/help#help': @@ -44,3 +20,68 @@ function help_help($path, $arg) { return $output; } } + +/** + * Implementation of hook_theme(). + */ +function help_theme() { + return array( + 'help_popup' => array( + 'arguments' => array('content' => NULL), + 'template' => 'help-popup', + 'file' => 'help.admin.inc', + ), + 'help_index_page' => array( + 'arguments' => array('topic_items' => NULL), + 'file' => 'help.admin.inc', + ), + 'help_by_module' => array( + 'arguments' => array('menu_items' => NULL), + 'file' => 'help.admin.inc', + ), + ); +} + +/** + * Implementation of hook_menu(). + */ +function help_menu() { + $items['admin/help'] = array( + 'title' => 'Help', + 'page callback' => 'help_index_page', + 'access arguments' => array('access administration pages'), + 'weight' => 9, + ); + + $items['admin/help/by-topic'] = array( + 'title' => 'By topic', + 'page callback' => 'help_index_page', + 'access arguments' => array('access administration pages'), + 'type' => MENU_DEFAULT_LOCAL_TASK, + ); + + $items['admin/help/by-module'] = array( + 'title' => 'By module', + 'page callback' => 'help_by_module', + 'access arguments' => array('access administration pages'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 9 + ); + + $items['admin/help/%'] = array( + 'page callback' => 'help_topic_page', + 'page arguments' => array(2), + 'access arguments' => array('access administration pages'), + 'parent' => 'admin/help', + 'type' => MENU_CALLBACK, + ); + + $items['admin/help/%/%'] = array( + 'page callback' => 'help_topic_page', + 'page arguments' => array(2, 3), + 'access arguments' => array('access administration pages'), + 'parent' => 'admin/help', + 'type' => MENU_CALLBACK, + ); + return $items; +} Index: modules/help/help.test =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.test,v retrieving revision 1.2 diff -u -p -r1.2 help.test --- modules/help/help.test 30 May 2008 07:30:51 -0000 1.2 +++ modules/help/help.test 23 Aug 2008 14:41:35 -0000 @@ -1,5 +1,5 @@ drupalModuleEnable('blog'); -// $this->drupalModuleEnable('poll'); $this->getModuleList(); // Create users. @@ -58,12 +55,8 @@ class HelpTestCase extends DrupalWebTest $this->drupalGet('admin/help/' . $module); $this->assertResponse($response); if ($response == 200) { - // NOTE: The asserts fail on blog and poll because the get returns the 'admin/help' node instead of the indicated node??? -// if ($module == 'blog' || $module == 'poll') { -// continue; -// } - $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed')); - $this->assertRaw('

' . t($name) . '

', t('[' . $module . '] Heading was displayed')); + $this->assertTitle('About ' . $name . ' | Drupal', t('[' . $module . '] Title was displayed')); + $this->assertRaw('

About ' . t($name) . '

', t('[' . $module . '] Heading was displayed')); $this->assertText(t('Home ' . $crumb . ' Administer ' . $crumb . ' Help'), t('[' . $module . '] Breadcrumbs were displayed')); } } Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.85 diff -u -p -r1.85 system.admin.inc --- modules/system/system.admin.inc 21 Aug 2008 19:36:38 -0000 1.85 +++ modules/system/system.admin.inc 23 Aug 2008 14:41:59 -0000 @@ -663,7 +663,7 @@ function system_modules($form_state = ar if ($help_arg && module_hook($filename, 'help')) { if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) { // Module has a help page. - $extra['help'] = theme('more_help_link', url("admin/help/$filename")); + $extra['help'] = theme('more_help_link', $filename); } } // Mark dependents disabled so user can not remove modules being depended on.