Permalink
Browse files

MDL-32480 fix display of IMS content packages with external links

  • Loading branch information...
1 parent 1430866 commit a2ec9613094088ec91426816c7af79f055181bda @ndunand ndunand committed with skodak Jun 3, 2013
Showing with 9 additions and 4 deletions.
  1. +9 −4 mod/imscp/locallib.php
View
13 mod/imscp/locallib.php
@@ -61,10 +61,15 @@ function imscp_print_content($imscp, $cm, $course) {
function imscp_htmllize_item($item, $imscp, $cm) {
global $CFG;
- $context = context_module::instance($cm->id);
- $urlbase = "$CFG->wwwroot/pluginfile.php";
- $path = '/'.$context->id.'/mod_imscp/content/'.$imscp->revision.'/'.$item['href'];
- $url = file_encode_url($urlbase, $path, false);
+ if (strpos($item['href'], 'http://') === 0) {
+ $url = $item['href'];
+ }
+ else {
+ $context = context_module::instance($cm->id);
+ $urlbase = "$CFG->wwwroot/pluginfile.php";
+ $path = '/'.$context->id.'/mod_imscp/content/'.$imscp->revision.'/'.$item['href'];
+ $url = file_encode_url($urlbase, $path, false);
+ }
$result = "<li><a href=\"$url\">".$item['title'].'</a>';
if ($item['subitems']) {
$result .= '<ul>';

0 comments on commit a2ec961

Please sign in to comment.