From b620a99505e7d6843a59109beca891276e78cb96 Mon Sep 17 00:00:00 2001 From: willcast Date: Tue, 25 Nov 2003 17:44:51 +0000 Subject: [PATCH] - Fixed two bugs: Teacher's modified or added entries were being set as not approved if the default approval status is off. - Fixed bug when trying to display entries with ? in the definitions or aliases. --- mod/glossary/dynalink.php | 2 +- mod/glossary/edit.php | 11 ++++++++--- mod/glossary/lib.php | 2 +- mod/glossary/view.php | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mod/glossary/dynalink.php b/mod/glossary/dynalink.php index fc6c3faef4..f41df57033 100644 --- a/mod/glossary/dynalink.php +++ b/mod/glossary/dynalink.php @@ -71,7 +71,7 @@ $href_tag_begin = "wwwroot/mod/glossary/showentry.php?courseid=$courseid&concept=$concepttitle\" ". "onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$courseid\&concept=$concepttitle', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">"; } - $replace = "\\[]'\"*()"; + $replace = "\\[]'\"*()\?"; $currentconcept = glossary_addslashes($replace,$concept->concept); if ( $currentconcept = trim(strip_tags($currentconcept)) ) { if ( !$concept->category ) { diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index 513e995c54..88d8b72594 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -1,9 +1,10 @@ casesensitive = $form->casesensitive; $newentry->fullmatch = $form->fullmatch; $newentry->timemodified = $timenow; - $newentry->approved = $glossary->defaultapproval or isteacher($course->id); + $newentry->approved = 0; + if ( $glossary->defaultapproval or isteacher($course->id) ) { + $newentry->approved = 1; + } if ($form->concept == '' or trim($form->text) == '' ) { $errors = get_string('fillfields','glossary'); @@ -106,6 +110,7 @@ if ( $confirm ) { } else { unset($newentry->attachment); } + if (! update_record("glossary_entries", $newentry)) { error("Could not update your glossary"); } else { @@ -119,7 +124,7 @@ if ( $confirm ) { $newentry->timecreated = $timenow; $newentry->sourceglossaryid = 0; $newentry->teacherentry = isteacher($course->id); - + $permissiongranted = 1; if ( !$glossary->allowduplicatedentries ) { if ($dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) { diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index d609d331c8..266b2fb346 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -416,7 +416,7 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="" if ( $displayformat < 0 ) { $displayformat = $glossary->displayformat; } - if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $mode == 'approval') { + if ($entry->approved or ($USER->id == $entry->userid) or ($mode == 'approval' and !$entry->approved) ) { $permissiongranted = 0; $formatfile = "$CFG->dirroot/mod/glossary/formats/$displayformat.php"; $functionname = "glossary_print_entry_by_format"; diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 4568d96ee4..bf0ec8dead 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -306,6 +306,7 @@ /// if we're browsing by alphabet and the current concept does not begin with /// the letter we are look for. $showentry = 1; + $num = 0; if ( $mode == 'letter' and $hook != 'SPECIAL' and $hook != 'ALL' ) { if ( strtoupper(substr($entry->concept, 0, strlen($hook))) != strtoupper($hook) ) { $showentry = 0; @@ -336,7 +337,7 @@ /// if the entry is not approved, deal with it based on the current view and /// user. if ( $showentry and $mode != 'approval' ) { - if ( !$entry->approved and isteacher($course->id, $entry->userid) ) { + if ( !$entry->approved and $USER->id != $entry->userid ) { $showentry = 0; } } -- 2.39.5