|
From: <be...@us...> - 2013-09-09 02:30:20
|
Revision: 12013
http://sourceforge.net/p/xoops/svn/12013
Author: beckmi
Date: 2013-09-09 02:30:14 +0000 (Mon, 09 Sep 2013)
Log Message:
-----------
Enhancing Help with multi-page (https://sourceforge.net/p/xoops/feature-requests/421/)
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/help.php
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/help.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/help.php 2013-09-08 17:33:02 UTC (rev 12012)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/help.php 2013-09-09 02:30:14 UTC (rev 12013)
@@ -18,135 +18,192 @@
// Include header
include 'header.php';
-$page = system_CleanVars ( $_REQUEST, 'page', '', 'string' );
-$mid = system_CleanVars ( $_REQUEST, 'mid', 0, 'int' );
+$page = system_CleanVars($_REQUEST, 'page', '', 'string');
+$mid = system_CleanVars($_REQUEST, 'mid', 0, 'int');
// Define main template
$xoopsOption['template_main'] = 'system_help.html';
xoops_cp_header();
// Define Stylesheet
-$xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css' );
-$xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/help.css' );
+$xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
+$xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/help.css');
// Define Breadcrumb and tips
-$xoBreadCrumb->addLink( _AM_SYSTEM_HELP, 'help.php' );
+$xoBreadCrumb->addLink(_AM_SYSTEM_HELP, 'help.php');
-if ( $mid > 0 ) {
+// If $mid > 0, we're in a module's help section.
+if ($mid > 0) {
$module_handler =& xoops_gethandler('module');
- $module = $module_handler->get($mid);
+ $module = $module_handler->get($mid);
- $xoBreadCrumb->addLink( $module->getVar('name'), 'help.php?mid=' . $module->getVar('mid', 's') );
- $xoBreadCrumb->addLink( system_adminVersion( $page, 'name' ) );
+ $xoBreadCrumb->addLink($module->getVar('name'), 'help.php?mid=' . $module->getVar('mid', 's'));
+ $xoBreadCrumb->addLink(system_adminVersion($page, 'name'));
$xoBreadCrumb->render();
- if ( $module->getVar('dirname', 'e') == 'system' ) {
-
+ // Special handling for the System Module
+ if ($module->getVar('dirname', 'e') == 'system') {
xoops_load('xoopslists');
-
$admin_dir = XOOPS_ROOT_PATH . '/modules/system/admin';
- $dirlist = XoopsLists::getDirListAsArray($admin_dir);
-
- foreach($dirlist as $directory) {
- if ( file_exists( $admin_dir . '/' . $directory . '/xoops_version.php' ) ) {
-
+ $dirlist = XoopsLists::getDirListAsArray($admin_dir);
+ foreach ($dirlist as $directory) {
+ if (file_exists($admin_dir . '/' . $directory . '/xoops_version.php')) {
require $admin_dir . '/' . $directory . '/xoops_version.php';
-
if ($modversion['help']) {
- $help['name'] = system_adminVersion( $directory, 'name' );
- $help['link'] = 'help.php?mid=' . $mid . '&' . system_adminVersion( $directory, 'help' );;
- $xoopsTpl->append_by_ref( 'help', $help );
+ $help['name'] = system_adminVersion($directory, 'name');
+ $help['link'] = 'help.php?mid=' . $mid . '&' . system_adminVersion($directory, 'help');
+ $xoopsTpl->append_by_ref('help', $help);
unset($help);
}
unset($modversion);
}
}
unset($dirlist);
+
+ // Handling for all other modules.
} else {
- $help = $module->toArray();
- //$help['name'] = $module->getVar('dirname', 's');
- $help['link'] = 'help.php?mid=' . $mid . '&' . $module->getInfo('help');
- $xoopsTpl->append_by_ref( 'help', $help );
+ $list_help = array();
+ $listed_mods[0] = $module->toArray();
+ $helplist = $module->getInfo('helpsection');
+ $j = 0;
+ if (is_array($helplist)) {
+ foreach ($helplist as $helpitem) {
+ if (($helpitem['name'] != '') && ($helpitem['link'] != '')) {
+ $list_help[$j]['name'] = $helpitem['name'];
+ $list_help[$j]['link'] = 'help.php?mid=' . $mid . '&' . $helpitem['link'];
+ $j++;
+ }
+ }
+ $listed_mods[0]['help_page'] = $list_help;
+ $xoopsTpl->assign('list_mods', $listed_mods);
+ }
+ unset ($helplist);
+ if (($module->getInfo('help') != '') && ($j == 0)) {
+ $help['name'] = $module->getInfo('name');
+ $help['link'] = 'help.php?mid=' . $mid . '&' . $module->getInfo('help');
+ $xoopsTpl->append_by_ref('help', $help);
+ }
unset($help);
}
- $xoopsTpl->assign( 'modname', $module->getVar('name') );
-
- if ( $page != '' ) {
+ $xoopsTpl->assign('modname', $module->getVar('name'));
+
+ if ($page != '') {
// Call template
- if ( file_exists( XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/' . $page . '.html' ) ) {
- $helpcontent = $xoopsTpl->fetch( XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/' . $page . '.html' );
- }else{
- if ( file_exists( XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/english/help/' . $page . '.html' ) ) {
- $helpcontent = $xoopsTpl->fetch(XOOPS_ROOT_PATH.'/modules/' . $module->getVar('dirname', 'e') . '/language/english/help/' . $page . '.html');
+ if (file_exists(
+ XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/' . $page . '.html'
+ )
+ ) {
+ $helpcontent = $xoopsTpl->fetch(
+ XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/' . $page . '.html'
+ );
+ } else {
+ if (file_exists(
+ XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/english/help/' . $page . '.html'
+ )
+ ) {
+ $helpcontent = $xoopsTpl->fetch(
+ XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/english/help/' . $page . '.html'
+ );
} else {
$xoopsTpl->assign('load_error', 1);
}
}
-
$xoopsTpl->assign('helpcontent', $helpcontent);
-
- } else {
- if ( file_exists( XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/module_index.html' ) ) {
- $helpcontent = $xoopsTpl->fetch( XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/module_index.html' );
- }else{
- $helpcontent = $module->getInfo('description');
- $helpcontent = '<div id="non-modhelp">' . $helpcontent . '</div>';
- }
-
- $xoopsTpl->assign('helpcontent', $helpcontent);
-
- }
-
+ } else {
+ if (file_exists(
+ XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/' . $xoopsConfig['language'] . '/help/module_index.html'
+ )
+ ) {
+ $helpcontent = $xoopsTpl->fetch(
+ XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'e') . '/language/'
+ . $xoopsConfig['language'] . '/help/module_index.html'
+ );
+ } else {
+ $helpcontent = $module->getInfo('description');
+ $helpcontent = '<div id="non-modhelp">' . $helpcontent . '</div>';
+ }
+ $xoopsTpl->assign('helpcontent', $helpcontent);
+ }
+
+ // This section is called if we're in the general help area.
} else {
$xoBreadCrumb->render();
+
// Get Module Handler
$module_handler =& xoops_gethandler('module');
- $criteria = new CriteriaCompo();
+ $criteria = new CriteriaCompo();
$criteria->setOrder('weight');
+
// Get all installed modules
- $installed_mods = $module_handler->getObjects( $criteria );
- $listed_mods = array();
- $i = 0;
- $j = 0;
- foreach ( $installed_mods as $module ) {
- $list_help = array();
- $listed_mods[$i] = $module->toArray();
+ $installed_mods = $module_handler->getObjects($criteria);
+ $listed_mods = array();
+ $i = 0;
+ $j = 0;
+ foreach ($installed_mods as $module) {
+ $list_help = array();
+ $listed_mods[$i] = $module->toArray();
$listed_mods[$i]['image'] = $module->getInfo('image');
$listed_mods[$i]['adminindex'] = $module->getInfo('adminindex');
- $listed_mods[$i]['version'] = round( $module->getVar('version') / 100, 2 );
- $listed_mods[$i]['last_update'] = formatTimestamp( $module->getVar('last_update'), 'm' );
+ $listed_mods[$i]['version'] = round($module->getVar('version') / 100, 2);
+ $listed_mods[$i]['last_update'] = formatTimestamp($module->getVar('last_update'), 'm');
$listed_mods[$i]['author'] = $module->getInfo('author');
$listed_mods[$i]['credits'] = $module->getInfo('credits');
$listed_mods[$i]['license'] = $module->getInfo('license');
$listed_mods[$i]['description'] = $module->getInfo('description');
- if ( $module->getVar('dirname', 'e') == 'system' ) {
+ // Special handling for the System module
+ if ($module->getVar('dirname', 'e') == 'system') {
xoops_load('xoopslists');
-
$admin_dir = XOOPS_ROOT_PATH . '/modules/system/admin';
- $dirlist = XoopsLists::getDirListAsArray($admin_dir);
-
- foreach($dirlist as $directory) {
- if ( file_exists( $admin_dir . '/' . $directory . '/xoops_version.php' ) ) {
-
+ $dirlist = XoopsLists::getDirListAsArray($admin_dir);
+ foreach ($dirlist as $directory) {
+ if (file_exists($admin_dir . '/' . $directory . '/xoops_version.php')) {
require $admin_dir . '/' . $directory . '/xoops_version.php';
-
if ($modversion['help']) {
- $list_help[$j]['name'] = system_adminVersion( $directory, 'name' );
- $list_help[$j]['link'] = 'help.php?mid=' . $module->getVar('mid', 'e') . '&' . system_adminVersion( $directory, 'help' );
+ $list_help[$j]['name'] = system_adminVersion($directory, 'name');
+ $list_help[$j]['link']
+ =
+ 'help.php?mid=' . $module->getVar('mid', 'e') . '&' . system_adminVersion(
+ $directory,
+ 'help'
+ );
}
unset($modversion);
$j++;
}
}
unset($dirlist);
+
+ // Handling for all other modules
} else {
- if ( $module->getInfo('help') != '' ) {
- $list_help[$j]['name'] = $module->getVar('dirname', 's');
- $list_help[$j]['link'] = 'help.php?mid=' . $module->getVar('mid', 'e') . '&' . $module->getInfo('help');
+ $helplist = $module->getInfo('helpsection');
+ $k = 0;
+
+ // Only build the list if one has been defined.
+ if (is_array($helplist)) {
+ foreach ($helplist as $helpitem) {
+ if (($helpitem['name'] != '') && ($helpitem['link'] != '')) {
+ $list_help[$j]['name'] = $helpitem['name'];
+ $list_help[$j]['link']
+ =
+ 'help.php?mid=' . $module->getVar('mid', 'e') . '&' . $helpitem['link'];
+ $j++;
+ $k++;
+ }
+ }
}
+ unset($helplist);
+
+ // If there is no help section ($k=0), and a lone help parameter has been defined.
+ if (($module->getInfo('help') != '') && ($k == 0)) {
+ $list_help[$j]['name'] = $module->getInfo('name');
+ $list_help[$j]['link']
+ =
+ 'help.php?mid=' . $module->getVar('mid', 'e') . '&' . $module->getInfo('help');
+ }
}
+
$listed_mods[$i]['help_page'] = $list_help;
- if ( $module->getInfo('help') == '' ) {
+ if ($module->getInfo('help') == '') {
unset($listed_mods[$i]);
}
unset($list_help);
@@ -155,15 +212,19 @@
$j++;
}
$xoopsTpl->assign('list_mods', $listed_mods);
-
- if ( file_exists( XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/help/help_center.html' ) ) {
- $helpcontent = $xoopsTpl->fetch( XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/help/help_center.html' );
- }else{
- $helpcontent = '<div id="non-modhelp">' . _MD_CPANEL_HELPCENTER . '</div>';
- }
-
+
+ if (file_exists(
+ XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/help/help_center.html'
+ )
+ ) {
+ $helpcontent = $xoopsTpl->fetch(
+ XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/help/help_center.html'
+ );
+ } else {
+ $helpcontent = '<div id="non-modhelp">' . _MD_CPANEL_HELPCENTER . '</div>';
+ }
+
$xoopsTpl->assign('helpcontent', $helpcontent);
}
+
xoops_cp_footer();
-
-?>
\ No newline at end of file
|