commit
a380159f0e
29 changed files with 2464 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||
# Default ignored files |
|||
/shelf/ |
|||
/workspace.xml |
|||
# Editor-based HTTP Client requests |
|||
/httpRequests/ |
|||
# Datasource local storage ignored files |
|||
/dataSources/ |
|||
/dataSources.local.xml |
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<module type="WEB_MODULE" version="4"> |
|||
<component name="NewModuleRootManager"> |
|||
<content url="file://$MODULE_DIR$" /> |
|||
<orderEntry type="inheritedJdk" /> |
|||
<orderEntry type="sourceFolder" forTests="false" /> |
|||
</component> |
|||
</module> |
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ProjectModuleManager"> |
|||
<modules> |
|||
<module fileurl="file://$PROJECT_DIR$/.idea/accessibility.iml" filepath="$PROJECT_DIR$/.idea/accessibility.iml" /> |
|||
</modules> |
|||
</component> |
|||
</project> |
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="PhpStanOptionsConfiguration"> |
|||
<option name="transferred" value="true" /> |
|||
</component> |
|||
<component name="PsalmOptionsConfiguration"> |
|||
<option name="transferred" value="true" /> |
|||
</component> |
|||
</project> |
@ -0,0 +1,28 @@ |
|||
New in 2.2.3: |
|||
* Minor bugfixes |
|||
|
|||
New in 2.2.2: |
|||
* Moodle 2.8 support |
|||
* Various bugfixes and improvements |
|||
|
|||
New in 2.2.1: |
|||
* IE support improved |
|||
* Scaling of headings adjusted |
|||
* Disabling/enabling buttons within block fixed |
|||
* Javascript script improved |
|||
* Various bugfixes and improvements |
|||
|
|||
New in 2.2: |
|||
* Compatibility with "Clean" theme |
|||
* Full no-js support (Plugin architecture is now moved entirely into server-side) |
|||
* Major fixes from previous relases |
|||
* Croatian language added |
|||
* Block instance configuration form implemented |
|||
|
|||
New in version 2.1.5: |
|||
* Fixed long-standing CSS inclusion bug, thanks to AviMoto |
|||
|
|||
New in version 2.1: |
|||
* Updated ATBar |
|||
* Added French Translation |
|||
* Various bug fixes |
@ -0,0 +1,20 @@ |
|||
Accessibility Block for Moodle |
|||
|
|||
Provides options for changing text size and colour scheme. Settings can be saved to persist between sessions. Colour settings can be defined at the block instance level (Block instance configuration). |
|||
|
|||
Also integrates ATbar from Southampton University ECS http://www.atbar.org. Code used under BSD Licence. |
|||
|
|||
To install, place all files in /blocks/accessibility/ directory and visit /admin/index.php in your browser. To achieve block appearance throughout entire Moodle site (so-called "Sticky block") once the plugin is installed into Moodle, it's recommended to add its instance onto the Moodle homepage (/index.php). Homepage instance of the block enables "Page contexts" option in block instance configuration to be set to "Display throughout entire site". |
|||
|
|||
This block was initially written by Mark Johnson <mark@barrenfrozenwasteland.com> |
|||
It is copyright of Mark Johnson, Richard Taunton's Sixth Form College and contributors. |
|||
|
|||
Developers can find the documentation here: https://drive.google.com/folderview?id=0BwrUG2o1JsD_bGo2S3hJNXFDd28&usp=sharing |
|||
|
|||
Translations are copyright of their respective authors, as indicated in each language file. |
|||
|
|||
Current languages are English, German, Spanish, Portuguese, Croatian and French. If you're |
|||
interested in adding a translation please raise a bug on Github |
|||
https://github.com/marxjohnson/moodle-block_accessibility/issues |
|||
|
|||
Released Under the GNU General Public Licence http://www.gnu.org/copyleft/gpl.html |
@ -0,0 +1,349 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Define the accessibility block's class |
|||
* |
|||
* @package block_accessibility |
|||
* @author Mark Johnson <mark.johnson@tauntons.ac.uk> |
|||
* @copyright 2010 Tauntons College, UK |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
*/ |
|||
|
|||
defined('MOODLE_INTERNAL') || die(); |
|||
require_once($CFG->dirroot . '/blocks/accessibility/lib.php'); |
|||
|
|||
/** |
|||
* accessibility Block's class |
|||
*/ |
|||
class block_accessibility extends block_base { |
|||
|
|||
const JS_URL = '/blocks/accessibility/module.js'; |
|||
const CSS_URL = '/blocks/accessibility/userstyles.php'; |
|||
const FONTSIZE_URL = '/blocks/accessibility/changesize.php'; |
|||
const COLOUR_URL = '/blocks/accessibility/changecolour.php'; |
|||
const DB_URL = '/blocks/accessibility/database.php'; |
|||
|
|||
/** |
|||
* Set the title and include the stylesheet |
|||
* |
|||
* We need to include the stylesheet here rather than in {@see get_content()} since get_content |
|||
* is sometimes called after $OUTPUT->heading(), e.g. such as /user/index.php where the middle |
|||
* region is hard-coded. |
|||
* However, /admin/plugins.php calls init() for each plugin after $OUTPUT->heading(), so the |
|||
* sheet is not included at all on that page. |
|||
*/ |
|||
public function init() { |
|||
$this->title = get_string('pluginname', 'block_accessibility'); |
|||
} |
|||
|
|||
/** |
|||
* Called after init(). Here we have instance id so we can use config for specific instance |
|||
* The function will include CSS declarations into Moodle Page |
|||
* CSS declarations will be generated according to user settings and instance configuration |
|||
* |
|||
*/ |
|||
public function specialization() { |
|||
$instanceid = $this->instance->id; |
|||
|
|||
if (!$this->page->requires->is_head_done()) { |
|||
|
|||
// Link default/saved settings to a page. |
|||
// Each block instance has it's own configuration form, so we need instance id. |
|||
$cssurl = self::CSS_URL . '?instance_id=' . $instanceid; |
|||
$this->page->requires->css($cssurl); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* instance_allow_multiple explicitly tells there cannot be multiple |
|||
* block instance on the same page |
|||
* |
|||
*/ |
|||
public function instance_allow_multiple() { |
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* Set where the block should be allowed to be added |
|||
* |
|||
* @return array |
|||
*/ |
|||
public function applicable_formats() { |
|||
return array('all' => true); |
|||
} |
|||
|
|||
/** |
|||
* Generate the contents for the block |
|||
* |
|||
* @return object Block contents and footer |
|||
*/ |
|||
public function get_content() { |
|||
global $USER; |
|||
global $FULLME; |
|||
global $DB; |
|||
|
|||
// Until Issue #63 is fixed, we don't want to display block for unauthenticated users. |
|||
if (!isloggedin()) { |
|||
return null; |
|||
} |
|||
|
|||
if ($this->content !== null) { |
|||
return $this->content; |
|||
} |
|||
|
|||
// Get the current page url (redirection after action when no Javascript). |
|||
$params = array('redirect' => $FULLME); |
|||
|
|||
// Set block services paths: changesize.php, changecolour.php and database.php. |
|||
$sizeurl = new moodle_url(self::FONTSIZE_URL, $params); |
|||
$coloururl = new moodle_url(self::COLOUR_URL, $params); |
|||
|
|||
$params['op'] = 'save'; |
|||
$params['size'] = true; |
|||
$params['scheme'] = true; |
|||
$dburl = new moodle_url(self::DB_URL, $params); |
|||
|
|||
// Initialization of increase_font, decrease_font and save button. |
|||
$incattrs = array( |
|||
'title' => get_string('inctext', 'block_accessibility'), |
|||
'id' => "block_accessibility_inc", |
|||
'href' => $sizeurl->out(false, array('op' => 'inc')) |
|||
); |
|||
$decattrs = array( |
|||
'title' => get_string('dectext', 'block_accessibility'), |
|||
'id' => "block_accessibility_dec", |
|||
'href' => $sizeurl->out(false, array('op' => 'dec')) |
|||
); |
|||
$saveattrs = array( |
|||
'title' => get_string('save', 'block_accessibility'), |
|||
'id' => "block_accessibility_save", |
|||
'href' => $dburl->out(false) |
|||
); |
|||
|
|||
// Initialization of reset button. |
|||
$resetattrs = array( |
|||
'id' => 'block_accessibility_reset', |
|||
'title' => get_string('resettext', 'block_accessibility'), |
|||
'href' => $sizeurl->out(false, array('op' => 'reset')) |
|||
); |
|||
|
|||
// If any of increase/decrease buttons reached maximum size, disable it. |
|||
if (isset($USER->fontsize)) { |
|||
if ($USER->fontsize == MIN_FONTSIZE) { |
|||
$decattrs['class'] = 'disabled'; |
|||
unset($decattrs['href']); |
|||
} |
|||
if ($USER->fontsize == MAX_FONTSIZE) { |
|||
$incattrs['class'] = 'disabled'; |
|||
unset($incattrs['href']); |
|||
} |
|||
} else { |
|||
// Or disable reset button. |
|||
$resetattrs['class'] = 'disabled'; |
|||
} |
|||
|
|||
// Initialization of scheme profiles buttons. |
|||
$c1attrs = array( |
|||
'title' => get_string('col1text', 'block_accessibility'), |
|||
'id' => 'block_accessibility_colour1', |
|||
'href' => $coloururl->out(false, array('scheme' => 1)) |
|||
); |
|||
$c2attrs = array( |
|||
'title' => get_string('col2text', 'block_accessibility'), |
|||
'id' => 'block_accessibility_colour2', |
|||
'href' => $coloururl->out(false, array('scheme' => 2)) |
|||
); |
|||
$c3attrs = array( |
|||
'title' => get_string('col3text', 'block_accessibility'), |
|||
'id' => 'block_accessibility_colour3', |
|||
'href' => $coloururl->out(false, array('scheme' => 3)) |
|||
); |
|||
$c4attrs = array( |
|||
'title' => get_string('col4text', 'block_accessibility'), |
|||
'id' => 'block_accessibility_colour4', |
|||
'href' => $coloururl->out(false, array('scheme' => 4)) |
|||
); |
|||
|
|||
if (!isset($USER->colourscheme)) { |
|||
$c1attrs['class'] = 'disabled'; |
|||
} |
|||
|
|||
// The display:inline-block CSS declaration is not applied to block's buttons because IE7 doesn't support, float is |
|||
// used instead for IE7 only. |
|||
$clearfix = ''; |
|||
if (preg_match('/(?i)msie [1-7]/', $_SERVER['HTTP_USER_AGENT'])) { |
|||
$clearfix = html_writer::tag('div', '', array('style' => 'clear:both')); // Required for IE7. |
|||
} |
|||
|
|||
// Render block HTML. |
|||
$content = ''; |
|||
|
|||
$strchar = get_string('char', 'block_accessibility'); |
|||
$resetchar = "R"; |
|||
$divattrs = array('id' => 'accessibility_controls', 'class' => 'content'); |
|||
$listattrs = array('id' => 'block_accessibility_textresize', 'class' => 'button_row'); |
|||
|
|||
$content .= html_writer::start_tag('div', $divattrs); |
|||
$content .= html_writer::start_tag('ul', $listattrs); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $strchar . '-', $decattrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $strchar, $resetattrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $strchar . '+', $incattrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', ' ', $saveattrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::end_tag('ul'); |
|||
|
|||
$content .= $clearfix; |
|||
|
|||
// Colour change buttons. |
|||
$content .= html_writer::start_tag('ul', array('id' => 'block_accessibility_changecolour')); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $resetchar, $c1attrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $strchar, $c2attrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $strchar, $c3attrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::start_tag('li', array('class' => 'access-button')); |
|||
$content .= html_writer::tag('a', $strchar, $c4attrs); |
|||
$content .= html_writer::end_tag('li'); |
|||
|
|||
$content .= html_writer::end_tag('ul'); |
|||
|
|||
$content .= $clearfix; |
|||
|
|||
// Display "settings saved" or etc. |
|||
if (isset($USER->accessabilitymsg)) { |
|||
$message = $USER->accessabilitymsg; |
|||
unset($USER->accessabilitymsg); |
|||
} else { |
|||
$message = ''; |
|||
} |
|||
$messageattrs = array('id' => 'block_accessibility_message', 'class' => 'clearfix'); |
|||
$content .= html_writer::tag('div', $message, $messageattrs); |
|||
|
|||
// Data to pass to module.js. |
|||
$jsdata['autoload_atbar'] = false; |
|||
$jsdata['instance_id'] = $this->instance->id; |
|||
|
|||
// Render ATBar. |
|||
$showatbar = DEFAULT_SHOWATBAR; |
|||
if (isset($this->config->showATbar)) { |
|||
$showatbar = $this->config->showATbar; |
|||
} |
|||
|
|||
if ($showatbar) { |
|||
|
|||
// Load database record for a current user. |
|||
$options = $DB->get_record('block_accessibility', array('userid' => $USER->id)); |
|||
|
|||
// Initialize ATBar. |
|||
$checkboxattrs = array( |
|||
'type' => 'checkbox', |
|||
'value' => 1, |
|||
'id' => 'atbar_auto', |
|||
'name' => 'atbar_auto', |
|||
'class' => 'atbar_control', |
|||
); |
|||
|
|||
$labelattrs = array( |
|||
'for' => 'atbar_auto', |
|||
'class' => 'atbar_control' |
|||
); |
|||
|
|||
if ($options && $options->autoload_atbar) { |
|||
$checkboxattrs['checked'] = 'checked'; |
|||
$jsdata['autoload_atbar'] = true; |
|||
} |
|||
|
|||
// ATbar launch button (if javascript is enabled). |
|||
$launchattrs = array( |
|||
'type' => 'button', |
|||
'value' => get_string('launchtoolbar', 'block_accessibility'), |
|||
'id' => 'block_accessibility_launchtoolbar', |
|||
'class' => 'atbar_control access-button' |
|||
); |
|||
|
|||
// Render ATBar. |
|||
$content .= html_writer::empty_tag('input', $launchattrs); |
|||
|
|||
$spanattrs = array('class' => 'atbar-always'); |
|||
$content .= html_writer::start_tag('span', $spanattrs); |
|||
$content .= html_writer::empty_tag('input', $checkboxattrs); |
|||
$strlaunch = get_string('autolaunch', 'block_accessibility'); |
|||
$content .= html_writer::tag('label', $strlaunch, $labelattrs); |
|||
$content .= html_writer::end_tag('span'); |
|||
} |
|||
|
|||
$content .= html_writer::end_tag('div'); |
|||
|
|||
// Loader icon. |
|||
$spanattrs = array('id' => 'loader-icon'); |
|||
$content .= html_writer::start_tag('span', $spanattrs); |
|||
$content .= html_writer::end_tag('span'); |
|||
|
|||
$content .= $clearfix; |
|||
|
|||
$this->content = new stdClass; |
|||
$this->content->footer = ''; |
|||
$this->content->text = $content; |
|||
|
|||
// Keep in mind that dynamic AJAX mode cannot work properly with IE <= 8 (for now), so javascript will not even be loaded. |
|||
if (!preg_match('/(?i)msie [1-8]/', $_SERVER['HTTP_USER_AGENT'])) { |
|||
// Language strings to pass to module.js. |
|||
$this->page->requires->string_for_js('saved', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnosave', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('reset', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnosizereset', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnocolourreset', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnosize', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnocolour', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnosizereset', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('jsnotloggedin', 'block_accessibility'); |
|||
$this->page->requires->string_for_js('launchtoolbar', 'block_accessibility'); |
|||
|
|||
$jsmodule = array( |
|||
'name' => 'block_accessibility', |
|||
'fullpath' => self::JS_URL, |
|||
'requires' => array('base', 'node', 'stylesheet') |
|||
); |
|||
|
|||
// Include js script and pass the arguments. |
|||
$this->page->requires->js_init_call('M.block_accessibility.init', $jsdata, false, $jsmodule); |
|||
} |
|||
|
|||
return $this->content; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,74 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Sets the session variable for custom colour schemes (1) |
|||
* |
|||
* This page accepts the required colour scheme as an argument, and |
|||
* sets a session variable accordingly. If the colour scheme is 1 (the |
|||
* theme default) the variable is unset. |
|||
* If the page is being requested via AJAX, we just return HTTP 200, or |
|||
* 400 if the parameter was invalid. If requesting normally, we redirect |
|||
* to reset the saved setting, or to the page we came from as required. (2) |
|||
* |
|||
* @package block_accessibility (3) |
|||
* @copyright Copyright © 2009 Taunton's College (4) |
|||
* @author Mark Johnson (5) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (6) |
|||
* @param int scheme - The number of the colour scheme, 1-4 (7) |
|||
*/ |
|||
|
|||
require_once('../../config.php'); |
|||
require_once($CFG->dirroot . '/blocks/accessibility/lib.php'); |
|||
require_login(); |
|||
|
|||
$scheme = required_param('scheme', PARAM_INT); |
|||
|
|||
switch ($scheme) { |
|||
case 1: |
|||
// Clear the scheme stored in the session. |
|||
unset($USER->colourscheme); |
|||
|
|||
// Clear user records in database. |
|||
$urlparams = array( |
|||
'op' => 'reset', |
|||
'scheme' => true, |
|||
'userid' => $USER->id |
|||
); |
|||
if (!accessibility_is_ajax()) { |
|||
$redirect = required_param('redirect', PARAM_TEXT); |
|||
$urlparams['redirect'] = safe_redirect_url($redirect); |
|||
} |
|||
$redirecturl = new moodle_url('/blocks/accessibility/database.php', $urlparams); |
|||
redirect($redirecturl); |
|||
break; |
|||
|
|||
case 2: |
|||
case 3: |
|||
case 4: |
|||
$USER->colourscheme = $scheme; |
|||
break; |
|||
|
|||
default: |
|||
header("HTTP/1.0 400 Bad Request"); |
|||
break; |
|||
} |
|||
|
|||
if (!accessibility_is_ajax()) { |
|||
$redirect = required_param('redirect', PARAM_TEXT); |
|||
$redirecturl = new moodle_url($redirect); |
|||
redirect($redirecturl); |
|||
} |
@ -0,0 +1,120 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Changes the text size via PHP or AJAX (1) |
|||
* |
|||
* This file finds the current font size, increases/decreases/resets it |
|||
* as specified, and stores it in the $USER->fontsize session variable. |
|||
* If requested via AJAX, it also returns the font size as a JSON |
|||
* string or suiable error code. If not, it redirects the user back to |
|||
* where they came from. (2) |
|||
* |
|||
* @package block_accessibility (3) |
|||
* @author Mark Johnson <mark.johnson@tauntons.ac.uk> |
|||
* @copyright 2010 Tauntons College, UK |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (5) |
|||
*/ |
|||
|
|||
header('Cache-Control: no-cache'); |
|||
|
|||
require_once('../../config.php'); |
|||
require_once($CFG->dirroot . '/blocks/accessibility/lib.php'); |
|||
require_login(); |
|||
|
|||
// If the user hasn't already changed the size, we need to find a default/referent so we know where we're |
|||
// increasing/decreasing from. |
|||
if (!isset($USER->defaultfontsize)) { |
|||
$USER->defaultfontsize = DEFAULT_FONTSIZE; |
|||
} |
|||
|
|||
// Get the current font size in px. |
|||
// NOTE: User settings priority: 1. $USER session, 2. database, 3. default. |
|||
$current = $USER->defaultfontsize; |
|||
if (isset($USER->fontsize)) { |
|||
$current = $USER->fontsize; // User session. |
|||
} else { |
|||
if ($userstyle = $DB->get_record('block_accessibility', array('userid' => $USER->id))) { |
|||
$current = $userstyle->fontsize; // User stored settings. |
|||
} |
|||
} |
|||
|
|||
// If value is in %, convert it to px to get array index of px so we are able to increment it... |
|||
if ($current > MAX_PX_FONTSIZE) { // Must be in % then. |
|||
// If we're already dealing with a percentage... |
|||
$current = accessibility_getsize($current); // Get the size in pixels. |
|||
} |
|||
|
|||
// Ok, we have font size in px now, get new percentage value from it. |
|||
|
|||
$op = required_param('op', PARAM_TEXT); |
|||
switch ($op) { |
|||
case 'inc': |
|||
if ($current == MAX_PX_FONTSIZE) { |
|||
// If we're at the upper limit, don't increase any further. |
|||
$new = accessibility_getsize($current); |
|||
} else { |
|||
// Otherwise, increase. |
|||
$new = accessibility_getsize($current + 1); |
|||
} |
|||
break; |
|||
case 'dec': |
|||
if ($current == MIN_PX_FONTSIZE) { |
|||
// If we're at the lower limit, don't decrease any further. |
|||
$new = accessibility_getsize($current); |
|||
} else { |
|||
$new = accessibility_getsize($current - 1); |
|||
} |
|||
break; |
|||
case 'reset': |
|||
// Clear the fontsize stored in the session. |
|||
unset($USER->fontsize); |
|||
unset($USER->defaultfontsize); |
|||
|
|||
// Clear user records in database. |
|||
$urlparams = array( |
|||
'op' => 'reset', |
|||
'size' => true, |
|||
'userid' => $USER->id |
|||
); |
|||
if (!accessibility_is_ajax()) { |
|||
$redirect = required_param('redirect', PARAM_TEXT); |
|||
$urlparams['redirect'] = safe_redirect_url($redirect); |
|||
} |
|||
|
|||
$redirecturl = new moodle_url('/blocks/accessibility/database.php', $urlparams); |
|||
redirect($redirecturl); |
|||
|
|||
break; |
|||
default: |
|||
if (accessibility_is_ajax()) { |
|||
header('HTTP/1.0 400 Bad Request'); |
|||
} else { |
|||
print_error('invalidop', 'block_accessibility'); |
|||
} |
|||
exit(); |
|||
} |
|||
|
|||
// Set the new font size in % |
|||
$USER->fontsize = $new; // If we've just increased or decreased, save the new size to the session. |
|||
|
|||
if (!accessibility_is_ajax()) { |
|||
// Otherwise, redirect the user |
|||
// if action is not achieved through ajax, redirect back to page is required. |
|||
$redirect = required_param('redirect', PARAM_TEXT); |
|||
$redirecturl = new moodle_url($redirect); |
|||
redirect($redirecturl); |
|||
} |
@ -0,0 +1,121 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Interacts with the database to save/reset font size settings (1) |
|||
* |
|||
* This file handles all the blocks database interaction. If saving, |
|||
* it will check if the current user already has a saved setting, and |
|||
* create/update it as appropriate. If resetting, it will delete the |
|||
* user's setting from the database. If responding to AJAX, it responds |
|||
* with suitable HTTP error codes. Otherwise, it sets a message to |
|||
* display, and redirects the user back to where they came from. (2) |
|||
* |
|||
* @package block_accessibility (3) |
|||
* @copyright 2009 © Taunton's College (4) |
|||
* @author Mark Johnson <mark.johnson@taunton.ac.uk> |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (5) |
|||
*/ |
|||
|
|||
require_once('../../config.php'); |
|||
require_once($CFG->dirroot . '/blocks/accessibility/lib.php'); |
|||
require_login(); |
|||
|
|||
$op = required_param('op', PARAM_TEXT); |
|||
$size = optional_param('size', false, PARAM_BOOL); |
|||
$scheme = optional_param('scheme', false, PARAM_BOOL); |
|||
$atbar = optional_param('atbar', false, PARAM_BOOL); |
|||
|
|||
if (!accessibility_is_ajax()) { |
|||
$redirect = required_param('redirect', PARAM_TEXT); |
|||
$redirecturl = safe_redirect_url($redirect); |
|||
} |
|||
|
|||
switch ($op) { |
|||
case 'save': |
|||
|
|||
if ($setting = $DB->get_record('block_accessibility', array('userid' => $USER->id))) { |
|||
// Check if the user's already got a saved setting. If they have, just update it. |
|||
if ($size && isset($USER->fontsize)) { |
|||
$setting->fontsize = $USER->fontsize; |
|||
} |
|||
if ($scheme && isset($USER->colourscheme)) { |
|||
$setting->colourscheme = $USER->colourscheme; |
|||
} |
|||
if ($atbar) { |
|||
$setting->autoload_atbar = 1; |
|||
} |
|||
$DB->update_record('block_accessibility', $setting); |
|||
} else { |
|||
$setting = new stdClass; |
|||
// Otherwise, create a new record for them. |
|||
if ($size && isset($USER->fontsize)) { |
|||
$setting->fontsize = $USER->fontsize; |
|||
} |
|||
if ($scheme && isset($USER->colourscheme)) { |
|||
$setting->colourscheme = $USER->colourscheme; |
|||
} |
|||
if ($atbar) { |
|||
$setting->autoload_atbar = 1; |
|||
} |
|||
$setting->userid = $USER->id; |
|||
$DB->insert_record('block_accessibility', $setting); |
|||
} |
|||
if (!accessibility_is_ajax()) { |
|||
// If not responding to AJAX, set a message to display and redirect. |
|||
$USER->accessabilitymsg = get_string('saved', 'block_accessibility'); |
|||
redirect($redirecturl); |
|||
} |
|||
break; |
|||
|
|||
case 'reset': |
|||
if ($setting = $DB->get_record('block_accessibility', array('userid' => $USER->id))) { |
|||
// If they've got a record, delete it and redirect the user if appropriate. |
|||
if ($size) { |
|||
$setting->fontsize = null; |
|||
} else { |
|||
if (!empty($USER->fontsize)) { |
|||
$setting->fontsize = $USER->fontsize; |
|||
} |
|||
} |
|||
if ($scheme) { |
|||
$setting->colourscheme = null; |
|||
} else { |
|||
if (!empty($USER->colourscheme)) { |
|||
$setting->colourscheme = $USER->colourscheme; |
|||
} |
|||
} |
|||
if ($atbar) { |
|||
$setting->autoload_atbar = 0; |
|||
} |
|||
|
|||
if (empty($setting->fontsize) && empty($setting->colourscheme) && empty($setting->atbar)) { |
|||
$DB->delete_records('block_accessibility', array('userid' => $USER->id)); |
|||
} else { |
|||
$DB->update_record('block_accessibility', $setting); |
|||
} |
|||
if (!accessibility_is_ajax()) { |
|||
$USER->accessabilitymsg = get_string('reset', 'block_accessibility'); |
|||
} |
|||
} |
|||
if (!accessibility_is_ajax()) { |
|||
redirect($redirecturl); |
|||
} |
|||
break; |
|||
|
|||
default: |
|||
header("HTTP/1.0 400 Bad Request"); |
|||
} |
@ -0,0 +1,50 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Capability definitions for the course_menu block |
|||
* |
|||
* @package block |
|||
* @subpackage course_accessibility |
|||
* @copyright 2013 onwards Paul Vaughan |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
*/ |
|||
|
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$capabilities = array( |
|||
|
|||
// New standard capability 'addinstance'. |
|||
'block/accessibility:addinstance' => array( |
|||
'captype' => 'write', |
|||
'contextlevel' => CONTEXT_COURSE, |
|||
'archetypes' => array( |
|||
'editingteacher' => CAP_ALLOW, |
|||
'manager' => CAP_ALLOW |
|||
), |
|||
'clonepermissionsfrom' => 'moodle/site:manageblocks' |
|||
), |
|||
'block/accessibility:myaddinstance' => array( |
|||
'riskbitmask' => RISK_PERSONAL, |
|||
'captype' => 'read', |
|||
'contextlevel' => CONTEXT_SYSTEM, |
|||
'archetypes' => array( |
|||
'user' => CAP_ALLOW, |
|||
), |
|||
'clonepermissionsfrom' => 'moodle/my:manageblocks' |
|||
), |
|||
|
|||
); |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<XMLDB PATH="blocks/accessibility/db" VERSION="20111220" COMMENT="XMLDB file for Moodle blocks/accessibility" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" |
|||
> |
|||
<TABLES> |
|||
<TABLE NAME="block_accessibility" COMMENT="Default comment for accessibility, please edit me"> |
|||
<FIELDS> |
|||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="userid"/> |
|||
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="fontsize"/> |
|||
<FIELD NAME="fontsize" TYPE="number" LENGTH="4" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="1" PREVIOUS="userid" NEXT="colourscheme"/> |
|||
<FIELD NAME="colourscheme" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="fontsize" NEXT="autoload_atbar"/> |
|||
<FIELD NAME="autoload_atbar" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Has the user set ATbar to autoload?" PREVIOUS="colourscheme"/> |
|||
</FIELDS> |
|||
<KEYS> |
|||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> |
|||
</KEYS> |
|||
</TABLE> |
|||
</TABLES> |
|||
</XMLDB> |
@ -0,0 +1,130 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Defines upgrades for Accessibility Block |
|||
* |
|||
* @package block_accessibility (4) |
|||
* @copyright Copyright 2009 onwards Taunton's College (5) |
|||
* @author Mark Johnson <mark.johnson@tauntons.ac.uk> (6) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (7) |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
function xmldb_block_accessibility_upgrade($oldversion = 0) { |
|||
|
|||
global $CFG, $THEME, $DB; |
|||
|
|||
$dbman = $DB->get_manager(); |
|||
|
|||
$result = true; |
|||
|
|||
// And upgrade begins here. For each one, you'll need one |
|||
// block of code similar to the next one. Please, delete |
|||
// this comment lines once this file start handling proper |
|||
// upgrade code. |
|||
|
|||
if ($result && $oldversion < 2009071000) { |
|||
|
|||
// Changing type of field fontsize on table accessibility to number. |
|||
$table = new XMLDBTable('accessibility'); |
|||
$field = new XMLDBField('fontsize'); |
|||
$field->setAttributes(XMLDB_TYPE_NUMBER, |
|||
'4, 1', |
|||
XMLDB_UNSIGNED, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
'userid'); |
|||
|
|||
// Launch change of type for field fontsize. |
|||
$result = $result && $dbman->change_field_type($table, $field); |
|||
upgrade_block_savepoint(true, 2009071000, 'accessibility'); |
|||
} |
|||
|
|||
if ($result && $oldversion < 2009082500) { |
|||
|
|||
// Define field colourscheme to be added to accessibility. |
|||
$table = new xmldb_table('accessibility'); |
|||
$field = new xmldb_field('colourscheme', |
|||
XMLDB_TYPE_INTEGER, |
|||
'1', |
|||
XMLDB_UNSIGNED, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
'fontsize'); |
|||
|
|||
// Launch add field colourscheme. |
|||
if (!$dbman->field_exists($table, $field)) { |
|||
$dbman->add_field($table, $field); |
|||
} |
|||
upgrade_block_savepoint(true, 2009082500, 'accessibility'); |
|||
} |
|||
|
|||
if ($oldversion < 2010121500) { |
|||
|
|||
// Define field autoload_atbar to be added to accessibility. |
|||
$table = new xmldb_table('accessibility'); |
|||
$cs = new xmldb_field('colourscheme', |
|||
XMLDB_TYPE_INTEGER, |
|||
'1', |
|||
XMLDB_UNSIGNED, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
'fontsize'); |
|||
$field = new xmldb_field('autoload_atbar', |
|||
XMLDB_TYPE_INTEGER, |
|||
'1', |
|||
XMLDB_UNSIGNED, |
|||
XMLDB_NOTNULL, |
|||
null, |
|||
'0', |
|||
'colourscheme'); |
|||
if (!$dbman->field_exists($table, $cs)) { |
|||
$dbman->add_field($table, $cs); |
|||
} |
|||
// Conditionally launch add field autoload_atbar. |
|||
if (!$dbman->field_exists($table, $field)) { |
|||
$dbman->add_field($table, $field); |
|||
} |
|||
|
|||
// Accessibility savepoint reached. |
|||
upgrade_block_savepoint(true, 2010121500, 'accessibility'); |
|||
} |
|||
|
|||
if ($oldversion < 2011122000) { |
|||
|
|||
// Define table accessibility to be renamed to block_accessibility. |
|||
$table = new xmldb_table('accessibility'); |
|||
|
|||
// Launch rename table for accessibility. |
|||
$dbman->rename_table($table, 'block_accessibility'); |
|||
|
|||
// Accessibility savepoint reached. |
|||
upgrade_block_savepoint(true, 2011122000, 'accessibility'); |
|||
} |
|||
|
|||
return $result; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
$defaults = array( |
|||
// The fg1 and bg1 would be reset/default colour - do not define it. |
|||
'bg2' => '#FFFFCC', |
|||
'fg2' => '', // Default theme colours will be unchanged. |
|||
'bg3' => '#99CCFF', |
|||
'fg3' => '', |
|||
'bg4' => '#000000', |
|||
'fg4' => '#FFFF00', |
|||
); |
@ -0,0 +1,84 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
class block_accessibility_edit_form extends block_edit_form { |
|||
|
|||
const CNF_AUTOSAVE = 'config_autosave'; |
|||
const CNF_ATBAR = 'config_showATbar'; |
|||
const CNF_FG = 'config_fg'; |
|||
const CNF_BG = 'config_bg'; |
|||
|
|||
const RE_COLOUR = '/^#[a-f0-9]{6}$/i'; |
|||
|
|||
protected function specific_definition($mform) { |
|||
|
|||
// Load default colours. |
|||
global $CFG; |
|||
require_once($CFG->dirroot . '/blocks/accessibility/defaults.php'); |
|||
|
|||
// Allow ATbar. |
|||
$mform->addElement('advcheckbox', self::CNF_ATBAR, |
|||
get_string(self::CNF_ATBAR, 'block_accessibility'), |
|||
get_string(self::CNF_ATBAR . '_checkbox', 'block_accessibility'), |
|||
null, |
|||
array(0, 1) |
|||
); |
|||
$mform->setDefault(self::CNF_ATBAR, 1); |
|||
$mform->setType(self::CNF_ATBAR, PARAM_INT); |
|||
$mform->addHelpButton(self::CNF_ATBAR, self::CNF_ATBAR, 'block_accessibility'); |
|||
|
|||
// Colour schemes. |
|||
for ($i = 2; $i < 5; $i++) { // This is how many declarations we defined in defaults.php. |
|||
// Get previously saved configuration. |
|||
$form = $this->block->config; // Or cast it to (array) and get properties like with []. |
|||
$fg = str_replace('config_', '', self::CNF_FG); |
|||
$bg = str_replace('config_', '', self::CNF_BG); |
|||
$fgcolour = isset($form->{$fg . $i}) ? $form->{$fg . $i} : $defaults['fg' . $i]; |
|||
$bgcolour = isset($form->{$bg . $i}) ? $form->{$bg . $i} : $defaults['bg' . $i]; |
|||
|
|||
// Display scheme example and identifier number of a scheme. |
|||
$mform->addElement('html', ' |
|||
<div class="fitem" style="padding:10px 0 8px"> |
|||
<div class="fitemtitle"></div> |
|||
<div class="felement"> |
|||
<span style="padding:2px 8px; color:' . $fgcolour . '; border:1px solid ' . $fgcolour . '; background:' . |
|||
$bgcolour . ' !important">A</span> |
|||
Colour scheme #' . $i . ' |
|||
</div> |
|||
</div>'); |
|||
|
|||
// Foreground colour. |
|||
$id = self::CNF_FG . $i; |
|||
$mform->addElement('text', $id, get_string(self::CNF_FG, 'block_accessibility')); |
|||
$mform->setDefault($id, $defaults['fg' . $i]); |
|||
$mform->setType($id, PARAM_TEXT); |
|||
$mform->addHelpButton($id, self::CNF_FG, 'block_accessibility'); |
|||
$mform->addRule($id, get_string('color_input_error', 'block_accessibility'), 'regex', self::RE_COLOUR, 'server', false, |
|||
false); |
|||
|
|||
// Background colour. |
|||
$id = self::CNF_BG . $i; |
|||
$mform->addElement('text', $id, get_string(self::CNF_BG, 'block_accessibility')); |
|||
$mform->setDefault($id, $defaults['bg' . $i]); |
|||
$mform->setType($id, PARAM_TEXT); |
|||
$mform->addHelpButton($id, self::CNF_BG, 'block_accessibility'); |
|||
$mform->addRule($id, get_string('color_input_error', 'block_accessibility'), 'regex', self::RE_COLOUR, 'server', false, |
|||
false); |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,64 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* German translation (1) |
|||
* |
|||
* @author Joachim Vogelgesang (2) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (3) |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$string['autolaunch'] = '(immer?)'; |
|||
$string['blockname'] = 'Barrierefreiheit'; |
|||
$string['char'] = 'A'; |
|||
$string['clearedoldcache'] = '{$a} alte Dateien aus dem Cache gelöscht'; |
|||
$string['dectext'] = 'Textgröße verkleinern'; |
|||
$string['inctext'] = 'Textgröße erhöhen'; |
|||
$string['invalidop'] = 'Die angegebene Operation war ungültig!'; |
|||
$string['jsnocolour'] = 'Fehler beim Ändern des Farbschemas'; |
|||
$string['jsnocolourreset'] = 'Fehler beim Zurücksetzen des Farbschemas'; |
|||
$string['jsnosave'] = 'Fehler beim Speichern der Einstellungen'; |
|||
$string['jsnosize'] = 'Fehler beim Ändern der Größe'; |
|||
$string['jsnosizereset'] = 'Fehler beim Zurücksetzen der Textgröße'; |
|||
$string['launchtoolbar'] = 'ATbar starten'; |
|||
$string['pluginname'] = 'Barrierefreiheit'; |
|||
$string['pluginnameplural'] = 'Barrierefreiheit'; |
|||
$string['resettext'] = 'Textgröße zurücksetzen (Löscht gespeicherte Einstellung'; |
|||
$string['reset'] = 'Einstellung gelöscht'; |
|||
$string['save'] = 'Einstellung speichern'; |
|||
$string['saved'] = 'Einstellung gespeichert'; |
|||
$string['col1text'] = 'Standard Farbschema (Löscht gespeicherte Einstellung)'; |
|||
$string['col2text'] = 'Reduzierter Kontrast 1'; |
|||
$string['col3text'] = 'Reduzierter Kontrast 2'; |
|||
$string['col4text'] = 'Hoher Kontrast'; |
|||
|
|||
// Configuration form - please help us translate it on GitHub. |
|||
$string['config_autosave'] = 'Auto save'; |
|||
$string['config_autosave_checkbox'] = 'Save user settings automatically (button "save" will disappear)'; |
|||
$string['config_autosave_help'] = 'Font size and colour schemes settings are automatically saved to the session as long as user is logged in to the system. However, session settings will be cleared once the user log off. The user can keep chosen settings throughout the sessions using the "save" button in the block. Enabling Auto-save option will remove the "save" button and automatically save settings for the user. This might lead to slightly higher impact to the system performance, which is why this option is disabled by default.'; |
|||
$string['config_showATbar'] = 'ATbar'; |
|||
$string['config_showATbar_checkbox'] = 'Allow ATbar appearance within Accessibility block'; |
|||
$string['config_showATbar_help'] = 'Accessibility block also integrates ATbar from Southampton University ECS <a href="http://www.atbar.org">http://www.atbar.org</a>.'; |
|||
$string['config_fg'] = 'Text colour (not required)'; |
|||
$string['config_fg_help'] = 'Define colour scheme foreground colour here. Keep in mind that the colour will be applied uniformly to all user interface elements. It is not always desirable to have the same colour in each user interface element. <strong>It is recommended to leave foreground colour field empty</strong> so that elements can keep its default colours. Try to change background colour only.'; |
|||
$string['config_bg'] = 'Background colour'; |
|||
$string['config_bg_help'] = 'Define colour scheme background colour here. Keep in mind that the background colour will be applied uniformly to all user interface elements.'; |
|||
$string['color_input_error'] = 'Please enter a color in a format as such: #FF0050'; |
|||
|
|||
$string['accessibility:addinstance'] = 'Add a new Accessibility block'; |
|||
$string['accessibility:myaddinstance'] = 'Add a new Accessibility block to My home'; |
|||
$string['jsnotloggedin'] = 'Error! Please check if you are logged-in to the system or contact your administrator'; |
@ -0,0 +1,62 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* English Lang Strings (1) |
|||
* |
|||
* @author Mark Johnson (2) |
|||
* @copyright © Taunton's College 2009 (3) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (4) |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$string['autolaunch'] = '(always?)'; |
|||
$string['blockname'] = 'Accessibility'; |
|||
$string['clearedoldcache'] = 'Cleared {$a} old files from the cache'; |
|||
$string['char'] = 'A'; |
|||
$string['dectext'] = 'Decrease Text Size'; |
|||
$string['inctext'] = 'Increase Text Size'; |
|||
$string['invalidop'] = 'The specified operation was invalid!'; |
|||
$string['jsnocolour'] = 'Error changing colour scheme'; |
|||
$string['jsnocolourreset'] = 'Error resetting colour scheme'; |
|||
$string['jsnosave'] = 'Error saving settings'; |
|||
$string['jsnosize'] = 'Error changing size'; |
|||
$string['jsnosizereset'] = 'Error resetting text size'; |
|||
$string['launchtoolbar'] = 'Launch ATbar'; |
|||
$string['pluginname'] = 'Accessibility'; |
|||
$string['pluginnameplural'] = 'Accessibility Blocks'; |
|||
$string['resettext'] = 'Reset Text Size (Clears Saved Setting)'; |
|||
$string['reset'] = 'Setting Cleared'; |
|||
$string['save'] = 'Save Setting'; |
|||
$string['saved'] = 'Setting Saved'; |
|||
$string['col1text'] = 'Deafult Colour Scheme (Clears Saved Setting)'; |
|||
$string['col2text'] = 'Lowered Contrast 1'; |
|||
$string['col3text'] = 'Lowered Contrast 2'; |
|||
$string['col4text'] = 'High Contrast'; |
|||
|
|||
// Configuration form - please help us translate it on GitHub. |
|||
$string['config_showATbar'] = 'ATbar'; |
|||
$string['config_showATbar_checkbox'] = 'Allow ATbar appearance within Accessibility block'; |
|||
$string['config_showATbar_help'] = 'Accessibility block also integrates ATbar from Southampton University ECS <a href="http://www.atbar.org">http://www.atbar.org</a>.'; |
|||
$string['config_fg'] = 'Text colour (not required)'; |
|||
$string['config_fg_help'] = 'Define colour scheme foreground colour here. Keep in mind that the colour will be applied uniformly to all user interface elements. It is not always desirable to have the same colour in each user interface element. <strong>It is recommended to leave foreground colour field empty</strong> so that elements can keep its default colours. Try to change background colour only.'; |
|||
$string['config_bg'] = 'Background colour'; |
|||
$string['config_bg_help'] = 'Define colour scheme background colour here. Keep in mind that the background colour will be applied uniformly to all user interface elements.'; |
|||
$string['color_input_error'] = 'Please enter a color in a format as such: #FF0050'; |
|||
|
|||
$string['accessibility:addinstance'] = 'Add a new Accessibility block'; |
|||
$string['accessibility:myaddinstance'] = 'Add a new Accessibility block to My home'; |
|||
$string['jsnotloggedin'] = 'Error! Please check if you are logged-in to the system or contact your administrator'; |
@ -0,0 +1,64 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Spanish translation (1) |
|||
* |
|||
* @author Enrique Robredo (2) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (3) |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$string['autolaunch'] = '(¿siempre?)'; |
|||
$string['blockname'] = 'Accesibilidad'; |
|||
$string['char'] = 'A'; |
|||
$string['clearedoldcache'] = 'Eliminados de la caché {$a} archivos antiguos'; |
|||
$string['dectext'] = 'Disminuir Texto'; |
|||
$string['inctext'] = 'Aumentar Texto'; |
|||
$string['invalidop'] = 'Esta operación será invalidada'; |
|||
$string['jsnocolour'] = 'Se ha producido un error cambiando el esquema de colores'; |
|||
$string['jsnocolourreset'] = 'Se ha producido un error reiniciano el esquema de colores'; |
|||
$string['jsnosave'] = 'Se ha producido un error cambiando la configuración'; |
|||
$string['jsnosize'] = 'Se ha producido un error cambiando el tamaño'; |
|||
$string['jsnosizereset'] = 'Se ha producido un error reiniciando el tamaño del texto'; |
|||
$string['launchtoolbar'] = 'Lanzar ATbar'; |
|||
$string['pluginname'] = 'Accesibilidad'; |
|||
$string['pluginnameplural'] = 'Accesibilidad'; |
|||
$string['resettext'] = 'Recuperar tamaño de la fuente (Se pierde la configuración guardada)'; |
|||
$string['reset'] = 'Configuración Reiniciada'; |
|||
$string['save'] = 'Guardar configuración'; |
|||
$string['saved'] = 'Configuración guardada'; |
|||
$string['col1text'] = 'Volver al esquema de colores original (Se pierde la configuración guardada)'; |
|||
$string['col2text'] = 'Bajo Contraste 1'; |
|||
$string['col3text'] = 'Bajo Contraste 2'; |
|||
$string['col4text'] = 'Alto Contraste'; |
|||
|
|||
// Configuration form - please help us translate it on GitHub. |
|||
$string['config_autosave'] = 'Auto save'; |
|||
$string['config_autosave_checkbox'] = 'Save user settings automatically (button "save" will disappear)'; |
|||
$string['config_autosave_help'] = 'Font size and colour schemes settings are automatically saved to the session as long as user is logged in to the system. However, session settings will be cleared once the user log off. The user can keep chosen settings throughout the sessions using the "save" button in the block. Enabling Auto-save option will remove the "save" button and automatically save settings for the user. This might lead to slightly higher impact to the system performance, which is why this option is disabled by default.'; |
|||
$string['config_showATbar'] = 'ATbar'; |
|||
$string['config_showATbar_checkbox'] = 'Allow ATbar appearance within Accessibility block'; |
|||
$string['config_showATbar_help'] = 'Accessibility block also integrates ATbar from Southampton University ECS <a href="http://www.atbar.org">http://www.atbar.org</a>.'; |
|||
$string['config_fg'] = 'Text colour (not required)'; |
|||
$string['config_fg_help'] = 'Define colour scheme foreground colour here. Keep in mind that the colour will be applied uniformly to all user interface elements. It is not always desirable to have the same colour in each user interface element. <strong>It is recommended to leave foreground colour field empty</strong> so that elements can keep its default colours. Try to change background colour only.'; |
|||
$string['config_bg'] = 'Background colour'; |
|||
$string['config_bg_help'] = 'Define colour scheme background colour here. Keep in mind that the background colour will be applied uniformly to all user interface elements.'; |
|||
$string['color_input_error'] = 'Please enter a color in a format as such: #FF0050'; |
|||
|
|||
$string['accessibility:addinstance'] = 'Add a new Accessibility block'; |
|||
$string['accessibility:myaddinstance'] = 'Add a new Accessibility block to My home'; |
|||
$string['jsnotloggedin'] = 'Error! Please check if you are logged-in to the system or contact your administrator'; |
@ -0,0 +1,67 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* French Lang Strings (1) |
|||
* |
|||
* @author steve.colin@ecampus-hainaut.be (2) |
|||
* @copyright © eCampus Provincial 2012 http://www.ecampus-hainaut.be (3) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (4) |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$string['autolaunch'] = '(toujours?)'; |
|||
$string['blockname'] = 'Accessibilité'; |
|||
$string['clearedoldcache'] = 'Nettoyé {$a} vieux fichier(s) dans le cache'; |
|||
$string['char'] = 'A'; |
|||
$string['dectext'] = 'Diminuer Taille du Texte'; |
|||
$string['inctext'] = 'Augmenter Taille du Texte'; |
|||
$string['invalidop'] = 'Opération invalide!'; |
|||
$string['jsnocolour'] = 'Erreur lors du changement de couleurs'; |
|||
$string['jsnocolourreset'] = 'Erreur lors de la remise à zéro des couleurs'; |
|||
$string['jsnosave'] = 'Erreur lors de la sauvegarder des paramètres'; |
|||
$string['jsnosize'] = 'Erreur lors du changement de la taille'; |
|||
$string['jsnosizereset'] = 'Erreur lors de la remise à zéro de la taille du texte'; |
|||
$string['launchtoolbar'] = 'Lancer ATbar'; |
|||
$string['pluginname'] = 'Accessibilité'; |
|||
$string['pluginnameplural'] = 'Accessibilité Block'; |
|||
$string['resettext'] = 'Remise à zéro de la taille du texte'; |
|||
$string['reset'] = 'Paramètres ré-initialisés'; |
|||
$string['save'] = 'Sauver les paramètres'; |
|||
$string['saved'] = 'Paramètres sauvés'; |
|||
$string['col1text'] = 'Couleurs par défaut'; |
|||
$string['col2text'] = 'Contraste élevé 1'; |
|||
$string['col3text'] = 'Contraste élevé 2'; |
|||
$string['col4text'] = 'Contraste Haut'; |
|||
|
|||
/* Configuration form - please help us translate it on GitHub |
|||
------------------------------------------------------------ |
|||
*/ |
|||
$string['config_autosave'] = 'Auto save'; // label |
|||
$string['config_autosave_checkbox'] = 'Save user settings automatically (button "save" will disappear)'; // checkbox label |
|||
$string['config_autosave_help'] = 'Font size and colour schemes settings are automatically saved to the session as long as user is logged in to the system. However, session settings will be cleared once the user log off. The user can keep chosen settings throughout the sessions using the "save" button in the block. Enabling Auto-save option will remove the "save" button and automatically save settings for the user. This might lead to slightly higher impact to the system performance, which is why this option is disabled by default.'; // help block |
|||
$string['config_showATbar'] = 'ATbar'; |
|||
$string['config_showATbar_checkbox'] = 'Allow ATbar appearance within Accessibility block'; |
|||
$string['config_showATbar_help'] = 'Accessibility block also integrates ATbar from Southampton University ECS <a href="http://www.atbar.org">http://www.atbar.org</a>.'; |
|||
$string['config_fg'] = 'Text colour (not required)'; |
|||
$string['config_fg_help'] = 'Define colour scheme foreground colour here. Keep in mind that the colour will be applied uniformly to all user interface elements. It is not always desirable to have the same colour in each user interface element. <strong>It is recommended to leave foreground colour field empty</strong> so that elements can keep its default colours. Try to change background colour only.'; |
|||
$string['config_bg'] = 'Background colour'; |
|||
$string['config_bg_help'] = 'Define colour scheme background colour here. Keep in mind that the background colour will be applied uniformly to all user interface elements.'; |
|||
$string['color_input_error'] = 'Please enter a color in a format as such: #FF0050'; |
|||
|
|||
$string['accessibility:addinstance'] = 'Add a new Accessibility block'; |
|||
$string['accessibility:myaddinstance'] = 'Add a new Accessibility block to My home'; |
|||
$string['jsnotloggedin'] = 'Error! Please check if you are logged-in to the system or contact your administrator'; |
@ -0,0 +1,70 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
|
|||
/** |
|||
* English Lang Strings (1) |
|||
* |
|||
* @author Mark Johnson (2) |
|||
* @copyright © Taunton's College 2009 (3) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (4) |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$string['autolaunch'] = '(uvijek?)'; |
|||
$string['blockname'] = 'Pristupačnost'; |
|||
$string['clearedoldcache'] = 'Obrisano {$a} datoteka iz cachea'; |
|||
$string['char'] = 'A'; |
|||
$string['dectext'] = 'Povećaj tekst'; |
|||
$string['inctext'] = 'Smanji tekst'; |
|||
$string['invalidop'] = 'Tražena operacija ne postoji!'; |
|||
$string['jsnocolour'] = 'Greška kod promjene profila boja'; |
|||
$string['jsnocolourreset'] = 'Greška kod resetiranja profila boja'; |
|||
$string['jsnosave'] = 'Greška kod pohrane postavki'; |
|||
$string['jsnosize'] = 'Greška kod promjene veličine teksta'; |
|||
$string['jsnosizereset'] = 'Greška kod resetiranja veličine teksta'; |
|||
$string['launchtoolbar'] = 'Pokreni ATbar'; |
|||
$string['pluginname'] = 'Pristupačnost'; |
|||
$string['pluginnameplural'] = 'Blokovi za pristupačnost'; |
|||
$string['resettext'] = 'Resetiranje veličine teksta (postavke obrisane)'; |
|||
$string['reset'] = 'Postavke obrisane'; |
|||
$string['save'] = 'Pohrani postavke'; |
|||
$string['saved'] = 'Postavke pohranjene'; |
|||
$string['col1text'] = 'Pretpostavljeni profil boja (postavke obrisane)'; |
|||
$string['col2text'] = 'Smanjeni kontrast 1'; |
|||
$string['col3text'] = 'Smanjeni kontrast 2'; |
|||
$string['col4text'] = 'Visoki kontrast'; |
|||
|
|||
/* Configuration form - please help us translate it on GitHub |
|||
------------------------------------------------------------ |
|||
*/ |
|||
/* not implemented |
|||
$string['config_autosave'] = 'Auto save'; // label |
|||
$string['config_autosave_checkbox'] = 'Save user settings automatically (button "save" will disappear)'; // checkbox label |
|||
$string['config_autosave_help'] = 'Font size and colour schemes settings are automatically saved to the session as long as user is logged in to the system. However, session settings will be cleared once the user log off. The user can keep chosen settings throughout the sessions using the "save" button in the block. Enabling Auto-save option will remove the "save" button and automatically save settings for the user. This might lead to slightly higher impact to the system performance, which is why this option is disabled by default.'; // help block |
|||
*/ |
|||
$string['config_showATbar'] = 'ATbar'; |
|||
$string['config_showATbar_checkbox'] = 'Allow ATbar appearance within Accessibility block'; |
|||
$string['config_showATbar_help'] = 'Accessibility block also integrates ATbar from Southampton University ECS <a href="http://www.atbar.org">http://www.atbar.org</a>.'; |
|||
$string['config_fg'] = 'Text colour (not required)'; |
|||
$string['config_fg_help'] = 'Define colour scheme foreground colour here. Keep in mind that the colour will be applied uniformly to all user interface elements. It is not always desirable to have the same colour in each user interface element. <strong>It is recommended to leave foreground colour field empty</strong> so that elements can keep its default colours. Try to change background colour only.'; |
|||
$string['config_bg'] = 'Background colour'; |
|||
$string['config_bg_help'] = 'Define colour scheme background colour here. Keep in mind that the background colour will be applied uniformly to all user interface elements.'; |
|||
$string['color_input_error'] = 'Please enter a color in a format as such: #FF0050'; |
|||
|
|||
$string['accessibility:addinstance'] = 'Dodaj novi Accessibility block'; |
|||
$string['accessibility:myaddinstance'] = 'Dodaj novi Accessibility block na glavnu stranicu'; |
|||
$string['jsnotloggedin'] = 'Greška! Molimo Vas provjerite jeste li prijavljeni u sustav ili kontaktirajte administratora'; |
@ -0,0 +1,69 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
|
|||
/** |
|||
* English Lang Strings |
|||
* |
|||
* @author Fernando Souza |
|||
* @author Willian Mano |
|||
* @copyright Fernando Souza 2013, Willian Mano 2016 |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
*/ |
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$string['autolaunch'] = '(sempre?)'; |
|||
$string['blockname'] = 'Acessibilidade'; |
|||
$string['clearedoldcache'] = 'Arquivos antigos {$a} apagados do cache'; |
|||
$string['char'] = 'A'; |
|||
$string['dectext'] = 'Diminuir o Tamanho do Texto'; |
|||
$string['inctext'] = 'Aumentar o Tamanho do Texto'; |
|||
$string['invalidop'] = 'A operação especificada é inválida!'; |
|||
$string['jsnocolour'] = 'Erro de mudança no esquema de cores'; |
|||
$string['jsnocolourreset'] = 'Erro em redefinir o esquema de cores'; |
|||
$string['jsnosave'] = 'Erro ao salvar as configurações'; |
|||
$string['jsnosize'] = 'Error ao mudar o tamanho'; |
|||
$string['jsnosizereset'] = 'Erro ao redefinir o tamanho do texto'; |
|||
$string['launchtoolbar'] = 'Lançar ATbar'; |
|||
$string['pluginname'] = 'Acessibilidade'; |
|||
$string['pluginnameplural'] = 'Blocos de Acessibilidade'; |
|||
$string['resettext'] = 'Redefiniri o Tamanho do Texto (Apaga a Configuração Salva)'; |
|||
$string['reset'] = 'Configuração Apagada'; |
|||
$string['save'] = 'Salvar Configuração'; |
|||
$string['saved'] = 'Configuração Salva'; |
|||
$string['col1text'] = 'Esquema de Cores Padrão (Apaga a configuração salva)'; |
|||
$string['col2text'] = 'Contraste Baixado 1'; |
|||
$string['col3text'] = 'Contraste Baixado 2'; |
|||
$string['col4text'] = 'Contraste Alto'; |
|||
|
|||
/* Configuration form - please help us translate it on GitHub |
|||
------------------------------------------------------------ |
|||
*/ |
|||
$string['config_autosave'] = 'Salvar automaticamente'; // label |
|||
$string['config_autosave_checkbox'] = 'Salvar configurações do usuário automaticamente(botão "salvar" desaparecerá)'; // checkbox label |
|||
$string['config_autosave_help'] = 'Configurações de Tamanho da fonte e Esquema de cores são salvas automaticamente na sessão enquanto o usuário estiver logado no sistema. No entanto, configurações de sessão serão apagadas quando o usuário sair do sistema. O usuário pode manter as configurações escolhidas ao logo das sessões usando o botão "Salvar" no bloco. Habilitando a opção "Salvar automaticamente" o botão "Salvar" será removido e as configurações do usuário serão automaticamente salvas. Isto pode impactar na performance do sistema, por isso esta opção é desabilitada por padrão.'; // help block |
|||
$string['config_showATbar'] = 'ATbar'; |
|||
$string['config_showATbar_checkbox'] = 'Permitir a barra ATbar junto com o bloco Acessibilidade'; |
|||
$string['config_showATbar_help'] = 'O bloco Acessibilidade també é integrado com a barra ATbar da Universidade de Southampton ECS <a href="http://www.atbar.org">http://www.atbar.org</a>.'; |
|||
$string['config_fg'] = 'Cor do texto (não obrigatório)'; |
|||
$string['config_fg_help'] = 'Defina a cor do texto aqui. Tenha em mente que a cor do texto será aplicada uniformemente a todos os elementos da interface do usuário. Não é sempre desejável ter a mesma cor em cada elemento da interface do usuário. <strong>É recomendado deixar o campo da cor do texto vazio</strong>, assim os elementos podem manter suas cores padrão. Tente mudar apenas a cor de fundo.'; |
|||
$string['config_bg'] = 'Cor de fundo'; |
|||
$string['config_bg_help'] = 'Defina a cor de fundo aqui. Tenha em mente que a cor de fundo será aplicada uniformemente a todos os elementos da interface do usuário.'; |
|||
$string['color_input_error'] = 'Por favor, insira uma cor como no formato: #FF0050'; |
|||
|
|||
$string['accessibility:addinstance'] = 'Adicionar um novo bloco Acessibilidade'; |
|||
$string['accessibility:myaddinstance'] = 'Adicionar um novo bloco Acessibilidade à Página inicial'; |
|||
$string['jsnotloggedin'] = 'Erro! Por favor, verifique se você está logado no sistema ou contate seu administrador'; |
@ -0,0 +1,125 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Defines 2 functions used in the block (1) |
|||
* |
|||
* 2 functions are defined here. {@link accessibility_getsize()} which |
|||
* converts the current textsize between px and %, and |
|||
* {@link accessibility_is_ajax()} which finds out if we're responding |
|||
* to an AJAX request. (2) |
|||
* |
|||
* @package block_accessibility (3) |
|||
* @copyright Copyright 2009 onwards Taunton's College (4) |
|||
* @author Mark Johnson <mark.johnson@tauntons.ac.uk> (5) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (6) |
|||
*/ |
|||
|
|||
/** |
|||
* Convert text size in pixels into a percentage eqivalent, or vice versa, accoring to the YUI |
|||
* fonts CSS guidelines |
|||
* http://developer.yahoo.com/yui/fonts/ |
|||
* |
|||
* @param int|real $size the text size we're converting. Sizes between 10 and 26 will be treated |
|||
* as pixel values. Sizes between 77 and 197 will be treated as percentage |
|||
* values. |
|||
* @return number the converted size |
|||
*/ |
|||
|
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
// Block constants. |
|||
// ! this definitions might cause conflicts to other Moodle plugins if there is used the same name. |
|||
define('DEFAULT_FONTSIZE', 100); // In %. |
|||
define('MAX_FONTSIZE', 197); // In %. |
|||
define('MIN_FONTSIZE', 77); // In %. |
|||
define('MAX_PX_FONTSIZE', 26); // In px. |
|||
define('MIN_PX_FONTSIZE', 10); // In px. |
|||
|
|||
define('DEFAULT_SHOWATBAR', true); |
|||
define('DEFAULT_AUTOSAVE', false); |
|||
|
|||
function accessibility_getsize($size) { |
|||
|
|||
// Define the array of sizes in px against sizes as % |
|||
// make sure to maintain defined constants above in the script |
|||
// http://yuilibrary.com/yui/docs/cssfonts/. |
|||
$sizes = array( |
|||
10 => 77, |
|||
11 => 85, |
|||
12 => 93, |
|||
13 => 100, |
|||
14 => 108, |
|||
15 => 116, |
|||
16 => 123.1, |
|||
17 => 131, |
|||
18 => 138.5, |
|||
19 => 146.5, |
|||
20 => 153.9, |
|||
21 => 161.6, |
|||
22 => 167, |
|||
23 => 174, |
|||
24 => 182, |
|||
25 => 189, |
|||
26 => 197 |
|||
); |
|||
if (is_int($size) && array_key_exists($size, $sizes)) { // If we're looking at a key (px). |
|||
return $sizes[$size]; // Return the value (%). |
|||
} else { |
|||
if (in_array($size, $sizes)) { // If we're looking at a value (%). |
|||
return array_search($size, $sizes); // Return the key (px). |
|||
} else { |
|||
throw new moodle_exception('invalidsize', 'block_accessibility'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Find out whether we're desponding to an AJAX call by seeing if the HTTP_X_REQUESTED_WITH header |
|||
* is XMLHttpRequest |
|||
* |
|||
* @return boolean whether we're reponding to an AJAX call or not |
|||
*/ |
|||
function accessibility_is_ajax() { |
|||
$reqwith = 'HTTP_X_REQUESTED_WITH'; |
|||
if (isset($_SERVER[$reqwith]) && $_SERVER[$reqwith] == 'XMLHttpRequest') { |
|||
$xhr = true; |
|||
} else { |
|||
$xhr = false; |
|||
} |
|||
return $xhr; |
|||
} |
|||
|
|||
/** |
|||
* Prevent redirecting to external URLs and redirect to the Moodle wwwroot if one is passed |
|||
* |
|||
* @param string $redirect |
|||
* @return string Safe URL to redirect to |
|||
*/ |
|||
function safe_redirect_url($redirect) { |
|||
global $CFG; |
|||
$redirecturl = new moodle_url($redirect); |
|||
|
|||
if (preg_match('/^(http(s)?:)?\/\//', $redirecturl)) { |
|||
$urltest = preg_replace('/^http(s)?:/', '', $redirecturl); |
|||
$roottest = preg_replace('/^http(s)?:/', '', $CFG->wwwroot); |
|||
|
|||
if (!preg_match('/^' . preg_quote($roottest, '/') . '/', $urltest)) { |
|||
$redirecturl = $CFG->wwwroot; |
|||
} |
|||
} |
|||
return $redirecturl; |
|||
} |
@ -0,0 +1,532 @@ |
|||
M.block_accessibility = { |
|||
/* |
|||
Note: As of 29.04.2014. no duplicate CSS declaration in both module.js and userstyles.php |
|||
CSS is now declared and generated based on user settings in a single point - userstyles.php |
|||
module.js script updates user settings and fetch updated stylesheet over AJAX for each action |
|||
*/ |
|||
|
|||
ATBAR_SRC: 'https://core.atbar.org/atbar/en/latest/atbar.min.js', |
|||
|
|||
// font sizes in %, this is defined in changesize.php as well
|
|||
DEFAULT_FONTSIZE: 100, |
|||
MAX_FONTSIZE: 197, |
|||
MIN_FONTSIZE: 77, |
|||
|
|||
// only in JS-mode, because .getStyle('fontSize') will return computed style in px
|
|||
DAFAULT_PX_FONTSIZE: 13, |
|||
MAX_PX_FONTSIZE: 26, |
|||
MIN_PX_FONTSIZE: 10+1, // +1 because of unknown error...YUI for 77% returns style of 11px
|
|||
|
|||
MAIN_SELECTOR : '#page', // userstyles.php applies CSS font-size to this element
|
|||
|
|||
//stylesheet: '',
|
|||
|
|||
sheetnode: '', |
|||
|
|||
instance_id: '', |
|||
|
|||
defaultsize: null, |
|||
|
|||
watch: null, |
|||
|
|||
debug: false, |
|||
|
|||
transactionsCount: 0, // AJAX transactions
|
|||
|
|||
init: function(Y, autoload_atbar, instance_id) { |
|||
// keep in mind that dynamic AJAX mode cannot work properly with IE <= 8 (for now), so this script will not even be loaded in block_accessibillity.php
|
|||
|
|||
|
|||
// TO-DO: determine if block is visible (for example in chat session is not)
|
|||
|
|||
this.Y = Y; |
|||
this.instance_id = instance_id; |
|||
|
|||
this.sheetnode = Y.one('link[href="'+M.cfg.wwwroot+ |
|||
'/blocks/accessibility/userstyles.php?instance_id='+instance_id+'"]'); |
|||
//this.stylesheet = Y.StyleSheet(this.sheetnode);
|
|||
|
|||
// Set default font size
|
|||
//this.log('Initial size: '+Y.one('body').getStyle('fontSize'));
|
|||
//this.defaultsize = M.block_accessibility.get_current_fontsize('body'); // this is disabled because it gives false results...
|
|||
this.defaultsize = M.block_accessibility.DEFAULT_FONTSIZE; |
|||
|
|||
// Attach the click handler
|
|||
Y.all('#block_accessibility_textresize a').on('click', function(e) { |
|||
if (!e.target.hasClass('disabled')) { |
|||
// If it is, and the button's not disabled, pass it's id to the changesize function
|
|||
M.block_accessibility.changesize(e.target); |
|||
} |
|||
}); |
|||
|
|||
Y.all('#block_accessibility_changecolour a').on('click', function(e) { |
|||
if (!e.target.hasClass('disabled')) { |
|||
// If it is, and the button's not disabled, pass it's id to the changecolour function
|
|||
M.block_accessibility.changecolour(e.target); |
|||
} |
|||
}); |
|||
|
|||
// Remove href attributes from anchors
|
|||
Y.all('#accessibility_controls a').each(function(node){ |
|||
node.removeAttribute('href'); |
|||
}); |
|||
|
|||
// ATBar might be disabled in block's config
|
|||
if(Y.one('#atbar_auto') !== null){ |
|||
// checkbox for setting 'always' chackbox
|
|||
Y.one('#atbar_auto').on('click', function(e) { |
|||
if (e.target.get('checked')) { |
|||
M.block_accessibility.atbar_autoload('on'); |
|||
} else { |
|||
M.block_accessibility.atbar_autoload('off'); |
|||
} |
|||
}); |
|||
|
|||
// Create Bookmarklet-style link using code from ATbar site
|
|||
// http://access.ecs.soton.ac.uk/StudyBar/versions
|
|||
Y.one('#block_accessibility_launchtoolbar').on('click', function() { |
|||
M.block_accessibility.load_atbar(); |
|||
|
|||
// Do we really need it?
|
|||
// Hide block buttons until ATbar is closed
|
|||
Y.one('#block_accessibility_textresize').setStyle('display', 'none'); |
|||
Y.one('#block_accessibility_changecolour').setStyle('display', 'none'); |
|||
M.block_accessibility.watch_atbar_for_close(); |
|||
}); |
|||
|
|||
if (autoload_atbar) { |
|||
M.block_accessibility.load_atbar(); |
|||
// Hide block buttons until ATbar is closed
|
|||
Y.one('#block_accessibility_textresize').setStyle('display', 'none'); |
|||
Y.one('#block_accessibility_changecolour').setStyle('display', 'none'); |
|||
// Wait 1 second to give the bar a chance to load
|
|||
setTimeout("M.block_accessibility.watch_atbar_for_close();", 1000); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
// assign loader icon events
|
|||
// Y.on('io:start', M.block_accessibility.show_loading); // this triggers even for io actions outside block causing conflicts
|
|||
// Y.on('io:complete', M.block_accessibility.hide_loading);
|
|||
}, |
|||
|
|||
|
|||
/** |
|||
* Code from ATbar bookmarklet to load bar into page |
|||
*/ |
|||
load_atbar: function() { |
|||
var jf = document.createElement('script'); |
|||
jf.src = M.block_accessibility.ATBAR_SRC; |
|||
jf.type = 'text/javascript'; |
|||
jf.id = 'ToolBar'; |
|||
document.getElementsByTagName('head')[0].appendChild(jf); |
|||
}, |
|||
|
|||
/** |
|||
* Displays the specified message in the block's footer |
|||
* |
|||
* @param {String} msg the message to display |
|||
*/ |
|||
show_message: function(msg) { |
|||
//this.log('Message set to '+msg);
|
|||
this.Y.one('#block_accessibility_message').setContent(msg); |
|||
|
|||
// make message disappear after some time
|
|||
if(msg) setTimeout("M.block_accessibility.show_message('')", 5000); |
|||
}, |
|||
|
|||
/** |
|||
* Calls the database script on the server to save the current setting to |
|||
* the database. Displays a message on success, or an error on failure. |
|||
* |
|||
* @requires accessibility_show_message |
|||
* @requires webroot |
|||
* |
|||
*/ |
|||
savesize: function() { |
|||
this.Y.io(M.cfg.wwwroot+'/blocks/accessibility/database.php', { |
|||
data: 'op=save&size=true&scheme=true', |
|||
method: 'get', |
|||
on: { |
|||
success: function(id, o) { |
|||
M.block_accessibility.show_message(M.util.get_string('saved', 'block_accessibility')); |
|||
//setTimeout("M.block_accessibility.show_message('')", 5000);
|
|||
}, |
|||
failure: function(id, o) { |
|||
alert(M.util.get_string('jsnosave', 'block_accessibility')+' '+o.status+' '+o.statusText); |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* Enables or disables the buttons as specified |
|||
* |
|||
* @requires webroot |
|||
* |
|||
* @param {String} id the ID of the button to enable/disable |
|||
* @param {String} op the operation we're doing, either 'on' or 'off'. |
|||
* |
|||
*/ |
|||
toggle_textsizer: function(id, op) { |
|||
var button = this.Y.one('#block_accessibility_'+id); |
|||
if (op == 'on') { |
|||
if (button.hasClass('disabled')) { |
|||
//this.log('Enabling '+button);
|
|||
button.removeClass('disabled'); |
|||
} |
|||
} else if (op == 'off') { |
|||
if(!button.hasClass('disabled')) { |
|||
//this.log('Disabling '+button);
|
|||
button.addClass('disabled'); |
|||
} |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* This handles clicks from the buttons. If increasing, decreasing or |
|||
* resetting size, it calls changesize.php via AJAX and sets the text |
|||
* size to the number returned from the server. If saving the size, it |
|||
* calls accessibility_savesize. |
|||
* Also enables/disables buttons as required when sizes are changed. |
|||
* |
|||
* @requires accessibility_toggle_textsizer |
|||
* @requires accessibility_savesize |
|||
* @requires accessibility_resetsize |
|||
* @requires stylesheet |
|||
* @requires webroot |
|||
* |
|||
* @param {Node} button the button that was pushed |
|||
* |
|||
*/ |
|||
changesize: function(button) { |
|||
|
|||
Y = this.Y; |
|||
|
|||
switch (button.get('id')) { |
|||
case "block_accessibility_inc": |
|||
//this.log('Increasing size from '+this.defaultsize);
|
|||
Y.io(M.cfg.wwwroot+'/blocks/accessibility/changesize.php', { |
|||
data: 'op=inc&cur='+this.defaultsize, // we need to find a default so we know where we're increasing/decreasing from, otherwise PHP will assume 100%
|
|||
method: 'get', |
|||
on: { |
|||
success: function(id, o) { |
|||
|
|||
// if redirected to login page, or some other error...
|
|||
if (!(o.response === undefined) && o.response.length > 0) { |
|||
alert(M.util.get_string('jsnotloggedin', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
} |
|||
|
|||
// now that we updated user setting to the server, load updated stylesheet
|
|||
M.block_accessibility.reload_stylesheet(); |
|||
var new_fontsize = M.block_accessibility.get_current_fontsize(M.block_accessibility.MAIN_SELECTOR); |
|||
M.block_accessibility.log('Increasing size to '+new_fontsize); |
|||
|
|||
// Disable/enable buttons as necessary
|
|||
var min_fontsize = M.block_accessibility.MIN_PX_FONTSIZE; |
|||
var max_fontsize = M.block_accessibility.MAX_PX_FONTSIZE; |
|||
if(new_fontsize == M.block_accessibility.defaultsize) { |
|||
M.block_accessibility.toggle_textsizer('reset', 'off'); |
|||
} else { |
|||
M.block_accessibility.toggle_textsizer('reset', 'on'); |
|||
} |
|||
if (new_fontsize >= max_fontsize) { |
|||
M.block_accessibility.toggle_textsizer('inc', 'off'); |
|||
} |
|||
M.block_accessibility.toggle_textsizer('dec', 'on'); |
|||
M.block_accessibility.toggle_textsizer('save', 'on'); |
|||
|
|||
}, |
|||
failure: function(o) { |
|||
alert(M.util.get_string('jsnosize', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
break; |
|||
case "block_accessibility_dec": |
|||
//this.log('Decreasing size from '+this.defaultsize);
|
|||
Y.io(M.cfg.wwwroot+'/blocks/accessibility/changesize.php', { |
|||
data: 'op=dec&cur='+this.defaultsize, |
|||
method: 'get', |
|||
on: { |
|||
success: function(id, o) { |
|||
|
|||
// if redirected to login page, or some other error...
|
|||
if (!(o.response === undefined) && o.response.length > 0) { |
|||
alert(M.util.get_string('jsnotloggedin', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
} |
|||
|
|||
// now that we updated user setting to the server, load updated stylesheet
|
|||
M.block_accessibility.reload_stylesheet(); |
|||
var new_fontsize = M.block_accessibility.get_current_fontsize(M.block_accessibility.MAIN_SELECTOR); |
|||
M.block_accessibility.log('Decreasing size to '+new_fontsize); |
|||
|
|||
// Disable/enable buttons as necessary
|
|||
var min_fontsize = M.block_accessibility.MIN_PX_FONTSIZE; |
|||
var max_fontsize = M.block_accessibility.MAX_PX_FONTSIZE; |
|||
if(new_fontsize == M.block_accessibility.defaultsize) { |
|||
M.block_accessibility.toggle_textsizer('reset', 'off'); |
|||
} else { |
|||
M.block_accessibility.toggle_textsizer('reset', 'on'); |
|||
} |
|||
if (new_fontsize <= min_fontsize) { |
|||
M.block_accessibility.toggle_textsizer('dec', 'off'); |
|||
} |
|||
M.block_accessibility.toggle_textsizer('inc', 'on'); |
|||
M.block_accessibility.toggle_textsizer('save', 'on'); |
|||
|
|||
}, |
|||
failure: function(id, o) { |
|||
alert(M.util.get_string('jsnosize', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
break; |
|||
case "block_accessibility_reset": |
|||
//this.log('Resetting size from '+this.defaultsize);
|
|||
Y.io(M.cfg.wwwroot+'/blocks/accessibility/changesize.php', { |
|||
data: 'op=reset&cur='+this.defaultsize, |
|||
method: 'get', |
|||
on: { |
|||
success: function(id, o) { |
|||
|
|||
// if redirected to login page, or some other error...
|
|||
if (!(o.response === undefined) && o.response.length > 0) { |
|||
alert(M.util.get_string('jsnotloggedin', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
} |
|||
|
|||
// now that we updated user setting to the server, load updated stylesheet
|
|||
M.block_accessibility.reload_stylesheet(); |
|||
var new_fontsize = M.block_accessibility.get_current_fontsize(M.block_accessibility.MAIN_SELECTOR); |
|||
M.block_accessibility.log('Resetting size to '+new_fontsize); |
|||
|
|||
// Disable/enable buttons as necessary
|
|||
var min_fontsize = M.block_accessibility.MIN_PX_FONTSIZE; |
|||
var max_fontsize = M.block_accessibility.MAX_PX_FONTSIZE; |
|||
M.block_accessibility.toggle_textsizer('reset', 'off'); |
|||
if(new_fontsize <= min_fontsize) { |
|||
M.block_accessibility.toggle_textsizer('dec', 'on'); |
|||
} else if (new_fontsize >= max_fontsize){ |
|||
M.block_accessibility.toggle_textsizer('inc', 'on'); |
|||
} |
|||
M.block_accessibility.toggle_textsizer('save', 'off'); |
|||
//M.block_accessibility.resetsize();
|
|||
|
|||
}, |
|||
failure: function(id, o) { |
|||
alert(M.util.get_string('jsnosize', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
break; |
|||
case "block_accessibility_save": |
|||
//this.log('Saving Size');
|
|||
M.block_accessibility.savesize(); |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* This handles clicks from the colour scheme buttons. |
|||
* We start by getting the scheme number from the theme button's ID. |
|||
* We then get the elements that need dynamically re-styling via their |
|||
* CSS selectors and loop through the arrays to style them appropriately. |
|||
* |
|||
* @requires accessibility_toggle_textsizer |
|||
* @requires accessibility_resetscheme |
|||
* @requires stylesheet |
|||
* @requires webroot |
|||
* |
|||
* @param {String} button - the button that was clicked. |
|||
* |
|||
*/ |
|||
|
|||
changecolour: function(button) { |
|||
Y = this.Y; |
|||
scheme = button.get('id').substring(26); |
|||
Y.io(M.cfg.wwwroot+'/blocks/accessibility/changecolour.php', { |
|||
data: 'scheme='+scheme, |
|||
method: 'get', |
|||
on: { |
|||
success: function (id, o) { |
|||
// if redirected to login page, or some other error...
|
|||
if (!(o.response === undefined) && o.response.length > 0) { |
|||
alert(M.util.get_string('jsnotloggedin', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
} |
|||
|
|||
M.block_accessibility.reload_stylesheet(); |
|||
if(scheme == 1){ |
|||
M.block_accessibility.toggle_textsizer('save', 'off'); // reset
|
|||
M.block_accessibility.toggle_textsizer('colour1', 'off'); |
|||
} |
|||
else{ |
|||
M.block_accessibility.toggle_textsizer('save', 'on'); |
|||
M.block_accessibility.toggle_textsizer('colour1', 'on'); |
|||
} |
|||
}, |
|||
failure: function(id, o) { |
|||
alert(get_string('jsnocolour', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
atbar_autoload: function(op) { |
|||
if (op == 'on') { |
|||
this.Y.io(M.cfg.wwwroot+'/blocks/accessibility/database.php', { |
|||
data: 'op=save&atbar=true', |
|||
method: 'get', |
|||
on: { |
|||
success: function(id, o) { |
|||
M.block_accessibility.show_message(M.util.get_string('saved', 'block_accessibility')); |
|||
//setTimeout("M.block_accessibility.show_message('')", 5000);
|
|||
}, |
|||
failure: function(id, o) { |
|||
if (o.status != '404') { |
|||
alert(M.util.get_string('jsnosave', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
} |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
} else if (op == 'off') { |
|||
this.Y.io(M.cfg.wwwroot+'/blocks/accessibility/database.php', { |
|||
data: 'op=reset&atbar=true', |
|||
method: 'get', |
|||
on: { |
|||
success: function(id, o) { |
|||
M.block_accessibility.show_message(M.util.get_string('reset', 'block_accessibility')); |
|||
//setTimeout("M.block_accessibility.show_message('')", 5000);
|
|||
}, |
|||
failure: function(id, o) { |
|||
if (o.status != '404') { |
|||
alert(M.util.get_string('jsnoreset', 'block_accessibility')+': '+o.status+' '+o.statusText); |
|||
} |
|||
}, |
|||
start: M.block_accessibility.show_loading, |
|||
end: M.block_accessibility.hide_loading |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
watch_atbar_for_close: function() { |
|||
Y = this.Y; |
|||
this.watch = setInterval(function() { |
|||
|
|||
if (typeof AtKit !== 'undefined') { |
|||
if (AtKit.isRendered()) { |
|||
Y.one('#block_accessibility_textresize').setStyle('display', 'block'); |
|||
Y.one('#block_accessibility_changecolour').setStyle('display', 'block'); |
|||
clearInterval(M.block_accessibility.watch); |
|||
} |
|||
} |
|||
}, 1000); |
|||
}, |
|||
|
|||
log: function(data) { |
|||
if (this.debug) { |
|||
console.log(data); |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Stylesheet is generated by userstyles.php based on user settings (e.g. font size) |
|||
* After settings are changed, the script should download and include updated stylesheet |
|||
* |
|||
*/ |
|||
reload_stylesheet: function(){ |
|||
var cache_prevention_salt = new Date().getTime(); |
|||
var oldStylesheet = M.block_accessibility.sheetnode; |
|||
var newStylesheet = null; |
|||
var cssURL = M.cfg.wwwroot+ |
|||
'/blocks/accessibility/userstyles.php?instance_id='+ |
|||
M.block_accessibility.instance_id+ |
|||
'&v='+cache_prevention_salt |
|||
|
|||
if (document.createStyleSheet) // only for IE < 11 and IE > 8
|
|||
{ |
|||
/* |
|||
here we use href attribute change which makes some delay while reloading stylesheet |
|||
|
|||
1. one another idea would be to load stylesheet using this.Y.io(.. and create <style> element |
|||
var styleSheet = document.createElement('STYLE'); |
|||
document.documentElement.firstChild.appendChild(styleSheet); |
|||
|
|||
2. initial idea was the same as for non-IE browsers but somehow doesn't work: |
|||
oldStylesheet.remove(true); |
|||
newStylesheet = document.createStyleSheet(cssURL); |
|||
// also keep in mind that createStyleSheet can create up to 31 stylesheets
|
|||
// http://msdn.microsoft.com/en-us/library/ie/ms531194(v=vs.85).aspx
|
|||
*/ |
|||
|
|||
oldStylesheet.set('href', cssURL); |
|||
} |
|||
else |
|||
{ |
|||
// IE 11 and non-IE browsers:
|
|||
// creating new stylesheet and deleting old one makes more smooth transition
|
|||
// Why wouldn't we just set the href attribute insted of creating another stylesheet node? Because before the new stylesheet is loaded and while old one is deleted, the page will lose all the styles and all the elements get unstyled for a some time (poor user experience)
|
|||
|
|||
newStylesheet = oldStylesheet.cloneNode(true); |
|||
newStylesheet.set('href', cssURL); |
|||
this.Y.one('head').append(newStylesheet); |
|||
// remove old stylesheet
|
|||
newStylesheet.getDOMNode().onload = function(){ |
|||
oldStylesheet.remove(true); |
|||
}; |
|||
|
|||
M.block_accessibility.sheetnode = newStylesheet; |
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
/** |
|||
* Stripes px or % and gives value only |
|||
* For improved user experience, only in JS-mode, we can set current font size as default font size |
|||
* We would initially put 100%, but it doesn't have to be true for all themes |
|||
* Also font-size value can be in % or in px, there is mapping defined in lib.php in the block |
|||
* The function needs to return percentage fontsize value as integer |
|||
* |
|||
* @param {String} root element to check font-size declaration (e.g. body or #page) |
|||
*/ |
|||
get_current_fontsize: function(root_element){ |
|||
var currentsize = M.block_accessibility.DEFAULT_FONTSIZE; |
|||
//var defaultsize = Y.one(root_element).getStyle('fontSize');
|
|||
var defaultsize = Y.one(root_element).getComputedStyle('fontSize'); |
|||
if (defaultsize.substr(-2) == 'px') { |
|||
currentsize = defaultsize.substr(0, defaultsize.length-2); |
|||
} else if (defaultsize.substr(-1) == '%') { |
|||
currentsize = defaultsize.substr(0, defaultsize.length-1); |
|||
} |
|||
return currentsize; |
|||
}, |
|||
|
|||
show_loading: function(){ |
|||
this.transactionsCount++; |
|||
Y.one('#loader-icon').setStyle('display', 'block'); |
|||
Y.one('#accessibility_controls').setStyle('opacity', '0.2'); |
|||
}, |
|||
hide_loading: function(){ |
|||
if(this.transactionsCount < 0) this.transactionsCount--; |
|||
else this.transactionsCount = 0; // prevention if count would end up to less than 0
|
|||
|
|||
if(this.transactionsCount == 0){ |
|||
Y.one('#loader-icon').setStyle('display', 'none'); |
|||
Y.one('#accessibility_controls').setStyle('opacity', '1'); |
|||
} |
|||
}, |
|||
} |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,131 @@ |
|||
body.jsdisabled #block_accessibility_launchtoolbar { |
|||
display: none; |
|||
} |
|||
|
|||
.block_accessibility{ |
|||
position: relative; /* for loader.gif to position absolute */ |
|||
|
|||
/*disable selection*/ |
|||
-webkit-touch-callout: none; |
|||
-webkit-user-select: none; |
|||
-khtml-user-select: none; |
|||
-moz-user-select: none; |
|||
-ms-user-select: none; |
|||
user-select: none; |
|||
} |
|||
|
|||
#accessibility_controls .access-button { |
|||
display: inline-block; |
|||
vertical-align: middle; |
|||
margin: 0 .15em; |
|||
border: 1px solid #ccc; |
|||
border-radius: 3px; |
|||
text-align: center; |
|||
background: -moz-linear-gradient(top, rgba(254,255,232,0) 0%, rgba(214,219,191,0.3) 100%) !important; /* FF3.6+ */ |
|||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,232,0)), color-stop(100%,rgba(214,219,191,0.3))) !important; /* Chrome,Safari4+ */ |
|||
background: -webkit-linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.3) 100%) !important; /* Chrome10+,Safari5.1+ */ |
|||
background: -o-linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.3) 100%) !important; /* Opera11.10+ */ |
|||
background: -ms-linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.3) 100%) !important; /* IE10+ */ |
|||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00feffe8', endColorstr='#4dd6dbbf',GradientType=0 ) !important; /* IE6-9 */ |
|||
background: linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.3) 100%) !important; /* W3C */ |
|||
|
|||
/*disable selection*/ |
|||
-webkit-touch-callout: none; |
|||
-webkit-user-select: none; |
|||
-khtml-user-select: none; |
|||
-moz-user-select: none; |
|||
-ms-user-select: none; |
|||
user-select: none; |
|||
} |
|||
|
|||
#accessibility_controls .access-button:hover { |
|||
background: -moz-linear-gradient(top, rgba(254,255,232,0) 0%, rgba(214,219,191,0.5) 50%) !important; /* FF3.6+ */ |
|||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,232,0)), color-stop(50%,rgba(214,219,191,0.5))) !important; /* Chrome,Safari4+ */ |
|||
background: -webkit-linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.5) 50%) !important; /* Chrome10+,Safari5.1+ */ |
|||
background: -o-linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.5) 50%) !important; /* Opera11.10+ */ |
|||
background: -ms-linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.5) 50%) !important; /* IE10+ */ |
|||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00feffe8', endColorstr='#80d6dbbf',GradientType=0 ) !important; /* IE6-9 */ |
|||
background: linear-gradient(top, rgba(254,255,232,0) 0%,rgba(214,219,191,0.5) 50%) !important; /* W3C */ |
|||
} |
|||
|
|||
.access-button a#block_accessibility_save { |
|||
background: url('[[pix:block_accessibility|document-save]]') !important; |
|||
background-attachment: fixed; |
|||
background-repeat: no-repeat !important; |
|||
background-position: center !important; |
|||
} |
|||
|
|||
.access-button a#block_accessibility_save.disabled { |
|||
background: url('[[pix:block_accessibility|document-save-grey]]') !important; |
|||
background-attachment: fixed; |
|||
background-repeat: no-repeat !important; |
|||
background-position: center !important; |
|||
} |
|||
|
|||
#accessibility_controls .access-button .disabled { |
|||
opacity:0.3; |
|||
cursor:not-allowed;; |
|||
} |
|||
|
|||
#accessibility_controls .access-button a { |
|||
display: block; |
|||
cursor: pointer; |
|||
color: #000; |
|||
border-radius: 2px; |
|||
padding: .15em .3em; |
|||
min-width: 1.5em; |
|||
} |
|||
|
|||
#accessibility_controls .access-button a:hover { |
|||
} |
|||
|
|||
|
|||
#accessibility_controls .access-button:active, #accessibility_controls .access-button:focus { |
|||
border: 1px solid #F24602 |
|||
} |
|||
|
|||
#accessibility_controls .access-button img { |
|||
vertical-align: middle; |
|||
} |
|||
- |
|||
#accessibility_controls input { |
|||
margin: 0 .2em; |
|||
} |
|||
|
|||
#accessibility_controls ul { |
|||
list-style: none; |
|||
margin: .4em 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
/* ATBar styles */ |
|||
#toolbar-launch { |
|||
position: absolute; |
|||
padding: 0; |
|||
top: -3px; |
|||
left: 50%; |
|||
} |
|||
|
|||
#toolbar-launch img { |
|||
padding: 0; |
|||
opacity: 0.6; |
|||
} |
|||
|
|||
.atbar-always{ |
|||
display: inline-block; |
|||
} |
|||
|
|||
#loader-icon{ |
|||
position: absolute; |
|||
width: 54px; |
|||
height: 55px; |
|||
top: 42%; |
|||
left:5em; |
|||
background: url('[[pix:block_accessibility|loader]]') !important; |
|||
display:none; |
|||
|
|||
} |
|||
#sbar{ |
|||
top:42px !important; |
|||
z-index: 999 !important; /* one less than profile menu */ |
|||
} |
@ -0,0 +1,188 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Sets per-user styles (all the CSS declarations are here) (1) |
|||
* |
|||
* This file is the cornerstone of the block - when the page loads, it |
|||
* checks if the user has a custom settings for the font size and colour |
|||
* scheme (either in the session or the database) and creates a stylesheet |
|||
* to override the standard styles with this setting. (2) |
|||
* |
|||
* @see block_accessibility.php (3) |
|||
* @package block_accessibility (4) |
|||
* @copyright Copyright 2009 onwards Taunton's College (5) |
|||
* @author Mark Johnson <mark.johnson@tauntons.ac.uk> (6) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (7) |
|||
*/ |
|||
|
|||
require_once('../../config.php'); |
|||
|
|||
// Including config.php overwrites header content-type in moodle 2.8. |
|||
header('Content-Type: text/css', true); |
|||
header("X-Content-Type-Options: nosniff"); // For IE. |
|||
header('Cache-Control: no-cache'); |
|||
|
|||
if (!isloggedin()) { |
|||
die(); |
|||
} |
|||
|
|||
// Get block instance config data outside of it's class |
|||
// https://moodle.org/mod/forum/discuss.php?d=129799 |
|||
// Also check configdata encoding in blocks/moodleblock.class.php. |
|||
|
|||
$instanceid = required_param('instance_id', PARAM_INT); |
|||
$data = $DB->get_record('block_instances', array('id' => $instanceid), '*', MUST_EXIST); |
|||
$blockinstance = block_instance('accessibility', $data); |
|||
|
|||
|
|||
// Read user settings. |
|||
// First, check the session to see if the user's overridden the default/saved setting. |
|||
$options = $DB->get_record('block_accessibility', array('userid' => $USER->id)); |
|||
|
|||
// NOTE: User settings priority: 1. $USER session, 2. database |
|||
// check for fontsize user setting. |
|||
if (!empty($USER->fontsize)) { |
|||
$fontsize = $USER->fontsize; |
|||
} else { |
|||
if (!empty($options->fontsize)) { |
|||
$fontsize = $options->fontsize; |
|||
} |
|||
} |
|||
|
|||
// Check for colourscheme user setting. |
|||
if (!empty($USER->colourscheme)) { |
|||
$colourscheme = $USER->colourscheme; |
|||
} else { |
|||
if (!empty($options->colourscheme)) { |
|||
$colourscheme = $options->colourscheme; |
|||
} |
|||
} |
|||
|
|||
// Font size CSS declarations. |
|||
// Echo out CSS for the body element. Use !important to override any other external stylesheets. |
|||
if (!empty($fontsize)) { |
|||
echo ' |
|||
|
|||
#page { /* block elements */ |
|||
font-size: ' . $fontsize . '% !important; |
|||
line-height:1.5; /*WCAG 2.0*/ |
|||
} |
|||
|
|||
#page *{ |
|||
line-height: inherit !important; |
|||
font-size: inherit !important; |
|||
} |
|||
|
|||
|
|||
/* issue #74 - default h* sizes from Moodle CSS */ |
|||
#page #page-header h1, #page #region-main h1{font-size:' . (0.32 * $fontsize) . 'px !important} |
|||
#page #page-header h2, #page #region-main h2{font-size:' . (0.28 * $fontsize) . 'px !important} |
|||
#page #page-header h3, #page #region-main h3{font-size:' . (0.24 * $fontsize) . 'px !important} |
|||
#page #page-header h4, #page #region-main h4{font-size:' . (0.20 * $fontsize) . 'px !important} |
|||
#page #page-header h5, #page #region-main h5{font-size:' . (0.16 * $fontsize) . 'px !important} |
|||
#page #page-header h6, #page #region-main h6{font-size:' . (0.12 * $fontsize) . 'px !important} |
|||
'; |
|||
} |
|||
|
|||
// Color schemes CSS declarations. |
|||
// So far, selector * is used. This might cause some problems. |
|||
// Idea: Maybe better solution is to apply backgrounds to specific elements like body, .header, ... |
|||
|
|||
if (!empty($colourscheme)) { |
|||
// If $colourscheme == 1, reset, so don't output any styles. |
|||
if ($colourscheme > 1 && $colourscheme < 5) { // This is how many declarations we defined in edit_form.php. |
|||
if ($blockinstance->config !== null) { |
|||
$fgcolour = $blockinstance->config->{'fg' . $colourscheme}; |
|||
$bgcolour = $blockinstance->config->{'bg' . $colourscheme}; |
|||
} else { // Block has never been configured, load default colours. |
|||
require_once($CFG->dirroot . '/blocks/accessibility/defaults.php'); |
|||
$fgcolour = $defaults['fg' . $colourscheme]; |
|||
$bgcolour = $defaults['bg' . $colourscheme]; |
|||
} |
|||
|
|||
} |
|||
|
|||
// Keep in mind that :not selector cannot work properly with IE <= 8 so this will not be included. |
|||
$notselector = ''; |
|||
if (!preg_match('/(?i)msie [1-8]/', $_SERVER['HTTP_USER_AGENT'])) { |
|||
$notselector = ':not([class*="mce"]):not([id*="mce"]):not([id*="editor"])'; |
|||
} |
|||
|
|||
// If no colours defined, no output, it will remain as default. |
|||
if (!empty($bgcolour)) { |
|||
echo ' |
|||
forumpost .topic { |
|||
background-image: none !important; |
|||
} |
|||
*' . $notselector . '{ |
|||
/* it works well only with * selector but mce editor gets unusable */ |
|||
background-color: ' . $bgcolour . ' !important; |
|||
background-image: none !important; |
|||
text-shadow:none !important; |
|||
} |
|||
'; |
|||
} |
|||
|
|||
// It is recommended not to change forground colour. |
|||
if (!empty($fgcolour)) { |
|||
echo ' |
|||
*' . $notselector . '{ |
|||
/* it works well only with * selector but mce editor gets unusable */ |
|||
color: ' . $fgcolour . ' !important; |
|||
} |
|||
#content a, .tabrow0 span { |
|||
color: ' . $fgcolour . ' !important; |
|||
} |
|||
.tabrow0 span:hover { |
|||
text-decoration: underline; |
|||
} |
|||
.block_accessibility .outer { |
|||
border-color: ' . $bgcolour . ' !important; |
|||
} |
|||
'; |
|||
} |
|||
|
|||
} |
|||
|
|||
// Accessibility block's colour scheme buttons. |
|||
// Do not edit (this part of code is not in styles.php because colours are defined in block's configuration form). |
|||
for ($i = 2; $i < 5; $i++) { // This is how many declarations we defined in defaults.php. |
|||
$colourscheme = $i; |
|||
if ($blockinstance->config !== null) { |
|||
$fgcolour = $blockinstance->config->{'fg' . $colourscheme}; |
|||
$bgcolour = $blockinstance->config->{'bg' . $colourscheme}; |
|||
} else { // Block has never been configured, load default colours. |
|||
require_once($CFG->dirroot . '/blocks/accessibility/defaults.php'); |
|||
$fgcolour = $defaults['fg' . $colourscheme]; |
|||
$bgcolour = $defaults['bg' . $colourscheme]; |
|||
} |
|||
echo '#block_accessibility_colour' . $colourscheme . '{'; |
|||
if (!empty($fgcolour)) { |
|||
echo 'color:' . $fgcolour . ' !important;'; |
|||
} |
|||
if (!empty($bgcolour)) { |
|||
echo 'background-color:' . $bgcolour . ' !important;'; |
|||
} |
|||
echo '}'; |
|||
} |
|||
|
|||
// The display:inline-block CSS declaration is not applied to block's buttons because IE7 doesn't support it. |
|||
// Float is used insted for IE7 only. |
|||
if (preg_match('/(?i)msie [1-7]/', $_SERVER['HTTP_USER_AGENT'])) { |
|||
echo '#accessibility_controls .access-button{float:left;}'; |
|||
echo '.atbar-always{float:left;}'; |
|||
} |
@ -0,0 +1,38 @@ |
|||
<?php |
|||
// This file is part of Moodle - http://moodle.org/ |
|||
// |
|||
// Moodle is free software: you can redistribute it and/or modify |
|||
// it under the terms of the GNU General Public License as published by |
|||
// the Free Software Foundation, either version 3 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// Moodle is distributed in the hope that it will be useful, |
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
// GNU General Public License for more details. |
|||
// |
|||
// You should have received a copy of the GNU General Public License |
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
/** |
|||
* Define metadata for Accessibility block |
|||
* |
|||
* This file is the cornerstone of the block - when the page loads, it |
|||
* checks if the user has a custom settings for the font size and colour |
|||
* scheme (either in the session or the database) and creates a stylesheet |
|||
* to override the standard styles with this setting. (2) |
|||
* |
|||
* @package block_accessibility (4) |
|||
* @copyright Copyright 2009 onwards Taunton's College (5) |
|||
* @author Mark Johnson (6) |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (7) |
|||
*/ |
|||
|
|||
defined('MOODLE_INTERNAL') || die(); |
|||
|
|||
$plugin->version = 2017051700; |
|||
$plugin->cron = 3600; |
|||
$plugin->requires = 2016051900; |
|||
$plugin->component = 'block_accessibility'; |
|||
$plugin->maturity = MATURITY_STABLE; |
|||
$plugin->release = '2.2.4'; |
Loading…
Reference in new issue