Merged in fix for MDL-7418

This commit is contained in:
mark-nielsen
2006-12-08 18:48:01 +00:00
parent 03bb25e1df
commit eb302b1914
3 changed files with 39 additions and 16 deletions

View File

@@ -4,4 +4,18 @@
Also, a link will be printed out on every lesson page that re-opens the pop-up if necessary.</p>
<p>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.</p>
height and width of the window can be set as well.</p>
<p>Supported embedded file types:
<ul>
<li>MP3</li>
<li>Media Player</li>
<li>Quicktime</li>
<li>Realmedia</li>
<li>HTML</li>
<li>Plain Text</li>
<li>GIF</li>
<li>JPEG</li>
<li>PNG</li>
</ul>
All other file types will default to a link for download.</p>

View File

@@ -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';
?>

View File

@@ -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 '</object>';
echo "</p></center>";
} 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 "<center><p>";
echo '<img class="lessonimage" src="'.s($fullurl).'" alt="" />';
echo "</p></center>";
} else { // Default
// Get the file name
$file = pathinfo($lesson->mediafile);
$filename = basename($file['basename'], '.'.$file['extension']);
echo "<center><p>";
notify(get_string('clicktodownload', 'lesson'));
echo "<a href=\"$fullurl\">".format_string($filename).'</a>';
echo "</p></center>";
}
function is_url($test_url) {