Skip to content

Commit

Permalink
a11y label fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
drlippman committed Dec 8, 2016
1 parent 01df0ff commit 186189a
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 70 deletions.
54 changes: 27 additions & 27 deletions forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
echo "<span class=\"form\"><label for=\"email\">Enter E-mail address:</label></span> <input class=\"form\" type=\"text\" size=60 id=email name=email><BR class=\"form\">\n";
echo "<span class=form><label for=\"msgnot\">Notify me by email when I receive a new message:</label></span><span class=formright><input type=checkbox id=msgnot name=msgnot checked=\"checked\" /></span><BR class=form>\n";
if (isset($studentTOS)) {
echo "<span class=form><label for=\"agree\">I have read and agree to the Terms of Use (below)</label></span><span class=formright><input type=checkbox name=agree></span><br class=form />\n";
echo "<span class=form><label for=\"agree\">I have read and agree to the Terms of Use (below)</label></span><span class=formright><input type=checkbox name=agree id=agree></span><br class=form />\n";
} else if (isset($CFG['GEN']['TOSpage'])) {
echo "<span class=form><label for=\"agree\">I have read and agree to the <a href=\"#\" onclick=\"GB_show('Terms of Use','".$CFG['GEN']['TOSpage']."',700,500);return false;\">Terms of Use</a></label></span><span class=formright><input type=checkbox name=agree></span><br class=form />\n";
echo "<span class=form><label for=\"agree\">I have read and agree to the <a href=\"#\" onclick=\"GB_show('Terms of Use','".$CFG['GEN']['TOSpage']."',700,500);return false;\">Terms of Use</a></label></span><span class=formright><input type=checkbox name=agree id=agree></span><br class=form />\n";
}

if (!$emailconfirmation) {
Expand All @@ -50,7 +50,7 @@
$stm = $DBH->query("SELECT id,name FROM imas_courses WHERE (istemplate&4)=4 AND available<4 ORDER BY name");
if ($stm->rowCount()>0) {
$doselfenroll = true;
echo '<p>Select the course you\'d like to enroll in</p>';
echo '<p><label for="courseselect">Select the course you\'d like to enroll in</label></p>';
echo '<p><select id="courseselect" name="courseselect" onchange="courseselectupdate(this);">';
echo '<option value="0" selected="selected">My teacher gave me a course ID (enter below)</option>';
echo '<optgroup label="Self-study courses">';
Expand Down Expand Up @@ -133,11 +133,11 @@
echo "<span class=\"formright\">";
if ($line['hasuserimg']==1) {
if(isset($GLOBALS['CFG']['GEN']['AWSforcoursefiles']) && $GLOBALS['CFG']['GEN']['AWSforcoursefiles'] == true) {
echo "<img src=\"{$urlmode}s3.amazonaws.com/{$GLOBALS['AWSbucket']}/cfiles/userimg_$userid.jpg\" alt=\"User picture\"/> <input type=\"checkbox\" name=\"removepic\" value=\"1\" /> Remove ";
echo "<img src=\"{$urlmode}s3.amazonaws.com/{$GLOBALS['AWSbucket']}/cfiles/userimg_$userid.jpg\" alt=\"User picture\"/> <input type=\"checkbox\" name=\"removepic\" id=removepic value=\"1\" /> <label for=removepic>Remove</label> ";
} else {
$curdir = rtrim(dirname(__FILE__), '/\\');
$galleryPath = "$curdir/course/files/";
echo "<img src=\"$imasroot/course/files/userimg_$userid.jpg\" alt=\"User picture\"/> <input type=\"checkbox\" name=\"removepic\" value=\"1\" /> Remove ";
echo "<img src=\"$imasroot/course/files/userimg_$userid.jpg\" alt=\"User picture\"/> <input type=\"checkbox\" name=\"removepic\" id=removepic value=\"1\" /> <label for=removepic>Remove</label> ";
}
} else {
echo "No Pic ";
Expand All @@ -162,32 +162,32 @@
}
$hpsets = '';
if (!isset($CFG['GEN']['fixedhomelayout']) || !in_array(2,$CFG['GEN']['fixedhomelayout'])) {
$hpsets .= '<input type="checkbox" name="homelayout10" ';
$hpsets .= '<input type="checkbox" name="homelayout10" id="homelayout10" ';
if (in_array(10,$pagelayout[2])) {$hpsets .= 'checked="checked"';}
$hpsets .= ' /> New messages widget<br/>';
$hpsets .= ' /> <label for="homelayout10">New messages widget</label><br/>';

$hpsets .= '<input type="checkbox" name="homelayout11" ';
$hpsets .= '<input type="checkbox" name="homelayout11" id="homelayout11" ';
if (in_array(11,$pagelayout[2])) {$hpsets .= 'checked="checked"';}
$hpsets .= ' /> New forum posts widget<br/>';
$hpsets .= ' /> <label for="homelayout11">New forum posts widget</label><br/>';
}
if (!isset($CFG['GEN']['fixedhomelayout']) || !in_array(3,$CFG['GEN']['fixedhomelayout'])) {

$hpsets .= '<input type="checkbox" name="homelayout3-0" ';
$hpsets .= '<input type="checkbox" name="homelayout3-0" id="homelayout3-0" ';
if (in_array(0,$pagelayout[3])) {$hpsets .= 'checked="checked"';}
$hpsets .= ' /> New messages notes on course list<br/>';
$hpsets .= ' /> <label for="homelayout3-0">New messages notes on course list</label><br/>';

$hpsets .= '<input type="checkbox" name="homelayout3-1" ';
$hpsets .= '<input type="checkbox" name="homelayout3-1" id="homelayout3-1" ';
if (in_array(1,$pagelayout[3])) {$hpsets .= 'checked="checked"';}
$hpsets .= ' /> New posts notes on course list<br/>';
$hpsets .= ' /> <label for="homelayout3-1">New posts notes on course list</label><br/>';
}
if ($hpsets != '') {
echo '<span class="form">Show on home page:</span><span class="formright">';
echo $hpsets;
echo '</span><br class="form" />';

}
echo '<span class="form">'._('Overwrite default course theme on all pages:').'</span><span class="formright">';
echo '<select name="theme">';
echo '<span class="form"><label for="theme">'._('Overwrite default course theme on all pages:').'</label></span><span class="formright">';
echo '<select name="theme" id="theme">';
echo '<option value="" '.($line['theme']==''?'selected':'').'>'._('Use course default theme').'</option>';
if (isset($CFG['GEN']['stuthemes'])) {
foreach ($CFG['GEN']['stuthemes'] as $k=>$v) {
Expand Down Expand Up @@ -243,8 +243,8 @@
echo "<span class=form>Default question library:</span><span class=formright> <span id=\"libnames\">$lname</span><input type=hidden name=\"libs\" id=\"libs\" value=\"{$line['deflib']}\">\n";
echo " <input type=button value=\"Select Library\" onClick=\"libselect()\"></span><br class=form> ";

echo "<span class=form>Use default question library for all templated questions?</span>";
echo "<span class=formright><input type=checkbox name=\"usedeflib\"";
echo "<span class=form><label for=usedeflib>Use default question library for all templated questions?</label></span>";
echo "<span class=formright><input type=checkbox name=\"usedeflib\" id=\"usedeflib\"";
if ($line['usedeflib']==1) {echo "checked=1";}
echo "> ";
echo "</span><br class=form>";
Expand Down Expand Up @@ -302,8 +302,8 @@
} else {
echo '<p>If you already know your course ID, you can enter it now. Otherwise, leave this blank and you can enroll later.</p>';
}
echo '<span class="form"><label for="cid">Course ID:</label></span><input class="form" type="text" size="20" name="cid"/><br class="form"/>';
echo '<span class="form"><label for="ekey">Enrollment Key:</label></span><input class="form" type="text" size="20" name="ekey"/><br class="form"/>';
echo '<span class="form"><label for="cid">Course ID:</label></span><input class="form" type="text" size="20" name="cid" id="cid"/><br class="form"/>';
echo '<span class="form"><label for="ekey">Enrollment Key:</label></span><input class="form" type="text" size="20" name="ekey" id="ekey"/><br class="form"/>';
if ($doselfenroll) {
echo '</div>';
echo '<div id="selfenrollwarn" class=noticetext style="display:none;">Warning: You have selected a non-credit self-study course. ';
Expand Down Expand Up @@ -332,7 +332,7 @@
echo "<form method=post action=\"actions.php?action=resetpw$gb\">\n";
echo "<p>Enter your User Name below and click Submit. An email will be sent to your email address on file. A link in that email will ";
echo "reset your password.</p>";
echo "<p>User Name: <input type=text name=\"username\"/></p>";
echo "<p><label for=username>User Name</label>: <input type=text name=\"username\" id=username /></p>";
echo "<p><input type=submit value=\"Submit\" /></p></form>";
break;
case "lookupusername":
Expand All @@ -342,7 +342,7 @@
echo '<div id="headerforms" class="pagetitle"><h2>Lookup Username</h2></div>';
echo "<form method=post action=\"actions.php?action=lookupusername$gb\">\n";
echo "If you can't remember your username, enter your email address below. An email will be sent to your email address with your username. ";
echo "<p>Email: <input type=text name=\"email\"/></p>";
echo "<p><label for=email>Email</label>: <input type=text name=\"email\" id=email /></p>";
echo "<p><input type=submit value=\"Submit\" /></p></form>";
break;
case "forumwidgetsettings":
Expand All @@ -369,9 +369,9 @@
//DB while ($row = mysql_fetch_row($result)) {
while ($row = $stm->fetch(PDO::FETCH_NUM)) {
$allcourses[] = $row[0];
echo '<br/><input type="checkbox" name="checked[]" class="teaching" value="'.$row[0].'" ';
echo '<br/><input type="checkbox" name="checked[]" class="teaching" value="'.$row[0].'" id="c'.$row[0].'"';
if (!in_array($row[0],$hidelist)) {echo 'checked="checked"';}
echo '/> '.$row[1];
echo '/> <label for="c'.$row[0].'">'.$row[1].'</label>';
}
echo '</p>';
}
Expand All @@ -385,9 +385,9 @@
//DB while ($row = mysql_fetch_row($result)) {
while ($row = $stm->fetch(PDO::FETCH_NUM)) {
$allcourses[] = $row[0];
echo '<br/><input type="checkbox" name="checked[]" class="tutoring" value="'.$row[0].'" ';
echo '<br/><input type="checkbox" name="checked[]" class="tutoring" value="'.$row[0].'" id="c'.$row[0].'"';
if (!in_array($row[0],$hidelist)) {echo 'checked="checked"';}
echo '/> '.$row[1];
echo '/> <label for="c'.$row[0].'">'.$row[1].'</label>';
}
echo '</p>';
}
Expand All @@ -401,9 +401,9 @@
//DB while ($row = mysql_fetch_row($result)) {
while ($row = $stm->fetch(PDO::FETCH_NUM)) {
$allcourses[] = $row[0];
echo '<br/><input type="checkbox" name="checked[]" class="taking" value="'.$row[0].'" ';
echo '<br/><input type="checkbox" name="checked[]" class="taking" value="'.$row[0].'" id="c'.$row[0].'"';
if (!in_array($row[0],$hidelist)) {echo 'checked="checked"';}
echo '/> '.$row[1];
echo '/> <label for="c'.$row[0].'">'.$row[1].'</label>';
}
echo '</p>';
}
Expand Down
72 changes: 36 additions & 36 deletions forums/posthandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
var filecnt = 1;
function addnewfile(t) {
var s = document.createElement("span");
s.innerHTML = \'Description: <input type="text" name="newfiledesc-\'+filecnt+\'" /><br/>File: <input type="file" name="newfile-\'+filecnt+\'" /><br/>\';
s.innerHTML = \'<label for="newfiledesc-\'+filecnt+\'">Description</label>: <input type="text" name="newfiledesc-\'+filecnt+\' id="newfiledesc-\'+filecnt+\'" /><br/><label for="newfile-\'+filecnt+\'">File</label>: <input type="file" name="newfile-\'+filecnt+\'" id="newfile-\'+filecnt+\'" /><br/>\';
t.parentNode.insertBefore(s,t);
filecnt++;
}</script>';
Expand All @@ -574,20 +574,20 @@ function addnewfile(t) {
require_once('../includes/filehandler.php');
$files = explode('@@',$line['files']);
for ($i=0;$i<count($files)/2;$i++) {
echo '<input type="text" name="filedesc['.$i.']" value="'.$files[2*$i].'"/>';
echo '<input type="text" name="filedesc['.$i.']" value="'.$files[2*$i].'" aria-label="'._('Description').'"/>';
echo '<a href="'.getuserfileurl('ffiles/'.$_GET['modify'].'/'.$files[2*$i+1]).'" target="_blank">View</a> ';
echo 'Delete? <input type="checkbox" name="filedel['.$i.']" value="1"/><br/>';
echo '<label for="filedel['.$i.']">Delete?</label> <input type="checkbox" name="filedel['.$i.']" id="filedel['.$i.']" value="1"/><br/>';
}
}
echo 'Description: <input type="text" name="newfiledesc-0" /><br/>';
echo 'File: <input type="file" name="newfile-0" /><br/>';
echo '<label for="newfiledesc-0">Description</label>: <input type="text" name="newfiledesc-0" id="newfiledesc-0" /><br/>';
echo '<label for=>File</label>: <input type="file" name="newfile-0" id="newfile-0" /><br/>';
echo '<a href="#" onclick="addnewfile(this);return false;">Add another file</a>';
echo "</span><br class=form>\n";
}
if ($taglist!='' && ($_GET['modify']=='new' || $_GET['modify']==$threadid)) {
$p = strpos($taglist,':');
echo '<span class="form"><label for="tag">'.substr($taglist,0,$p).'</label></span>';
echo '<span class="formright"><select name="tag">';
echo '<span class="formright"><select name="tag" id="tag">';
echo '<option value="">Select...</option>';
$tags = explode(',',substr($taglist,$p+1));
foreach ($tags as $tag) {
Expand All @@ -610,40 +610,40 @@ function addnewfile(t) {
}
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 "<input type=radio name=type value=0 ";
echo "<input type=radio name=type id=type0 value=0 ";
if ($line['posttype']==0) { echo "checked=1 ";}
echo ">Regular<br>\n";
echo "<input type=radio name=type value=1 ";
echo "> <label for=type0>Regular</label><br>\n";
echo "<input type=radio name=type value=1 id=type1 ";
if ($line['posttype']==1) { echo "checked=1 ";}
echo ">Displayed at top of list<br>\n";
echo "<input type=radio name=type value=2 ";
echo "> <label for=type1>Displayed at top of list</label><br>\n";
echo "<input type=radio name=type value=2 id=type2 ";
if ($line['posttype']==2) { echo "checked=1 ";}
echo ">Displayed at top and locked (no replies)<br>\n";
echo "<input type=radio name=type value=3 ";
echo "> <label for=type2>Displayed at top and locked (no replies)</label><br>\n";
echo "<input type=radio name=type value=3 id=type3 ";
if ($line['posttype']==3) { echo "checked=1 ";}
echo ">Displayed at top and students can only see their own replies\n";
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 "<input type=radio name=replyby value=\"null\" ";
echo "<input type=radio name=replyby id=replyby0 value=\"null\" ";
if ($line['replyby']==null) { echo "checked=1 ";}
echo "/>Use default<br/>";
echo "<input type=radio name=replyby value=\"Always\" ";
echo "/> <label for=replyby0>Use default</label><br/>";
echo "<input type=radio name=replyby id=replyby1 value=\"Always\" ";
if ($line['replyby']==2000000000) { echo "checked=1 ";}
echo "/>Always<br/>";
echo "<input type=radio name=replyby value=\"Never\" ";
echo "/> <label for=replyby1>Always</label><br/>";
echo "<input type=radio name=replyby id=replyby2 value=\"Never\" ";
if ($line['replyby']==='0') { echo "checked=1 ";}
echo "/>Never<br/>";
echo "<input type=radio name=replyby value=\"Date\" ";
echo "/> <label for=replyby2>Never</label><br/>";
echo "<input type=radio name=replyby id=replyby3 value=\"Date\" ";
if ($line['replyby']!==null && $line['replyby']<2000000000 && $line['replyby']>0) { echo "checked=1 ";}
echo "/>Before: ";
echo "<input type=text size=10 name=replybydate value=\"$replybydate\"/>";
echo "/> <label for=replyby3>Before:</label> ";
echo "<input type=text size=10 name=replybydate value=\"$replybydate\" aria-label=\"reply by date\"/>";
echo '<a href="#" onClick="displayDatePicker(\'replybydate\', this); return false">';
//echo "<A HREF=\"#\" onClick=\"cal1.select(document.forms[0].replybydate,'anchor3','MM/dd/yyyy',(document.forms[0].replybydate.value==$replybydate')?(document.forms[0].replyby.value):(document.forms[0].replyby.value)); return false;\" NAME=\"anchor3\" ID=\"anchor3\">
echo "<img src=\"../img/cal.gif\" alt=\"Calendar\"/></A>";
echo "at <input type=text size=10 name=replybytime value=\"$replybytime\"></span><br class=\"form\" />";
echo "at <input type=text size=10 name=replybytime value=\"$replybytime\" aria-label=\"reply by time\"></span><br class=\"form\" />";
if ($groupsetid >0) {
echo '<span class="form">Set thread to group:</span><span class="formright">';
echo '<select name="stugroup">';
echo '<span class="form"><label for="stugroup">Set thread to group</label>:</span><span class="formright">';
echo '<select name="stugroup" id="stugroup">';
echo '<option value="0" ';
if ($curstugroupid==0) { echo 'selected="selected"';}
echo '>Non group-specific</option>';
Expand All @@ -667,8 +667,8 @@ function addnewfile(t) {

}
if ($isteacher && $haspoints && $_GET['modify']=='reply') {
echo '<span class="form">Points for message you\'re replying to:</span><span class="formright">';
echo '<input type="text" size="4" name="points" value="'.$points.'" /></span><br class="form" />';
echo '<span class="form"><label for="points">Points for message you\'re replying to</label>:</span><span class="formright">';
echo '<input type="text" size="4" name="points" id="points" value="'.$points.'" /></span><br class="form" />';
}
if ($_GET['modify']=='reply') {
echo "<div class=submit><input type=submit value='Post Reply'></div>\n";
Expand Down Expand Up @@ -977,11 +977,11 @@ function addchildren($b,&$tochange,$children) {
echo '<input type="hidden" name="thread" value="'.$threadid.'"/>';
echo "<p>What do you want to do?<br/>";
if ($ishead) {
echo '<input type="radio" name="movetype" value="0" checked="checked" onclick="toggleforumselect(0)"/> Move thread to different forum<br/>';
echo '<input type="radio" name="movetype" value="1" onclick="toggleforumselect(1)"/> Move post to be a reply to a thread';
echo '<input type="radio" name="movetype" value="0" id=movetype0 checked="checked" onclick="toggleforumselect(0)"/> <label for="movetype0">Move thread to different forum</label><br/>';
echo '<input type="radio" name="movetype" value="1" id=movetype1 onclick="toggleforumselect(1)"/> <label for="movetype1">Move post to be a reply to a thread</label>';
} else {
echo '<input type="radio" name="movetype" value="0" onclick="toggleforumselect(0)"/> Move post to be a new thread in this or another forum<br/>';
echo '<input type="radio" name="movetype" value="1" checked="checked" onclick="toggleforumselect(1)"/> Move post to be a reply to a different thread';
echo '<input type="radio" name="movetype" value="0" id=movetype0 onclick="toggleforumselect(0)"/> <label for="movetype0">Move post to be a new thread in this or another forum</label><br/>';
echo '<input type="radio" name="movetype" value="1" id=movetype1 checked="checked" onclick="toggleforumselect(1)"/> <label for="movetype1">Move post to be a reply to a different thread</label>';
}
echo '</p>';
echo '<div id="fsel" ';
Expand All @@ -993,9 +993,9 @@ function addchildren($b,&$tochange,$children) {
$stm = $DBH->prepare("SELECT id,name FROM imas_forums WHERE courseid=:courseid");
$stm->execute(array(':courseid'=>$cid));
while ($row = $stm->fetch(PDO::FETCH_NUM)) {
echo "<input type=\"radio\" name=\"movetof\" value=\"{$row[0]}\" ";
echo "<input type=\"radio\" name=\"movetof\" value=\"{$row[0]}\" id=\"moveto{$row[0]}\" ";
if ($row[0]==$forumid) {echo 'checked="checked"';}
echo "/>{$row[1]}<br/>";
echo "/> <label for=\"moveto{$row[0]}\">{$row[1]}</label><br/>";
}
echo '</div>';

Expand All @@ -1009,9 +1009,9 @@ function addchildren($b,&$tochange,$children) {
$stm->execute(array(':forumid'=>$forumid));
while ($row = $stm->fetch(PDO::FETCH_NUM)) {
if ($ishead && $row[0]==$threadid) {continue;}
echo "<input type=\"radio\" name=\"movetot\" value=\"{$row[0]}\" ";
echo "<input type=\"radio\" name=\"movetot\" value=\"{$row[0]}\" id=\"movetot{$row[0]}\" ";
if ($row[0]==$threadid) {echo 'checked="checked"';}
echo "/>{$row[1]}<br/>";
echo "/> <label for=\"movetot{$row[0]}\">{$row[1]}</label><br/>";
}
echo '</div>';

Expand Down
Loading

0 comments on commit 186189a

Please sign in to comment.