Skip to content

Commit

Permalink
Support for auto embedding of WMV files
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Jan 20, 2004
1 parent 52c6d39 commit 98a45cd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions files/mimetypes.php
Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions lang/en/resource.php
Expand Up @@ -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.';
Expand Down
39 changes: 37 additions & 2 deletions mod/resource/view.php
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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 <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"));
}
Expand All @@ -254,11 +261,39 @@
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);
}
Expand Down

0 comments on commit 98a45cd

Please sign in to comment.