From: moodler <moodler>
Date: Mon, 23 Aug 2004 12:29:29 +0000 (+0000)
Subject: MOre tolerant of empty fields, and fixed heading
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a8449f8c71df80c9e798f3ec81953e7cabbe8830;p=moodle.git

MOre tolerant of empty fields, and fixed heading
---

diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php
index 1422210cc3..a52da9bb40 100644
--- a/mod/quiz/edit.php
+++ b/mod/quiz/edit.php
@@ -15,8 +15,14 @@
 
     if ($modform and !empty($modform->course)) {    // form submitted from mod.html
 
-        if (empty($modform->name) or empty($modform->intro)) {
-            error(get_string("filloutallfields"), $_SERVER["HTTP_REFERER"]);
+        $modform->name = trim($modform->name);
+
+        if (empty($modform->name)) {
+            if (empty($modform->intro)) {
+                $modform->name = get_string('modulename', 'quiz');
+            } else {
+                $modform->name = strip_tags($modform->intro);
+            }
         }
 
         $SESSION->modform = $modform;    // Save the form in the current session
@@ -164,7 +170,7 @@
     $strediting = get_string(isset($modform->instance) ? "editingquiz" : "editquestions", "quiz");
     $strheading = empty($modform->name) ? $strediting : $modform->name;
 
-    print_header_simple("$strediting", "$strheading",
+    print_header_simple($strediting, '',
                  "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a> -> $strediting");
 
     // Print basic page layout.