Add accessibility labels to Create Table fields
This commit is contained in:
parent
f0a5fb56a5
commit
682e86d236
|
@ -141,7 +141,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
|
||||||
global $structured_types, $types, $unsigned, $on_actions;
|
global $structured_types, $types, $unsigned, $on_actions;
|
||||||
$type = $field["type"];
|
$type = $field["type"];
|
||||||
?>
|
?>
|
||||||
<td><select name="<?php echo h($key); ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"<?php echo on_help("getTarget(event).value", 1); ?>><?php
|
<td><select name="<?php echo h($key); ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"<?php echo on_help("getTarget(event).value", 1); ?> aria-labelledby="label-type"><?php
|
||||||
if ($type && !isset($types[$type]) && !isset($foreign_keys[$type])) {
|
if ($type && !isset($types[$type]) && !isset($foreign_keys[$type])) {
|
||||||
array_unshift($structured_types, $type);
|
array_unshift($structured_types, $type);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ if ($foreign_keys) {
|
||||||
}
|
}
|
||||||
echo optionlist($structured_types, $type);
|
echo optionlist($structured_types, $type);
|
||||||
?></select>
|
?></select>
|
||||||
<td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); ?> onchange="editingLengthChange(this);" onkeyup="this.onchange();"><td class="options"><?php //! type="number" with enabled JavaScript
|
<td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); ?> onchange="editingLengthChange(this);" onkeyup="this.onchange();" aria-labelledby="label-length"><td class="options"><?php //! type="number" with enabled JavaScript
|
||||||
echo "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
echo "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
||||||
echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match('~((^|[^o])int|float|double|decimal)$~', $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match('~((^|[^o])int|float|double|decimal)$~', $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
||||||
echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
|
echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
|
||||||
|
@ -238,20 +238,20 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||||
?>
|
?>
|
||||||
<thead><tr class="wrap">
|
<thead><tr class="wrap">
|
||||||
<?php if ($type == "PROCEDURE") { ?><td> <?php } ?>
|
<?php if ($type == "PROCEDURE") { ?><td> <?php } ?>
|
||||||
<th><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
|
<th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
|
||||||
<td><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
|
<td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
|
||||||
<td><?php echo lang('Length'); ?>
|
<td id="label-length"><?php echo lang('Length'); ?>
|
||||||
<td><?php echo lang('Options'); ?>
|
<td><?php echo lang('Options'); // no label required, options have their own label ?>
|
||||||
<?php if ($type == "TABLE") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td>NULL
|
<td id="label-null">NULL
|
||||||
<td><input type="radio" name="auto_increment_col" value=""><acronym title="<?php echo lang('Auto Increment'); ?>">AI</acronym><?php echo doc_link(array(
|
<td><input type="radio" name="auto_increment_col" value=""><acronym id="label-ai" title="<?php echo lang('Auto Increment'); ?>">AI</acronym><?php echo doc_link(array(
|
||||||
'sql' => "example-auto-increment.html",
|
'sql' => "example-auto-increment.html",
|
||||||
'sqlite' => "autoinc.html",
|
'sqlite' => "autoinc.html",
|
||||||
'pgsql' => "datatype.html#DATATYPE-SERIAL",
|
'pgsql' => "datatype.html#DATATYPE-SERIAL",
|
||||||
'mssql' => "ms186775.aspx",
|
'mssql' => "ms186775.aspx",
|
||||||
)); ?>
|
)); ?>
|
||||||
<td><?php echo lang('Default value'); ?>
|
<td id="label-default"><?php echo lang('Default value'); ?>
|
||||||
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . ">" . lang('Comment') : ""); ?>
|
<?php echo (support("comment") ? "<td id='label-comment'" . ($comments ? "" : " class='hidden'") . ">" . lang('Comment') : ""); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td><?php echo "<input type='image' class='icon' name='add[" . (support("move_col") ? 0 : count($fields)) . "]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>"; ?><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script>
|
<td><?php echo "<input type='image' class='icon' name='add[" . (support("move_col") ? 0 : count($fields)) . "]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>"; ?><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -264,14 +264,14 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||||
?>
|
?>
|
||||||
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
|
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
|
||||||
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
|
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
|
||||||
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="editingNameChange(this);<?php echo ($field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow(this);" onkeyup="if (this.value) editingAddRow(this);'); ?>" maxlength="64" autocapitalize="off"><?php } ?>
|
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="editingNameChange(this);<?php echo ($field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow(this);" onkeyup="if (this.value) editingAddRow(this);'); ?>" maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php } ?>
|
||||||
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
|
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
|
||||||
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
|
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
|
||||||
<?php if ($type == "TABLE") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block"); ?>
|
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
|
||||||
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }"></label><td><?php
|
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }" aria-labelledby="label-ai"></label><td><?php
|
||||||
echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onkeyup="keyupChange.call(this);" onchange="this.previousSibling.checked = true;">
|
echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onkeyup="keyupChange.call(this);" onchange="this.previousSibling.checked = true;" aria-labelledby="label-default">
|
||||||
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "'>" : ""); ?>
|
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "' aria-labelledby='label-comment'>" : ""); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
|
|
|
@ -113,10 +113,12 @@ function nl_br($string) {
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @return string
|
* @return string
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function checkbox($name, $value, $checked, $label = "", $onclick = "", $class = "") {
|
function checkbox($name, $value, $checked, $label = "", $onclick = "", $class = "", $labelled_by = "") {
|
||||||
$return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
|
$return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
|
||||||
. ($checked ? " checked" : "")
|
. ($checked ? " checked" : "")
|
||||||
|
. ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
|
||||||
. ($onclick ? ' onclick="' . h($onclick) . '"' : '')
|
. ($onclick ? ' onclick="' . h($onclick) . '"' : '')
|
||||||
. ">"
|
. ">"
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Adminer 4.2.6-dev:
|
Adminer 4.2.6-dev:
|
||||||
|
Add accessibility labels to Create Table fields
|
||||||
|
|
||||||
Adminer 4.2.5 (released 2016-06-01):
|
Adminer 4.2.5 (released 2016-06-01):
|
||||||
Fix remote execution in SQLite query
|
Fix remote execution in SQLite query
|
||||||
|
|
Loading…
Reference in a new issue