| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
/** |
/** |
| 10 |
* Menu callback; prints a page listing a glossary of Drupal terminology. |
* Menu callback; prints a page displaying available help topics for modules. |
| 11 |
*/ |
*/ |
|
function help_index_pag_e($module = '') { |
|
|
$output = ''; |
|
|
/* // Add CSS |
|
|
drupal_add_css(drupal_get_path('module', 'help') . '/help.css', 'module', 'all', FALSE); |
|
|
$output .= '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . help_links_as_list(); |
|
|
*/ |
|
|
$breadcrumb = array(); |
|
|
|
|
|
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', help_by_module()); |
|
|
return; |
|
|
} |
|
|
|
|
|
$topics = help_get_topics(); |
|
|
|
|
|
if ($module) { |
|
|
if (empty($topics[$module])) { |
|
|
return drupal_not_found(); |
|
|
} |
|
|
|
|
|
help_get_topic_hierarchy($topics); |
|
|
$items = help_get_tree($topics, $topics[$module]['']['children'], array(), 0); |
|
|
|
|
|
$breadcrumb[] = help_l('Help', 'admin/help'); |
|
|
|
|
|
drupal_set_title(t('@module help index', array('@module' => help_get_module_name($module)))); |
|
|
$output .= theme('item_list', $items, NULL, 'ul', array('id' => 'toc')); |
|
|
} |
|
|
else { |
|
|
// Print a module index. |
|
|
$items = array(); |
|
|
$modules = module_rebuild_cache(); |
|
|
foreach ($modules as $file) { |
|
|
if (!empty($topics[$file->name])) { |
|
|
$items[] = help_l($file->info['name'], "admin/help/$file->name"); |
|
|
} |
|
|
} |
|
|
|
|
|
$output .= theme('item_list', $items); |
|
|
} |
|
|
|
|
|
$breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb)); |
|
|
drupal_set_breadcrumb($breadcrumb); |
|
|
|
|
|
return $output; |
|
|
} |
|
|
|
|
| 12 |
function help_index_page() { |
function help_index_page() { |
| 13 |
|
$output = ''; |
| 14 |
$breadcrumb = array(); |
$breadcrumb = array(); |
|
|
|
| 15 |
$menu_items = array(); |
$menu_items = array(); |
| 16 |
$items = array(); |
$items = array(); |
| 17 |
|
|
| 45 |
$breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb)); |
$breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb)); |
| 46 |
drupal_set_breadcrumb($breadcrumb); |
drupal_set_breadcrumb($breadcrumb); |
| 47 |
|
|
| 48 |
$output = drupal_get_form('search_form', &$form_state, '', '', t('Search Help'), NULL); |
if (module_exists('search')) { |
| 49 |
|
$output .= drupal_get_form('search_form', &$form_state, '', '', t('Search Help'), NULL); |
| 50 |
|
} |
| 51 |
$output .= theme('help_by_module', $menu_items); |
$output .= theme('help_by_module', $menu_items); |
| 52 |
return $output; |
return $output; |
| 53 |
} |
} |
| 97 |
$breadcrumb[] = help_l(help_get_module_name($pmodule), "admin/help/$pmodule"); |
$breadcrumb[] = help_l(help_get_module_name($pmodule), "admin/help/$pmodule"); |
| 98 |
$breadcrumb[] = help_l(t('Help'), "admin/help"); |
$breadcrumb[] = help_l(t('Help'), "admin/help"); |
| 99 |
|
|
| 100 |
$output = !isset($topic) ? help_view_module($module, $popup) : help_view_topic($module, $topic, $popup); |
if (isset($topic)) { |
| 101 |
|
$output = help_view_topic($module, $topic, $popup); |
| 102 |
|
} |
| 103 |
|
else { |
| 104 |
|
$output = help_view_topic($module, 'about', $popup); |
| 105 |
|
drupal_set_title(t('About @module', array('@module' => help_get_module_name($module)))); |
| 106 |
|
} |
| 107 |
if (empty($output)) { |
if (empty($output)) { |
| 108 |
$output = t('Missing help topic.'); |
$output = t('Missing help topic.'); |
| 109 |
} |
} |
| 114 |
print theme('help_popup', $output); |
print theme('help_popup', $output); |
| 115 |
return; |
return; |
| 116 |
} |
} |
| 117 |
|
|
| 118 |
if (!$popup) { |
$breadcrumb[] = help_l('Administer', 'admin'); |
|
$breadcrumb[] = help_l('Administer', 'admin'); |
|
|
} |
|
|
|
|
|
drupal_add_css(drupal_get_path('module', 'help') . '/help.css'); |
|
| 119 |
$breadcrumb[] = l('Home', ''); |
$breadcrumb[] = l('Home', ''); |
| 120 |
drupal_set_breadcrumb(array_reverse($breadcrumb)); |
drupal_set_breadcrumb(array_reverse($breadcrumb)); |
| 121 |
|
drupal_add_css(drupal_get_path('module', 'help') . '/help.css'); |
| 122 |
return $output; |
return $output; |
| 123 |
} |
} |
| 124 |
|
|
| 243 |
} |
} |
| 244 |
} |
} |
| 245 |
|
|
|
|
|
|
/*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 = '<div class="clear-block"><div class="help-items"><ul>'; |
|
|
$i = 0; |
|
|
foreach ($modules as $module => $name) { |
|
|
$output .= '<li>' . l($name, 'admin/help/' . $module) . '</li>'; |
|
|
if (($i + 1) % $break == 0 && ($i + 1) != $count) { |
|
|
$output .= '</ul></div><div class="help-items' . ($i + 1 == $break * 3 ? ' help-items-last' : '') . '"><ul>'; |
|
|
} |
|
|
$i++; |
|
|
} |
|
|
$output .= '</ul></div></div>'; |
|
|
|
|
|
return $output; |
|
|
}*/ |
|
|
|
|
|
/** |
|
|
* Menu callback; prints a page listing general help for a module. |
|
|
*/ |
|
|
/*function help_topic_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'])); |
|
|
} |
|
|
else { |
|
|
$output .= $temp; |
|
|
} |
|
|
|
|
|
// 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']))); |
|
|
} |
|
|
|
|
|
} |
|
|
return $output; |
|
|
}*/ |
|
|
|
|
| 246 |
/** |
/** |
| 247 |
* Build a tree of help topics. |
* Build a tree of help topics. |
| 248 |
*/ |
*/ |
| 343 |
function _help_check_default_file(&$info, $module, &$path) { |
function _help_check_default_file(&$info, $module, &$path) { |
| 344 |
if (isset($path) && file_exists($path . '/about.html') && empty($info['about'])) { |
if (isset($path) && file_exists($path . '/about.html') && empty($info['about'])) { |
| 345 |
$info['about'] = array( |
$info['about'] = array( |
| 346 |
'title' => t('About'), |
'title' => t('About @module', array('@module' => help_get_module_name($module))), |
| 347 |
'file' => 'about', |
'file' => 'about', |
| 348 |
'weight' => -20, |
'weight' => -20, |
| 349 |
); |
); |
| 383 |
_help_check_default_file($info, $module, $path); |
_help_check_default_file($info, $module, $path); |
| 384 |
} |
} |
| 385 |
else if (file_exists("$help_example/$module/$module.help")) { |
else if (file_exists("$help_example/$module/$module.help")) { |
| 386 |
// Temporary support for core module helps files. |
// Temporary support for core module helps files in help_example. |
| 387 |
$path = "$help_example/$module"; |
$path = "$help_example/$module"; |
| 388 |
$info = parse_ini_file("./$help_example/$module/$module.help", TRUE); |
$info = parse_ini_file("./$help_example/$module/$module.help", TRUE); |
| 389 |
_help_check_default_file($info, $module, $path); |
_help_check_default_file($info, $module, $path); |