From: martin Date: Sun, 21 Jul 2002 08:34:25 +0000 (+0000) Subject: Improvements to the help system X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=65cf9fc3906ccdf946381278addf6f7ddbf7b3eb;p=moodle.git Improvements to the help system --- diff --git a/help.php b/help.php index a16f4416fc..3070e850a4 100644 --- a/help.php +++ b/help.php @@ -2,26 +2,41 @@ /// help.php - prints a very simple page and includes a /// page content or a string from elsewhere /// Usually this will appear in a popup - /// See help() in lib/moodlelib.php + /// See helpbutton() in lib/moodlelib.php include("config.php"); + optional_variable($file, ""); + optional_variable($text, "No text to display"); + optional_variable($module, "moodle"); + if (ereg("\\.\\.", $file)) { error("Error: Filenames can not contain \"..\""); } - ?> -lang/page/$file")) { - include("lang/$CFG->lang/page/$file"); - } else { - include("lang/en/page/$file"); - } +dirroot/lang"; + } else { + $langpath = "$CFG->dirroot/mod/$module/lang"; + } + + if (file_exists("$langpath/$CFG->lang/page/$file")) { + include("$langpath/$CFG->lang/page/$file"); + } else { + include("$langpath/en/page/$file"); + } + } else { + echo "

"; + echo $text; + echo "

"; + } ?> diff --git a/lang/en/strings.php b/lang/en/strings.php index aff87ca9ee..ae05a28a6d 100644 --- a/lang/en/strings.php +++ b/lang/en/strings.php @@ -65,6 +65,9 @@ $string[fullprofile] = "Full profile"; $string[fullname] = "Full name"; $string[guestsno] = "No, do not allow guests in"; $string[guestsyes] = "Yes, allow 'guest' student in"; +$string[helppicture] = "How to upload a picture"; +$string[helptext] = "How to write text"; +$string[helpquestions] = "How to ask questions"; $string[home] = "Home"; $string[htmlformat] = "Pretty HTML format"; $string[icqnumber] = "ICQ number"; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 84f2def616..a54d44370c 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -311,11 +311,28 @@ function error ($message, $link="") { die; } -function helpbutton ($info, $type="file") { +function helpbutton ($page, $title="", $module="moodle", $image=true, $text="") { + // $page = the keyword that defines a help page + // $title = the title of links, rollover tips, alt tags etc + // $module = which module is the page defined in + // $image = use a help image for the link? (otherwise uses text) + // $text = if defined then this text is used in the page, and + // the $page variable is ignored. global $CFG; - $url = "/help.php?$type=help.$info.php"; - $image = "helpwwwroot/pix/help.gif\">"; - link_to_popup_window ($url, "popup", $image, $height=400, $width=500); + if ($module == "") { + $module = "moodle"; + } + if ($image) { + $linkobject = "\"$title\"wwwroot/pix/help.gif\">"; + } else { + $linkobject = $title; + } + if ($text) { + $url = "/help.php?module=$module&text=$text"; + } else { + $url = "/help.php?module=$module&file=help.$page.php"; + } + link_to_popup_window ($url, "popup", $linkobject, 400, 500, $title); } function notice ($message, $link="") { @@ -370,7 +387,6 @@ function notify ($message) { /// PARAMETER HANDLING //////////////////////////////////////////////////// function require_variable($var) { - if (! isset($var)) { error("A required parameter was missing"); } @@ -1324,5 +1340,4 @@ function format_time($totalsecs) { return "now"; } - ?> diff --git a/lib/weblib.php b/lib/weblib.php index 376a821f27..7052741908 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -123,7 +123,7 @@ function frmchecked(&$var, $true_value = "checked", $false_value = "") { } -function link_to_popup_window ($url, $name="popup", $linkname="click here", $height=400, $width=500) { +function link_to_popup_window ($url, $name="popup", $linkname="click here", $height=400, $width=500, $title="Popup window") { // This will create a HTML link that will work on both // Javascript and non-javascript browsers. // Relies on the Javascript function openpopup in javascript.php @@ -131,10 +131,10 @@ function link_to_popup_window ($url, $name="popup", $linkname="click here", $hei echo "\n"; - echo "\n\n"; + echo "\n\n"; } diff --git a/user/edit.html b/user/edit.html index f2e2b74f4d..0f6b139582 100644 --- a/user/edit.html +++ b/user/edit.html @@ -4,14 +4,14 @@

: - ( .jpg / .png ) + ( .jpg / .png )

: - +