Commit ecc5cc31 authored by Rossiani Wijaya's avatar Rossiani Wijaya
Browse files

MDL-34650 - accessibility compliance: Add <label> for form input text and select tag

parent 55a568fa
...@@ -937,6 +937,7 @@ $string['liketologin'] = 'Would you like to log in now with a full user account? ...@@ -937,6 +937,7 @@ $string['liketologin'] = 'Would you like to log in now with a full user account?
$string['list'] = 'List'; $string['list'] = 'List';
$string['listfiles'] = 'List of files in {$a}'; $string['listfiles'] = 'List of files in {$a}';
$string['listofallpeople'] = 'List of all people'; $string['listofallpeople'] = 'List of all people';
$string['listofcourses'] = 'List of courses';
$string['local'] = 'Local'; $string['local'] = 'Local';
$string['localplugindeleteconfirm'] = 'You are about to completely delete the local plugin \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?'; $string['localplugindeleteconfirm'] = 'You are about to completely delete the local plugin \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
$string['localplugins'] = 'Local plugins'; $string['localplugins'] = 'Local plugins';
...@@ -1032,6 +1033,7 @@ $string['messageselectadd'] = 'Send a message'; ...@@ -1032,6 +1033,7 @@ $string['messageselectadd'] = 'Send a message';
$string['migratinggrades'] = 'Migrating grades'; $string['migratinggrades'] = 'Migrating grades';
$string['min'] = 'min'; $string['min'] = 'min';
$string['mins'] = 'mins'; $string['mins'] = 'mins';
$string['minute'] = 'minute';
$string['minutes'] = 'minutes'; $string['minutes'] = 'minutes';
$string['miscellaneous'] = 'Miscellaneous'; $string['miscellaneous'] = 'Miscellaneous';
$string['missingcategory'] = 'You need to choose a category'; $string['missingcategory'] = 'You need to choose a category';
...@@ -1059,6 +1061,8 @@ $string['missingteacher'] = 'Must choose something'; ...@@ -1059,6 +1061,8 @@ $string['missingteacher'] = 'Must choose something';
$string['missingurl'] = 'Missing URL'; $string['missingurl'] = 'Missing URL';
$string['missingusername'] = 'Missing username'; $string['missingusername'] = 'Missing username';
$string['moddoesnotsupporttype'] = 'Module {$a->modname} does not support uploads of type {$a->type}'; $string['moddoesnotsupporttype'] = 'Module {$a->modname} does not support uploads of type {$a->type}';
$string['month'] = 'Month';
$string['months'] = 'Months';
$string['modified'] = 'Modified'; $string['modified'] = 'Modified';
$string['modchooserenable'] = 'Activity chooser on'; $string['modchooserenable'] = 'Activity chooser on';
$string['modchooserdisable'] = 'Activity chooser off'; $string['modchooserdisable'] = 'Activity chooser off';
...@@ -1247,6 +1251,7 @@ $string['oldpassword'] = 'Current password'; ...@@ -1247,6 +1251,7 @@ $string['oldpassword'] = 'Current password';
$string['olduserdirectory'] = 'This is the OLD users directory, and is no longer needed. You may safely delete it. The files it contains have been copied to the NEW user directory.'; $string['olduserdirectory'] = 'This is the OLD users directory, and is no longer needed. You may safely delete it. The files it contains have been copied to the NEW user directory.';
$string['opentoguests'] = 'Guest access'; $string['opentoguests'] = 'Guest access';
$string['optional'] = 'optional'; $string['optional'] = 'optional';
$string['options'] = 'options';
$string['order'] = 'Order'; $string['order'] = 'Order';
$string['originalpath'] = 'Original path'; $string['originalpath'] = 'Original path';
$string['orphanedactivities'] = 'Orphaned activities'; $string['orphanedactivities'] = 'Orphaned activities';
...@@ -1493,9 +1498,15 @@ $string['sectionusedefaultname'] = 'Use default section name'; ...@@ -1493,9 +1498,15 @@ $string['sectionusedefaultname'] = 'Use default section name';
$string['seealsostats'] = 'See also: stats'; $string['seealsostats'] = 'See also: stats';
$string['select'] = 'Select'; $string['select'] = 'Select';
$string['selectacountry'] = 'Select a country'; $string['selectacountry'] = 'Select a country';
$string['selectacourse'] = 'Select a course';
$string['selectacoursesite'] = 'Select a course or site';
$string['selectanaction'] = 'Select an action';
$string['selectagroup'] = 'Select a group';
$string['selectaregion'] = 'Select a region'; $string['selectaregion'] = 'Select a region';
$string['selctauser'] = 'Select a user';
$string['selectall'] = 'Select all'; $string['selectall'] = 'Select all';
$string['selectamodule'] = 'Please select an activity module'; $string['selectamodule'] = 'Please select an activity module';
$string['selectanoptions'] = 'Select an options';
$string['selectdefault'] = 'Select default'; $string['selectdefault'] = 'Select default';
$string['selectedfile'] = 'Selected file'; $string['selectedfile'] = 'Selected file';
$string['selectednowmove'] = '{$a} files selected for moving. Now go into the destination folder and press \'Move files to here\''; $string['selectednowmove'] = '{$a} files selected for moving. Now go into the destination folder and press \'Move files to here\'';
......
...@@ -27,5 +27,6 @@ $string['downloadas'] = 'Download table data as'; ...@@ -27,5 +27,6 @@ $string['downloadas'] = 'Download table data as';
$string['downloadcsv'] = 'a comma separated values text file'; $string['downloadcsv'] = 'a comma separated values text file';
$string['downloadexcel'] = 'a Microsoft Excel spreadsheet'; $string['downloadexcel'] = 'a Microsoft Excel spreadsheet';
$string['downloadods'] = 'an OpenDocument Spreadsheet (ODS)'; $string['downloadods'] = 'an OpenDocument Spreadsheet (ODS)';
$string['downloadoptions'] = 'Select download options';
$string['downloadtsv'] = 'a tab separated values text file'; $string['downloadtsv'] = 'a tab separated values text file';
$string['downloadxhtml'] = 'an unpaged XHTML document'; $string['downloadxhtml'] = 'an unpaged XHTML document';
...@@ -361,10 +361,11 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { ...@@ -361,10 +361,11 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
$str .= '<div>'; $str .= '<div>';
if (count($formats)>1) { if (count($formats)>1) {
$str.= html_writer::select($formats, $elname.'[format]', $format, false); $str .= html_writer::label(get_string('format'), 'menu'. $elname. 'format', false, array('class' => 'accesshide'));
$str .= html_writer::select($formats, $elname.'[format]', $format, false, array('id' => 'menu'. $elname. 'format'));
} else { } else {
$keys = array_keys($formats); $keys = array_keys($formats);
$str.= html_writer::empty_tag('input', $str .= html_writer::empty_tag('input',
array('name'=>$elname.'[format]', 'type'=> 'hidden', 'value' => array_pop($keys))); array('name'=>$elname.'[format]', 'type'=> 'hidden', 'value' => array_pop($keys)));
} }
$str .= '</div>'; $str .= '</div>';
......
...@@ -714,6 +714,11 @@ class single_select implements renderable { ...@@ -714,6 +714,11 @@ class single_select implements renderable {
*/ */
var $label = ''; var $label = '';
/**
* @var array Button label's
*/
var $labelattributes = array();
/** /**
* @var string Form submit method post or get * @var string Form submit method post or get
*/ */
...@@ -806,9 +811,12 @@ class single_select implements renderable { ...@@ -806,9 +811,12 @@ class single_select implements renderable {
* Sets select's label * Sets select's label
* *
* @param string $label * @param string $label
* @param array $attributes (optional)
*/ */
public function set_label($label) { public function set_label($label, $attributes = array()) {
$this->label = $label; $this->label = $label;
$this->labelattributes = $attributes;
} }
} }
...@@ -850,6 +858,11 @@ class url_select implements renderable { ...@@ -850,6 +858,11 @@ class url_select implements renderable {
*/ */
var $label = ''; var $label = '';
/**
* @var array Button label's attributes
*/
var $labelattributes = array();
/** /**
* @var string Wrapping div class * @var string Wrapping div class
*/ */
...@@ -922,9 +935,11 @@ class url_select implements renderable { ...@@ -922,9 +935,11 @@ class url_select implements renderable {
* Sets select's label * Sets select's label
* *
* @param string $label * @param string $label
* @param array $attributes (optional)
*/ */
public function set_label($label) { public function set_label($label, $attributes = array()) {
$this->label = $label; $this->label = $label;
$this->labelattributes = $attributes;
} }
} }
......
...@@ -1332,7 +1332,7 @@ class core_renderer extends renderer_base { ...@@ -1332,7 +1332,7 @@ class core_renderer extends renderer_base {
} }
if ($select->label) { if ($select->label) {
$output .= html_writer::label($select->label, $select->attributes['id']); $output .= html_writer::label($select->label, $select->attributes['id'], false, $select->labelattributes);
} }
if ($select->helpicon instanceof help_icon) { if ($select->helpicon instanceof help_icon) {
...@@ -1340,7 +1340,6 @@ class core_renderer extends renderer_base { ...@@ -1340,7 +1340,6 @@ class core_renderer extends renderer_base {
} else if ($select->helpicon instanceof old_help_icon) { } else if ($select->helpicon instanceof old_help_icon) {
$output .= $this->render($select->helpicon); $output .= $this->render($select->helpicon);
} }
$output .= html_writer::select($select->options, $select->name, $select->selected, $select->nothing, $select->attributes); $output .= html_writer::select($select->options, $select->name, $select->selected, $select->nothing, $select->attributes);
$go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go'))); $go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go')));
...@@ -1410,7 +1409,7 @@ class core_renderer extends renderer_base { ...@@ -1410,7 +1409,7 @@ class core_renderer extends renderer_base {
$output = ''; $output = '';
if ($select->label) { if ($select->label) {
$output .= html_writer::label($select->label, $select->attributes['id']); $output .= html_writer::label($select->label, $select->attributes['id'], false, $select->labelattributes);
} }
if ($select->helpicon instanceof help_icon) { if ($select->helpicon instanceof help_icon) {
...@@ -1627,6 +1626,7 @@ class core_renderer extends renderer_base { ...@@ -1627,6 +1626,7 @@ class core_renderer extends renderer_base {
$scalearray = array(RATING_UNSET_RATING => $strrate.'...') + $rating->settings->scale->scaleitems; $scalearray = array(RATING_UNSET_RATING => $strrate.'...') + $rating->settings->scale->scaleitems;
$scaleattrs = array('class'=>'postratingmenu ratinginput','id'=>'menurating'.$rating->itemid); $scaleattrs = array('class'=>'postratingmenu ratinginput','id'=>'menurating'.$rating->itemid);
$ratinghtml .= html_writer::label($rating->rating, 'menurating'.$rating->itemid, false, array('class' => 'accesshide'));
$ratinghtml .= html_writer::select($scalearray, 'rating', $rating->rating, false, $scaleattrs); $ratinghtml .= html_writer::select($scalearray, 'rating', $rating->rating, false, $scaleattrs);
//output submit button //output submit button
......
...@@ -462,7 +462,8 @@ function portfolio_instance_select($instances, $callerformats, $callbackclass, $ ...@@ -462,7 +462,8 @@ function portfolio_instance_select($instances, $callerformats, $callbackclass, $
$pinsane = portfolio_plugin_sanity_check(); $pinsane = portfolio_plugin_sanity_check();
$count = 0; $count = 0;
$selectoutput = "\n" . '<select name="' . $selectname . '">' . "\n"; $selectoutput = "\n" . '<label class="accesshide" for="instanceid">' . get_string('plugin', 'portfolio') . '</label>';
$selectoutput .= "\n" . '<select id="instanceid" name="' . $selectname . '">' . "\n";
$existingexports = portfolio_existing_exports_by_plugin($USER->id); $existingexports = portfolio_existing_exports_by_plugin($USER->id);
foreach ($instances as $instance) { foreach ($instances as $instance) {
$formats = portfolio_supported_formats_intersect($callerformats, $instance->supported_formats()); $formats = portfolio_supported_formats_intersect($callerformats, $instance->supported_formats());
......
...@@ -992,7 +992,7 @@ function question_category_select_menu($contexts, $top = false, $currentcat = 0, ...@@ -992,7 +992,7 @@ function question_category_select_menu($contexts, $top = false, $currentcat = 0,
foreach ($categoriesarray as $group => $opts) { foreach ($categoriesarray as $group => $opts) {
$options[] = array($group => $opts); $options[] = array($group => $opts);
} }
echo html_writer::label($selected, 'menucategory', false, array('class' => 'accesshide'));
echo html_writer::select($options, 'category', $selected, $choose); echo html_writer::select($options, 'category', $selected, $choose);
} }
......
...@@ -918,6 +918,7 @@ class flexible_table { ...@@ -918,6 +918,7 @@ class flexible_table {
$html = '<form action="'. $this->baseurl .'" method="post">'; $html = '<form action="'. $this->baseurl .'" method="post">';
$html .= '<div class="mdl-align">'; $html .= '<div class="mdl-align">';
$html .= '<input type="submit" value="'.get_string('downloadas', 'table').'"/>'; $html .= '<input type="submit" value="'.get_string('downloadas', 'table').'"/>';
$html .= html_writer::label(get_string('downloadoptions', 'table'), 'menudownload', false, array('class' => 'accesshide'));
$html .= html_writer::select($downloadoptions, 'download', $this->defaultdownloadformat, false); $html .= html_writer::select($downloadoptions, 'download', $this->defaultdownloadformat, false);
$html .= '</div></form>'; $html .= '</div></form>';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment