From 42ead7d7cd21ee1399d68cb1a24e0b10d3b0f66c Mon Sep 17 00:00:00 2001 From: nfreear Date: Tue, 25 Sep 2007 14:59:16 +0000 Subject: [PATCH] Fix MDL-7436 Accessibility "Indicate type of resource in the name of the resource" --- lib/filelib.php | 25 +++++++++++++++++++++++++ theme/standard/styles_fonts.css | 8 +++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/filelib.php b/lib/filelib.php index 0feb39abf9..c9a7846745 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -238,6 +238,31 @@ function mimeinfo_from_type($element, $mimetype) { return $mimeinfo['xxx'][$element]; // Default } +/** + * Get information about a filetype based on the icon file. + * @param string $element Desired information (usually 'icon') + * @param string $icon Icon file path. + * @return string Requested piece of information from array + */ +function mimeinfo_from_icon($element, $icon) { + static $mimeinfo; + $mimeinfo=get_mimetypes_array(); + + if (preg_match("/\/(.*)/", $icon, $matches)) { + $icon = $matches[1]; + } + $info = $mimeinfo['xxx'][$element]; // Default + foreach($mimeinfo as $values) { + if($values['icon']==$icon) { + if(isset($values[$element])) { + $info = $values[$element]; + } + //No break, for example for 'excel.gif' we don't want 'csv'! + } + } + return $info; +} + /** * Obtains descriptions for file types (e.g. 'Microsoft Word document') from the * mimetypes.php language file. diff --git a/theme/standard/styles_fonts.css b/theme/standard/styles_fonts.css index 168566439a..0739860606 100644 --- a/theme/standard/styles_fonts.css +++ b/theme/standard/styles_fonts.css @@ -49,11 +49,17 @@ a:link, a:visited { text-decoration:none; } - a:hover { text-decoration: underline; } +.img-text a:hover { + text-decoration: none; +} +.img-text a:hover span { + text-decoration: underline; +} + h1.main, h2.main, h3.main, -- 2.39.5