From: moodler Date: Sat, 3 May 2003 06:50:29 +0000 (+0000) Subject: Two new language variables implemented. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=984a8bf349b2e116acffad2947e678c0015c0339;p=moodle.git Two new language variables implemented. langmenu - turns the language menu on and off langlist - allows the admin to restrict and/or re-order the available language choices --- diff --git a/admin/config.html b/admin/config.html index 52ff77e3fb..0cfc0ba2c2 100644 --- a/admin/config.html +++ b/admin/config.html @@ -24,6 +24,29 @@ + +

langmenu: + + langmenu, "", "", ""); + ?> + + + + + + +

langlist: + + + + + + +

locale: diff --git a/doc/top.php b/doc/top.php index 1f32f4d05f..82751d529f 100644 --- a/doc/top.php +++ b/doc/top.php @@ -2,10 +2,13 @@ require("../config.php"); - $currlang = current_language(); - - $langs = get_list_of_languages(); - $langmenu = popup_form ("$CFG->wwwroot/doc/?lang=", $langs, "chooselang", $currlang, "", "", "", true); + if (empty($CFG->langmenu)) { + $langmenu = ""; + } else { + $currlang = current_language(); + $langs = get_list_of_languages(); + $langmenu = popup_form ("$CFG->wwwroot/doc/?lang=", $langs, "chooselang", $currlang, "", "", "", true); + } if (! $site = get_site()) { error("Site is misconfigured"); diff --git a/index.php b/index.php index 0d59bbab9e..c65396613b 100644 --- a/index.php +++ b/index.php @@ -22,9 +22,13 @@ $loginstring = "".user_login_string($site).""; } - $currlang = current_language(); - $langs = get_list_of_languages(); - $langmenu = popup_form ("$CFG->wwwroot/?lang=", $langs, "chooselang", $currlang, "", "", "", true); + if (empty($CFG->langmenu)) { + $langmenu = ""; + } else { + $currlang = current_language(); + $langs = get_list_of_languages(); + $langmenu = popup_form ("$CFG->wwwroot/?lang=", $langs, "chooselang", $currlang, "", "", "", true); + } print_header("$site->fullname", "$site->fullname", "home", "", "summary))."\">", diff --git a/lang/en/moodle.php b/lang/en/moodle.php index dbe5c12ae0..f0be92b3a8 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -67,6 +67,8 @@ $string['confightmleditor'] = "Choose whether or not to allow use of the embedde $string['configintro'] = "On this page you can specify a number of configuration variables that help make Moodle work properly on your server. Don't worry too much about it - the defaults will usually work fine and you can always come back to this page later and change these settings."; $string['configlang'] = "Choose a default language for the whole site. Users can override this setting later."; $string['configlangdir'] = "Most languages are printed left-to-right, but some, like Arabic and Hebrew, are printed right-to-left."; +$string['configlangmenu'] = "Choose whether or not you want to display the general-purpose language menu on the home page, login page etc. This does not affect the user's ability to set the preferred language in their own profile."; +$string['configlanglist'] = "Leave this blank to allow users to choose from any language you have in this installation of Moodle. However, you can shorten the language menu by entering a comma-separated list of language codes that you want. For example: en,es_es,fr,it"; $string['configlocale'] = "Choose a sitewide locale - this will affect the format and language of dates. You need to have this locale data installed on your operating system. (eg en_US or es_ES). If you don't know what to choose leave it blank."; $string['configlongtimenosee'] = "If students haven't logged in for a very long time, then they are automatically unsubscribed from courses. This parameter specifies that time limit."; $string['configloglifetime'] = "This specifies the length of time you want to keep logs about user activity. Logs that are older than this age are automatically deleted. It is best to keep logs as long as possible, in case you need them, but if you have a very busy server and are experiencing performance problems, then you may want to lower the log lifetime."; diff --git a/lib/defaults.php b/lib/defaults.php index c050dc789b..b265a3f914 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -4,31 +4,33 @@ // It defines default values for any important configuration variables $defaults = array ( - "theme" => "standard", + "auth" => "email", + "changepassword" => true, + "country" => "", + "debug" => 7, + "framename" => "_top", + "gdversion" => 1, + "guestloginbutton" => 1, + "htmleditor" => true, "lang" => "en", "langdir" => "LTR", + "langmenu" => 1, + "langhide" => "", "locale" => "en", - "auth" => "email", - "smtphosts" => "", - "smtpuser" => "", - "smtppass" => "", - "gdversion" => 1, - "longtimenosee" => 100, "loglifetime" => 0, - "zip" => "", - "unzip" => "", - "slasharguments" => 1, - "htmleditor" => true, - "proxyhost" => "", - "proxyport" => "", + "longtimenosee" => 100, "maxeditingtime" => 1800, - "changepassword" => true, - "country" => "", "prefix" => "", - "guestloginbutton" => 1, + "proxyhost" => "", + "proxyport" => "", "sessiontimeout" => 7200, - "framename" => "_top", - "debug" => 7 + "slasharguments" => 1, + "smtphosts" => "", + "smtppass" => "", + "smtpuser" => "", + "theme" => "standard", + "unzip" => "", + "zip" => "" ); ?> diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a88bdfdfe4..ba0e99e75e 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1024,15 +1024,28 @@ function get_list_of_languages() { /// Returns a list of language codes and their full names global $CFG; - if (!$langdirs = get_list_of_plugins("lang")) { - return false; + $languages = array(); + + if (!empty($CFG->langlist)) { // use admin's list of languages + $langlist = explode(',', $CFG->langlist); + foreach ($langlist as $lang) { + if (file_exists("$CFG->dirroot/lang/$lang/moodle.php")) { + include("$CFG->dirroot/lang/$lang/moodle.php"); + $languages[$lang] = $string["thislanguage"]." ($lang)"; + unset($string); + } + } + } else { + if (!$langdirs = get_list_of_plugins("lang")) { + return false; + } + foreach ($langdirs as $lang) { + include("$CFG->dirroot/lang/$lang/moodle.php"); + $languages[$lang] = $string["thislanguage"]." ($lang)"; + unset($string); + } } - foreach ($langdirs as $lang) { - include("$CFG->dirroot/lang/$lang/moodle.php"); - $languages[$lang] = $string["thislanguage"]." ($lang)"; - unset($string); - } return $languages; } diff --git a/login/index.php b/login/index.php index 1718696a1e..7b02215191 100644 --- a/login/index.php +++ b/login/index.php @@ -106,9 +106,13 @@ error("No site found!"); } - $currlang = current_language(); - $langs = get_list_of_languages(); - $langmenu = popup_form ("$CFG->wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); + if (empty($CFG->langmenu)) { + $langmenu = ""; + } else { + $currlang = current_language(); + $langs = get_list_of_languages(); + $langmenu = popup_form ("$CFG->wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); + } $loginsite = get_string("loginsite"); diff --git a/login/signup.php b/login/signup.php index 965fabdc4c..7b6485fb21 100644 --- a/login/signup.php +++ b/login/signup.php @@ -57,10 +57,13 @@ $newaccount = get_string("newaccount"); $login = get_string("login"); - $currlang = current_language(); - $langs = get_list_of_languages(); - $langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); - + if (empty($CFG->langmenu)) { + $langmenu = ""; + } else { + $currlang = current_language(); + $langs = get_list_of_languages(); + $langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); + } print_header($newaccount, $newaccount, "$login -> $newaccount", $focus, "", true, "

$langmenu
"); include("signup_form.html");