.notebook file type

.notebook file type

by David Broadley -
Number of replies: 12

Hello we have a problem when we upload a resource file to a course. When we upload the file it uploads fine but when you goto the page and download it the file extension on the file has been changed to .zip. The file is a smart notebook file. I have included an example here. We are on moodle version 2.3

Average of ratings: -
In reply to David Broadley

Re: .notebook file type

by David Broadley -

Has anyone had a similar problem with the file extension being changed when you upload a file?

In reply to David Broadley

Re: .notebook file type

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I just tried this and had no issue at all.  I used Drag and Drop and the file remained a Notebook file and I was able to download it and open it.  Do you have Smart software on the computer that you are trying to download the file to?

In reply to Emma Richardson

Re: .notebook file type

by David Broadley -

Yes i do have smart software on the PC. When i just download the file and save as the extension is a .zip and not the originally uploaded .notebook file. If i manually rename to .notebook this works fine. I did not use the drag and drop upload. I just went under resources and selected file. Could you try this for me instead of the drag and drop.

 

Thanks

David

In reply to David Broadley

Re: .notebook file type

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

It was fine that way.  Does the file show as a zip file on the site or just when you download it?  What browser are using to download?

In reply to Emma Richardson

Re: .notebook file type

by David Broadley -
The file shows the same icon for a notebook file and a zip file. It seems to be doing some kind of auto detection of the file contents and then naming the file extension. Thanks David
In reply to Emma Richardson

Re: .notebook file type

by David Broadley -

Hi,

I was using internet explorer 9 to upload and download.

What version of moodle are you using?

We are on Moodle 2.3.1+ (Build: 20120719)

 

Thanks

David

In reply to David Broadley

Re: .notebook file type

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, I just replicated this with Internet Explorer - that is where the issue is.  I suggest putting in a tracker ticket and using a real browser in the meantime!!  I normally suggest that my teachers use firefox or chrome with Moodle - Internet Explorer often shows some strange behavior with Moodle.  A little googling shows that Internet Explorer actually has this problem with multiple file types.  If it doesn't recognize a filetype, it will guess as something and normally put a zip format.  You can actually just rename it once downloaded and it should be fine.

In reply to Emma Richardson

Re: .notebook file type

by David Broadley -

The problem is we have over 600 machines in school and using another browser is just not viable. Is this internet explorers issue or is this moodles issue? I will open a ticket for this. Thanks for your help so far

In reply to David Broadley

Re: .notebook file type

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

It appears to be an Internet Explorer issue but I did come across a fix that could be applied to Apache (but it was for Office files).  

I think it would work for this.  The fix was to create an htaccess file or edit the config file (php.ini I am guessing) and add file extensions so that the browser would get the right info.  The format they used was as below:

AddType application/vnd.ms-word.document.macroEnabled.12 .docm

AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
 
If you have access to the server and some apache knowhow, this would probably be the quickest fix.
In reply to Emma Richardson

Re: .notebook file type

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi all,
to let this work in Moodle 2.3 it is better to open the lib/filelib.php file and search for the function get_mimetypes_array(). The new MIME types for the SMART board are:

  • 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/11941.aspx?lang=en-US

A patch to add these new types:

diff --git a/lib/filelib.php b/lib/filelib.php
index e814fee..d55cd7a 100644
--- a/lib/filelib.php
+++ b/lib/filelib.php
@@ -1395,6 +1395,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'=>'unknown'),
+        'galleryite,'       => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'unknown'),
+        'gallerycollection' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'unknown'),
         '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'),
@@ -1436,6 +1440,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'=>'unknown'),
+        'notebook'  => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'unknown'),
+
         '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')),
@@ -1515,6 +1522,7 @@ 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'=>'unknown'),
         'xdp'  => array ('type'=>'application/pdf', 'icon'=>'pdf'),
         'xfd'  => array ('type'=>'application/pdf', 'icon'=>'pdf'),
         'xfdf' => array ('type'=>'application/pdf', 'icon'=>'pdf'),

If these MIME types are considered useful for other Moodle users, it could be nice to file an improvement into the Tracker and add the patch above.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: .notebook file type

by David Broadley -

This has worked fine. I think that this would be useful in an update as smart notebook is used heavily in schools. Thanks for everyones help on this.

 

Thanks

David