]> git.mjollnir.org Git - moodle.git/commitdiff
Solved some notices (debug mode) when creating new entries...
authorstronk7 <stronk7>
Mon, 10 May 2004 18:10:17 +0000 (18:10 +0000)
committerstronk7 <stronk7>
Mon, 10 May 2004 18:10:17 +0000 (18:10 +0000)
mod/glossary/edit.html
mod/glossary/edit.php

index 11427c9a598750a7bc6e924ff845b2a61aa2fb77..fdfcdc8a57420281516ec494a5242d88127d9448 100644 (file)
@@ -66,7 +66,7 @@ if (isset($errors)) {
     } else {
         echo '<script>var items = [\'casesensitive\',\'fullmatch\'];</script>';
 
-        if (!empty($newentry->usedynalink) or ($CFG->glossary_linkentries and !isset($newentry->id) ) ) {
+        if (!empty($newentry->usedynalink)) {
             $selected = "checked";
         } else {
             $selected = "";
@@ -78,7 +78,7 @@ if (isset($errors)) {
         echo helpbutton("usedynalink", strip_tags(get_string("usedynalink", "glossary")), "glossary"); 
         echo '<br />';
 
-        if (!empty($newentry->casesensitive) or ($CFG->glossary_casesensitive and !isset($newentry->id)) ) {
+        if (!empty($newentry->casesensitive)) {
             $selected = "checked";
         } else {
             $selected = "";
@@ -91,7 +91,7 @@ if (isset($errors)) {
         echo '<br />';
 
 
-        if (!empty($newentry->fullmatch) or ($CFG->glossary_fullmatch and !isset($newentry->id)) ) {
+        if (!empty($newentry->fullmatch)) {
             $selected = "checked";
         } else {
             $selected = "";
index e560494174600b61db2577ca8eb0c12dbecc2be1..fd75a7a2042443d263619a4149cacfcb68d54f59 100644 (file)
@@ -120,6 +120,8 @@ if ( $confirm ) {
             error("Could not update this glossary entry because this concept already exist.");
         }
     } else {
+
+echo "Creating!!!!!";
         $newentry->userid = $USER->id;
         $newentry->timecreated = $timenow;
         $newentry->sourceglossaryid = 0;
@@ -201,8 +203,38 @@ if ( $confirm ) {
         }
     }
 }
-/// Otherwise fill and print the form.
-
+//Fill and print the form. 
+//We check every field has a default values here!!
+if (!isset($newentry->concept)) {
+    $newentry->concept = "";
+}
+if (!isset($newentry->aliases)) {
+    $newentry->aliases = "";
+}
+if (!isset($newentry->usedynalink)) {
+    if (isset($CFG->glossary_linkentries)) {
+        $newentry->usedynalink = $CFG->glossary_linkentries;
+    } else {
+        $newentry->usedynalink = 0;
+    }
+}
+if (!isset($newentry->casesensitive)) {
+    if (isset($CFG->glossary_casesensitive)) {
+        $newentry->casesensitive = $CFG->glossary_casesensitive;
+    } else {
+        $newentry->casesensitive = 0;
+    }         
+}
+if (!isset($newentry->fullmatch)) {
+    if (isset($CFG->glossary_fullmatch)) {
+        $newentry->fullmatch = $CFG->glossary_fullmatch;
+    } else {
+        $newentry->fullmatch = 0;
+    }  
+}
+if (!isset($newentry->definition)) {
+    $newentry->definition = "";
+}
 $strglossary = get_string("modulename", "glossary");
 $strglossaries = get_string("modulenameplural", "glossary");
 $stredit = get_string("edit");