From 58b1904fd14377c8e017cc4d0cb86325049ec9a5 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Sat, 29 Sep 2012 08:33:49 +0200 Subject: [PATCH] MDL-35622 files: Add support for SMART Notebook MIME types - The MIME type for Notebook files is: application/x-smarttech-notebook - The MIME type for Gallery files is also: application/x-smarttech-notebook Refs: http://exchange-forum.smarttech.com/forums/p/5152/11945.aspx#11945 Original author: Matteo Scaramuccia Fixed by: Paul Holden --- lib/db/upgrade.php | 17 +++++++++++++++++ lib/filelib.php | 10 ++++++++++ version.php | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 3dcc1d17e6f..2a307bb09bc 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1564,6 +1564,23 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2012120300.07); } + if ($oldversion < 2013021100.01) { + // Fixing possible wrong MIME types for SMART Notebook files. + $extensions = array('%.gallery', '%.galleryitem', '%.gallerycollection', '%.nbk', '%.notebook', '%.xbk'); + $select = $DB->sql_like('filename', '?', false); + foreach ($extensions as $extension) { + $DB->set_field_select( + 'files', + 'mimetype', + 'application/x-smarttech-notebook', + $select, + array($extension) + ); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2013021100.01); + } return true; } diff --git a/lib/filelib.php b/lib/filelib.php index 013f6c509df..c67e7e958ec 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1469,6 +1469,10 @@ function &get_mimetypes_array() { 'fdf' => array ('type'=>'application/pdf', 'icon'=>'pdf'), 'flv' => array ('type'=>'video/x-flv', 'icon'=>'flash', 'groups'=>array('video','web_video'), 'string'=>'video'), 'f4v' => array ('type'=>'video/mp4', 'icon'=>'flash', 'groups'=>array('video','web_video'), 'string'=>'video'), + + 'gallery' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'), + 'galleryitem,' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'), + 'gallerycollection' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'), 'gif' => array ('type'=>'image/gif', 'icon'=>'gif', 'groups'=>array('image', 'web_image'), 'string'=>'image'), 'gtar' => array ('type'=>'application/x-gtar', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive'), 'tgz' => array ('type'=>'application/g-zip', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive'), @@ -1512,6 +1516,9 @@ function &get_mimetypes_array() { 'mpe' => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), 'mpg' => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), + 'nbk' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'), + 'notebook' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'), + 'odt' => array ('type'=>'application/vnd.oasis.opendocument.text', 'icon'=>'writer', 'groups'=>array('document')), 'ott' => array ('type'=>'application/vnd.oasis.opendocument.text-template', 'icon'=>'writer', 'groups'=>array('document')), 'oth' => array ('type'=>'application/vnd.oasis.opendocument.text-web', 'icon'=>'oth', 'groups'=>array('document')), @@ -1591,6 +1598,8 @@ function &get_mimetypes_array() { 'webm' => array ('type'=>'video/webm', 'icon'=>'video', 'groups'=>array('video'), 'string'=>'video'), 'wmv' => array ('type'=>'video/x-ms-wmv', 'icon'=>'wmv', 'groups'=>array('video'), 'string'=>'video'), 'asf' => array ('type'=>'video/x-ms-asf', 'icon'=>'wmv', 'groups'=>array('video'), 'string'=>'video'), + + 'xbk' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'), 'xdp' => array ('type'=>'application/pdf', 'icon'=>'pdf'), 'xfd' => array ('type'=>'application/pdf', 'icon'=>'pdf'), 'xfdf' => array ('type'=>'application/pdf', 'icon'=>'pdf'), @@ -1605,6 +1614,7 @@ function &get_mimetypes_array() { 'xml' => array ('type'=>'application/xml', 'icon'=>'markup'), 'xsl' => array ('type'=>'text/xml', 'icon'=>'markup'), + 'zip' => array ('type'=>'application/zip', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive') ); return $mimearray; diff --git a/version.php b/version.php index b867e43de2a..8a58e90585e 100644 --- a/version.php +++ b/version.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2013020800.00; // YYYYMMDD = weekly release date of this DEV branch +$version = 2013021100.01; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes