]> git.mjollnir.org Git - moodle.git/commitdiff
Changes related to module editing buttons
authormoodler <moodler>
Wed, 16 Oct 2002 04:53:44 +0000 (04:53 +0000)
committermoodler <moodler>
Wed, 16 Oct 2002 04:53:44 +0000 (04:53 +0000)
course/mod.php
lang/en/moodle.php
lib/moodlelib.php

index 1e7f8b6ac34326bbaefbae01499e2f5a6b713585..9653003ae59c65381ab934007a85b820c0155cc9 100644 (file)
@@ -5,6 +5,18 @@
     require("../config.php");
     require("lib.php");
 
+    if (isset($cancel)) {  
+        if ($SESSION->returnpage) {
+            $return = $SESSION->returnpage;
+            unset($SESSION->returnpage);
+            save_session("SESSION");
+            redirect($return);
+        } else {
+            redirect("view.php?id=$mod->course");
+        }
+    } 
+
+
     if (isset($course) && isset($HTTP_POST_VARS)) {    // add or update form submitted
 
         if (isset($SESSION->modform)) {   // Variables are stored in the session
         exit;
     }
 
-    if (isset($return)) {  
-        $SESSION->returnpage = $HTTP_REFERER;
-        save_session("SESSION");
-    }
 
     if (isset($move)) {  
 
             error("This course section doesn't exist");
         }
 
+        if (isset($return)) {  
+            $SESSION->returnpage = "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id";
+            save_session("SESSION");
+        }
+
         $form->coursemodule = $cm->id;
         $form->section      = $cm->section;     // The section ID
         $form->course       = $course->id;
index 8d445678f62ae9e2177042f9fd9f8e0313681116..efa33d0833d2def30d91d544af675fb98d500cb9 100644 (file)
@@ -454,6 +454,7 @@ $string['updatesevery'] = "Updates every \$a seconds";
 $string['updatethiscourse'] = "Update this course";
 $string['updatinga'] = "Updating a \$a";
 $string['updatingain'] = "Updating a \$a->what in \$a->in";
+$string['updatethis'] = "Update this \$a";
 $string['upload'] = "Upload";
 $string['uploadafile'] = "Upload a file";
 $string['uploadthisfile'] = "Upload this file";
index 8ab9db854d2c95112985f70714cc01e92c970738..888173ae376421e8d094968fca5f6fa48d89d7a3 100644 (file)
@@ -357,22 +357,23 @@ function update_course_icon($courseid) {
             $string = get_string("turneditingon");
             $edit = "on";
         }
-        return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/view.php\">
-                <INPUT TYPE=hidden NAME=id VALUE=\"$courseid\">
-                <INPUT TYPE=hidden NAME=edit VALUE=\"$edit\">
-                <INPUT TYPE=submit VALUE=\"$string\"></FORM>";
+        return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/view.php\">".
+               "<INPUT TYPE=hidden NAME=id VALUE=\"$courseid\">".
+               "<INPUT TYPE=hidden NAME=edit VALUE=\"$edit\">".
+               "<INPUT TYPE=submit VALUE=\"$string\"></FORM>";
     }
 }
 
-function update_module_icon($moduleid, $courseid) {
-// Used to be an icon, but it's now a simple form button
+function update_module_button($moduleid, $courseid, $string) {
+// Prints the editing button on a module "view" page
     global $CFG;
 
     if (isteacher($courseid)) {
-        return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/mod.php\">
-                <INPUT TYPE=hidden NAME=update VALUE=\"$moduleid\">
-                <INPUT TYPE=hidden NAME=return VALUE=\"true\">
-                <INPUT TYPE=submit VALUE=\"".get_string("editthisactivity")."\"></FORM>";
+        $string = get_string("updatethis", "", $string);
+        return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/mod.php\">".
+               "<INPUT TYPE=hidden NAME=update VALUE=\"$moduleid\">".
+               "<INPUT TYPE=hidden NAME=return VALUE=\"true\">".
+               "<INPUT TYPE=submit VALUE=\"$string\"></FORM>";
     }
 }
 
@@ -2013,7 +2014,10 @@ function check_browser_version($brand="MSIE", $version=5.5) {
 
 function can_use_richtext_editor() {
     global $USER, $CFG;
-    return (check_browser_version("MSIE", 5.5) and $USER->htmleditor and $CFG->htmleditor);
+    if ($USER->htmleditor and $CFG->htmleditor) {
+        return check_browser_version("MSIE", 5.5);
+    }
+    return false;
 }