--- /Users/daniele/Desktop/moodle/mod/resource/type/file/resource.class.php 2008-08-27 02:19:26.000000000 +0200 +++ /Applications/MAMP/htdocs/moodle19/mod/resource/type/file/resource.class.php 2008-09-09 11:48:34.000000000 +0200 @@ -369,24 +369,50 @@ $frameset = optional_param('frameset', '', PARAM_ALPHA); if (empty($frameset) and !$embedded and !$inpopup and ($resource->options == "frame") and empty($USER->screenreader)) { - @header('Content-Type: text/html; charset=utf-8'); - echo "\n"; - echo "\n"; - echo ''; - echo ''; - echo "" . format_string($course->shortname) . ": ".strip_tags(format_string($resource->name,true))."\n"; - echo "resource_framesize,*\">"; - echo "id}&type={$resource->type}&frameset=top\" title=\"" - . get_string('modulename','resource')."\"/>"; - if (!empty($localpath)) { // Show it like this so we interpose some HTML - echo "id}&type={$resource->type}&inpopup=true\" title=\"". - get_string('modulename','resource')."\"/>"; + if (false) { + @header('Content-Type: text/html; charset=utf-8'); + echo "\n"; + echo "\n"; + echo ''; + echo ''; + echo "" . format_string($course->shortname) . ": ".strip_tags(format_string($resource->name,true))."\n"; + echo "resource_framesize,*\">"; + echo "id}&type={$resource->type}&frameset=top\" title=\"" + . get_string('modulename','resource')."\"/>"; + if (!empty($localpath)) { // Show it like this so we interpose some HTML + echo "id}&type={$resource->type}&inpopup=true\" title=\"". + get_string('modulename','resource')."\"/>"; + } else { + echo ""; + } + echo ""; + echo ""; + exit; } else { - echo ""; + $navigation = build_navigation($this->navlinks, $cm); + print_header($pagetitle, $course->fullname, $navigation, + "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); + $htmlurl = $CFG->dataroot.'/'.$resource->course.'/'.$resource->reference; + $htmlfilecontent = file_get_contents($htmlurl); + + // build the starting tag body + $regexp = '||'; + if (preg_match($regexp, $htmlfilecontent, $matches)) { + //$startingbodytag = $matches[0]; + + // now get the body + $regexp = '|'.$matches[0].'(.*)|s'; + if (preg_match($regexp, $htmlfilecontent, $matches)) { + echo '
'.$matches[1].'
'; + } else { + print_string('empty_html_body_file','resource'); + } + print_string('missing_body_in_html_file','resource'); + } + + print_footer($course); + exit; } - echo ""; - echo ""; - exit; }