From: mark-nielsen
Date: Fri, 8 Dec 2006 18:48:01 +0000 (+0000)
Subject: Merged in fix for MDL-7418
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=eb302b191410a5b0a106806e118b83c10c01954c;p=moodle.git
Merged in fix for MDL-7418
---
diff --git a/lang/en_utf8/help/lesson/mediafile.html b/lang/en_utf8/help/lesson/mediafile.html
index f31562212a..c908ac4aa0 100644
--- a/lang/en_utf8/help/lesson/mediafile.html
+++ b/lang/en_utf8/help/lesson/mediafile.html
@@ -4,4 +4,18 @@
Also, a link will be printed out on every lesson page that re-opens the pop-up if necessary.
Optionally a "Close Window" button be printed at the bottom of the pop-up and the
-height and width of the window can be set as well.
\ No newline at end of file
+height and width of the window can be set as well.
+
+Supported embedded file types:
+
+ - MP3
+ - Media Player
+ - Quicktime
+ - Realmedia
+ - HTML
+ - Plain Text
+ - GIF
+ - JPEG
+ - PNG
+
+ All other file types will default to a link for download.
\ No newline at end of file
diff --git a/lang/en_utf8/lesson.php b/lang/en_utf8/lesson.php
index f52fb7ab63..80829e3034 100644
--- a/lang/en_utf8/lesson.php
+++ b/lang/en_utf8/lesson.php
@@ -41,6 +41,7 @@ $string['checkedthisone'] = 'checked this one.';
$string['checknavigation'] = 'Check navigation';
$string['checkquestion'] = 'Check question';
$string['classstats'] = 'Class statistics';
+$string['clicktodownload'] = 'Click on the following link to download the file.';
$string['clicktopost'] = 'Click here to post your grade on the High Scores list.';
$string['clusterjump'] = 'Unseen question within a cluster';
$string['clustertitle'] = 'Cluster';
@@ -298,4 +299,5 @@ $string['yourcurrentgradeis'] = 'Your current grade is $a';
$string['yourcurrentgradeisoutof'] = 'Your current grade is $a->grade out of $a->total';
$string['youshouldview'] = 'You should answer at least: $a';
+
?>
diff --git a/mod/lesson/mediafile.php b/mod/lesson/mediafile.php
index d8183006b5..03c1574813 100644
--- a/mod/lesson/mediafile.php
+++ b/mod/lesson/mediafile.php
@@ -43,16 +43,7 @@
require_login($course->id, false, $cm);
-
- // get the mimetype
- //$path_parts = pathinfo('http://www.apple.com'); //$lesson->mediafile
- $mimetype = mimeinfo("type", $lesson->mediafile); //$path_parts['basename']
-
- //print_header();
-
- if (substr_count($lesson->mediafile, '//') == 1) {
- // OK, taking a leap of faith here. We are assuming that teachers are cool
- // and thus the mediafile is a url
+ if (is_url($lesson->mediafile)) {
$fullurl = $lesson->mediafile;
} else {
// get the full url to the file while taking into consideration $CFG->slasharguments
@@ -64,7 +55,8 @@
$fullurl = "$CFG->wwwroot$relativeurl";
}
-
+ // Get the mimetype
+ $mimetype = mimeinfo("type", $lesson->mediafile);
// find the correct type and print it out
if ($mimetype == "audio/mp3") { // It's an MP3 audio file
@@ -140,9 +132,9 @@
echo '';
echo "";
- } else if ($mimetype == "application/x-shockwave-flash") { // It's a flash file
+ //} else if ($mimetype == "application/x-shockwave-flash") { // It's a flash file
- error('Flash is not supported yet');
+ // error('Flash is not supported yet');
} else if ($mimetype == "audio/x-pn-realaudio") { // It's a realmedia file
@@ -175,8 +167,23 @@
}
exit();
- } else {
- error('Unsupported mime type: '.$mimetype);
+ } else if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // Image
+
+ echo "";
+ echo '
';
+ echo "
";
+
+ } else { // Default
+
+ // Get the file name
+ $file = pathinfo($lesson->mediafile);
+ $filename = basename($file['basename'], '.'.$file['extension']);
+
+ echo "";
+ notify(get_string('clicktodownload', 'lesson'));
+ echo "".format_string($filename).'';
+ echo "
";
+
}
function is_url($test_url) {