Merge branch 'MDL-34563_accessibility' of git://github.com/rwijaya/moodle

This commit is contained in:
Aparup Banerjee 2012-08-14 14:34:19 +08:00
commit 1474543a20
14 changed files with 46 additions and 18 deletions

View File

@ -352,6 +352,7 @@ if (($mode == 'new') && (!empty($newtype)) && confirm_sesskey()) { ///
$options = array(0 => get_string('ascending', 'data'),
1 => get_string('descending', 'data'));
echo html_writer::label(get_string('sortby'), 'menudefaultsortdir', false, array('class' => 'accesshide'));
echo html_writer::select($options, 'defaultsortdir', $data->defaultsortdir, false);
echo '<input type="submit" value="'.get_string('save', 'data').'" />';
echo '</div>';

View File

@ -44,9 +44,12 @@ class data_field_date extends data_field_base {
}
$str = '<div title="'.s($this->field->description).'">';
$dayselector = html_writer::select_time('days', 'field_'.$this->field->id.'_day', $content);
$monthselector = html_writer::select_time('months', 'field_'.$this->field->id.'_month', $content);
$yearselector = html_writer::select_time('years', 'field_'.$this->field->id.'_year', $content);
$dayselector = html_writer::label(get_string('days'), 'menufield_'.$this->field->id.'_day', false, array('class' => 'accesshide'))
. html_writer::select_time('days', 'field_'.$this->field->id.'_day', $content);
$monthselector = html_writer::label(get_string('months'), 'menufield_'.$this->field->id.'_month', false, array('class' => 'accesshide'))
. html_writer::select_time('months', 'field_'.$this->field->id.'_month', $content);
$yearselector = html_writer::label(get_string('years'), 'menufield_'.$this->field->id.'_year', false, array('class' => 'accesshide'))
. html_writer::select_time('years', 'field_'.$this->field->id.'_year', $content);
$str .= $dayselector . $monthselector . $yearselector;
$str .= '</div>';
@ -55,8 +58,11 @@ class data_field_date extends data_field_base {
//Enable the following three functions once core API issues have been addressed.
function display_search_field($value=0) {
$selectors = html_writer::select_time('days', 'f_'.$this->field->id.'_d', $value)
$selectors = html_writer::label(get_string('days'), 'menuf_'.$this->field->id.'_d', false, array('class' => 'accesshide'))
. html_writer::select_time('days', 'f_'.$this->field->id.'_d', $value)
. html_writer::label(get_string('months'), 'menuf_'.$this->field->id.'_m', false, array('class' => 'accesshide'))
. html_writer::select_time('months', 'f_'.$this->field->id.'_m', $value)
. html_writer::label(get_string('years'), 'menuf_'.$this->field->id.'_y', false, array('class' => 'accesshide'))
. html_writer::select_time('years', 'f_'.$this->field->id.'_y', $value);
return $selectors;

View File

@ -91,7 +91,8 @@ class data_field_file extends data_field_base {
}
function display_search_field($value = '') {
return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
return '<label class="accesshide" for=f_"' . $this->field->id . '">' . $this->field->name . '</label>' .
'<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function generate_sql($tablealias, $value) {

View File

@ -14,6 +14,7 @@
<?php
$course = $DB->get_record('course', array('id'=>$this->data->course));
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
echo html_writer::label($this->field->param3, 'menuparam3', false, array('class' => 'accesshide'));
echo html_writer::select($choices, 'param3', $this->field->param3, false, array('id' => 'param3'));
?>
</td>

View File

@ -82,7 +82,9 @@ class data_field_latlong extends data_field_base {
}
$latlongsrs->close();
return html_writer::select($options, 'f_'.$this->field->id, $value);
$return = html_writer::label(get_string('latlong', 'data'), 'menuf_'.$this->field->id, false, array('class' => 'accesshide'));
$return .= html_writer::select($options, 'f_'.$this->field->id, $value);
return $return;
}
function parse_search_field() {
@ -150,7 +152,9 @@ class data_field_latlong extends data_field_base {
. str_replace(array_keys($urlreplacements), array_values($urlreplacements), $this->linkoutservices[$servicesshown[0]])
."' title='$servicesshown[0]'>$compasslat, $compasslong</a>";
} elseif (sizeof($servicesshown)>1) {
$str .= "$compasslat, $compasslong\n<select name='jumpto'>";
$str .= "$compasslat, $compasslong\n";
$str .= "<label class='accesshide' for='jumpto'>". get_string('jumpto') ."</label>";
$str .= "<select id='jumpto' name='jumpto'>";
foreach($servicesshown as $servicename){
// Add a link to a service
$str .= "\n <option value='"

View File

@ -46,7 +46,7 @@ class data_field_menu extends data_field_base {
}
}
$str .= html_writer::label(get_string('menuchoose', 'data'), 'field_'.$this->field->id, false, array('class' => 'accesshide'));
$str .= html_writer::select($options, 'field_'.$this->field->id, $content, array(''=>get_string('menuchoose', 'data')), array('id'=>'field_'.$this->field->id));
$str .= '</div>';
@ -86,7 +86,9 @@ class data_field_menu extends data_field_base {
return '';
}
return html_writer::select($options, 'f_'.$this->field->id, $content);
$return = html_writer::label(get_string('namemenu', 'data'), 'menuf_'. $this->field->id, false, array('class' => 'accesshide'));
$return .= html_writer::select($options, 'f_'.$this->field->id, $content);
return $return;
}
function parse_search_field() {

View File

@ -38,6 +38,7 @@ class data_field_multimenu extends data_field_base {
$str = '<div title="'.s($this->field->description).'">';
$str .= '<input name="field_' . $this->field->id . '[xxx]" type="hidden" value="xxx"/>'; // hidden field - needed for empty selection
$str .= '<label class="accesshide" for="field_' . $this->field->id . '">' . $this->field->name. '</label>';
$str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
foreach (explode("\n",$this->field->param1) as $option) {
@ -71,7 +72,8 @@ class data_field_multimenu extends data_field_base {
static $c = 0;
$str = '<select name="f_'.$this->field->id.'[]" multiple="multiple">';
$str = '<label class="accesshide" for="f_' . $this->field->id . '">' . $this->field->name . '</label>';
$str .= '<select id="f_'.$this->field->id.'" name="f_'.$this->field->id.'[]" multiple="multiple">';
// display only used options
$varcharcontent = $DB->sql_compare_text('content', 255);

View File

@ -70,7 +70,8 @@ class data_field_number extends data_field_base {
}
function display_search_field($value = '') {
return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
return '<label class="accesshide" for="f_'.$this->field->id.'">' . get_string('fieldname', 'data') . '</label>' .
'<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {

View File

@ -118,7 +118,8 @@ class data_field_picture extends data_field_base {
}
function display_search_field($value = '') {
return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
return '<label class="accesshide" for="f_'.$this->field->id.'">' . get_string('fieldname', 'data') . '</label>' .
'<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {

View File

@ -46,6 +46,7 @@
<?php
$course = $DB->get_record('course', array('id'=>$this->data->course));
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
echo html_writer::label($this->field->param3, 'menuparam3', false, array('class' => 'accesshide'));
echo html_writer::select($choices, 'param3', $this->field->param3, false, array('id'=>'param3'));
?>
</td>

View File

@ -78,7 +78,9 @@ class data_field_radiobutton extends data_field_base {
$options[$rec->content] = $rec->content; //Build following indicies from the sql.
}
}
return html_writer::select($options, 'f_'.$this->field->id, $value);
$return = html_writer::label(get_string('nameradiobutton', 'data'), 'menuf_'. $this->field->id, false, array('class' => 'accesshide'));
$return .= html_writer::select($options, 'f_'.$this->field->id, $value);
return $return;
}
function parse_search_field() {

View File

@ -27,7 +27,7 @@ class data_field_text extends data_field_base {
var $type = 'text';
function display_search_field($value = '') {
return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
return '<label class="accesshide" for="f_' . $this->field->id . '">'. $this->field->name.'</label>' . '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {

View File

@ -126,7 +126,8 @@ class data_field_textarea extends data_field_base {
$editor->use_editor($field, $options, $fpoptions);
$str .= '<input type="hidden" name="'.$field.'_itemid" value="'.$draftitemid.'" />';
$str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'">'.s($text).'</textarea></div>';
$str .= '<div><select name="'.$field.'_content1">';
$str .= '<div><label class="accesshide" for="' . $field . '_content1">' . get_string('format') . '</label>';
$str .= '<select id="' . $field . '_content1" name="'.$field.'_content1">';
foreach ($formats as $key=>$desc) {
$selected = ($format == $key) ? 'selected="selected"' : '';
$str .= '<option value="'.s($key).'" '.$selected.'>'.$desc.'</option>';
@ -140,7 +141,8 @@ class data_field_textarea extends data_field_base {
function display_search_field($value = '') {
return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
return '<label class="accesshide" for="f_' . $this->field->id . '">' . $this->field->name . '</label>' .
'<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {

View File

@ -52,11 +52,14 @@ class data_field_url extends data_field_base {
$str = '<div title="'.s($this->field->description).'">';
if (!empty($this->field->param1) and empty($this->field->param2)) {
$str .= '<table><tr><td align="right">';
$str .= get_string('url','data').':</td><td><input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.$url.'" size="60" /></td></tr>';
$str .= get_string('url','data').':</td><td>';
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.$url.'" size="60" /></td></tr>';
$str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($text).'" size="60" /></td></tr>';
$str .= '</table>';
} else {
// Just the URL field
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />';
}
@ -74,7 +77,8 @@ class data_field_url extends data_field_base {
}
function display_search_field($value = '') {
return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
return '<label class="accesshide" for="f_'.$this->field->id.'">' . get_string('fieldname', 'data') . '</label>' .
'<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {