diff --git a/lam/docs/modules-specification.htm b/lam/docs/modules-specification.htm index 85c8a50a..4f3451d2 100644 --- a/lam/docs/modules-specification.htm +++ b/lam/docs/modules-specification.htm @@ -274,6 +274,25 @@ return false. If true is returned the next module page will be displayed.

+

2.2.4. get_help

+
+ + + + + + +
function get_help($helpID)
+
+
+This function is called when a page requests a help topic from this module.
+$scope is the help identifier; it must only contain a-z, A-Z, 0-9 +-, . and _.
+It must return the help entry as array for the submitted help identifier. The format of the array to be returned is described in section 4. "Help entry syntax".
+


3. Meta HTML code

@@ -395,9 +414,32 @@ example", "td" => array("colspan" => 3))
)


+


+

+

4. Help entry syntax

+The array that is returned by the get_help function must follow the below described syntax. +Fields marked REQUIRED are neccessary under any circumstances. Fields marked +OPTIONAL may be left out when not needed.
+There are basically two different types of help entries that can be used. Internal help entries, that +means the headline, text, etc is included in the help entry or external help entries, that means the help +entry has only a reference pointing to a HTML/PHP page that offers the help entry.

-
-
+


+

+

4.1. Internal help entries

+ext (REQUIRED) +
Must be FALSE in this case. +

+Headline (REQUIRED) +
The headline of this help entry. Can consist of any alpha-numeric characters. No HTML/CSS +elements are not allowed here. +

+Text (REQUIRED) +
The text of this help entry. Can constist if any alpha-numeric characters and can contain +placeholder for variables passed to this help entry. The placeholder must follow the syntax for +placeholder defined by the PHP printf function. HTML/CSS elements are allowed here as long +as they follow the XHTML1.0 Strict specification. +


diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index ae1239af..2ef8d89c 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -188,6 +188,11 @@ function checkProfileOptions($scope, $options) { return $return; } +// get the single help entry array for help identifier $helpID from module $module +function getHelp($module,$helpID) { + return call_user_func(array($module, "get_help"), $helpID); +} + class accountContainer { // Constructor diff --git a/lam/templates/help.php b/lam/templates/help.php index 27964637..7211bf9e 100644 --- a/lam/templates/help.php +++ b/lam/templates/help.php @@ -56,56 +56,68 @@ function echoHTMLFoot() } /* Print help site */ -function displayHelp($helpNumber) -{ - global $helpArray; - /* If no help number was submitted print error message */ - if($helpNumber == "") - { - $errorMessage = _("Sorry no help number submitted."); - echoHTMLHead(); - statusMessage("ERROR","",$errorMessage); - echoHTMLFoot(); - } - /* If submitted help number is not in help/help.inc print error message */ - elseif(!array_key_exists($helpNumber,$helpArray)) - { - $variables = array(); - array_push($variables,$helpNumber); - $errorMessage = _("Sorry this help number ({bold}%d{endbold}) is not available."); - echoHTMLHead(); - statusMessage("ERROR","",$errorMessage,$variables); - echoHTMLFoot(); - } - /* Print help site out of $helpArray */ - elseif($helpArray[$helpNumber]["ext"] == "FALSE") - { - echoHTMLHead(); - echo "

" . $helpArray[$helpNumber]['Headline'] . "

\n"; - $format = "

" . $helpArray[$helpNumber]['Text'] . "

\n"; - printf($format,$helpArray[$helpNumber]['variables'][0],$helpArray[$helpNumber]['variables'][1],$helpArray[$helpNumber]['variables'][2],$helpArray[$helpNumber]['variables'][3],$helpArray[$helpNumber]['variables'][4],$helpArray[$helpNumber]['variables'][5],$helpArray[$helpNumber]['variables'][6],$helpArray[$helpNumber]['variables'][7],$helpArray[$helpNumber]['variables'][8],$helpArray[$helpNumber]['variables'][9]); - //echo "

" . $helpArray[$helpNumber]['Text'] . "

\n"; - if($helpArray[$helpNumber]["SeeAlso"] <> "") - { - echo "

" . _("See also") . ": " . $helpArray[$helpNumber]['SeeAlso'] . "

\n"; - } - echoHTMLFoot(); - } +function displayHelp($helpEntry) { /* Load external help page */ - elseif($helpArray[$helpNumber]["ext"] == "TRUE") + if($helpEntry["ext"] == "TRUE") { echoHTMLHead(); - include_once("../help/" . $helpArray[$helpNumber]["Link"]); + include_once("../help/" . $helpEntry["Link"]); echoHTMLFoot(); } - /* Print empty page in all other cases */ + /* Print help site out of $helpEntry */ else { + $helpVariables = array(); + while($current = current($helpEntry['variables'])) { + array_push($helpVariables,$current); + next($helpEntry['variables']); + } echoHTMLHead(); + echo "

" . $helpEntry['Headline'] . "

\n"; + $format = "

" . $helpEntry['Text'] . "

\n"; + array_unshift($helpVariables,$format); + call_user_func_array("printf",$helpVariables); + if($helpEntry["SeeAlso"] <> "") + { + echo "

" . _("See also") . ": " . $helpEntry['SeeAlso'] . "

\n"; + } echoHTMLFoot(); } } -displayHelp($_GET['HelpNumber']); +/* If no help number was submitted print error message */ +if(!isset($_GET['HelpNumber'])) +{ + $errorMessage = _("Sorry no help number submitted."); + echoHTMLHead(); + statusMessage("ERROR","",$errorMessage); + echoHTMLFoot(); + exit; +} -?> +$helpEntry = array(); + +if(isset[$_GET['Module']) { + include_once("../lib/modules.inc"); + $helpEntry = getHelp($_GET['Module'],$_GET['HelpNumber']); +} +else { + /* If submitted help number is not in help/help.inc print error message */ + if(!array_key_exists($_GET['HelpNumber'],$helpArray)) + { + $variables = array(); + array_push($variables,$_GET['HelpNumber']); + $errorMessage = _("Sorry this help number ({bold}%d{endbold}) is not available."); + echoHTMLHead(); + statusMessage("ERROR","",$errorMessage,$variables); + echoHTMLFoot(); + exit; + } + else { + $helpEntry = $helpArray[$_GET['HelpNumber']]; + } +} + +displayHelp($helpEntry); + +?> \ No newline at end of file