From 778c28671af6b465e6cefebd5acacbce3367e46c Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 14 Dec 2002 08:18:18 +0000 Subject: [PATCH] Added new configuration setting "country" to set a default country for the site. If this is set then user menus are pre-selected. eg when signing up or filling out profile after external authentication. --- admin/config.html | 8 ++++++++ admin/config.php | 1 + lang/en/moodle.php | 1 + lang/en_us/moodle.php | 1 + lib/defaults.php | 1 + login/index_form.html | 8 ++++---- login/signup.php | 4 ++++ login/signup_form.php | 2 +- user/edit.html | 8 +++++++- 9 files changed, 28 insertions(+), 6 deletions(-) diff --git a/admin/config.html b/admin/config.html index 4a4dfd5f158df..6403cbba018be 100644 --- a/admin/config.html +++ b/admin/config.html @@ -36,6 +36,14 @@ + +

country: + country, get_string("selectacountry"), "", "") ?> + + + + +

smtphosts: diff --git a/admin/config.php b/admin/config.php index b6673fe27a5ba..592bfdd1a8038 100644 --- a/admin/config.php +++ b/admin/config.php @@ -2,6 +2,7 @@ // config.php - allows admin to edit all configuration variables include("../config.php"); + require("../lib/countries.php"); if (isset($phpinfo)) { // For debugging purposes, protected by password if (md5($phpinfo) == "caf9b6b99962bf5c2264824231d7a40c") { diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 11caf07e00924..6ba911c13faee 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -53,6 +53,7 @@ $string['city'] = "City/town"; $string['closewindow'] = "Close this window"; $string['comparelanguage'] = "Compare and edit current language"; +$string['configcountry'] = "If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset."; $string['configgdversion'] = "Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing."; $string['configerrorlevel'] = "Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice."; $string['confightmleditor'] = "Choose whether or not to allow use of the embedded HTML text editor. Even if you choose allow, this editor will only appear when the user is using a compatible browser (IE 5.5 or later). Users can also choose not to use it."; diff --git a/lang/en_us/moodle.php b/lang/en_us/moodle.php index 2c834e9678e02..0f69d8964ca1f 100644 --- a/lang/en_us/moodle.php +++ b/lang/en_us/moodle.php @@ -53,6 +53,7 @@ $string['closewindow'] = "Close this window"; $string['comparelanguage'] = "Compare and edit current language"; $string['complete'] = "Complete"; +$string['configcountry'] = "If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset."; $string['configerrorlevel'] = "Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice."; $string['configgdversion'] = "Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing."; $string['confightmleditor'] = "Choose whether or not to allow use of the embedded HTML text editor. Even if you choose allow, this editor will only appear when the user is using a compatible browser (IE 5.5 or later). Users can also choose not to use it."; diff --git a/lib/defaults.php b/lib/defaults.php index 24f3e48e8e795..b91dccbeabae7 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -21,6 +21,7 @@ "proxyhost" => "", "proxyport" => "", "maxeditingtime" => 1800, + "country" => "", "guestloginbutton" => 1 ); diff --git a/login/index_form.html b/login/index_form.html index 41ff81378ec5d..927bb5255795f 100644 --- a/login/index_form.html +++ b/login/index_form.html @@ -3,16 +3,16 @@ - - - -
cellheading2?> class="generaltableheader"> + cellheading2?> class="headingblock">

cellheading2?> class="generaltableheader"> + cellheading2?> class="headingblock">

+

:
()
@@ -74,7 +74,7 @@

+ auth) { case "email": ?> diff --git a/login/signup.php b/login/signup.php index 28a4683db28b1..d53f59ef75105 100644 --- a/login/signup.php +++ b/login/signup.php @@ -40,6 +40,10 @@ } } + if (!$user->country and $CFG->country) { + $user->country = $CFG->country; + } + $newaccount = get_string("newaccount"); $login = get_string("login"); diff --git a/login/signup_form.php b/login/signup_form.php index ac50411200e50..f37d41f0e293f 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -1,5 +1,5 @@
-
+
diff --git a/user/edit.html b/user/edit.html index 45c1a4125660a..6ff8f01cfa725 100644 --- a/user/edit.html +++ b/user/edit.html @@ -81,7 +81,13 @@ -

:

country, get_string("selectacountry")."...", "", "") ?> + country and $CFG->country) { + $user->country = $CFG->country; + } + + choose_from_menu ($COUNTRIES, "country", $user->country, get_string("selectacountry")."...", "", "") ?>