From 98a45cd7e7fa5ca550c6ff40394b3346f75b9528 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 20 Jan 2004 11:22:09 +0000 Subject: [PATCH] Support for auto embedding of WMV files --- files/mimetypes.php | 1 + lang/en/resource.php | 1 + mod/resource/view.php | 39 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/files/mimetypes.php b/files/mimetypes.php index df21d20d1edb1..a678626c6922c 100644 --- a/files/mimetypes.php +++ b/files/mimetypes.php @@ -67,6 +67,7 @@ function mimeinfo($element, $filename) { "tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"), "txt" => array ("type"=>"text/plain", "icon"=>"text.gif"), "wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"), + "wmv" => array ("type"=>"video/x-ms-wmv", "icon"=>"avi.gif"), "xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"), "xml" => array ("type"=>"text/xml", "icon"=>"xml.gif"), "xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"), diff --git a/lang/en/resource.php b/lang/en/resource.php index 858e35ea5cfc8..c2786a448cfad 100644 --- a/lang/en/resource.php +++ b/lang/en/resource.php @@ -18,6 +18,7 @@ $string['configpopuptoolbar'] = 'Should popup windows show the tool bar by default?'; $string['configpopupwidth'] = 'What width should be the default width for new popup windows?'; $string['configwebsearch'] = 'When adding a URL as a webpage or weblink, this location is offered as a site to help the user search for the URL they want.'; +$string['directlink'] = 'Direct link to this file'; $string['editingaresource'] = 'Editing a resource'; $string['example'] = 'Example'; $string['examplereference'] = 'Tobin, K. & Tippins, D (1993) Constructivism as a Referent for Teaching and Learning. In: K. Tobin (Ed) The Practice of Constructivism in Science Education, pp 3-21, Lawrence-Erlbaum, Hillsdale, NJ.'; diff --git a/mod/resource/view.php b/mod/resource/view.php index 199932a28ea43..bcb18726440e6 100644 --- a/mod/resource/view.php +++ b/mod/resource/view.php @@ -141,6 +141,10 @@ $resourcetype = "mp3"; $embedded = true; + } else if ($mimetype == "video/x-ms-wmv") { // It's a Media Player file + $resourcetype = "wmv"; + $embedded = true; + } else if ($mimetype == "text/html") { // It's a web page $resourcetype = "html"; } @@ -225,11 +229,14 @@ /// Display the actual resource if ($embedded) { // Display resource embedded in page + $strdirectlink = get_string("directlink", "resource"); + if ($inpopup) { print_header($pagetitle); } else { print_header($pagetitle, "$course->fullname", - "$navigation framename\" HREF=\"$fullurl\">$resource->name", + "$navigation framename\" ". + "href=\"$fullurl\">$resource->name", "", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm, "self")); } @@ -254,11 +261,39 @@ echo ''; echo ''; echo "

"; + + } else if ($resourcetype == "wmv") { + echo "

"; + echo ''; + echo ""; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo "\n'; + echo ''; + echo ''; + echo "

"; } + if ($resource->summary) { print_simple_box(format_text($resource->summary), 'center'); } - if (!$inpopup) { + + if ($inpopup) { + echo "

($strdirectlink)

"; + } else { print_spacer(20,20); print_footer($course); }