]> git.mjollnir.org Git - moodle.git/commitdiff
Two new language variables implemented.
authormoodler <moodler>
Sat, 3 May 2003 06:50:29 +0000 (06:50 +0000)
committermoodler <moodler>
Sat, 3 May 2003 06:50:29 +0000 (06:50 +0000)
langmenu  - turns the language menu on and off
langlist  - allows the admin to restrict and/or re-order the available language choices

admin/config.html
doc/top.php
index.php
lang/en/moodle.php
lib/defaults.php
lib/moodlelib.php
login/index.php
login/signup.php

index 52ff77e3fb2067388e9f0c8bf7a1ca288e57cab5..0cfc0ba2c21df31d1cbadc562b75e7b163ce6823 100644 (file)
     <? print_string("configlangdir") ?>
     </td>
 </tr>
+<tr valign=top>
+       <td align=right><p>langmenu:</td>
+       <td>
+    <? unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+
+       choose_from_menu ($options, "langmenu", $config->langmenu, "", "", "");
+    ?>
+    </td>
+    <td>
+    <? print_string("configlangmenu") ?>
+    </td>
+</tr>
+<tr valign=top>
+       <td align=right><p>langlist:</td>
+       <td>
+    <input name=langlist type=text size=40 value="<?=$config->langlist?>">
+    </td>
+    <td>
+    <? print_string("configlanglist") ?>
+    </td>
+</tr>
 <tr valign=top>
        <td align=right><p>locale:</td>
        <td>
index 1f32f4d05fd0ff8fe31c553f7d92e2ad350fec60..82751d529f694ed3aa5fd96ec5fcad13329059ec 100644 (file)
@@ -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");
index 0d59bbab9ed33b4367b8ace79d46e0f0cf511424..c65396613b1a69a626546893e5efd9e4af192545 100644 (file)
--- a/index.php
+++ b/index.php
         $loginstring = "<font size=1>".user_login_string($site)."</font>";
     }
 
-    $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", "",
                  "<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",
index dbe5c12ae0f9d72b76367e63735f17f67ba16d38..f0be92b3a8d07f0fd88e781a170cabdc2017be44 100644 (file)
@@ -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.";
index c050dc789b3fc38c9aa7921d029d10735a6f4a6d..b265a3f91429304673893d96be86dbcf64ac3994 100644 (file)
@@ -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"              => ""
     );
 
 ?>
index a88bdfdfe47b6eeb39138594d73c12ba6eb0ecfb..ba0e99e75e0aada767cfedca0aec67208b898b7c 100644 (file)
@@ -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;
 }
 
index 1718696a1e3451f76f71d11242298aaa8d7b83b6..7b02215191376039ef53d94bc7b7b7ab8ed879d8 100644 (file)
         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");
 
index 965fabdc4c703e8704ef01670bec87346eb5747d..7b6485fb2166b33d1dc692a9c18959b21dbf1bc3 100644 (file)
     $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, "<A HREF=\"index.php\">$login</A> -> $newaccount", $focus, "", true, "<div align=right>$langmenu</div>");
     include("signup_form.html");