Crew,
Since i've been moving a couple of my modules to the new Admin GUI, I cannot help but notice how lacking the help interface is for things other than the System module. This is something that we really should change since there are a number of modules that can be quite verbose as far as what quality help content could be.
To that end, I propose extending the help system from a module developer's perspective by making a new array available called "Help Section" implemented something like this:
$i=0;
$modversion['helpsection'][$i]['name'] = "Page 1";
$modversion['helpsection'][$i]['link'] = "page=help";
$i++;
$modversion['helpsection'][$i]['name'] = "Page 2";
$modversion['helpsection'][$i]['link'] = "page=help2";
The trick is in the implementation, as help.pho handles four help classifications:
* mid > 0, system
* mid > 0, non-system
* general, system
* genera, non-system
The first segment I've changed is mid > 0, non-system:
if ( $module->getVar('dirname', 'e') == 'system' ) {
...
} else {
/* Original Help Code
$help = $module->toArray();
//$help['name'] = $module->getVar('dirname', 's');
$help['link'] = 'help.php?mid=' . $mid . '&' . $module->getInfo('help');
$xoopsTpl->append_by_ref( 'help', $help );
unset($help);
*/
// New Code Start
$list_help = array();
$listed_mods[0] = $module->toArray();
$helplist = $module->getInfo('helpsection');
$j=0;
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++;
}
}
unset ($helplist);
$listed_mods[0]['help_page'] = $list_help;
$xoopsTpl->assign('list_mods',$listed_mods);
if (( $module->getInfo('help') != '' ) && ($j == 0)){
$help['name'] = $module->getInfo('name');
$help['link'] = 'help.php?mid=' . $mid . '&' . $module->getInfo('help');
}
$k=0;
// New Code Stop
The second change is general help, non-system.
if ( $module->getVar('dirname', 'e') == 'system' ) {
...
} 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');
}
*/
// New Code Start
$helplist = $module->getInfo('helpsection');
foreach ($helplist as $page) {
if ( ($page['name'] != '') && ($page['link'] != '') ) {
$list_help[$j]['name'] = $page['name'];
$list_help[$j]['link'] = 'help.php?mid=' . $module->getVar('mid', 'e') . '&' . $page['link'];
$j++;
$k++;
}
}
unset ($helplist);
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');
}
$k=0;
// New Code Stop
}
The code could probably use a little optimization, but it does make it possible for modules to have more than one single page.
Additionally, if the system module could be updated to support this in the main section instead of each little subsection, the code for this piece of the admin puzzle could be significantly shorter.