Fixes bug MDL-9753, "THEME->larrow, rarrow don't work in stock IE6". Merged.

This commit is contained in:
nfreear
2007-05-11 11:29:45 +00:00
parent 2b241253e4
commit 1e53ed8af3
5 changed files with 150 additions and 50 deletions
+1 -2
View File
@@ -45,8 +45,7 @@ class ExHtmlReporter extends HtmlReporter {
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
$this->strrunonlyfile = $this->get_string('runonlyfile');
check_theme_arrows();
$this->strseparator = ' <span class="sep">'.$THEME->rarrow.'</span> ';
$this->strseparator = get_separator();
}
/**
+1 -2
View File
@@ -29,8 +29,7 @@ class block_search_forums extends block_base {
$search = get_string('search');
//Accessibility: replaced <input value=" />" type="submit"> with configurable text/'silent' character.
check_theme_arrows();
// Theme config, $CFG->block_search_button = $THEME->rarrow .'<span class="accesshide">'.get_string('search').'</span>';
// Theme config, $CFG->block_search_button = link_arrow_right(get_string('search'), $url='', $accesshide=true);
$button = (isset($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go');
$this->content->text = '<div class="searchform">';
+45 -20
View File
@@ -620,31 +620,28 @@ function calendar_top_controls($type, $data) {
$data['y'] = $date['year'];
//Accessibility: calendar block controls, replaced <table> with <div>.
check_theme_arrows();
$nexttext = $THEME->rarrow .'<span class="accesshide">'.get_string('monthnext','access').'</span>';
$prevtext = $THEME->larrow .'<span class="accesshide">'.get_string('monthprev','access').'</span>';
//$nexttext = link_arrow_right(get_string('monthnext', 'access'), $url='', $accesshide=true);
//$prevtext = link_arrow_left(get_string('monthprev', 'access'), $url='', $accesshide=true);
switch($type) {
case 'frontpage':
list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
$nextlink = calendar_get_link_tag($nexttext, 'index.php?', 0, $nextmonth, $nextyear);
$prevlink = calendar_get_link_tag($prevtext, 'index.php?', 0, $prevmonth, $prevyear);
$content .= '<div class="calendar-controls">';
$content .= '<span class="previous" title="'.get_string('monthprev','access').'">'.$prevlink."</span>\n";
$nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'index.php?', 0, $nextmonth, $nextyear, $accesshide=true);
$prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'index.php?', 0, $prevmonth, $prevyear, true);
$content .= "\n".'<div class="calendar-controls">'. $prevlink;
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
$content .= '<span class="hide"> | </span><span class="next" title="'.get_string('monthnext','access').'">'.$nextlink."</span>\n";
$content .= '<span class="hide"> | </span>'. $nextlink ."\n";
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
break;
case 'course':
list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
$nextlink = calendar_get_link_tag($nexttext, 'view.php?id='.$data['id'].'&amp;', 0, $nextmonth, $nextyear);
$prevlink = calendar_get_link_tag($prevtext, 'view.php?id='.$data['id'].'&amp;', 0, $prevmonth, $prevyear);
$content .= '<div class="calendar-controls">';
$content .= '<span class="previous" title="'.get_string('monthprev','access').'">'.$prevlink."</span>\n";
$nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'view.php?id='.$data['id'].'&amp;', 0, $nextmonth, $nextyear, $accesshide=true);
$prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'view.php?id='.$data['id'].'&amp;', 0, $prevmonth, $prevyear, true);
$content .= "\n".'<div class="calendar-controls">'. $prevlink;
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month&amp;course='.$data['id'].'&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
$content .= '<span class="hide"> | </span><span class="next" title="'.get_string('monthnext','access').'">'.$nextlink."</span>\n";
$content .= '<span class="hide"> | </span>'. $nextlink ."\n";
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
break;
case 'upcoming':
@@ -658,10 +655,10 @@ function calendar_top_controls($type, $data) {
list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
$prevdate = make_timestamp($prevyear, $prevmonth, 1);
$nextdate = make_timestamp($nextyear, $nextmonth, 1);
$content .= '<div class="calendar-controls">';
$content .= '<span class="previous"><a href="'.calendar_get_link_href('view.php?view=month&amp;', 1, $prevmonth, $prevyear)."\"> $THEME->larrow ".userdate($prevdate, get_string('strftimemonthyear')).'</a></span>';
$content .= "\n".'<div class="calendar-controls">';
$content .= calendar_get_link_previous(userdate($prevdate, get_string('strftimemonthyear')), 'view.php?view=month&amp;', 1, $prevmonth, $prevyear);
$content .= '<span class="hide"> | </span><span class="current">'.userdate($time, get_string('strftimemonthyear'))."</span>\n";
$content .= '<span class="hide"> | </span><span class="next"><a href="'.calendar_get_link_href('view.php?view=month&amp;', 1, $nextmonth, $nextyear).'">'.userdate($nextdate, get_string('strftimemonthyear'))." $THEME->rarrow</a></span>\n";
$content .= '<span class="hide"> | </span>'.calendar_get_link_next(userdate($nextdate, get_string('strftimemonthyear')), 'view.php?view=month&amp;', 1, $nextmonth, $nextyear);
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
break;
case 'day':
@@ -670,9 +667,9 @@ function calendar_top_controls($type, $data) {
$nextdate = usergetdate(make_timestamp($data['y'], $data['m'], $data['d'] + 1));
$prevname = calendar_wday_name($CALENDARDAYS[$prevdate['wday']]);
$nextname = calendar_wday_name($CALENDARDAYS[$nextdate['wday']]);
$content .= '<div class="calendar-controls">';
$content .= '<span class="previous"><a href="'.calendar_get_link_href('view.php?view=day&amp;', $prevdate['mday'], $prevdate['mon'], $prevdate['year'])."\">$THEME->larrow ".$prevname."</a></span>\n";
$content .= "\n".'<div class="calendar-controls">';
$content .= calendar_get_link_previous($prevname, 'view.php?view=day&amp;', $prevdate['mday'], $prevdate['mon'], $prevdate['year']);
// Get the format string
$text = get_string('strftimedaydate');
/*
@@ -685,7 +682,7 @@ function calendar_top_controls($type, $data) {
// Print the actual thing
$content .= '<span class="hide"> | </span><span class="current">'.$text.'</span>';
$content .= '<span class="hide"> | </span><span class="next"><a href="'.calendar_get_link_href('view.php?view=day&amp;', $nextdate['mday'], $nextdate['mon'], $nextdate['year']).'">'.$nextname." $THEME->rarrow</a></span>\n";
$content .= '<span class="hide"> | </span>'. calendar_get_link_next($nextname, 'view.php?view=day&amp;', $nextdate['mday'], $nextdate['mon'], $nextdate['year']);
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
break;
}
@@ -854,6 +851,34 @@ function calendar_get_link_tag($text, $linkbase, $d, $m, $y) {
return '<a href="'.$href.'">'.$text.'</a>';
}
/**
* Build and return a previous month HTML link, with an arrow.
* @param string $text The text label.
* @param string $linkbase The URL stub.
* @param int $d $m $y Day of month, month and year numbers.
* @param bool $accesshide Default visible, or hide from all except screenreaders.
* @return string HTML string.
*/
function calendar_get_link_previous($text, $linkbase, $d, $m, $y, $accesshide=false) {
$href = calendar_get_link_href($linkbase, $d, $m, $y);
if(empty($href)) return $text;
return link_arrow_left($text, $href, $accesshide, 'previous');
}
/**
* Build and return a next month HTML link, with an arrow.
* @param string $text The text label.
* @param string $linkbase The URL stub.
* @param int $d $m $y Day of month, month and year numbers.
* @param bool $accesshide Default visible, or hide from all except screenreaders.
* @return string HTML string.
*/
function calendar_get_link_next($text, $linkbase, $d, $m, $y, $accesshide=false) {
$href = calendar_get_link_href($linkbase, $d, $m, $y);
if(empty($href)) return $text;
return link_arrow_right($text, $href, $accesshide, 'next');
}
function calendar_wday_name($englishname) {
return get_string(strtolower($englishname), 'calendar');
}
+101 -21
View File
@@ -2202,10 +2202,11 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
}
@header('Accept-Ranges: none');
$currentlanguage = current_language();
if (empty($usexml)) {
$direction = ' xmlns="http://www.w3.org/1999/xhtml"'. $direction; // See debug_header
} else {
$currentlanguage = current_language();
$mathplayer = preg_match("/MathPlayer/i", $_SERVER['HTTP_USER_AGENT']);
if(!$mathplayer) {
header('Content-Type: application/xhtml+xml');
@@ -2262,6 +2263,8 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
$pageclass .= ' drag';
}
$pageclass .= ' lang-'.$currentlanguage;
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
ob_start();
@@ -2833,6 +2836,85 @@ function check_theme_arrows() {
}
}
/**
* Return the right arrow with text ('next'), and optionally embedded in a link.
* See function above, check_theme_arrows.
* To see examples of this function in use, see function get_separator below (simple),
* and function calendar_get_link_next in calendar/lib.php (more complex).
* @param string $text Plain text label (set to blank only for breadcrumb separator cases).
* @param string $url An optional link to use in a surrounding HTML anchor.
* @param bool $accesshide True if text should be hidden (for screen readers only).
* @param string $addclass Additional class names for the link, or the arrow character.
* @return string HTML string.
*/
function link_arrow_right($text, $url='', $accesshide=false, $addclass='') {
global $THEME;
check_theme_arrows();
$arrowclass = 'arrow ';
if (! $url) {
$arrowclass .= $addclass;
}
$arrow = '<span class="'.$arrowclass.'">'.$THEME->rarrow.'</span>';
$htmltext = '';
if ($text) {
$htmltext = htmlspecialchars($text).'&nbsp;';
if ($accesshide) {
$htmltext = '<span class="accesshide">'.$htmltext.'</span>';
}
}
if ($url) {
$class = '';
if ($addclass) {
$class =" class=\"$addclass\"";
}
return '<a'.$class.' href="'.$url.'" title="'.htmlspecialchars($text).'">'.$htmltext.$arrow.'</a>';
}
return $htmltext.$arrow;
}
/**
* Return the left arrow with text ('previous'), and optionally embedded in a link.
* See function above, check_theme_arrows.
* @param string $text Plain text label (set to blank only for breadcrumb separator cases).
* @param string $url An optional link to use in a surrounding HTML anchor.
* @param bool $accesshide True if text should be hidden (for screen readers only).
* @param string $addclass Additional class names for the link, or the arrow character.
* @return string HTML string.
*/
function link_arrow_left($text, $url='', $accesshide=false, $addclass='') {
global $THEME;
check_theme_arrows();
$arrowclass = 'arrow ';
if (! $url) {
$arrowclass .= $addclass;
}
$arrow = '<span class="'.$arrowclass.'">'.$THEME->larrow.'</span>';
$htmltext = '';
if ($text) {
$htmltext = '&nbsp;'.htmlspecialchars($text);
if ($accesshide) {
$htmltext = '<span class="accesshide">'.$htmltext.'</span>';
}
}
if ($url) {
$class = '';
if ($addclass) {
$class =" class=\"$addclass\"";
}
return '<a'.$class.' href="'.$url.'" title="'.htmlspecialchars($text).'">'.$arrow.$htmltext.'</a>';
}
return $arrow.$htmltext;
}
/**
* Return the breadcrumb trail navigation separator.
* @return string HTML string.
*/
function get_separator() {
//Accessibility: the 'hidden' slash is preferred for screen readers.
return ' '.link_arrow_right($text='/', $url='', $accesshide=true, 'sep').' ';
}
/**
* Prints breadcrumb trail of links, called in theme/-/header.html
*
@@ -2846,20 +2928,19 @@ function print_navigation ($navigation, $separator=0, $return=false) {
global $CFG, $THEME;
$output = '';
check_theme_arrows();
if (0 === $separator) {
$separator = $THEME->rarrow;
$separator = get_separator();
}
if (!empty($separator)) {
else {
$separator = '<span class="sep">'. $separator .'</span>';
}
if ($navigation) {
if (!is_array($navigation)) {
$ar = explode('->', $navigation);
$navigation = array();
foreach ($ar as $a) {
if (strpos($a, '</a>') === false) {
$navigation[] = array('title' => $a, 'url' => '');
@@ -2875,17 +2956,17 @@ function print_navigation ($navigation, $separator=0, $return=false) {
$site = new object();
$site->shortname = get_string('home');
}
//Accessibility: breadcrumb links now in a list, &raquo; replaced with a 'silent' character.
$nav_text = get_string('youarehere','access');
$output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
$output .= '<li class="first">'."\n".'<a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
.$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))
&& !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest())
? '/my' : '') .'/">'. format_string($site->shortname) ."</a>\n</li>\n";
foreach ($navigation as $navitem) {
$title = trim(strip_tags(format_string($navitem['title'], false)));
$url = $navitem['url'];
@@ -2897,7 +2978,7 @@ function print_navigation ($navigation, $separator=0, $return=false) {
.$url.'">'."$title</a>\n</li>\n";
}
}
$output .= "</ul>\n";
}
@@ -3379,11 +3460,11 @@ has_capability('moodle/course:viewhiddenuserfields', $context)) {
/**
* Print a specified group's avatar.
*
* @param group $group A {@link group} object representing a group or array of groups
* @param int $courseid ?
* @param boolean $large ?
* @param boolean $return ?
* @param boolean $link ?
* @param group $group A single {@link group} object OR array of groups.
* @param int $courseid The course ID.
* @param boolean $large Default small picture, or large.
* @param boolean $return If false print picture, otherwise return the output as string
* @param boolean $link Enclose image in a link to view specified course?
* @return string
* @todo Finish documenting this function
*/
@@ -4353,7 +4434,6 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
}
}
//Accessibility: added Alt text, replaced &gt; &lt; with 'silent' character and 'accesshide' text.
check_theme_arrows();
if ($selectmod and has_capability('moodle/site:viewreports', $context)) {
$logstext = get_string('alllogs');
@@ -4367,15 +4447,15 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
$backtext= get_string('activityprev', 'access');
$backmod = '<li>'."\n".'<form action="'.$CFG->wwwroot.'/mod/'.$backmod->mod.'/view.php" '.$CFG->frametarget.'>'."\n".'<div>'."\n".
'<input type="hidden" name="id" value="'.$backmod->cm.'" />'."\n".
'<button type="submit" title="'.$backtext.'">'.$THEME->larrow."\n".
'<span class="accesshide">'.$backtext.'</span>'."\n".'</button>'."\n".'</div>'."\n".'</form>'."\n".'</li>'."\n";
'<button type="submit" title="'.$backtext.'">'.link_arrow_left($backtext, $url='', $accesshide=true)."\n".
'</button>'."\n".'</div>'."\n".'</form>'."\n".'</li>'."\n";
}
if ($nextmod) {
$nexttext= get_string('activitynext', 'access');
$nextmod = '<li>'."\n".'<form action="'.$CFG->wwwroot.'/mod/'.$nextmod->mod.'/view.php" '.$CFG->frametarget.'>'."\n".'<div>'."\n".
'<input type="hidden" name="id" value="'.$nextmod->cm.'" />'."\n".
'<button type="submit" title="'.$nexttext.'">'.$THEME->rarrow."\n".
'<span class="accesshide">'.$nexttext.'</span>'."\n".'</button>'."\n".'</div>'."\n".'</form>'."\n".'</li>'."\n";
'<button type="submit" title="'.$nexttext.'">'.link_arrow_right($nexttext, $url='', $accesshide=true)."\n".
'</button>'."\n".'</div>'."\n".'</form>'."\n".'</li>'."\n";
}
return '<div class="navigation">'."\n".'<ul>'.$logslink . $backmod .
+2 -5
View File
@@ -184,11 +184,8 @@ a.useredit, a:hover.useredit, .blink {
}
/* Accessibility: only certain fonts support Unicode chars like &#x25BA; in IE6 */
.breadcrumb .sep, .headermenu button,
.calendar-controls .previous, .calendar-controls .next,
.arrow_button input, .arrow_button button {
font-family:Arial,Helvetica,Courier,'Arial Unicode MS',
'Lucida Sans Unicode','Lucida Grande','GNU Unifont',unifont,sans-serif;
.arrow, .arrow_button input {
font-family: Arial,Helvetica,Courier,sans-serif;
}
.navigation button {