} 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 = "";
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 = "";
echo '<br />';
- if (!empty($newentry->fullmatch) or ($CFG->glossary_fullmatch and !isset($newentry->id)) ) {
+ if (!empty($newentry->fullmatch)) {
$selected = "checked";
} else {
$selected = "";
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;
}
}
}
-/// 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");