? 299050-85.patch ? modules/help_1.zip ? modules/mkdir-help-directories.sh ? modules/aggregator/help ? modules/block/help ? modules/blog/help ? modules/blogapi/help ? modules/book/help ? modules/color/help ? modules/comment/help ? modules/contact/help ? modules/dblog/help ? modules/forum/help ? modules/help/.DS_Store ? modules/help/help ? modules/locale/help ? modules/menu/help ? modules/node/help ? modules/openid/help ? modules/path/help ? modules/poll/help ? modules/profile/help ? modules/search/help ? modules/simpletest/help ? modules/statistics/help ? modules/syslog/help ? modules/system/help ? modules/taxonomy/help ? modules/tracker/help ? modules/translation/help ? modules/trigger/help ? modules/update/help ? modules/upload/help ? modules/user/help ? sites/default/files ? sites/default/settings.php Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.834 diff -u -p -r1.834 common.inc --- includes/common.inc 3 Dec 2008 12:31:37 -0000 1.834 +++ includes/common.inc 6 Dec 2008 19:17:42 -0000 @@ -3268,6 +3268,21 @@ function element_children($element) { } /** + * Determine whether help topics for a given module exist. + * + * @param $module + * The name of the module (without the .module extension). + * @return + * TRUE if the help module is installed and enabled and the given module provides help topics. + */ +function help_exists($module) { + if (drupal_function_exists('help_get_topics') && module_exists($module)) { + $topics = help_get_topics(); + return isset($topics[$module]); + } +} + +/** * Provide theme registration for themes across .inc files. */ function drupal_common_theme() { @@ -3336,8 +3351,8 @@ function drupal_common_theme() { 'item_list' => array( 'arguments' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => NULL), ), - 'more_help_link' => array( - 'arguments' => array('url' => NULL), + 'help_link' => array( + 'arguments' => array('module' => NULL, 'topic' => NULL, 'title' => 'More help', 'popup' => NULL, '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.307 diff -u -p -r1.307 menu.inc --- includes/menu.inc 3 Dec 2008 14:38:59 -0000 1.307 +++ includes/menu.inc 6 Dec 2008 19:17:43 -0000 @@ -1292,8 +1292,8 @@ 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') && $function('admin/help#' . $arg[2], $empty_arg) && $help) { - $output .= theme("more_help_link", url('admin/help/' . $arg[2])); + if ($arg[0] == "admin" && help_exists($arg[2]) && $help) { + $output .= theme("help_link", $arg[2]); } } return $output; Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.454 diff -u -p -r1.454 theme.inc --- includes/theme.inc 5 Dec 2008 22:30:20 -0000 1.454 +++ includes/theme.inc 6 Dec 2008 19:17:43 -0000 @@ -1559,10 +1559,51 @@ function theme_item_list($items = array( } /** - * Returns code that emits the 'more help'-link. - */ -function theme_more_help_link($url) { - return ''; + * 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_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 class for links to be opened in popup; degrades in the absence of JavaScript. + $attributes += array('class' => $popup_class); + } + + // Fetch the topic information. + drupal_function_exists('help_get_topic'); + $info = help_get_topic($module, $topic); + + // Return empty if 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 JavaScript for launching popup for hyperlinks with class 'help-link-popup'. + drupal_add_js('modules/help/help.js'); + $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 ''; } /** 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 6 Dec 2008 19:17:43 -0000 @@ -0,0 +1,156 @@ +/* $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 */ +} + +code, pre { + border: 1px solid #444; + background: #f1f1f1; + margin: 1em; + padding: .2em; + display: block; +} + +div#breadcrumb { + padding-left: 1em; + background-color: white; + border-bottom: 1px solid #ccc; + height: 2em; + position: fixed; + top: 0; + width: 100%; +} + +div#breadcrumb .breadcrumb { + padding: 0; + margin: 0; +} + +#content { + margin: 3em 1em 1em 1em; +} + +#content #page-title { + margin-bottom: .5em; +} + +#content .toc { + background: #fff 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: #fff 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: #fff 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; +} 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 6 Dec 2008 19:17:43 -0000 @@ -0,0 +1,35 @@ + + + + + <?php print $title; ?> + + + + + + +
+ + + +
+

+
+ + +
+ +
+
+ + + +
+ + Index: modules/help/help-rtl.css =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help-rtl.css,v retrieving revision 1.2 diff -u -p -r1.2 help-rtl.css --- modules/help/help-rtl.css 27 Nov 2007 12:09:26 -0000 1.2 +++ modules/help/help-rtl.css 6 Dec 2008 19:17:43 -0000 @@ -9,3 +9,23 @@ padding-right: 0; padding-left: 0; } + +.help-topic .toc-block { + float: left; +} + +.help-left { + float: right; +} + +.help-right { + float: left; +} + +.help-previous { + float: right; +} + +.help-next { + float: left; +} Index: modules/help/help.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.admin.inc,v retrieving revision 1.7 diff -u -p -r1.7 help.admin.inc --- modules/help/help.admin.inc 26 Oct 2008 18:06:38 -0000 1.7 +++ modules/help/help.admin.inc 6 Dec 2008 19:17:43 -0000 @@ -1,76 +1,657 @@ FALSE)); - $output = '

' . t('Help topics') . '

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

' . help_links_as_list(); +function help_by_module() { + $output = ''; + $breadcrumb = array(); + $menu_items = array(); + $items = array(); + + $topics = help_get_topics(); + $settings = help_get_settings(); + + help_get_topic_hierarchy($topics); + + $modules = module_rebuild_cache(); + foreach ($modules as $file) { + $module = $file->name; + if (empty($topics[$module]) || !empty($settings[$module]['hide'])) { + continue; + } + + // Fetch help links. + $items = help_get_tree($topics, $topics[$module]['']['children'], array(), 0); + + // Sort. + ksort($items); + + if (isset($settings[$module]['index name'])) { + $name = $settings[$module]['index name']; + } + elseif (isset($settings[$module]['name'])) { + $name = $settings[$module]['name']; + } + else { + $name = t($file->info['name']); + } + + $menu_items[$name] = array($file->info['description'], $items); + } + + if (!empty($_GET['popup'])) { + 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 listing general help for a module. + * Menu callback; prints a page with help topic for a module. */ -function help_page($name) { - $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'])); +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) { + drupal_set_breadcrumb(array_reverse($breadcrumb)); + print theme('help_popup', $output); + return; } + + $breadcrumb[] = help_l(t('Administer'), 'admin'); + $breadcrumb[] = l(t('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 = '
'; + + 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 = ''; + } + elseif (strpos($info['parent'], '%')) { + list($parent_module, $parent) = 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]; + } +} + +/** + * A helper function to check for 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, + ); + } + elseif (empty($info) && empty($path)) { + $info = array(); + $help_example = drupal_get_path('module', 'help_example') . '/modules'; + $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() { + $cache = _help_parse_ini(); + return $cache['topics']; +} + +function help_get_settings() { + $cache = _help_parse_ini(); + return $cache['settings']; +} + +function _help_parse_ini() { + static $cache = NULL; + + if (!isset($cache)) { + $cache = array('topics' => array(), 'settings' => array()); + + $topics = array(); + $help_example = drupal_get_path('module', 'help_example') . '/modules'; + + 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)) { + global $language; + // Get translated titles: + + $translation = array(); + 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); + } + $cache['settings'][$module] = array(); + if (!empty($info['help settings'])) { + $cache['settings'][$module] = $info['help settings']; + unset($info['help settings']); + + // Check translated strings for translatable global settings. + if (isset($translation['help settings']['name'])) { + $cache['settings']['name'] = $translation['help settings']['name']; + } + if (isset($translation['help settings']['index name'])) { + $cache['settings']['index name'] = $translation['help settings']['index name']; + } + } + + 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; + $cache['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 .ini file + 'line break' => isset($topic['line break']) ? $topic['line break'] : (isset($cache['settings'][$module]['line break']) ? $cache['settings'][$module]['line break'] : FALSE), + 'navigation' => isset($topic['navigation']) ? $topic['navigation'] : (isset($cache['settings'][$module]['navigation']) ? $cache['settings'][$module]['navigation'] : TRUE), + 'css' => isset($topic['css']) ? $topic['css'] : (isset($cache['settings'][$module]['css']) ? $cache['settings'][$module]['css'] : NULL), + ); + } + } + $path = ''; + $info = array(); + } + drupal_alter('help_topic_info', $cache); + } + return $cache; +} + +/** + * Sort topics info array. + */ +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; +} + +/** + * Return help topic filename. + */ +function help_get_topic_filename($module, $topic) { + $info = help_get_topic_file_info($module, $topic); + if ($info) { + return "./$info[path]/$info[file]"; + } +} + + +/** + * Load and render a help topic. + */ +function help_get_topic_file_info($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 array('path' => $path, 'file' => $info['file']); + } + } +} + +/** + * Small helper function to get a module's proper name. + */ +function help_get_module_name($module) { + $settings = help_get_settings(); + if (isset($settings[$module]['name'])) { + $name = $settings[$module]['name']; + } + else { + $info = db_fetch_object(db_query("SELECT * FROM {system} WHERE name = :name", array(':name' => $module))); + $info = unserialize($info->info); + $name = t($info['name']); + } + return $name; +} + +/** + * Format a link but preserve popup identity. + */ +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 but preserve popup identity. + */ +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); +} + +/** + * Theme the by-module help browsing interface. + */ +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.api.php =================================================================== RCS file: modules/help/help.api.php diff -N modules/help/help.api.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/help/help.api.php 6 Dec 2008 19:17:43 -0000 @@ -0,0 +1,67 @@ + l(t('user permissions'), + * 'admin/user/permission'))); + * + * For a detailed usage example, see page_example.module. + */ +function hook_help($path, $arg) { + switch ($path) { + case 'admin/help#block': + return '

' . t('Blocks are boxes of content that may be rendered into certain regions of your web pages, for example, into sidebars. Blocks are usually generated automatically by modules (e.g., Recent Forum Topics), but administrators can also define custom blocks.') . '

'; + + case 'admin/build/block': + return t('

Blocks are boxes of content that may be rendered into certain regions of your web pages, for example, into sidebars. They are usually generated automatically by modules, but administrators can create blocks manually.

+

If you want certain blocks to disable themselves temporarily during high server loads, check the "Throttle" box. You can configure the auto-throttle on the throttle configuration page after having enabled the throttle module.

+

You can configure the behaviour of each block (for example, specifying on which pages and for what users it will appear) by clicking the "configure" link for each block.

', array('@throttle' => url('admin/settings/throttle'))); + } +} + +/** + * @} End of "addtogroup hooks". + */ Index: modules/help/help.css =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.css,v retrieving revision 1.2 diff -u -p -r1.2 help.css --- modules/help/help.css 27 May 2007 17:57:48 -0000 1.2 +++ modules/help/help.css 6 Dec 2008 19:17:43 -0000 @@ -5,6 +5,85 @@ width: 22%; padding-right: 3%; /* LTR */ } + .help-items-last { padding-right: 0; /* LTR */ } + +.help-topic h3, +.help-topic h4, +.help-topic h5, +.help-topic h6, +.help-topic dt { + font-weight: bold; +} + +.help-topic li h3, +.help-topic li h4, +.help-topic li h5, +.help-topic li h6 { + font-weight: normal; +} + +.help-topic code, +.help-topic pre { + border: 1px solid #444; + background: #f1f1f1; + margin: 1em; + padding: .2em; + display: block; +} + +.help-topic .toc-block { + background-color: #EDF5FA; + border: 1px solid #D0EBFF; + float: right; /* LTR */ + margin: 5px; + padding: 5px; +} + +.help-left { + text-align: left; + width: 42%; + display: block; + float: left; /* LTR */ +} + +.help-up { + margin: 0 5%; + width: 4%; + display: block; + float: left; /* LTR */ +} + +.help-up-noleft { + margin: 0 5%; + width: 42%; + text-align: right; + display: block; + float: left; /* LTR */ +} + +.help-right { + text-align: right; + width: 42%; + display: block; + float: right; +} + +.help-box { + margin: .5em; +} + +.help-navigation { + border-top: 1px dotted #ccc; +} + +.help-previous { + float: left; /* LTR */ +} + +.help-next { + float: right; /* LTR */ +} + Index: modules/help/help.info =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.info,v retrieving revision 1.7 diff -u -p -r1.7 help.info --- modules/help/help.info 11 Oct 2008 02:32:47 -0000 1.7 +++ modules/help/help.info 6 Dec 2008 19:17:43 -0000 @@ -1,4 +1,4 @@ -; $Id: help.info,v 1.7 2008/10/11 02:32:47 webchick Exp $ +; $Id: help.info,v 1.6 2008/05/06 12:18:47 dries Exp $ name = Help description = Manages the display of online help. package = Core 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 6 Dec 2008 19:17:43 -0000 @@ -0,0 +1,12 @@ +// $Id: $ + +Drupal.behaviors.help = { + attach: function() { + $('.help-link-popup').bind('click', function() { + var url = this.href + (this.href.indexOf('?') != -1 ? '&' : '?') + "popup=1"; + var w = window.open(url, 'help_window', 'width=600,height=550,scrollbars,resizable'); + w.focus(); + return false; + }); + } +} \ No newline at end of file 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 6 Dec 2008 19:17:43 -0000 @@ -7,25 +7,58 @@ */ /** + * Implementation of hook_perm(). + */ +function help_perm() { + return array( + 'access help' => array( + 'title' => t('Access help'), + 'description' => t('View help content.'), + ), + ); +} + +/** + * Implementation of hook_theme(). + */ +function help_theme() { + return array( + 'help_by_module' => array( + 'arguments' => array('menu_items' => NULL), + 'file' => 'help.admin.inc', + ), + 'help_popup' => array( + 'arguments' => array('content' => NULL), + 'template' => 'help-popup', + 'file' => 'help.admin.inc', + ), + ); +} + +/** * Implementation of hook_menu(). */ function help_menu() { + $items = array(); + $items['admin/help'] = array( 'title' => 'Help', - 'page callback' => 'help_main', - 'access arguments' => array('access administration pages'), + 'page callback' => 'help_by_module', + 'access arguments' => array('access help'), '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, - ); - } + $items['admin/help/%'] = array( + 'page callback' => 'help_topic_page', + 'page arguments' => array(2), + 'access arguments' => array('access help'), + 'type' => MENU_CALLBACK, + ); + $items['admin/help/%/%'] = array( + 'page callback' => 'help_topic_page', + 'page arguments' => array(2, 3), + 'access arguments' => array('access help'), + 'type' => MENU_CALLBACK, + ); return $items; } @@ -36,11 +69,6 @@ function help_menu() { function help_help($path, $arg) { switch ($path) { case 'admin/help': - $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': - $output = '

' . t('The help module 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')) . '

'; - $output .= '

' . t('For more information, see the online handbook entry for Help module.', array('@help' => 'http://drupal.org/handbook/modules/help/')) . '

'; - return $output; + return '

' . 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')) . '

'; } } Index: modules/help/help.test =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.test,v retrieving revision 1.3 diff -u -p -r1.3 help.test --- modules/help/help.test 25 Nov 2008 13:14:27 -0000 1.3 +++ modules/help/help.test 6 Dec 2008 19:17:43 -0000 @@ -8,7 +8,7 @@ class HelpTestCase extends DrupalWebTest function getInfo() { return array( 'name' => t('Help functionality'), - 'description' => t('Verify help display and user access to help based on persmissions.'), + 'description' => t('Verify access to and display of help.'), 'group' => t('Help'), ); } @@ -25,7 +25,7 @@ class HelpTestCase extends DrupalWebTest $this->getModuleList(); // Create users. - $this->big_user = $this->drupalCreateUser(array('access administration pages')); // 'administer blocks', 'administer site configuration', + $this->big_user = $this->drupalCreateUser(array('access administration pages', 'access help')); $this->any_user = $this->drupalCreateUser(array()); } @@ -60,7 +60,7 @@ class HelpTestCase extends DrupalWebTest // continue; // } $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed')); - $this->assertRaw('

' . t($name) . '

', t('[' . $module . '] Heading 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.110 diff -u -p -r1.110 system.admin.inc --- modules/system/system.admin.inc 26 Nov 2008 13:54:05 -0000 1.110 +++ modules/system/system.admin.inc 6 Dec 2008 19:17:43 -0000 @@ -88,7 +88,6 @@ function system_admin_by_module() { $modules = module_rebuild_cache(); $menu_items = array(); - $help_arg = module_exists('help') ? drupal_help_arg() : FALSE; foreach ($modules as $file) { $module = $file->name; @@ -102,7 +101,7 @@ function system_admin_by_module() { if (count($admin_tasks)) { // Check for help links. - if ($help_arg && module_invoke($module, 'help', "admin/help#$module", $help_arg)) { + if (help_exists($module)) { $admin_tasks[100] = l(t('Get help'), "admin/help/$module"); } @@ -634,9 +633,6 @@ function system_modules($form_state = ar $modules = array(); $form['modules'] = array('#tree' => TRUE); - // Used when checking if module implements a help page. - $help_arg = module_exists('help') ? drupal_help_arg() : FALSE; - // Iterate through each of the modules. foreach ($files as $filename => $module) { $extra = array(); @@ -657,11 +653,9 @@ function system_modules($form_state = ar } } // Generate link for module's help page, if there is one. - if ($help_arg && $module->status && in_array($filename, module_implements('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")); - } + if (help_exists($filename)) { + // Module has a help page. + $extra['help'] = theme('help_link', $filename); } // Mark dependents disabled so user can not remove modules being depended on. $dependents = array(); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.650 diff -u -p -r1.650 system.module --- modules/system/system.module 28 Nov 2008 09:25:59 -0000 1.650 +++ modules/system/system.module 6 Dec 2008 19:17:43 -0000 @@ -191,7 +191,7 @@ function system_perm() { ), 'access administration pages' => array( 'title' => t('Access administration pages'), - 'description' => t('View the administration panel and browse the help system.'), + 'description' => t('View the administration panel.'), ), 'access site reports' => array( 'title' => t('Access site reports'),