]> git.mjollnir.org Git - moodle.git/commitdiff
Adjusted the 'frame' option for some mimetypes when restoring 1.3 courses...
authorstronk7 <stronk7>
Fri, 30 Jul 2004 20:23:04 +0000 (20:23 +0000)
committerstronk7 <stronk7>
Fri, 30 Jul 2004 20:23:04 +0000 (20:23 +0000)
mod/resource/restorelib.php

index 1f8ce293abea10c397b052f0f92c006e0adbdd0d..c4c377e3fb557e5c5c98fae1332a39e3899add0d 100644 (file)
                 $oldtype = $resource->type;
                 $resource->type = $types[$oldtype];
                 $resource->options = $options[$oldtype];
+
+                //Finally, check some specific mimetypes to decide when to set the frame option
+                //making the restore smoother...:-)
+                require_once("$CFG->dirroot/files/mimetypes.php");
+                $embedded = false;
+                if ($resource->type == 'file' and !$resource->options and !$resource->popup) {
+                    $mimetype = mimeinfo("type", $resource->reference);
+                    if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))
+                        or (substr($mimetype, 0, 10) == "video/x-ms")
+                        or ($mimetype == "audio/mp3")
+                        or ($mimetype == "video/quicktime")) {
+                        $embedded = true;
+                    }
+                    if (!$embedded) { 
+                        $resource->options = 'frame';
+                    }
+                }
             }
  
             //The structure is equal to the db, so insert the resource