How do i add a new icon for a new resource file type?

How do i add a new icon for a new resource file type?

by aggelos panagiotakis -
Number of replies: 4
How do i add a new icon for a resource file type?

the file extension is .mcd (mathcad file type)
the following links in moodle docs where not very help full in my situation:
http://docs.moodle.org/en/Replacing_icons_with_CSS#How_to_replace_icons_with_CSS
http://docs.moodle.org/en/Replacing_icons_with_CSS3

I tried the following:
1.
td.activity.resource img[src$="mcd.gif"] ~ a,
.file a[href$=".mcd"] {
background-image: url(moodle theme path/pix/f/mcd.gif);
}
the css generated does not change this style to anything.it is as is.
whats the meaning og src$="mcd.gif" anyway?????

2.
td.activity.resource > a {background-image: url(moodle theme path/pix/f/mcd.gif);}
this one does not do the work, and even if then all the resources would have that icon!

anyway to sum it up i want each time a resource (file) with an extension of .mcd is uploaded i want it have a specific icon.

any ideas?
Average of ratings: -
In reply to aggelos panagiotakis

Απάντηση: How do i add a new icon for a new resource file type?

by aggelos panagiotakis -
the silution is simpler than that!
just add a line or two in the file:
[your moodle installation path]/lib/filelib.php

for example add:

'mcd' => array ('type'=>'Mathcad Document/mcd', 'icon'=>'mcd.gif'),
'xmcd' => array ('type'=>'Mathcad Document/xmcd', 'icon'=>'mcd.gif'),
'xmct' => array ('type'=>'Mathcad Template/mct', 'icon'=>'mcd.gif')
in the first section.
a nice environment for updating these filetypes would be nice!

Sorry for posting here. I though this should be relating to a theme issue but it is not. After that you can go to your theme in the path "/pix/f/" and add the icon mcd.gif as stated above
In reply to aggelos panagiotakis

Re: Απάντηση: How do i add a new icon for a new resource file type?

by Chad Evans -

Help! I tried everything you said, but it does not seem to work. I was very excited as it is something I have been trying to do for a while

I added

function get_mimetypes_array() {
    return array (
        'flp' => array ('type'=>'document/flp', 'icon'=>'flp.gif'),

put the icon in the right place, but no joy. Have I made a mistake?

Thanks

Chad

In reply to Chad Evans

Απάντηση: Re: Απάντηση: How do i add a new icon for a new resource file type?

by aggelos panagiotakis -
yes thats a true problem for me too , the icon did not appear immediatly , i had to upload a new resource.So....
try to add a new file to your server of that type - just upload!
then delete that resource it if you down want it!
also clear your cache before proceeding!
hit refresh on your web browser . hopefully you will see the new icon on your resource!!!!
i hope the icon is placed inside your selected theme for that course and particularly in the folder [moodle theme folder]/pix/f/[your_icon.gif]
In reply to aggelos panagiotakis

Re: Απάντηση: Re: Απάντηση: How do i add a new icon for a new resource file type?

by Chad Evans -
Fantastic!! Thank you so much.