From ea7a9614e77d7b4972fcc9862ef188fc4f1761a0 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 26 Oct 2010 15:05:04 +0000 Subject: [PATCH] MDL-24859 adding missing glossary ajax text formatting (patch by Jason Platts) + adding missing context param to formatting options --- mod/glossary/lib.php | 9 +++++---- mod/glossary/showentry_ajax.php | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 56ad02b8b14..bcecc0672d3 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -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 '

'; @@ -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 diff --git a/mod/glossary/showentry_ajax.php b/mod/glossary/showentry_ajax.php index 2efd77a37e4..8dac6446d60 100644 --- a/mod/glossary/showentry_ajax.php +++ b/mod/glossary/showentry_ajax.php @@ -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 = "

» wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname,true)."

"; add_to_log($entry->courseid, 'glossary', 'view entry', "showentry.php?eid=$entry->id", $entry->id, $entry->cmid); }