From fce0e06d8112dab3e4878628d9528cd9487788a6 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 10 May 2004 18:10:17 +0000 Subject: [PATCH] Solved some notices (debug mode) when creating new entries... --- mod/glossary/edit.html | 6 +++--- mod/glossary/edit.php | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/mod/glossary/edit.html b/mod/glossary/edit.html index 11427c9a59..fdfcdc8a57 100644 --- a/mod/glossary/edit.html +++ b/mod/glossary/edit.html @@ -66,7 +66,7 @@ if (isset($errors)) { } else { echo ''; - 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 '
'; - 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 '
'; - if (!empty($newentry->fullmatch) or ($CFG->glossary_fullmatch and !isset($newentry->id)) ) { + if (!empty($newentry->fullmatch)) { $selected = "checked"; } else { $selected = ""; diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index e560494174..fd75a7a204 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -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"); -- 2.39.5