From ed0f5a950713991b92e6ed69569c73603561796a Mon Sep 17 00:00:00 2001 From: sam marshall Date: Thu, 30 Aug 2012 12:13:56 +0100 Subject: [PATCH] MDL-35141 Filelib: No icon for epub filetype --- lang/en/mimetypes.php | 1 + lib/filelib.php | 13 +++++++++---- pix/f/epub.png | Bin 0 -> 640 bytes 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 pix/f/epub.png diff --git a/lang/en/mimetypes.php b/lang/en/mimetypes.php index 9cb966dd3cb..64624fb6ea2 100644 --- a/lang/en/mimetypes.php +++ b/lang/en/mimetypes.php @@ -46,6 +46,7 @@ $string['application/vnd.openxmlformats-officedocument.presentationml.slideshow' $string['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] = 'Excel spreadsheet'; $string['application/vnd.openxmlformats-officedocument.spreadsheetml.template'] = 'Excel template'; $string['application/vnd.openxmlformats-officedocument.wordprocessingml.document'] = 'Word document'; +$string['application/epub_zip'] = 'EPUB ebook'; $string['archive'] = 'Archive ({$a->EXT})'; $string['audio'] = 'Audio file ({$a->EXT})'; $string['default'] = '{$a->mimetype}'; diff --git a/lib/filelib.php b/lib/filelib.php index af71f161883..5e07761eab8 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1406,6 +1406,7 @@ function &get_mimetypes_array() { 'dir' => array ('type'=>'application/x-director', 'icon'=>'flash'), 'dxr' => array ('type'=>'application/x-director', 'icon'=>'flash'), 'eps' => array ('type'=>'application/postscript', 'icon'=>'eps'), + 'epub' => array ('type'=>'application/epub+zip', 'icon'=>'epub', 'groups'=>array('document')), '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'), @@ -1819,10 +1820,14 @@ function get_mimetype_description($obj, $capitalise=false) { $a[strtoupper($key)] = strtoupper($value); $a[ucfirst($key)] = ucfirst($value); } - if (get_string_manager()->string_exists($mimetype, 'mimetypes')) { - $result = get_string($mimetype, 'mimetypes', (object)$a); - } else if (get_string_manager()->string_exists($mimetypestr, 'mimetypes')) { - $result = get_string($mimetypestr, 'mimetypes', (object)$a); + + // MIME types may include + symbol but this is not permitted in string ids. + $safemimetype = str_replace('+', '_', $mimetype); + $safemimetypestr = str_replace('+', '_', $mimetypestr); + if (get_string_manager()->string_exists($safemimetype, 'mimetypes')) { + $result = get_string($safemimetype, 'mimetypes', (object)$a); + } else if (get_string_manager()->string_exists($safemimetypestr, 'mimetypes')) { + $result = get_string($safemimetypestr, 'mimetypes', (object)$a); } else if (get_string_manager()->string_exists('default', 'mimetypes')) { $result = get_string('default', 'mimetypes', (object)$a); } else { diff --git a/pix/f/epub.png b/pix/f/epub.png new file mode 100644 index 0000000000000000000000000000000000000000..a660c7311b9a08c4addae50562155d4921f7b029 GIT binary patch literal 640 zcmV-`0)PF9P)WFU8GbZ8()Nlj2>E@cM*00HDlL_t(I%YBnEXw_g8 zg}+nUMFc7J&s!7`l;Y&l%|VLA#L3y>R1g(6*94a)9Tl8J+DXK29Xgnx*iD5xbg+Yy zh#)kvjxG+zA$iZdSM}e1xQFlDbMJ-!yu1ugiz@n2RMExmugRLJ{->y-zIa{IE!(r; zcX<`&v!rpq20;HHZ%A6f1_|3p`~+P}<9aVIgR-RY$iW18L(+j{GW1nyYOt;W%i^cu5G`n_1F| z^D@jx`eYbPOIqy67`BHk8O~vrI`WGwX_i}ZbOP7~&I*_^EJ-?OJJjQ%itYkrakD3J z+4$K|oL6B6*hQT0Aca~>(H!!=&;ShRej3-0#+GbI?!>@@G_F^tiYg*Y>O;W-=AfJG z!@P{{j3#uHyq3oGYEeb%90anYAuq!mqIJ@4;XPp8_@mGmdANY;-$5GJ6jeBd^#L(x zY5pSX3~k73SzM<@6^-_LauY{RB<+I-?n*R4PUHIMHD*aen@MvBUI2Z?Mz|RET$Ew# a@O}dpw*EQmo5_O!0000