]> git.mjollnir.org Git - moodle.git/commitdiff
Merged in fix for MDL-7418
authormark-nielsen <mark-nielsen>
Fri, 8 Dec 2006 18:48:01 +0000 (18:48 +0000)
committermark-nielsen <mark-nielsen>
Fri, 8 Dec 2006 18:48:01 +0000 (18:48 +0000)
lang/en_utf8/help/lesson/mediafile.html
lang/en_utf8/lesson.php
mod/lesson/mediafile.php

index f31562212a3e0f7b9da822618d854807c12cde19..c908ac4aa00a90d396a798bbbdb196752beb00e1 100644 (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>
\ No newline at end of file
+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>
\ No newline at end of file
index f52fb7ab635fba835ba9ad03d5942dac6209dbb8..80829e3034e2ddfd99fa98ec8e9ca04a5de91c03 100644 (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';
 
+
 ?>
index d8183006b51824659276a746c12ff2846a66d0ec..03c15748134c98a3c6f3c4524d1dc83db87f47ce 100644 (file)
 
     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
         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
         
         }
         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) {