How to ensure a new icon for a new resource type?

How to ensure a new icon for a new resource type?

by Dan Stowell -
Number of replies: 2
Hi -

I've created a new resource type for 3D molecule viewing (details/download here). It's all working perfectly, except that I can't get it to display with its own icon on a course main page.

How is it achieved? I have placed a new file, "icon.gif", inside my resource folder (/mod/resource/type/jmol/), but it simply doesn't appear. I don't believe it's a cache problem since it's been about 4 or 5 days since I first put the new icon in place, and it still doesn't show, even if using a completely different web browser (one I haven't used for months!).

Is there something else required to nudge Moodle into picking up the icon file?
Average of ratings: -
In reply to Dan Stowell

Re: How to ensure a new icon for a new resource type?

by A. T. Wyatt -

Does this help?

Notes on adding new pix for additional mime types:

amend lib/filelib.php and add an icon gif to pix/f

Code snippet from lib/filelib.php (red line = new line):
...
    'm'    => array ('type'=>'text/plain', 'icon'=>'text.gif'),
    'mdb'  => array ('type'=>'application/vnd.ms-access', 'icon'=>'access.gif'),
    'mov'  => array ('type'=>'video/quicktime', 'icon'=>'video.gif'),
...

As long as I didn't make any changes to my course, my course resources kept showing the old icons. As soon as I added another resource to my course, all icons were renewed!

reference:
http://moodle.org/mod/forum/discuss.php?d=32631

atw
In reply to A. T. Wyatt

Re: How to ensure a new icon for a new resource type?

by Dan Stowell -
Thanks for that, but it only applies for the main "file" type of resource, not for a whole new resource type.

I worked out how to do it, by the way. Unfortunately you have to modify mod/resource/lib.php and add an extra statement into the resource_get_coursemodule_info() function. Not as easy as I hoped...