diff --git a/lang/en_utf8/help/resource/frameifpossible.html b/lang/en_utf8/help/resource/frameifpossible.html index 05b1ee63bec..8f5421aa6aa 100644 --- a/lang/en_utf8/help/resource/frameifpossible.html +++ b/lang/en_utf8/help/resource/frameifpossible.html @@ -1,6 +1,8 @@
This option will allow the file to be displayed in a frame, so that the Moodle navigation remains on the page in an upper frame.
+This option will allow the file to be displayed in a frame or object tag, so that the Moodle navigation remains on the top of the page.
Note that this option is normally not necessary for media types such as movies, audio files and flash files, as without this option turned on they will be embedded within a navigable page.
-Note also that the use of frames can break accessibility, and so this option will be completely ignored if the user has chosen the "Screenreader" option in their profile.
\ No newline at end of file +Note also that the use of frame tags can break accessibility, and so this option will be completely ignored if the user has chosen the "Screenreader" option in their profile.
+ +Note finally that the use of object tags is XHTML strict (frame tag isn't). However object tag could break some Moodle themes. In conclusion if the resource is well displayed with object tag, prefer it to frame tag.
\ No newline at end of file diff --git a/lang/en_utf8/resource.php b/lang/en_utf8/resource.php index 6e2486b7ca7..c939d72a13c 100644 --- a/lang/en_utf8/resource.php +++ b/lang/en_utf8/resource.php @@ -64,6 +64,9 @@ $string['localfileselect'] = 'Choose this file path.'; $string['maindirectory'] = 'Main files directory'; $string['modulename'] = 'Resource'; $string['modulenameplural'] = 'Resources'; +$string['keepnavigationvisibleno'] = 'No'; +$string['keepnavigationvisibleyesframe'] = 'Yes, frame tag'; +$string['keepnavigationvisibleyesobject'] = 'Yes, object tag'; $string['navigationbuttons'] = 'Navigation buttons'; $string['navigationmenu'] = 'Navigation side menu'; $string['navigationup'] = 'Up button'; diff --git a/mod/resource/type/file/resource.class.php b/mod/resource/type/file/resource.class.php index 55fa3052870..80838ee03a1 100644 --- a/mod/resource/type/file/resource.class.php +++ b/mod/resource/type/file/resource.class.php @@ -149,11 +149,21 @@ class resource_file extends resource_base { unset($resource->windowpopup); $resource->options = ''; - } else { + } else { if (empty($resource->framepage)) { $resource->options = ''; } else { - $resource->options = 'frame'; + switch ($resource->framepage) { + case 1: + $resource->options = 'frame'; + break; + case 2: + $resource->options = 'objectframe'; + break; + default: + $resource->options = ''; + break; + } } unset($resource->framepage); $resource->popup = ''; @@ -370,73 +380,96 @@ class resource_file extends resource_base { /// Now check whether we need to display a frameset $frameset = optional_param('frameset', '', PARAM_ALPHA); - if (empty($frameset) and !$embedded and !$inpopup and ($resource->options == "frame") and empty($USER->screenreader)) { - ///Yahoo javascript libaries for updating embedded object size - require_js(array('yui_utilities')); - require_js(array('yui_container')); - require_js(array('yui_dom-event')); - require_js(array('yui_dom')); + if (empty($frameset) and !$embedded and !$inpopup and ($resource->options == "frame" || $resource->options == "objectframe") and empty($USER->screenreader)) { + /// display the resource into a object tag + if ($resource->options == "objectframe") { + /// Yahoo javascript libaries for updating embedded object size + require_js(array('yui_utilities')); + require_js(array('yui_container')); + require_js(array('yui_dom-event')); + require_js(array('yui_dom')); - ///Moodle Header and navigation bar - $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, "parent")); - $options = new object(); - $options->para = false; - if (!empty($localpath)) { // Show some help - echo '