]> git.mjollnir.org Git - moodle.git/commitdiff
Robustness fixes
authormoodler <moodler>
Wed, 1 Jan 2003 13:17:27 +0000 (13:17 +0000)
committermoodler <moodler>
Wed, 1 Jan 2003 13:17:27 +0000 (13:17 +0000)
mod/forum/mod.html
mod/journal/mod.html
mod/quiz/db/mysql.php
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.php
mod/quiz/db/postgres7.sql
mod/quiz/mod.html
mod/quiz/version.php
mod/resource/mod.html
mod/survey/mod.html

index 1d6009df8485a25c11b2e8c8241ba4ad67f14923..0c8674a8b4437f5404272d9044b74e8c5f94e70c 100644 (file)
@@ -1,3 +1,23 @@
+<?PHP
+    if (empty($form->name)) {
+        $form->name = "";
+    }
+    if (empty($form->type)) {
+        $form->type = "";
+    }
+    if (empty($form->intro)) {
+        $form->intro = "";
+    }
+    if (empty($form->open)) {
+        $form->open = "";
+    }
+    if (empty($form->assessed)) {
+        $form->assessed = "";
+    }
+    if (empty($form->forcesubscribe)) {
+        $form->forcesubscribe = "";
+    }
+?>
 <form name="form" method="post" action="<?=$ME ?>">
 <table cellpadding=5>
 <tr>
index 5e5f9c559401e4a8a0e6f9f471f73f68063bfaff..b62975b903dfa09acc6f39f273f2e67a9e5eb664 100644 (file)
@@ -1,3 +1,15 @@
+<?PHP
+    if (empty($form->name)) {
+        $form->name = "";
+    }
+    if (empty($form->intro)) {
+        $form->intro = "";
+    }
+    if (empty($form->days)) {
+        $form->days = "14";
+    }
+?>
+
 <form name="form" method="post" action="<?=$ME ?>">
 <table cellpadding=5>
 <tr valign=top>
@@ -32,9 +44,6 @@
             $options[$days] = get_string("numweeks", "", $i);
         }
         $options[365] = get_string("numweeks", "", 52);
-        if ($form->days == "") {
-            $form->days == "14";
-        }
         choose_from_menu($options, "days", "$form->days");
      ?>
     </TD>
index e369d715bfc3a934894fd3cc21535103ae57b777..754eef177db35fe42781251147f9ae053cdea588 100644 (file)
@@ -29,6 +29,12 @@ function quiz_upgrade($oldversion) {
         execute_sql("ALTER TABLE `quiz_attempts` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
     }
 
+    // prefixes required from here on
+
+    if ($oldversion < 2003010100) {
+        execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review TINYINT(4) UNSIGNED DEFAULT '0' NOT NULL AFTER `grademethod` ");
+    }
+
     return true;
 }
 
index f8042432dbbe5ba644af4246ee2497e713e79d99..4c844a757a56f70c897284450d72c32d9bd8238e 100644 (file)
@@ -24,6 +24,7 @@ CREATE TABLE `prefix_quiz` (
   `feedback` tinyint(4) NOT NULL default '0',
   `correctanswers` tinyint(4) NOT NULL default '1',
   `grademethod` tinyint(4) NOT NULL default '1',
+  `review` tinyint(4) NOT NULL default '0',
   `questions` text NOT NULL,
   `sumgrades` int(10) NOT NULL default '0',
   `grade` int(10) NOT NULL default '0',
index 1af9d80d021ced3b330bfbdb45efe8486f4d1780..87cd5dff4507f4d6d57c8d34c435fa879d9f0a14 100644 (file)
@@ -6,6 +6,10 @@ function quiz_upgrade($oldversion) {
 
     global $CFG;
 
+    if ($oldversion < 2003010100) {
+        execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review integer DEFAULT '0' NOT NULL AFTER `grademethod` ");
+    }
+
     return true;
 }
 
index 854da8858de114e05bb5157c97c6b23af39894cb..c42b7b02b0712d91e678467916e0ce5a6430fb9e 100644 (file)
@@ -24,6 +24,7 @@ CREATE TABLE prefix_quiz (
   feedback integer NOT NULL default '0',
   correctanswers integer NOT NULL default '1',
   grademethod integer NOT NULL default '1',
+  review integer NOT NULL default '0',
   questions text NOT NULL default '',
   sumgrades integer NOT NULL default '0',
   grade integer NOT NULL default '0',
index 8b2fe04b9d43d6095164a76f2b00ab67048f8d3f..4617f3ac1c3a5fb1069bd42229d485567aefaa76 100644 (file)
@@ -1,7 +1,42 @@
 <!-- This page defines the form to create or edit an instance of this module -->
 <!-- It is used from /course/mod.php.  The whole instance is available as $form. -->
 
-<? include_once("$CFG->dirroot/mod/quiz/lib.php") ?>
+<?PHP 
+    include_once("$CFG->dirroot/mod/quiz/lib.php");
+
+    if (empty($form->name)) {
+        $form->name = "";
+    }
+    if (empty($form->intro)) {
+        $form->intro = "";
+    }
+    if (empty($form->timeopen)) {
+        $form->timeopen = "";
+    }
+    if (empty($form->timeclose)) {
+        $form->timeclose = "";
+    }
+    if (empty($form->attempts)) {
+        $form->attempts = "";
+    }
+    if (empty($form->grademethod)) {
+        $form->grademethod = "";
+    }
+    if (empty($form->feedback)) {
+        $form->feedback = "";
+    }
+    if (empty($form->correctanswers)) {
+        $form->correctanswers = "";
+    }
+    if (empty($form->grade)) {
+        $form->grade = "";
+    }
+    if (empty($form->questions)) {
+        $form->questions = "";
+    }
+?>
+
+
 
 <FORM name="form" method="post" action="<?=$CFG->wwwroot?>/mod/quiz/edit.php">
 <CENTER>
index 24bfb42f241855ed14a9f7411a1dfb916f5f2865..ebd409fa8bf2b78876bda97bc38fe5c601ddeb9e 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2002122300;   // The (date) version of this module
+$module->version  = 2003010100;   // The (date) version of this module
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
 ?>
index 10608f196ca0d603110ca5dc2caeb377b6ec3efd..6b730b185372e64bd8132ddfb1dabd1d15ea3fe5 100644 (file)
@@ -1,3 +1,22 @@
+<?PHP
+    if (empty($form->name)) {
+        $form->name = "";
+    }
+    if (empty($form->type)) {
+        $form->type = "";
+    }
+    if (empty($form->summary)) {
+        $form->summary = "";
+    }
+    if (empty($form->reference)) {
+        $form->reference = "";
+    }
+    if (empty($form->alltext)) {
+        $form->alltext = "";
+    }
+?>
+
+
 <form name="form" method="post" action="<?=$CFG->wwwroot?>/mod/resource/details.php">
 <table cellpadding=5>
 <tr valign=top>
index e45cd6b160de3bbe914f394b8bc97dbebb17d4b5..2d8c1e4edd90a7cbd8cad5c04c718a1d4a8f2e0f 100644 (file)
@@ -1,3 +1,15 @@
+<?PHP
+    if (empty($form->name)) {
+        $form->name = "";
+    }
+    if (empty($form->template)) {
+        $form->template = "";
+    }
+    if (empty($form->intro)) {
+        $form->intro = "";
+    }
+?>
+
 <form name="form" method="post" action="<?=$CFG->wwwroot ?>/mod/survey/details.php">
 <table cellpadding=5>
 <tr valign=top>