From 1f33691c864126762bfc20cba1f687d838f18144 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 6 May 2003 15:58:20 +0000 Subject: [PATCH] Cleaned up the initial setup process. It looks a bit smoother now. Hopefully this is also the end of the occasional errors we keep hearing about to do with never getting to setup the admin user. (I think admin/site.php had a redirect that didn't always work). The setup process is now much better at "trapping" you until it's all done. --- admin/config.php | 7 ++- admin/index.php | 12 ++--- admin/lang.php | 11 +++- admin/site.php | 26 ++++++--- admin/user.php | 6 ++- lang/en/docs/release.html | 110 +++++++++++++++++++------------------- lang/en/moodle.php | 7 ++- lang/en/survey.php | 1 + user/edit.php | 30 ++++++++--- 9 files changed, 130 insertions(+), 80 deletions(-) diff --git a/admin/config.php b/admin/config.php index db440ce660..623b3ab171 100644 --- a/admin/config.php +++ b/admin/config.php @@ -86,13 +86,16 @@ print_header(); print_heading($strconfigvariables); print_simple_box(get_string("configintro"), "center"); - echo "
"; + echo "
"; } print_simple_box_start("center", "", "$THEME->cellheading"); include("config.html"); print_simple_box_end(); - print_footer(); + + if ($site) { + print_footer(); + } exit; diff --git a/admin/index.php b/admin/index.php index e7298cdfff..2af34bcb59 100644 --- a/admin/index.php +++ b/admin/index.php @@ -92,9 +92,9 @@ if (!$agreelicence) { $strlicense = get_string("license"); print_header($strlicense, $strlicense, $strlicense); - print_heading("Moodle - Modular Object-Oriented Dynamic Learning Environment"); + print_heading("Moodle - Modular Object-Oriented Dynamic Learning Environment"); print_heading(get_string("copyrightnotice")); - print_simple_box_start("CENTER"); + print_simple_box_start("center"); echo text_to_html(get_string("gpl")); print_simple_box_end(); echo "
"; @@ -156,8 +156,8 @@ } } else { - $strdatabaseupgrades = get_string("databaseupgrades"); - print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades); + $strcurrentversion = get_string("currentversion"); + print_header($strcurrentversion, $strcurrentversion, $strcurrentversion); if (set_config("version", $version)) { print_heading("You are currently using Moodle version $version (Release $release)"); @@ -177,8 +177,8 @@ /// Updated human-readable release version if necessary if ($release <> $CFG->release) { // Update the release version - $strdatabaseupgrades = get_string("databaseupgrades"); - print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades); + $strcurrentrelease = get_string("currentrelease"); + print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease); print_heading($release); if (!set_config("release", $release)) { notify("ERROR: Could not update release version in database!!"); diff --git a/admin/lang.php b/admin/lang.php index 763c3fe23b..9605cb1785 100644 --- a/admin/lang.php +++ b/admin/lang.php @@ -176,6 +176,9 @@ } echo ""; foreach ($enstring as $key => $envalue) { + $envalue = trim($envalue); + $envalue = str_replace("\n\r\n\r","\n",$envalue); + $envalue = str_replace("\n\n","\n",$envalue); $envalue = nl2br(htmlspecialchars($envalue)); $envalue = preg_replace('/(\$a\-\>[a-zA-Z0-9]*|\$a)/', '$0', $envalue); // Make variables bold. $envalue = str_replace("%%","%",$envalue); @@ -184,7 +187,13 @@ echo ""; echo ""; - $value = str_replace("\\","",$string[$key]); // Delete all slashes + $value = $string[$key]; + $value = trim($value); + $value = str_replace("\n\r","\n",$value); + $value = str_replace("\n\n","\n",$value); + $value = str_replace("\n\n","\n",$value); + $value = str_replace("\n\n","\n",$value); + $value = str_replace("\\","",$value); // Delete all slashes $value = str_replace("%%","%",$value); $value = htmlspecialchars($value); diff --git a/admin/site.php b/admin/site.php index a7271f5a26..ccfe14c6be 100644 --- a/admin/site.php +++ b/admin/site.php @@ -6,8 +6,8 @@ if (!isadmin()) { error("You need to be admin to edit this page"); } + $site->format = "social"; // override } - $site->format = "social"; // override /// If data submitted, then process and store. @@ -21,7 +21,7 @@ if ($form->id) { if (update_record("course", $form)) { - redirect("index.php", get_string("changessaved")); + redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved")); } else { error("Serious Error! Could not update the site record! (id = $form->id)"); } @@ -29,7 +29,7 @@ if ($newid = insert_record("course", $form)) { $cat->name = get_string("miscellaneous"); if (insert_record("course_categories", $cat)) { - redirect("index.php", get_string("changessaved"), "1"); + redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved")); } else { error("Serious Error! Could not set up a default course category!"); } @@ -50,10 +50,12 @@ if ($site and empty($form)) { $form = $site; + $firsttime = false; } else { $form->category = 0; $form->format = "social"; $form->newsitems = 0; + $firsttime = true; } if (empty($focus)) { @@ -63,14 +65,24 @@ $stradmin = get_string("administration"); $strsitesettings = get_string("sitesettings"); - print_header("$site->shortname: $strsitesettings", "$site->fullname", - "$stradmin -> $strsitesettings", "$focus"); + if ($firsttime) { + print_header(); + print_heading($strsitesettings); + print_simple_box(get_string("configintrosite"), "center"); + echo "
"; + } else { + print_header("$site->shortname: $strsitesettings", "$site->fullname", + "$stradmin -> $strsitesettings", "$focus"); + print_heading($strsitesettings); + } - print_heading($strsitesettings); print_simple_box_start("center", "", "$THEME->cellheading"); include("site.html"); print_simple_box_end(); - print_footer(); + + if (!$firsttime) { + print_footer(); + } exit; diff --git a/admin/user.php b/admin/user.php index 82a4acf30a..f2d934777f 100644 --- a/admin/user.php +++ b/admin/user.php @@ -15,8 +15,8 @@ optional_variable($search, ""); if (! record_exists("user_admins")) { // No admin user yet - $user->firstname = "Admin"; - $user->lastname = "User"; + $user->firstname = get_string("admin"); + $user->lastname = get_string("user"); $user->username = "admin"; $user->password = md5("admin"); $user->email = "root@localhost"; @@ -55,8 +55,10 @@ $USER->site = $CFG->wwwroot; $USER->admin = true; $USER->teacher["$site->id"] = true; + $USER->newadminuser = true; redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id"); + exit; } else { if (! $site = get_site()) { diff --git a/lang/en/docs/release.html b/lang/en/docs/release.html index 6e1abbe43d..335e1dc714 100644 --- a/lang/en/docs/release.html +++ b/lang/en/docs/release.html @@ -15,106 +15,106 @@ diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 6a7ac547dc..c0c8daff16 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -65,6 +65,8 @@ $string['configgdversion'] = "Indicate the version of GD that is installed. The $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."; $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['configintroadmin'] = "On this page you should configure your main administrator account which will have complete control over the site. Make sure you give it a secure username and password as well as a valid email address. You can create more admin accounts later on."; +$string['configintrosite'] = "This page allows you to configure the front page and name of this new site. You can come back here later to change these settings any time using the 'Site Settings' link on the home page."; $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."; @@ -99,6 +101,8 @@ $string['createuserandpass'] = "Create a new username and password to log in wit $string['createziparchive'] = "Create zip archive"; $string['currentlanguage'] = "Current language"; $string['currentlocaltime'] = "your current local time"; +$string['currentrelease'] = "Current release information"; +$string['currentversion'] = "Current version"; $string['databasechecking'] = "Upgrading Moodle database from version \$a->oldversion to \$a->newversion..."; $string['databasesetup'] = "Setting up database"; $string['databasesuccess'] = "Database was successfully upgraded"; @@ -235,7 +239,7 @@ $string['gd1'] = "GD 1.x is installed"; $string['gd2'] = "GD 2.x is installed"; $string['gdneed'] = "GD must be installed to see this graph"; $string['gdnot'] = "GD is not installed"; -$string['gpl'] = "Copyright (C) 2001-on Martin Dougiamas (http://dougiamas.com) +$string['gpl'] = "Copyright (C) 2001-2003 Martin Dougiamas (http://dougiamas.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -586,6 +590,7 @@ $string['userfiles'] = "User Files"; $string['username'] = "Username"; $string['usernameexists'] = "This username already exists, choose another"; $string['userprofilefor'] = "User profile for \$a"; +$string['user'] = "User"; $string['users'] = "Users"; $string['webpage'] = "Web page"; $string['week'] = "Week"; diff --git a/lang/en/survey.php b/lang/en/survey.php index 5bf2badadd..e229e39c4c 100644 --- a/lang/en/survey.php +++ b/lang/en/survey.php @@ -178,6 +178,7 @@ $string['downloadexcel'] = "Download data as Excel spreadsheet"; $string['downloadinfo'] = "You can download the complete raw data for this survey in a form suitable for analysis in Excel, SPSS or other package."; $string['downloadtext'] = "Download data as a plain text file"; $string['editingasurvey'] = "Editing a survey"; +$string['guestsnotallowed'] = "Guests are not allowed to submit surveys"; $string['helpsurveys'] = "Help on the different types of surveys"; $string['howlong'] = "How long did this survey take you to complete?"; $string['howlongoptions'] = "under 1 min,1-2 min,2-3 min,3-4 min,4-5-min,5-10 min,more than 10"; diff --git a/user/edit.php b/user/edit.php index bd7c38dfa6..a1097d275d 100644 --- a/user/edit.php +++ b/user/edit.php @@ -93,9 +93,13 @@ foreach ($usernew as $variable => $value) { $USER->$variable = $value; } - redirect("view.php?id=$user->id&course=$course->id", get_string("changessaved")); + if (isset($USER->newadminuser)) { + unset($USER->newadminuser); + redirect("$CFG->wwwroot", get_string("changessaved")); + } + redirect("$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id", get_string("changessaved")); } else { - redirect("../admin/user.php", get_string("changessaved")); + redirect("$CFG->wwwroot/admin/user.php", get_string("changessaved")); } } else { error("Could not update the user record ($user->id)"); @@ -122,9 +126,13 @@ -> id&course=$course->id\">$userfullname -> $streditmyprofile", ""); } else { - print_header("$course->shortname: $streditmyprofile", "$course->fullname", - "id&course=$course->id\">$userfullname - -> $streditmyprofile", ""); + if (isset($USER->newadminuser)) { + print_header(); + } else { + print_header("$course->shortname: $streditmyprofile", "$course->fullname", + "id&course=$course->id\">$userfullname + -> $streditmyprofile", ""); + } } } else { $userfullname = $strnewuser; @@ -144,6 +152,12 @@ } print_heading( get_string("userprofilefor", "", "$userfullname") ); + + if (isset($USER->newadminuser)) { + print_simple_box(get_string("configintroadmin"), "center"); + echo "
"; + } + print_simple_box_start("center", "", "$THEME->cellheading"); if (!empty($err)) { echo "
"; @@ -152,8 +166,12 @@ } include("edit.html"); print_simple_box_end(); - print_footer($course); + if (!isset($USER->newadminuser)) { + print_footer($course); + } + + exit; -- 2.39.5
cellheading\" NOWRAP VALIGN=TOP>$keycellheading\" VALIGN=TOP>$envalue