Skip to content

Commit

Permalink
filter MDL-23810 adding a flag to indicate when we're working in an e…
Browse files Browse the repository at this point in the history
…mbedded resource to prevent winding up with nested Moodles
  • Loading branch information
Andrew Davis committed Sep 16, 2010
1 parent c25662b commit 4eaa964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mod/glossary/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,18 @@ function glossary_filter($courseid, $text) {
//hardcoding dictionary format in the URL rather than defaulting to the current glossary format which may not work in a popup.
//for example "entry list" means the popup would only contain a link that opens another popup.
$link = new moodle_url('/mod/glossary/showentry.php', array('courseid'=>$courseid, 'eid'=>$concept->id, 'displayformat'=>'dictionary'));
$href_tag_begin = html_writer::start_tag('a', array(
$attributes = array(
'href'=>$link,
'title'=>$title,
'class'=>'glossary autolink glossaryid'.$concept->glossaryid));
'class'=>'glossary autolink glossaryid'.$concept->glossaryid);

//this flag is optionally set by resource_pluginfile()
//if processing an embedded file use target to prevent getting nested Moodles
if (isset($CFG->embeddedsoforcelinktarget) && $CFG->embeddedsoforcelinktarget) {
$attributes['target'] = '_top';
}

$href_tag_begin = html_writer::start_tag('a', $attributes);
}
$conceptlist[] = new filterobject($concept->concept, $href_tag_begin, '</a>',
$concept->casesensitive, $concept->fullmatch);
Expand Down
1 change: 1 addition & 0 deletions mod/resource/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ function resource_pluginfile($course, $cm, $context, $filearea, $args, $forcedow
$mimetype = $file->get_mimetype();
if ($mimetype = 'text/html' or $mimetype = 'text/plain') {
$filter = $DB->get_field('resource', 'filterfiles', array('id'=>$cm->instance));
$CFG->embeddedsoforcelinktarget = true;
} else {
$filter = 0;
}
Expand Down

0 comments on commit 4eaa964

Please sign in to comment.