]> git.mjollnir.org Git - moodle.git/commitdiff
Fix MDL-7436 Accessibility "Indicate type of resource in the name of the resource"
authornfreear <nfreear>
Tue, 25 Sep 2007 15:15:07 +0000 (15:15 +0000)
committernfreear <nfreear>
Tue, 25 Sep 2007 15:15:07 +0000 (15:15 +0000)
course/lib.php

index 197394ac2c32056bf29b083e5b5d321002afa0bd..d4374ecfdb8b9577bd92c380b77586b691cb1c4a 100644 (file)
@@ -1350,7 +1350,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
     if (!empty($section->sequence)) {
 
         // Fix bug #5027, don't want style=\"width:$width\".
-        echo "<ul class=\"section\">\n";
+        echo "<ul class=\"section img-text\">\n";
         $sectionmods = explode(",", $section->sequence);
 
         foreach ($sectionmods as $modnumber) {
@@ -1400,12 +1400,32 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
 
                 } else { // Normal activity
 
+                    //Accessibility: for files get description via icon.
+                    $altname = '';
+                    if ('resource'==$mod->modname) {
+                        if (!empty($modinfo[$modnumber]->icon)) {
+                            $possaltname = $modinfo[$modnumber]->icon;
+
+                            $mimetype = mimeinfo_from_icon('type', $possaltname);
+                            $altname = get_mimetype_description($mimetype); //get_string($mimetype, 'mimetypes');
+                        } else {
+                            $altname = $mod->modfullname;
+                        }
+                    } else {
+                        $altname = $mod->modfullname;
+                    }
+
+                    // Avoid unnecessary duplication.
+                    if (false!==stripos($instancename, $altname)) {
+                        $altname = '';
+                    }
+
                     $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
-                    echo '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
+                    echo '<a '.$linkcss.' '.$extra.        // Title unnecessary!
                          ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
-                         '<img src="'.$icon.'"'.
-                         ' class="activityicon" alt="'.$mod->modfullname.'" /> '.
-                         $instancename.'</a>';
+                         '<img src="'.$icon.'" title=""'.  // Suppress IE tooltip.
+                         ' class="activityicon" alt="'.$altname.'" /> <span>'.
+                         $instancename.'</span></a>';
                     if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
                         echo " <span class=\"groupinglabel\"> - ".format_string($groupings[$mod->groupingid]->name).'</span>';
                     }