]> git.mjollnir.org Git - moodle.git/commitdiff
Support for auto embedding of WMV files
authormoodler <moodler>
Tue, 20 Jan 2004 11:22:09 +0000 (11:22 +0000)
committermoodler <moodler>
Tue, 20 Jan 2004 11:22:09 +0000 (11:22 +0000)
files/mimetypes.php
lang/en/resource.php
mod/resource/view.php

index df21d20d1edb105290c9b84b7730574d3bdd9345..a678626c6922c25925e0787a3cdedeac51df555d 100644 (file)
@@ -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"),
index 858e35ea5cfc878cabf9724b9071ffff45734d7c..c2786a448cfad63f4f0886f09c5d952b9dad76c4 100644 (file)
@@ -18,6 +18,7 @@ $string['configpopupstatus'] = 'Should popup windows show the status bar by defa
 $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.';
index 199932a28ea435dc7cda3cbfad2598f24539b733..bcb18726440e6fd7d3fc037f25e6830c9835d291 100644 (file)
                 $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";
             }
             /// 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 <a target=\"$CFG->framename\" HREF=\"$fullurl\">$resource->name</A>",
+                                 "$navigation <a title=\"$strdirectlink\" target=\"$CFG->framename\" ".
+                                 "href=\"$fullurl\">$resource->name</a>",
                                  "", "", true, update_module_button($cm->id, $course->id, $strresource), 
                                  navmenu($course, $cm, "self"));
                 }
                     echo '</embed>';
                     echo '</object>';
                     echo "</p></center>";
+
+                } else if ($resourcetype == "wmv") {  
+                    echo "<center><p>";
+                    echo '<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
+                    echo '        codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
+                    echo '        standby="Loading Microsoft® Windows® Media Player components..." ';
+                    echo '        id="wmvplayer" align="" type="application/x-oleobject">';
+                    echo "<param name=\"Filename\" value=\"$fullurl\">";
+                    echo '<param name="ShowControls" value=true>';
+                    echo '<param name="AutoRewind" value=true>';
+                    echo '<param name="AutoStart" value=true>';
+                    echo '<param name="Autosize" value=true>';
+                    echo '<param name="EnableContextMenu" value=true>';
+                    echo '<param name="TransparentAtStart" value=false>';
+                    echo '<param name="AnimationAtStart" value=false>';
+                    echo '<param name="ShowGotoBar" value=false>';
+                    echo '<param name="EnableFullScreenControls" value=true>';
+                    echo "\n<embed src=\"$fullurl\" name=\"wmvplayer\" type=\"application/x-mplayer2\" ";
+                    echo ' ShowControls="1" AutoRewind="1" AutoStart="1" Autosize="1" EnableContextMenu="1"';
+                    echo ' TransparentAtStart="0" AnimationAtStart="0" ShowGotoBar="0" EnableFullScreenControls="1"';
+                    echo ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">';
+                    echo '</embed>';
+                    echo '</object>';
+                    echo "</p></center>";
                 }
+
                 if ($resource->summary) {
                     print_simple_box(format_text($resource->summary), 'center');
                 }
-                if (!$inpopup) {
+
+                if ($inpopup) {
+                    echo "<center><p>(<a href=\"$fullurl\">$strdirectlink</a>)</p></center>";
+                } else {
                     print_spacer(20,20);
                     print_footer($course);
                 }