From 21ddaf605c84d56f33394443917ea31f13c13f8b Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 25 Nov 2001 15:48:24 +0000 Subject: [PATCH] Several changes related to the front page, so that it now works OK. --- config.php | 12 ++++++------ course/view.php | 8 ++++---- file.php | 9 ++++++--- lib/moodlelib.php | 12 ++++++++++++ theme/standard/footer.html | 19 ++++++++----------- 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/config.php b/config.php index 77b4a79d81..e9dfee8743 100644 --- a/config.php +++ b/config.php @@ -14,15 +14,15 @@ $CFG->dbtype = "mysql"; // eg mysql, postgres, oracle, access etc $CFG->dbhost = "localhost"; // eg localhost $CFG->dbname = "moodle"; // eg moodle -$CFG->dbuser = "muser"; -$CFG->dbpass = "mpassword"; +$CFG->dbuser = "moodle"; +$CFG->dbpass = "moodle"; // Next you need to tell Moodle where it is, and where it can save files. -$CFG->wwwroot = "http://example.com/moodle"; -$CFG->dirroot = "/home/httpd/moodle"; -$CFG->dataroot = "/home/moodledata"; // Web-server writeable +$CFG->wwwroot = "http://server.dougiamas.net/moodle"; +$CFG->dirroot = "/web/server/moodle"; +$CFG->dataroot = "/web/moodledata"; // Web-server writeable // Choose a theme from the "themes" folder. Default theme is "standard". @@ -33,7 +33,7 @@ $CFG->theme = "standard"; // Give the full name (eg mail.example.com) of an SMTP server that the // web server machine has access to (to send mail). Default: "localhost". -$CFG->smtphost = "mail.example.com"; +$CFG->smtphost = "dougiamas.com"; // You should not need to change anything below this line diff --git a/course/view.php b/course/view.php index 3044a7b4c0..f7fc198852 100644 --- a/course/view.php +++ b/course/view.php @@ -12,10 +12,6 @@ error("That's an invalid course id"); } - if (! $course->category) { // This course is not a real course. - redirect("$CFG->wwwroot"); - } - add_to_log("View course: $course->shortname", $id); if ( $USER->teacher[$course->id] ) { @@ -31,6 +27,10 @@ $USER->help = false; } + if (! $course->category) { // This course is not a real course. + redirect("$CFG->wwwroot"); + } + print_header("Course: $course->fullname", "$course->fullname", "$course->shortname", ""); if (! $modtypes = get_records_sql_menu("SELECT name,fullname FROM modules ORDER BY fullname") ) { diff --git a/file.php b/file.php index bd787620d7..fa1bd9cf93 100644 --- a/file.php +++ b/file.php @@ -13,13 +13,16 @@ $args = get_slash_arguments(); $numargs = count($args); - $courseid = (integer)$args[0]; - if ($courseid > 0) { + $course = get_record("course", "id", $courseid); + + if ($course->category) { require_login($courseid); } + // it's OK to get here if no course was specified + $pathname = "$CFG->dataroot$PATH_INFO"; $filename = $args[$numargs-1]; @@ -36,7 +39,7 @@ header("Content-type: $mimetype"); readfile("$pathname"); } else { - error("Sorry, but the file you are looking for was not found", "/course/view.php?id=$courseid"); + error("Sorry, but the file you are looking for was not found", "course/view.php?id=$courseid"); } exit; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a8c181a28e..bd109174bb 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -156,6 +156,18 @@ function print_table($table) { return true; } +function print_editing_switch($courseid) { + global $CFG, $USER; + + if (isadmin() || isteacher($courseid)) { + if ($USER->editing) { + echo "wwwroot/course/view.php?id=$courseid&edit=off\">Turn editing off"; + } else { + echo "wwwroot/course/view.php?id=$courseid&edit=on\">Turn editing on"; + } + } +} + function moodledate($date) { return date("l, j F Y, g:i A T", $date); diff --git a/theme/standard/footer.html b/theme/standard/footer.html index 49045eb18e..5645faa7d1 100644 --- a/theme/standard/footer.html +++ b/theme/standard/footer.html @@ -1,18 +1,15 @@

-

+ +

id) { - echo "You are logged in as $USER->firstname $USER->lastname. "; - if ($USER->survey) { - echo " (Student)
To log out you need to quit the browser."; - } else { - echo " (wwwroot/login/logout.php>Logout)"; - } - } else { - echo "You are not logged in. wwwroot/login/>Log in here."; - } + echo "You are logged in as $USER->firstname $USER->lastname."; + echo "(wwwroot/login/logout.php\">Logout)"; + } else { + echo "You are not logged in. wwwroot/login/\">Log in here."; + } ?>

- +
-- 2.39.5