]> git.mjollnir.org Git - moodle.git/commitdiff
- Fixed two bugs: Teacher's modified or added entries were being set as not approved...
authorwillcast <willcast>
Tue, 25 Nov 2003 17:44:51 +0000 (17:44 +0000)
committerwillcast <willcast>
Tue, 25 Nov 2003 17:44:51 +0000 (17:44 +0000)
- Fixed bug when trying to display entries with ? in the definitions or aliases.

mod/glossary/dynalink.php
mod/glossary/edit.php
mod/glossary/lib.php
mod/glossary/view.php

index fc6c3faef490cbfd40fa4a6ab4d1bad79393e063..f41df57033149584d48a81635793abc50c447375 100644 (file)
@@ -71,7 +71,7 @@
                         $href_tag_begin = "<a target=\"entry\" class=\"autolink\" title=\"$title\" href=\"$CFG->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 ) {
index 513e995c54bd06deadbed624487e19a1659048d7..88d8b7259419c5e601c03e7efacbc55e0ac13a26 100644 (file)
@@ -1,9 +1,10 @@
 <?PHP // $Id$
-global $CFG, $USER, $THEME;
 
 require_once("../../config.php");
 require_once("lib.php");
 
+global $CFG, $USER, $THEME;
+
 require_variable($id);    // Course Module ID
 optional_variable($e);    // EntryID
 optional_variable($confirm,0);    // proceed. Edit the edtry
@@ -52,7 +53,10 @@ if ( $confirm ) {
     $newentry->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)) {
index d609d331c84254d855a9444c0ddfad2ec69a0983..266b2fb3467d578edc2aa3e00f32b03249b0e136 100644 (file)
@@ -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";
index 4568d96ee44f7ae4dffeacfe29a28c9f9deeb64d..bf0ec8deadd49b84199d61cdb12a3471e30b652c 100644 (file)
         /// 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;
         /// 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;
                 }            
             }