diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index c0af39efe45..47ce5769375 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -289,16 +289,16 @@ class block_base { $title = '
'; if (!empty($CFG->allowuserblockhiding)) { - //Accessibility: added static 'alt' text for the +- icon. - //TODO (nfreear): language string 'hide OR show block' - $title .= '
'. - ''. - '
'; + //Accessibility: added 'alt' text for the +- icon. + //Theme the buttons using, Admin - Miscellaneous - smartpix. + $strshow = addslashes_js(get_string('showblocka', 'access', $this->title)); + $strhide = addslashes_js(get_string('hideblocka', 'access', $this->title)); + $title .= ''; } //Accesssibility: added H2 (was in, weblib.php: print_side_block) diff --git a/lang/en_utf8/access.php b/lang/en_utf8/access.php index 2f6b613e26d..27bbdfa0d1a 100644 --- a/lang/en_utf8/access.php +++ b/lang/en_utf8/access.php @@ -14,7 +14,8 @@ $string['currentweek'] = 'This week '; $string['currenttopic'] = 'This topic '; $string['monthnext'] = 'Next month'; $string['monthprev'] = 'Previous month'; -$string['showhideblock'] = 'Show or hide block'; +$string['showblocka'] = 'Show $a block'; +$string['hideblocka'] = 'Hide $a block'; $string['sitemap'] = 'Site map'; $string['skipa'] = 'Skip $a'; $string['skipblock'] = 'Skip block'; diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 219a368f99e..cdc283a2456 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -347,19 +347,30 @@ function unmaskPassword(id) { If persistent == true, also sets a cookie for this. */ -function elementToggleHide(el, persistent, elementFinder) { +function elementToggleHide(el, persistent, elementFinder, strShow, strHide) { if(!elementFinder) { - var obj = el; + var obj = el; //el:container + el = document.getElementById('togglehide_'+obj.id); } else { - var obj = elementFinder(el); + var obj = elementFinder(el); //el:button. } if(obj.className.indexOf('hidden') == -1) { obj.className += ' hidden'; + if (el.src) { + el.src = el.src.replace('switch_minus', 'switch_plus'); + el.alt = strShow; + el.title = strShow; + } var shown = 0; } else { - obj.className = obj.className.replace(new RegExp(' ?hidden'), '') + obj.className = obj.className.replace(new RegExp(' ?hidden'), ''); + if (el.src) { + el.src = el.src.replace('switch_plus', 'switch_minus'); + el.alt = strHide; + el.title = strHide; + } var shown = 1; } @@ -368,12 +379,11 @@ function elementToggleHide(el, persistent, elementFinder) { } } - -function elementCookieHide(id) { +function elementCookieHide(id, strShow, strHide) { var obj = document.getElementById(id); var cook = new cookie('hide:' + id).read(); if(cook != null) { - elementToggleHide(obj, false); + elementToggleHide(obj, false, null, strShow, strHide); } } diff --git a/lib/weblib.php b/lib/weblib.php index 4892f19d857..7fb999fd8cb 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -6403,7 +6403,7 @@ function print_side_block($heading='', $content='', $list=NULL, $icons=NULL, $fo } - print_side_block_end($attributes); + print_side_block_end($attributes, $title); echo $skip_dest; } @@ -6453,8 +6453,7 @@ function print_side_block_start($heading='', $attributes = array()) { echo '
'."\n"; } if ($heading) { - //Accessibility: replaced
with H2; no, H2 more appropriate in moodleblock.class.php: _title_html. - // echo '
'.$heading.'
'; + //Accessibility: H2 more appropriate in moodleblock.class.php: _title_html. echo '
'; if (!empty($THEME->customcorners)) { echo '
 
'; @@ -6484,7 +6483,7 @@ function print_side_block_start($heading='', $attributes = array()) { /** * Print table ending tags for a side block box. */ -function print_side_block_end($attributes = array()) { +function print_side_block_end($attributes = array(), $title='') { global $CFG, $THEME; echo '
'; @@ -6495,10 +6494,13 @@ function print_side_block_end($attributes = array()) { echo '
'; + $strshow = addslashes_js(get_string('showblocka', 'access', $title)); + $strhide = addslashes_js(get_string('hideblocka', 'access', $title)); + // IE workaround: if I do it THIS way, it works! WTF? if (!empty($CFG->allowuserblockhiding) && isset($attributes['id'])) { - echo ''; + echo ''; } } diff --git a/pix/t/switch_minus.gif b/pix/t/switch_minus.gif index 959a5c2286b..96327ff410c 100644 Binary files a/pix/t/switch_minus.gif and b/pix/t/switch_minus.gif differ diff --git a/pix/t/switch_plus.gif b/pix/t/switch_plus.gif index 84ac3532459..758b05e7b69 100644 Binary files a/pix/t/switch_plus.gif and b/pix/t/switch_plus.gif differ diff --git a/theme/standard/styles_color.css b/theme/standard/styles_color.css index ef5c3486991..a3c77203c17 100644 --- a/theme/standard/styles_color.css +++ b/theme/standard/styles_color.css @@ -408,19 +408,6 @@ table.flexible .r1 { border-bottom-color: #dddddd; } -.sideblock .header .hide-show img.hide-show-image { - background: url('../../pix/t/switch_minus.gif') no-repeat bottom; -} - -.sideblock.hidden .header .hide-show img.hide-show-image { - background: url('../../pix/t/switch_plus.gif') no-repeat bottom; -} - -/* Accessibility: for Windows High Contrast, partial fix MDL-7493. */ -.sideblock .hide-show a { - border:1px solid white; -} - /*** *** Blogs diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 98416c4522e..f03b48f4d91 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -1184,11 +1184,8 @@ a.skip:focus, a.skip:active { padding:0; } -.sideblock .header .hide-show { +.sideblock .header .hide-show-image { float:right; -} - -.sideblock .header .hide-show img.hide-show-image { height:11px; width:11px; margin-top:0.25em;