[LON-CAPA-cvs] cvs: loncom /interface lonmsgdisplay.pm lonselstudent.pm
raeburn
raeburn at source.lon-capa.org
Tue Dec 16 15:01:18 EST 2025
raeburn Tue Dec 16 20:01:18 2025 EDT
Modified files:
/loncom/interface lonmsgdisplay.pm lonselstudent.pm
Log:
- WCAG 2 compliance.
- Replace use of <table> with <div> for layout
- Include labels for form elements
-------------- next part --------------
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.205 loncom/interface/lonmsgdisplay.pm:1.206
--- loncom/interface/lonmsgdisplay.pm:1.205 Sat Dec 13 05:56:01 2025
+++ loncom/interface/lonmsgdisplay.pm Tue Dec 16 20:01:18 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.205 2025/12/13 05:56:01 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.206 2025/12/16 20:01:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1301,14 +1301,14 @@
$r->print("\n".'</select></label></div>'."\n");
if (keys(%gotfolders) > 0) {
- $r->print('<td><b>'.&mt('Destination folder').'</b><br />');
+ $r->print('<div class="LC_mail_actions"><label><b>'.&mt('Destination folder').'</b><br />');
my %userfolders;
foreach my $key (keys(%gotfolders)) {
$userfolders{$key} = $key;
}
$userfolders{''} = "";
$r->print(&Apache::loncommon::select_form('','movetofolder',\%userfolders).
- '</td>');
+ '</label></div>');
}
$r->print('<div class="LC_mail_actions">'.
'<br /><input type="button" name="go" value="'.&mt('Go').
@@ -1433,11 +1433,13 @@
'ad' => 'Additional Recipients',
'rt' => 'Reply to',
'ar' => 'Allow replies',
+ 'sr' => 'Set replies allowed',
'sb' => 'Subject',
'ca' => 'Cancel',
'gen' => 'Generate messages from a file',
'gmt' => 'General message text',
'tff' => 'The file format for the uploaded portion of the message is',
+ 'saf' => 'Select a file',
'uas' => 'Upload and Send',
'atta' => 'Attachment',
'to' => 'To:',
@@ -1448,10 +1450,10 @@
num => 1048576,
);
if (!$forwarding && !$multiforward) {
- $attachrow = '<tr><td colspan="3"><label><b>'.$lt{'atta'}.'</b> '.$attachmax{'text'}
+ $attachrow = '<div><label><b>'.$lt{'atta'}.'</b> '.$attachmax{'text'}
.': <input type="file" name="attachment" class="LC_flUpload" multiple /></label>'
.'<input type="hidden" id="LC_free_space" value="'.$attachmax{'num'}.'" />'
- .'</td></tr>';
+ .'</div>';
}
if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
@@ -1464,12 +1466,13 @@
} else {
$rsstxt = &mt('Include in course RSS newsfeed');
}
+ my $reqrtn = &mt('Return receipt requirement');
$dispcrit=
- '<span class="LC_nobreak"><label><input type="checkbox" name="critmsg" /> '.&mt('Send as critical message').'.</label>'.$crithelp.' '.&mt('Require return receipt?').'<label><input type="radio" name="sendbck" value="1" />'.&mt('Yes').'</label> <label><input type="radio" name="sendbck" value="" checked="checked" />'.&mt('No').'</label></span><br />'.
- '<label><input type="checkbox" name="permanent" /> '.
-&mt('Send copy to permanent e-mail address (if known)').'</label><br />'.
-'<label><input type="checkbox" name="rsspost" /> '.
- $rsstxt.'</label><br />';
+'<div style="margin: 0;"><span class="LC_nobreak"><label><input type="checkbox" name="critmsg" /> '.&mt('Send as critical message').'.</label>'.$crithelp.'</span> <fieldset class="LC_borderless"><legend class="LC_visually_hidden">'.$reqrtn.'</legend><span class="LC_nobreak">'.&mt('Require return receipt?').'<label><input type="radio" name="sendbck" value="1" />'.&mt('Yes').'</label> <label><input type="radio" name="sendbck" value="" checked="checked" />'.&mt('No').'</label></span></fieldset></div>'.
+'<div style="margin: 0;"><span class="LC_nobreak"><label><input type="checkbox" name="permanent" /> '.
+&mt('Send copy to permanent e-mail address (if known)').'</label></span><br />'.
+'<span class="LC_nobreak"><label><input type="checkbox" name="rsspost" /> '.
+ $rsstxt.'</label></span></div>';
}
if ($broadcast ne 'group') {
if (&Apache::lonnet::allowed('dff',$env{'request.course.id'}) ||
@@ -1609,18 +1612,17 @@
$r->print(
'<form action="/adm/email" name="compemail" method="post"'.
' enctype="multipart/form-data"'.$onsubmit.'>'."\n".
- '<input type="hidden" name="sendmail" value="on" />'."\n".
- '<table>');
+ '<input type="hidden" name="sendmail" value="on" />'."\n");
if (($broadcast eq 'group') && ($group ne '') && (!$can_grp_broadcast)) {
$r->print(&recipient_input_row($cdom,%lt));
}
if (($broadcast ne 'group') && ($broadcast ne 'upload')) {
if ($replying) {
if ($content{'noreplies'}) {
- $r->print('<tr><td>'.&mt('This message was designated by the sender not to allow replies.').'</td></tr></table></form>');
+ $r->print('<div>'.&mt('This message was designated by the sender not to allow replies.').'</div></form>');
return;
}
- $r->print('<tr><td colspan="3"><b>'.&mt('Replying to').'</b> ');
+ $r->print('<div><b>'.&mt('Replying to').'</b> ');
if ($content{'replytoaddr'}) {
my ($replytoname,$replytodom) = split(/:/,$content{'replytoaddr'});
if ($replytoname ne '' && $replytodom ne '') {
@@ -1630,10 +1632,9 @@
$r->print('<input type="hidden" name="recuname" value="'.
$replytoname.'" />'.
'<input type="hidden" name="recdomain" value="'.
- $replytodom.'" /></td></tr>');
-
+ $replytodom.'" /></div>');
} else {
- $r->print(&mt('The sender did not designate a reply to address for this message.').'</td></tr></table>');
+ $r->print(&mt('The sender did not designate a reply to address for this message.').'</div>');
return;
}
} else {
@@ -1644,8 +1645,9 @@
$r->print('<input type="hidden" name="recuname" value="'.
$content{'sendername'}.'" />'.
'<input type="hidden" name="recdomain" value="'.
- $content{'senderdomain'}.'" /></td></tr>');
+ $content{'senderdomain'}.'" /></div>');
}
+ $r->print('<div style="padding:0;clear:both;margin:0;border:0"></div>'."\n");
if ($content{'recipid'}) {
my %recips;
&retrieve_recips('replying',\%content,\%recips);
@@ -1664,7 +1666,7 @@
|;
}
my $tolist = join(' ',@{$recips{'to'}});
- $r->print('<tr><td colspan="3"><table><tr><td>'.&mt('[_1]Send reply[_2] to other recipients','<b>','</b>').':<br />'.$replyall.'</td><td>'.$tolist.'</td></tr></table></td></tr>');
+ $r->print('<div><div style="display: inline">'.&mt('[_1]Send reply[_2] to other recipients','<b>','</b>').':<br />'.$replyall.'</div><div style="display: inline">'.$tolist.'</div></div>');
}
}
if (ref($recips{'cc'}) eq 'ARRAY') {
@@ -1682,7 +1684,7 @@
|;
}
my $cclist = join(' ',@{$recips{'cc'}});
- $r->print('<tr><td colspan="3"><table><tr><td>'.&mt('[_1]Cc[_2] to other copied recipients','<b>','</b>').':<br />'.$replyall.'</td><td>'.$cclist.'</td></tr></table></td></tr>');
+ $r->print('<div><div style="display: inline">'.&mt('[_1]Cc[_2] to other copied recipients','<b>','</b>').':<br />'.$replyall.'</div><div style="display: inline">'.$cclist.'</div></div>');
}
}
if ($content{'group'} ne '') {
@@ -1702,7 +1704,7 @@
|;
}
my $groupcclist = join(' ',@{$recips{'group_cc_broadcast'}});
- $r->print('<tr><td colspan="3"><table><tr><td>'.&mt('[_1]Cc[_2] to other copied group members','<b>','</b>').':<br />'.$replyall.'</td><td>'.$groupcclist.'<input type="hidden" name="group" value="'.$content{'group'}.'" /><input type="hidden" name="sendmode" value="group" /><input type="hidden" name="groupmail" value="cc" /></td></tr></table></td></tr>');
+ $r->print('<div><div style="display: inline">'.&mt('[_1]Cc[_2] to other copied group members','<b>','</b>').':<br />'.$replyall.'</div><div>'.$groupcclist.'<input type="hidden" name="group" value="'.$content{'group'}.'" /><input type="hidden" name="sendmode" value="group" /><input type="hidden" name="groupmail" value="cc" /></div></div>');
}
}
}
@@ -1721,10 +1723,10 @@
my $subj_size;
if ($multiforward) {
$r->print(&additional_rec_row(\%lt));
- $r->print('<tr><td colspan="2">'.
+ $r->print('<div>'.
&mt('Unless you choose otherwise:').'<ul><li>'.
&mt("The subject in each forwarded message will be [_1]'Forwarding:'[_2] followed by the original subject.",'<i>','</i>').'</li><li>'.
- &mt("The message itself will begin with a first line: [_1]'Forwarded message from'[_2] followed by the original sender's name.",'<i>','</i>').'</li></ul></td></tr>');
+ &mt("The message itself will begin with a first line: [_1]'Forwarded message from'[_2] followed by the original sender's name.",'<i>','</i>').'</li></ul></div>');
$func1='Forward'; # do not translate here!
$dissub = &mt('Forwarding').': ';
$subj_size = '10';
@@ -1733,19 +1735,18 @@
$dismsg = &mt('Forwarded message from ').' ';
my $sender = &mt("sender's name");
$r->print(&msg_subject_row($dissub,\%lt,$subj_size,$extra));
- $r->print('<tr><td>'.&mt('Message begins with:').'</td><td><input type="text" name="msgheader" value="'.$dismsg.'" /> '.$sender.' <input type="radio" name="showorigsender" value="1" checked="checked" />'.&mt('Yes').' <input type="radio" name="showorigsender" value="0" />'.&mt('No').'<input type="hidden" name="multiforward" value="'.$multiforward.'" /></td></tr>
-</table>
-<br /><table>
-<tr><td align="left">'."\n".
+ $r->print('<div>'.&mt('Message begins with:').' <input type="text" name="msgheader" value="'.$dismsg.'" /> '.$sender.' <input type="radio" name="showorigsender" value="1" checked="checked" />'.&mt('Yes').' <input type="radio" name="showorigsender" value="0" />'.&mt('No').'<input type="hidden" name="multiforward" value="'.$multiforward.'" /></div>
+<br />
+<div>'."\n".
$latexHelp."<br />\n".
&mt("Any new text to display before the text of the original messages:").'<br />'."\n".
-'<textarea name="message" id="message" cols="80" rows="5" wrap="hard" $textareaclass></textarea>');
+'<textarea name="message" id="message" cols="80" rows="5" wrap="hard" '.$textareaclass.'></textarea>');
my @to_forward = &Apache::loncommon::get_env_multiple('form.delmark');
foreach my $msg (@to_forward) {
$r->print('<input type="hidden" name="delmark" value="'.$msg.'" />');
}
$r->print(&submit_button_row($folder,$dismode,&mt($func1.' '.$func2{'msg'}),
- \%lt));
+ \%lt).'</div>');
} elsif ($broadcast ne 'upload') {
$subj_size = '50';
$r->print(&additional_rec_row(\%lt));
@@ -1758,7 +1759,7 @@
my $labeltext = &HTML::Entities::encode($lt{'msgb'});
$r->print(<<"ENDCOMP");
$attachrow
-</table><br />
+<br />
$latexHelp<br />
<textarea name="message" id="message" cols="80" rows="15" wrap="hard" $textareaclass aria-label="$labeltext">$dismsg
</textarea>
@@ -1782,7 +1783,7 @@
$r->print(<<ENDBLOCK);
<input type="hidden" name="sendmode" value="upload" />
<input type="hidden" name="send" value="on" />
-<h3>$lt{'gen'}</h3>
+<h2 class="LC_heading_2">$lt{'gen'}</h2>
<p>
<label>$lt{'sb'}: <input type="text" size="50" name="subject" /></label>
</p>
@@ -1804,7 +1805,7 @@
$r->print(<<ENDUPLOAD);
</p>
<p>
-<input type="file" name="upfile" size="40" /></p><p>
+<input type="file" name="upfile" size="40" aria-label="$lt{'saf'}" /></p><p>
$dispcrit
<input type="submit" value="$lt{'uas'}" /></p>
ENDUPLOAD
@@ -1840,7 +1841,7 @@
&Apache::loncommon::selectstudent_link('compemail','recuname',
'recdomain');
my $output = <<"ENDREC";
-<tr><td colspan="3"><span class="LC_nobreak"><b>$lt{'to'}</b> <label>$lt{'us'}: <input type="text" size="12" name="recuname" value="$env{'form.recname'}" /></label> <label>$lt{'do'}: $domform</label> $selectlink</span></td></tr>
+<div><fieldset class="LC_borderless"><legend class="LC_visually_hidden">$lt{'re'}</legend><span class="LC_nobreak"><b>$lt{'to'}</b> <label>$lt{'us'}: <input type="text" size="12" name="recuname" value="$env{'form.recname'}" /></label> <label>$lt{'do'}: $domform</label> $selectlink</span></fieldset></div>
ENDREC
return $output;
}
@@ -1850,7 +1851,7 @@
my $radioyes = &mt('Yes');
my $radiono = &mt('No');
my $output = <<"ENDREP";
-<tr><td colspan="3"><span class="LC_nobreak"><b>$lt->{'ar'}</b>:<label><input type="radio" name="can_reply" value="Y" checked="checked" />$radioyes</label> <label><input type="radio" name="can_reply" value="N" />$radiono</label></span> <span class="LC_nobreak">$lt->{'rt'}: <input type="text" size="25" name="reply_to_addr" value="$env{'user.name'}:$env{'user.domain'}" /></span></td></tr>
+<div style="margin: 0"><b>$lt->{'ar'}</b>:<fieldset class="LC_borderless"><legend class="LC_visually_hidden">$lt->{'sr'}</legend><span class="LC_nobreak"><label><input type="radio" name="can_reply" value="Y" checked="checked" />$radioyes</label> <label><input type="radio" name="can_reply" value="N" />$radiono</label></span></fieldset> <span class="LC_nobreak"><label>$lt->{'rt'}: <input type="text" size="25" name="reply_to_addr" value="$env{'user.name'}:$env{'user.domain'}" /></label></span></div>
ENDREP
return $output;
}
@@ -1861,10 +1862,33 @@
my $bcc = &mt('Bcc:');
my $exmpl = &mt('username:domain,username:domain,...');
my $output = <<"ENDADD";
-<tr><td colspan="3"><fieldset id="LC_additionalrecips"><legend>$lt->{'ad'} <tt>($exmpl)</tt></legend><table>
-<tr><td> </td><td><label for="additionalrec_to">$lt->{'to'}</label></td><td><input type="text" size="50" name="additionalrec_to" id="additionalrec_to" /></td></tr>
-<tr><td> </td><td><label for="additionalrec_cc">$cc</label></td><td><input type="text" size="50" name="additionalrec_cc" id="additionalrec_cc" /></td></tr>
-<tr><td> </td><td><label for="additionalrec_bcc">$bcc</label></td><td><input type="text" size="50" name="additionalrec_bcc" id="additionalrec_bcc" /></td></tr></table></fieldset></td></tr>
+<fieldset id="LC_additionalrecips"><legend>$lt->{'ad'} <tt>($exmpl)</tt></legend>
+<div class="LC_grid">
+<div class="LC_grid_row">
+<div class="LC_grid_cell">
+<label for="additionalrec_to">$lt->{'to'}</label>
+</div>
+<div class="LC_grid_cell">
+<input type="text" size="50" name="additionalrec_to" id="additionalrec_to" />
+</div>
+</div>
+<div class="LC_grid_row">
+<div class="LC_grid_cell">
+<label for="additionalrec_cc">$cc</label>
+</div>
+<div class="LC_grid_cell"><input type="text" size="50" name="additionalrec_cc" id="additionalrec_cc" />
+</div>
+</div>
+<div class="LC_grid_row">
+<div class="LC_grid_cell">
+<label for="additionalrec_bcc">$bcc</label>
+</div>
+<div class="LC_grid_cell">
+<input type="text" size="50" name="additionalrec_bcc" id="additionalrec_bcc" />
+</div>
+</div>
+</div>
+</fieldset>
ENDADD
return $output;
}
@@ -1884,19 +1908,19 @@
}
}
$output .= qq|
-<table><tr><td align="left">
+<div><div style="display: inline;">
<input type="submit" name="send" value="$value" title="$sendtext" />
<input type="submit" name="cancel" value="$lt->{'ca'}" />
-</td><td width="60"> </td><td align="right">$prevbutton</td></tr></table>
+</div><div style="display: inline; padding-left: 60px">$prevbutton</div></div>
|;
return $output;
}
sub msg_subject_row {
my ($dissub,$lt,$subj_size,$extra) = @_;
- my $output = '<tr><td colspan="3"><label><b>'.$lt->{'sb'}.'</b>: <input type="text" size="'.
+ my $output = '<div><label><b>'.$lt->{'sb'}.'</b>: <input type="text" size="'.
$subj_size.'" name="subject" value="'.$dissub.'" /></label>'.$extra.
- '</td></tr>';
+ '</div>';
return $output;
}
@@ -2063,7 +2087,7 @@
# already filled in
if ($env{'form.recdomain'}) { $defdom=$env{'form.recdomain'}; }
# generate output
- my $domform = &Apache::loncommon::select_dom_form($defdom,'recdomain');
+ my $domform = &Apache::loncommon::select_dom_form($defdom,'recdomain','','','','','','','recdomain');
my $stdbrws = &Apache::loncommon::selectstudent_link
('stdselect','recuname','recdomain');
my %lt=&Apache::lonlocal::texthash('user' => 'Username',
@@ -2073,15 +2097,15 @@
'newr' => 'New Record (record is visible to '.lc($crstype).' '.$leaders.')',
'post' => 'Post this Record');
- $r->print('<h2>'.$lt{'head'}.'</h2>'
+ $r->print('<h2 class="LC_heading_2">'.$lt{'head'}.'</h2>'
.'<form method="post" action="/adm/email" name="stdselect">'
.'<input type="hidden" name="recordftf" value="retrieve" />'
.&Apache::lonhtmlcommon::start_pick_box()
- .&Apache::lonhtmlcommon::row_title($lt{'user'})
- .'<input type="text" size="12" name="recuname" value="'.$env{'form.recuname'}.'" />'
+ .&Apache::lonhtmlcommon::row_title('<label for="recuname">'.$lt{'user'}.'</label>')
+ .'<input type="text" size="12" name="recuname" id="recuname" value="'.$env{'form.recuname'}.'" />'
.' '.$stdbrws
.&Apache::lonhtmlcommon::row_closure()
- .&Apache::lonhtmlcommon::row_title($lt{'dom'})
+ .&Apache::lonhtmlcommon::row_title('<label for="recdomain">'.$lt{'dom'}.'</label>')
.$domform
.&Apache::lonhtmlcommon::row_closure(1)
.&Apache::lonhtmlcommon::end_pick_box()
Index: loncom/interface/lonselstudent.pm
diff -u loncom/interface/lonselstudent.pm:1.17 loncom/interface/lonselstudent.pm:1.18
--- loncom/interface/lonselstudent.pm:1.17 Sat Oct 22 02:03:31 2016
+++ loncom/interface/lonselstudent.pm Tue Dec 16 20:01:18 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# lonselstudent.pm : Reusable subs for student selection.
#
-# $Id: lonselstudent.pm,v 1.17 2016/10/22 02:03:31 raeburn Exp $
+# $Id: lonselstudent.pm,v 1.18 2025/12/16 20:01:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -320,8 +320,9 @@
$sections{$sect} = 1;
}
}
+ my $labeltext = &mt('Category/categories for multiple users selection shortcut');
- $result .= '<table><tr><td>';
+ $result .= '<div style="display: inline">';
my $size = scalar(keys(%sections));
if ($context eq 'accesstimes') {
@@ -333,7 +334,7 @@
$size = 5;
}
$result .= '<select multiple="multiple" name="'.$formprefix
- .'.chosensections" size="'.$size.'">'."\n";
+ .'.chosensections" size="'.$size.'" aria-label="'.$labeltext.'">'."\n";
$result .= '<option value="allstudents">'.&mt('All Students').'</option>';
unless ($context eq 'accesstimes') {
$result .= '<option value="allpersonnel">'.&mt('All Course Personnel').'</option>';
@@ -343,12 +344,13 @@
foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) {
$result .= '<option value="'.$sec.'">'.$sec.'</option>'."\n";
}
- $result .= '</select></td><td valign="top">';
+ $result .= '</select></div><div style="display: inline; vertical-align: top;">';
$result .= '<input type="button" name="'.$formprefix.'.select" value="'.&mt('Select').'" onclick='
- ."'selectSections(\"$formprefix.chosensections\", \"$formprefix\", document.forms.$formname)'".' /></td>';
- $result .= '<td valign="top"><input type="button" name="'.$formprefix
+ ."'selectSections(\"$formprefix.chosensections\", \"$formprefix\", document.forms.$formname)'".' />';
+ $result .= '</div><div style="display: inline; vertical-align: top;"><input type="button" name="'.$formprefix
.'.unselect" value="'.&mt('Unselect').'" onclick='.
- "'unselectSections(\"$formprefix.chosensections\", \"$formprefix\", document.forms.$formname)' ".' /></td></tr></table>';
+ "'unselectSections(\"$formprefix.chosensections\", \"$formprefix\", document.forms.$formname)' ".' />'.
+ '</div>';
}
# Now we list the students, but the form element type
@@ -358,7 +360,8 @@
$result .= &Apache::loncommon::start_data_table();
$result .= &Apache::loncommon::start_data_table_header_row();
- $result .= '<th></th><th>'.&mt('Name').'</th>'."\n";
+ $result .= ' <th>'.&mt('Select').'</th>'."\n";
+ $result .= ' <th>'.&mt('Name').'</th>'."\n";
$result .= ' <th>'.&mt('Section').'</th>'."\n";
$result .= ' <th>'.&mt('Status').'</th>'."\n";
$result .= ' <th>'.&mt('Role').'</th>'."\n";
@@ -396,7 +399,8 @@
.$student->[3] . ':'
.$student->[4] . ":"
.$formprefix, "<>&\"'")
- ."\" /></td><td>\n";
+ .'" aria-label="'.&mt('select [_1]',&HTML::Entities::encode($user,"<>&\"'"))
+ .'" /></td><td>'."\n";
$result .= &HTML::Entities::encode($student->[1], '<>&"')
. '</td><td align="center" >'."\n";
$result .= &HTML::Entities::encode($student->[2], '<>&"')
More information about the LON-CAPA-cvs
mailing list