MDL-24859 adding missing glossary ajax text formatting (patch by Jason Platts) +...
authorPetr Skoda <skodak@moodle.org>
Tue, 26 Oct 2010 15:05:04 +0000 (15:05 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 26 Oct 2010 15:05:04 +0000 (15:05 +0000)
mod/glossary/lib.php
mod/glossary/showentry_ajax.php

index 56ad02b..bcecc06 100644 (file)
@@ -845,6 +845,7 @@ function glossary_print_entry_default ($entry, $glossary, $cm) {
     $options = new stdClass();
     $options->para = false;
     $options->trusted = $entry->definitiontrust;
+    $options->context = $context; 
     $definition = format_text($definition, $entry->definitionformat, $options);
     echo ($definition);
     echo '<br /><br />';
@@ -895,13 +896,13 @@ function glossary_print_entry_definition($entry, $glossary, $cm) {
         }
     }
 
-    $options = new stdClass();
-    $options->para = false;
-    $options->trusted = $entry->definitiontrust;
-
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     $definition = file_rewrite_pluginfile_urls($definition, 'pluginfile.php', $context->id, 'mod_glossary', 'entry', $entry->id);
 
+    $options = new stdClass();
+    $options->para = false;
+    $options->trusted = $entry->definitiontrust;
+    $options->context = $context; 
     $text = format_text($definition, $entry->definitionformat, $options);
 
     // Stop excluding concepts from autolinking
index 2efd77a..8dac644 100644 (file)
@@ -59,6 +59,16 @@ if ($entries) {
                 continue;
             }
         }
+
+        $context = get_context_instance(CONTEXT_MODULE, $entry->cmid);
+        $definition = file_rewrite_pluginfile_urls($entry->definition, 'pluginfile.php', $context->id, 'mod_glossary', 'entry', $entry->id);
+
+        $options = new stdClass();
+        $options->para = false;
+        $options->trusted = $entry->definitiontrust;
+        $options->context = $context; 
+        $entries[$key]->definition = format_text($definition, $entry->definitionformat, $options);
+
         $entries[$key]->footer = "<p style=\"text-align:right\">&raquo;&nbsp;<a href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname,true)."</a></p>";
         add_to_log($entry->courseid, 'glossary', 'view entry', "showentry.php?eid=$entry->id", $entry->id, $entry->cmid);
     }