Skip to content

Commit

Permalink
Add radiogroups and labels for a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
drlippman committed Jun 5, 2018
1 parent bf2d403 commit 3482332
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 26 deletions.
16 changes: 8 additions & 8 deletions assessment/displayq2.php
Original file line number Diff line number Diff line change
Expand Up @@ -1248,10 +1248,10 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {

if ($displayformat == 'inline') {
if ($colorbox != '') {$style .= ' class="'.$colorbox.'" ';} else {$style='';}
$out .= "<span $style id=\"qnwrap$qn\">";
$out .= "<span $style id=\"qnwrap$qn\" role=radiogroup aria-label=\""._('Select an answer')."\">";
} else if ($displayformat != 'select') {
if ($colorbox != '') {$style .= ' class="'.$colorbox.' clearfix" ';} else {$style=' class="clearfix" ';}
$out .= "<div $style id=\"qnwrap$qn\" style=\"display:block\">";
$out .= "<div $style id=\"qnwrap$qn\" style=\"display:block\" role=radiogroup aria-label=\""._('Select an answer')."\">";
}
if ($displayformat == "select") {
$msg = '?';
Expand All @@ -1262,21 +1262,21 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
}
}
if ($colorbox != '') {$style .= ' class="'.$colorbox.'" ';} else {$style='';}
$out = "<select name=\"qn$qn\" id=\"qn$qn\" $style><option value=\"NA\">$msg</option>\n";
$out = "<select name=\"qn$qn\" id=\"qn$qn\" $style aria-label=\""._('Select an answer')."\"><option value=\"NA\">$msg</option>\n";
} else if ($displayformat == "horiz") {

} else if ($displayformat == "inline") {

} else if ($displayformat == 'column') {

} else {
$out .= "<ul class=nomark>";
} else {
$out .= '<ul class=nomark>';
}


for ($i=0; $i < count($randkeys); $i++) {
if ($displayformat == "horiz") {
$out .= "<div class=choice ><label for=\"qn$qn-$i\">{$questions[$randkeys[$i]]}</label><br/><input type=radio id=\"qn$qn-$i\" name=qn$qn value=$i ";
$out .= "<div class=choice><label for=\"qn$qn-$i\">{$questions[$randkeys[$i]]}</label><br/><input type=radio id=\"qn$qn-$i\" name=qn$qn value=$i ";
if (($la!='') && ($la == $i)) { $out .= "CHECKED";}
$out .= " /></div>\n";
} else if ($displayformat == "select") {
Expand Down Expand Up @@ -1381,10 +1381,10 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {

if ($displayformat == 'inline') {
if ($colorbox != '') {$style .= ' class="'.$colorbox.'" ';} else {$style='';}
$out .= "<span $style id=\"qnwrap$qn\">";
$out .= "<span $style id=\"qnwrap$qn\" role=group aria-label=\""._('Select one, none, or multiple answers')."\">";
} else {
if ($colorbox != '') {$style .= ' class="'.$colorbox.' clearfix" ';} else {$style=' class="clearfix" ';}
$out .= "<div $style id=\"qnwrap$qn\" style=\"display:block\">";
$out .= "<div $style id=\"qnwrap$qn\" style=\"display:block\" role=group aria-label=\""._('Select one, none, or multiple answers')."\">";
}
if ($displayformat == "horiz") {

Expand Down
4 changes: 2 additions & 2 deletions forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
} else {
echo "No Pic ";
}
echo '<br/><input type="file" name="stupic"/></span><br class="form" />';
echo '<br/><input type="file" name="stupic" id="stupic"/></span><br class="form" />';
echo '<span class="form"><label for="perpage">Messages/Posts per page:</label></span>';
echo '<span class="formright"><select name="perpage">';
echo '<span class="formright"><select name="perpage" id="perpage">';
for ($i=10;$i<=100;$i+=10) {
echo '<option value="'.$i.'" ';
if ($i==$line['listperpage']) {echo 'selected="selected"';}
Expand Down
8 changes: 5 additions & 3 deletions forums/forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ function flattenitems($items,&$addto) {
<div id="forumsearch">
<form method="post" action="forums.php?cid=<?php echo $cid;?>">
<p>
Search: <input type=text name="search" value="<?php echo Sanitize::encodeStringForDisplay($searchstr);?>" />
<input type="radio" name="searchtype" value="thread" <?php if ($searchtype!='posts') {echo 'checked="checked"';}?>/>All thread subjects
<input type="radio" name="searchtype" value="posts" <?php if ($searchtype=='posts') {echo 'checked="checked"';}?>/>All posts.
<label for="search">Search</label>: <input type=text id="search" name="search" value="<?php echo Sanitize::encodeStringForDisplay($searchstr);?>" />
<span role="radiogroup" aria-label="what to search">
<label><input type="radio" name="searchtype" value="thread" <?php if ($searchtype!='posts') {echo 'checked="checked"';}?>/>All thread subjects</label>
<label><input type="radio" name="searchtype" value="posts" <?php if ($searchtype=='posts') {echo 'checked="checked"';}?>/>All posts</label>
</span>
<?php
if ($tagfilterselect != '') {
echo "Limit by $tagfilterselect";
Expand Down
7 changes: 4 additions & 3 deletions forums/posthandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ function addnewfile(t) {
echo "></span><br class=form/>";
}
if ($isteacher && ($_GET['modify']=='new' || $line['userid']==$userid) && ($_GET['modify']=='new' || $_GET['modify']==$_GET['thread'] || ($_GET['modify']!='reply' && $line['parent']==0))) {
echo "<span class=form>Post Type:</span><span class=formright>\n";
echo "<span class=form id=posttypelabel>Post Type:</span><span class=formright role=radiogroup aria-labeledby=posttypelabel>\n";
echo "<input type=radio name=type id=type0 value=0 ";
if ($line['posttype']==0) { echo "checked=1 ";}
echo "> <label for=type0>Regular</label><br>\n";
Expand All @@ -662,7 +662,8 @@ function addnewfile(t) {
if ($line['posttype']==3) { echo "checked=1 ";}
echo "> <label for=type3>Displayed at top and students can only see their own replies</label>\n";
echo "</span><br class=form>";
echo "<span class=form>Allow replies: </span><span class=formright>\n";

echo "<span class=form id=allowreplieslabel>Allow replies: </span><span class=formright role=radiogroup aria-labeledby=allowreplieslabel>\n";
echo "<input type=radio name=replyby id=replyby0 value=\"null\" ";
if ($line['replyby']==null) { echo "checked=1 ";}
echo "/> <label for=replyby0>Use default</label><br/>";
Expand Down Expand Up @@ -693,7 +694,7 @@ function addnewfile(t) {
$releasebydate = tzdate("m/d/Y",$now);
$releasebytime = tzdate("g:i a",$now);
}
echo "<span class=form>Release Post:</span><span class=formright>\n";
echo "<span class=form id=releasepostlabel>Release Post:</span><span class=formright role=radiogroup aria-labeledby=releasepostlabel>\n";
if ($_GET['modify']=='new') {
echo "<input type=radio name=releaseon id=releaseon1 value=\"Immediately\" ";
if ($thread_lastposttime<=$now) { echo "checked=1 ";}
Expand Down
6 changes: 4 additions & 2 deletions forums/thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,9 @@
echo "<input type=hidden name=forum value=\"$forumid\"/>";

?>
<label for="search">Search</label>: <input type=text name="search" id="search" /> <input type=checkbox name="allforums" id="allforums" /> <label for="allforums">All forums in course?</label> <input type="submit" value="Search"/>
<label for="search">Search</label>: <input type=text name="search" id="search" />
<input type=checkbox name="allforums" id="allforums" /> <label for="allforums">All forums in course?</label>
<input type="submit" value="Search"/>
</form>
<?php
if ($isteacher && $groupsetid>0) {
Expand Down Expand Up @@ -616,7 +618,7 @@
echo " window.location = \"thread.php?page=$pages&cid=$cid&forum=$forumid&ffilter=\"+ffilter;";
echo '}';
echo '</script>';*/
echo '<p>Show posts for group: <select id="ffilter" onChange="chgfilter()"><option value="-1" ';
echo '<p><label for="ffilter">Show posts for group</label>: <select id="ffilter" onChange="chgfilter()"><option value="-1" ';
if ($curfilter==-1) { echo 'selected="1"';}
echo '>All groups</option>';
foreach ($groupnames as $gid=>$gname) {
Expand Down
2 changes: 1 addition & 1 deletion includes/userprefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function showUserPrefsForm() {
writeHtmlSelect($key,array_keys($prefs[$key]), array_values($prefs[$key]), isset($sessiondata['userprefs'][$key])?$sessiondata['userprefs'][$key]:$prefdefaults[$key]);
if ($key=='tztype') {
echo '<span id="tzset" style="display:none;"><br/>';
echo _('Set timezone to:').' <select name="settimezone" id="settimezone">';
echo '<label for="settimezone">'._('Set timezone to:').'</label> <select name="settimezone" id="settimezone">';
foreach ($timezones as $tz) {
echo '<option value="'.$tz.'" '.($tz==$tzname?'selected':'').'>'.$tz.'</option>';
}
Expand Down
10 changes: 5 additions & 5 deletions msgs/msglist.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function updateTo(el) {
echo "<input type=hidden name=courseid value=\"".Sanitize::courseId($courseid)."\"/>\n";
} else {
if ($filtercid>0) {
echo "<select name=\"to\" id=\"to\">";
echo '<select name="to" id="to" aria-label="'._('Select an individual').'">';
echo '<option value="0">Select a recipient...</option>';
if ($isteacher || $msgset<2) {
//DB $query = "SELECT imas_users.id,imas_users.FirstName,imas_users.LastName FROM ";
Expand Down Expand Up @@ -551,11 +551,11 @@ function updateTo(el) {
echo "</select>";
echo "<input type=hidden name=courseid value=\"".Sanitize::courseId($courseid)."\"/>\n";
} else {
echo '<select name="courseid" onchange="updateTo(this)" aria-label="Select a course">';
echo '<select name="courseid" onchange="updateTo(this)" aria-label="'._('Select a course').'">';
echo '<option value="0">Select a course...</option>';
echo $courseopts;
echo '</select><br/>';
echo '<select name="to" id="to" style="display:none;" aria-label="Select an individual ">';
echo '<select name="to" id="to" style="display:none;" aria-label="'._('Select an individual').'">';
echo '<option value="0">Select an individual...</option></select>';
}

Expand Down Expand Up @@ -815,7 +815,7 @@ function chgfilter() {
}
</script>
<form id="qform" method=post action="msglist.php?page=<?php echo $page;?>&cid=<?php echo $cid;?>">
<p>Filter by course: <select id="filtercid" onchange="chgfilter()">
<p><label for="filtercid">Filter by course</label>: <select id="filtercid" onchange="chgfilter()">
<?php

$query = "SELECT DISTINCT imas_courses.id,imas_courses.name,";
Expand Down Expand Up @@ -857,7 +857,7 @@ function chgfilter() {
}
echo "</select> ";

echo 'By sender: <select id="filteruid" onchange="chgfilter()"><option value="0" ';
echo '<label for="filteruid">By sender</label>: <select id="filteruid" onchange="chgfilter()"><option value="0" ';
if ($filteruid==0) {
echo 'selected="selected" ';
}
Expand Down
4 changes: 2 additions & 2 deletions msgs/sentlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function chgfilter() {
}
</script>
<form id="qform" method="post" action="sentlist.php?page=<?php echo $page;?>&cid=<?php echo $cid;?>">
<p>Filter by course: <select id="filtercid" onchange="chgfilter()">
<p><label for="filtercid">Filter by course</label>: <select id="filtercid" onchange="chgfilter()">
<?php
echo "<option value=\"0\" ";
if ($filtercid==0) {
Expand Down Expand Up @@ -233,7 +233,7 @@ function chgfilter() {
printf(" >%s</option>", Sanitize::encodeStringForDisplay($prefix . $row[1]));
}
echo "</select> ";
echo 'By recipient: <select id="filteruid" onchange="chgfilter()"><option value="0" ';
echo '<label for="filteruid">By recipient</label>: <select id="filteruid" onchange="chgfilter()"><option value="0" ';
if ($filteruid==0) {
echo 'selected="selected" ';
}
Expand Down

0 comments on commit 3482332

Please sign in to comment.