From 2bbaf749c8f5974a5d35bfca4e73baa8d78dd319 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 25 Nov 2006 18:09:33 +0000 Subject: [PATCH] MDL-7434 all images that convey information should have alt text to convey that information - part 2 --- enrol/paypal/enrol.html | 2 +- files/index.php | 22 ++++++++++++---------- filter/algebra/filter.php | 3 ++- filter/tex/filter.php | 3 ++- lang/en_utf8/enrol_paypal.php | 1 + lang/en_utf8/moodle.php | 1 + lib/tablelib.php | 16 ++++++++-------- lib/weblib.php | 16 +++++++++++----- message/history.php | 4 ++-- user/view.php | 4 ++-- 10 files changed, 42 insertions(+), 30 deletions(-) diff --git a/enrol/paypal/enrol.html b/enrol/paypal/enrol.html index 793e6bc87e..d289d3d0c6 100644 --- a/enrol/paypal/enrol.html +++ b/enrol/paypal/enrol.html @@ -2,7 +2,7 @@

enrol_currency $cost"; ?>

-

PayPal

+

<?php print_string('paypalaccepted', 'enrol_paypal') ?>

usepaypalsandbox) ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr'; diff --git a/files/index.php b/files/index.php index f055aa1f92..9fc4586a33 100644 --- a/files/index.php +++ b/files/index.php @@ -618,9 +618,12 @@ function clearfilelist() { function printfilelist($filelist) { global $CFG, $basedir; + $strfolder = get_string("folder"); + $strfile = get_string("file"); + foreach ($filelist as $file) { if (is_dir($basedir.'/'.$file)) { - echo "pixpath/f/folder.gif\" height=\"16\" width=\"16\" alt=\"\" /> $file
"; + echo "pixpath/f/folder.gif\" height=\"16\" width=\"16\" alt=\"$strfolder\" /> $file
"; $subfilelist = array(); $currdir = opendir($basedir.'/'.$file); while (false !== ($subfile = readdir($currdir))) { @@ -632,7 +635,7 @@ function printfilelist($filelist) { } else { $icon = mimeinfo("icon", $file); - echo "pixpath/f/$icon\" height=\"16\" width=\"16\" alt=\"\" /> $file
"; + echo "pixpath/f/$icon\" height=\"16\" width=\"16\" alt=\"$strfile\" /> $file
"; } } } @@ -688,7 +691,9 @@ function displaydir ($wdir) { $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore= get_string("restore"); - $strchoose = get_string("choose"); + $strchoose = get_string("choose"); + $strfolder = get_string("folder"); + $strfile = get_string("file"); echo "
"; @@ -717,7 +722,8 @@ function displaydir ($wdir) { if ($dir == '..') { $fileurl = rawurlencode(dirname($wdir)); print_cell(); - print_cell('left', ''.get_string('parentfolder').' '.get_string('parentfolder').'', 'name'); + // alt attribute intentionally empty to prevent repetition in screen reader + print_cell('left', '  '.get_string('parentfolder').'', 'name'); print_cell(); print_cell(); print_cell(); @@ -730,7 +736,7 @@ function displaydir ($wdir) { $filesize = display_size(get_directory_size("$fullpath/$dir")); $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); print_cell("center", "", 'checkbox'); - print_cell("left", "pixpath/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /> ".htmlspecialchars($dir)."", 'name'); + print_cell("left", "pixpath/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"$strfolder\" /> ".htmlspecialchars($dir)."", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); print_cell("right", "$strrename", 'commands'); @@ -766,11 +772,7 @@ function displaydir ($wdir) { $ffurl = str_replace('//', '/', "/file.php?file=/$id/$fileurl"); } link_to_popup_window ($ffurl, "display", - "pixpath/f/$icon\" height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />", - 480, 640); - echo ' '; - link_to_popup_window ($ffurl, "display", - htmlspecialchars($file), + "pixpath/f/$icon\" height=\"16\" width=\"16\" border=\"0\" alt=\"$strfile\" /> ".htmlspecialchars($file), 480, 640); echo ""; diff --git a/filter/algebra/filter.php b/filter/algebra/filter.php index 3cc2d9ff13..1f6739c5a7 100644 --- a/filter/algebra/filter.php +++ b/filter/algebra/filter.php @@ -52,6 +52,7 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width="" global $CFG; $output = ""; + $origtex = $tex; if ($tex) { $tex = str_replace('&','&',$tex); $tex = str_replace('<','<',$tex); @@ -76,7 +77,7 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width="" $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,"; $output .= "resizable,width=300,height=240', 0);\">"; } - $output .= "\"\"slasharguments) { // Use this method if possible for better caching $output .= "$CFG->wwwroot/$CFG->algebrafilterdir/pix.php/$imagefile"; } else { diff --git a/filter/tex/filter.php b/filter/tex/filter.php index aacca52e30..6e1ba73fd2 100644 --- a/filter/tex/filter.php +++ b/filter/tex/filter.php @@ -45,6 +45,7 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="", $a global $CFG; $output = ""; + $origtex = $tex; if ($tex) { $tex = str_replace('&','&',$tex); $tex = str_replace('<','<',$tex); @@ -69,7 +70,7 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="", $a $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,"; $output .= "resizable,width=300,height=240', 0);\">"; } - $output .= "\"\"slasharguments) { // Use this method if possible for better caching $output .= "$CFG->wwwroot/$CFG->texfilterdir/pix.php/$imagefile"; } else { diff --git a/lang/en_utf8/enrol_paypal.php b/lang/en_utf8/enrol_paypal.php index 7005b80e9d..096500d165 100644 --- a/lang/en_utf8/enrol_paypal.php +++ b/lang/en_utf8/enrol_paypal.php @@ -6,6 +6,7 @@ $string['business'] = 'The email address of your business PayPal account'; $string['costorkey'] = 'Please choose one of the following methods of enrolment.'; $string['description'] = 'The PayPal module allows you to set up paid courses. If the cost for any course is zero, then students are not asked to pay for entry. There is a site-wide cost that you set here as a default for the whole site and then a course setting that you can set for each course individually. The course cost overrides the site cost.'; $string['enrolname'] = 'PayPal'; +$string['paypalaccepted'] = 'PayPal payments accepted'; $string['sendpaymentbutton'] = 'Send payment via PayPal'; ?> diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index b7a70f6b7b..cff3833520 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -554,6 +554,7 @@ $string['findmorecourses'] = 'Find more courses...'; $string['firstdayofweek'] = '0'; $string['firstname'] = 'First name'; $string['firsttime'] = 'Is this your first time here?'; +$string['folder'] = 'Folder'; $string['folderclosed'] = 'Closed folder'; $string['folderopened'] = 'Opened folder'; $string['followingoptional'] = 'The following items are optional'; diff --git a/lib/tablelib.php b/lib/tablelib.php index 3a38aae3e3..a481e4ad88 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -447,10 +447,10 @@ class flexible_table { if($this->is_collapsible) { if(!empty($this->sess->collapse[$column])) { - $icon_hide = ' '; + $icon_hide = ' '.get_string('show').''; } else if($this->headers[$index] !== NULL) { - $icon_hide = ' '; + $icon_hide = ' '.get_string('hide').''; } } @@ -468,18 +468,18 @@ class flexible_table { $icon_sort_first = $icon_sort_last = ''; if($primary_sort_column == 'firstname') { if($primary_sort_order == SORT_ASC) { - $icon_sort_first = ' '; + $icon_sort_first = ' '.get_string('asc').''; } else { - $icon_sort_first = ' '; + $icon_sort_first = ' '.get_string('desc').''; } } else if($primary_sort_column == 'lastname') { if($primary_sort_order == SORT_ASC) { - $icon_sort_last = ' '; + $icon_sort_last = ' '.get_string('asc').''; } else { - $icon_sort_last = ' '; + $icon_sort_last = ' '.get_string('desc').''; } } $this->headers[$index] = ''.get_string('firstname').' '.$icon_sort_first.' / '. @@ -495,10 +495,10 @@ class flexible_table { if($this->is_sortable) { if($primary_sort_column == $column) { if($primary_sort_order == SORT_ASC) { - $icon_sort = ' '; + $icon_sort = ' '.get_string('asc').''; } else { - $icon_sort = ' '; + $icon_sort = ' '.get_string('desc').''; } } $this->headers[$index] = ''.$this->headers[$index].''; diff --git a/lib/weblib.php b/lib/weblib.php index 5dd4099a72..342a0d8162 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -3041,8 +3041,13 @@ function print_user_picture($userid, $courseid, $picture, $size=0, $return=false $class .= " defaultuserpic"; $src = "$CFG->pixpath/u/$file.png\""; } + if ($user = get_record('user', 'username', 'guest')) { + $username = fullname($user); + } else { + $username = get_string('none'); + } $output .= "\"\""; + " border=\"0\" width=\"$size\" height=\"$size\" alt=\"".s(get_string('user').' '.$username)."\" />"; if ($link) { $output .= ''; } @@ -3222,10 +3227,10 @@ function print_group_picture($group, $courseid, $large=false, $return=false, $li if ($group->picture) { // Print custom group picture if ($CFG->slasharguments) { // Use this method if possible for better caching $output .= ''; + ' border="0" width="'.$size.'" height="'.$size.'" alt="'.s(get_string('group').' '.$group->name).'" title="'.s($group->name).'"/>'; } else { $output .= ''; + ' border="0" width="'.$size.'" height="'.$size.'" alt="'.s(get_string('group').' '.$group->name).'" title="'.s($group->name).'"/>'; } } if ($link or has_capability('moodle/site:accessallgroups', $context)) { @@ -4225,7 +4230,7 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid $class = 'activity '.$mod->mod; $class .= ($cmid == $mod->cm) ? ' selected' : ''; $menu[] = '
  • '. - ''. + ''. ''.$mod->name.'
  • '; $previousmod = $mod; } @@ -5359,7 +5364,8 @@ function page_doc_link($text='', $iconpath='') { $iconpath = $CFG->wwwroot . '/pix/docs.gif'; } - $str .= 'Docs' .$text. ''; + // alt left blank intentionally to prevent repetition in screenreaders + $str .= ' ' .$text. ''; return $str; } diff --git a/message/history.php b/message/history.php index b5cd97ee96..68fc4929e5 100644 --- a/message/history.php +++ b/message/history.php @@ -46,8 +46,8 @@ echo fullname($user1); echo ''; echo ''; - echo ''; - echo ''; + echo ''.get_string('from').''; + echo ''.get_string('to').''; echo ''; echo ''; echo print_user_picture($user2->id, SITEID, $user2->picture, 100, true, true, 'userwindow').'
    '; diff --git a/user/view.php b/user/view.php index b156472ccf..825c4eb397 100644 --- a/user/view.php +++ b/user/view.php @@ -240,7 +240,7 @@ } $emailswitch = " id&course=$course->id&$switchparam=1\">". - "pixpath/t/$switchpix\" alt=\"\" />"; + "pixpath/t/$switchpix\" alt=\"$switchclick\" />"; } else if ($currentuser) { /// Can only re-enable an email this way if ($user->emailstop) { // Include link that tells how to re-enable their email @@ -266,7 +266,7 @@ if ($user->skype && !isset($hiddenfields['skypeid'])) { print_row(get_string('skypeid').':',''.s($user->skype). - ' status'); } if ($user->yahoo && !isset($hiddenfields['yahooid'])) { -- 2.39.5