From 7b2eff28862cb192298c13c8d60c31795ce7d136 Mon Sep 17 00:00:00 2001 From: David Balch Date: Tue, 28 Oct 2014 09:29:28 +0000 Subject: [PATCH] MDL-36874 mod_book: Add uarrow() output renderer. In preparation for Book navigation improvements in MDL-36874, this commit adds a uarrow() output renderer, to complement rarrow() and larrow(). --- lib/outputlib.php | 26 ++++++++++++++++++++------ lib/outputrenderers.php | 13 +++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index 6ff4db7d2a0..560f66329a6 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -278,6 +278,15 @@ class theme_config { */ public $larrow = null; + /** + * @var string Accessibility: Up arrow-like character is used in + * the book heirarchical navigation. + * If the theme does not set characters, appropriate defaults + * are set automatically. Please DO NOT + * use ^ - this is confusing for blind users. + */ + public $uarrow = null; + /** * @var bool Some themes may want to disable ajax course editing. */ @@ -452,11 +461,13 @@ class theme_config { $baseconfig = $config; } - $configurable = array('parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'javascripts', 'javascripts_footer', - 'parents_exclude_javascripts', 'layouts', 'enable_dock', 'enablecourseajax', 'supportscssoptimisation', - 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'hidefromselector', 'doctype', - 'yuicssmodules', 'blockrtlmanipulations', 'lessfile', 'extralesscallback', 'lessvariablescallback', - 'blockrendermethod'); + $configurable = array( + 'parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', + 'javascripts', 'javascripts_footer', 'parents_exclude_javascripts', + 'layouts', 'enable_dock', 'enablecourseajax', 'supportscssoptimisation', + 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'uarrow', + 'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations', + 'lessfile', 'extralesscallback', 'lessvariablescallback', 'blockrendermethod'); foreach ($config as $key=>$value) { if (in_array($key, $configurable)) { @@ -533,7 +544,7 @@ class theme_config { } /** - * Checks if arrows $THEME->rarrow, $THEME->larrow have been set (theme/-/config.php). + * Checks if arrows $THEME->rarrow, $THEME->larrow, $THEME->uarrow have been set (theme/-/config.php). * If not it applies sensible defaults. * * Accessibility: right and left arrow Unicode characters for breadcrumb, calendar, @@ -546,6 +557,7 @@ class theme_config { // Also OK in Win 9x/2K/IE 5.x $this->rarrow = '►'; $this->larrow = '◄'; + $this->uarrow = '▲'; if (empty($_SERVER['HTTP_USER_AGENT'])) { $uagent = ''; } else { @@ -564,6 +576,7 @@ class theme_config { // So we use the same ones Konqueror uses. $this->rarrow = '→'; $this->larrow = '←'; + $this->uarrow = '↑'; } elseif (isset($_SERVER['HTTP_ACCEPT_CHARSET']) && false === stripos($_SERVER['HTTP_ACCEPT_CHARSET'], 'utf-8')) { @@ -571,6 +584,7 @@ class theme_config { // To be safe, non-Unicode browsers! $this->rarrow = '>'; $this->larrow = '<'; + $this->uarrow = '^'; } // RTL support - in RTL languages, swap r and l arrows diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index b0deb72a798..e571613c935 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -3189,6 +3189,19 @@ EOD; return $this->page->theme->larrow; } + /** + * Accessibility: Up arrow-like character is used in + * the book heirarchical navigation. + * If the theme does not set characters, appropriate defaults + * are set automatically. Please DO NOT + * use ^ - this is confusing for blind users. + * + * @return string + */ + public function uarrow() { + return $this->page->theme->uarrow; + } + /** * Returns the custom menu if one has been set *