[LON-CAPA-cvs] cvs: loncom /html/adm/helper newslot.helper /interface loncommon.pm lonhelper.pm lonnavmaps.pm lonprintout.pm
raeburn
raeburn at source.lon-capa.org
Sat Apr 18 23:47:19 EDT 2026
raeburn Sun Apr 19 03:47:19 2026 EDT
Modified files:
/loncom/interface loncommon.pm lonhelper.pm lonnavmaps.pm
lonprintout.pm
/loncom/html/adm/helper newslot.helper
Log:
- WCAG 2.2 compliance
- Fix some 'label for=' attributes added in lonprintout.pm rev. 1.497
(these need to point at element id, not element name).
- Include labels for form elements.
- Group form elements in fieldset with legend for screenreaders
- Use <th> tags for column headings and row headings in data table
with scope="row" attribute for latter.
- For form elements in data table cells use aria-labelledby to reference
appropriate column and row headers.
- Satisfy minimum spacing between touch targets.
- Sequential headings.
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1514 loncom/interface/loncommon.pm:1.1515
--- loncom/interface/loncommon.pm:1.1514 Sat Apr 18 06:39:48 2026
+++ loncom/interface/loncommon.pm Sun Apr 19 03:47:18 2026
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1514 2026/04/18 06:39:48 raeburn Exp $
+# $Id: loncommon.pm,v 1.1515 2026/04/19 03:47:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -8024,8 +8024,8 @@
table.LC_innerpickbox tr th {
font-weight: bold;
background-color: $data_table_head;
- color:$fontmenu;
- font-size:90%;
+ color: $fontmenu;
+ font-size: 90%;
}
table.LC_data_table tr.LC_odd_row th.LC_enrolltype {
@@ -9612,6 +9612,48 @@
padding: 3px;
background-color: #FFFFFF;
font-size: 90%;
+ line-height: 170%;
+}
+
+table.LC_resourceList {
+ font-size: 90%;
+ line-height: 170%;
+}
+
+table.LC_resourceList tr.LC_odd_row th.LC_colheader {
+ font-weight: bold;
+ background-color: $data_table_head;
+ color: $fontmenu;
+ font-size: 100%;
+}
+
+table.LC_resourceList tr.LC_odd_row th {
+ background-color: $data_table_light;
+}
+
+table.LC_resourceList tr.LC_even_row th {
+ background-color: $data_table_dark;
+}
+
+
+table.LC_resourceList tr.LC_odd_row th.LC_colheader {
+ background-color: $data_table_head;
+}
+
+table.LC_resourceList tr th.LC_rowheader {
+ font-weight: normal;
+ color: $font;
+ text-align: left;
+ font-size: 100%;
+}
+
+table.LC_resourceList tr.LC_odd_row td.LC_colheader {
+ background-color: $data_table_head;
+}
+
+table.LC_resourceList a {
+ background-color: transparent;
+ text-decoration: none;
}
table.LC_tableOfContent {
@@ -9619,12 +9661,14 @@
}
table.LC_tableBrowseRes a,
-table.LC_tableOfContent a {
+table.LC_tableOfContent a,
+table.LC_resourceList a {
background-color: transparent;
text-decoration: none;
}
-table.LC_tableOfContent img {
+table.LC_tableOfContent img,
+table.LC_resourceList img {
border: none;
height: 1.3em;
vertical-align: text-bottom;
@@ -20949,7 +20993,7 @@
$cblksize,$cblocks)=stat($spooldir.'/'.$filename);
my $css_class = ($count{$ext} % 2)?'LC_odd_row':'LC_even_row';
$result{$ext} .=
- '<tr class="'.$css_class.'">'
+ '<tr class="'.$css_class.'" style="line-height: 170%;">'
.'<td>'
.'<a href="/'.$spooltype.'/'.$filename.'">'.$lt{$ext}.'</a>'
.'</td>'
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.207 loncom/interface/lonhelper.pm:1.208
--- loncom/interface/lonhelper.pm:1.207 Sat Apr 18 20:23:16 2026
+++ loncom/interface/lonhelper.pm Sun Apr 19 03:47:18 2026
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.207 2026/04/18 20:23:16 raeburn Exp $
+# $Id: lonhelper.pm,v 1.208 2026/04/19 03:47:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -643,7 +643,7 @@
- $result .= '<h2>'.$stateTitle.$stateHelp.'</h2>';
+ $result .= '<h2 class="LC_heading_2">'.$stateTitle.$stateHelp.'</h2>';
# $result .= '<div>';
@@ -1248,6 +1248,9 @@
value, will allow the user to select none of the choices without raising
an error message.
+<choices> takes an attribute "id" which, if set, will include
+an id attribute in the <input> tag
+
=head3 SUB-TAGS
<choices> can have the following subtags:X<choice, helper tag>
@@ -1437,8 +1440,10 @@
}
$result .= $buttons;
-
- $result .= "<table>\n\n";
+
+ $result .= "<fieldset class=\"LC_borderless\">\n".
+ "<legend class=\"LC_visually_hidden\">".&mt("Choose $var")."</legend>\n".
+ "<div role=\"grid\" class=\"LC_grid\" style=\"margin: 0; padding: 0;\">\n\n";
my %checkedChoices;
my $checkedChoicesFunc;
@@ -1480,15 +1485,14 @@
if ($self->{'multichoice'}) { $type = 'checkbox'; }
foreach my $choice (@{$self->{CHOICES}}) {
my $id = &new_id();
- $result .= "<tr>\n<td width='20'> </td>\n";
- $result .= "<td valign='top'><input type='$type' name='${var}_forminput'"
- . " value='" .
- HTML::Entities::encode($choice->[1],"<>&\"'")
- . "'";
+ $result .= "<div role=\"row\" class=\"LC_grid_row\" style=\"line-height: 160%;\">\n"
+ ."<div role=\"gridcell\" class=\"LC_grid_cell\"> </div>\n"
+ ."<div role=\"gridcell\" class=\"LC_grid_cell\"><input type='$type' name='${var}_forminput'"
+ ." value='".HTML::Entities::encode($choice->[1],"<>&\"'")
+ ."'";
if ($checkedChoices{$choice->[1]}) {
$result .= " checked='checked'";
}
- $result .= qq{ id="id$id"};
my $choiceLabel = $choice->[0];
if ($choice->[3]) { # if we need to evaluate this choice
$choiceLabel = "sub { my $helper = shift; my $state = shift;" .
@@ -1496,16 +1500,23 @@
$choiceLabel = eval($choiceLabel);
$choiceLabel = &$choiceLabel($helper, $self);
}
- $result .= " /></td><td> ".qq{<label for="id$id">}.
- $choiceLabel. "</label></td>";
+ if ($choiceLabel ne '') {
+ $result .= ' id="id'.$id.'" /></div>'
+ .'<div role="gridcell" class="LC_grid_cell">'
+ .'<label for="id'.$id.'">'
+ .$choiceLabel.'</label></div>';
+ } else {
+ $result .= ' /></div>';
+ }
if ($choice->[4]) {
- $result .='<td><input type="text" size="5" name="'
- .$choice->[4].'_forminput" value="'
- .$choice->[5].'" /></td>';
+ $result .= '<div role="gridcell" class="LC_grid_cell">'
+ .'<input type="text" size="5" name="'
+ .$choice->[4].'_forminput" value="'
+ .$choice->[5].'" /></div>';
}
- $result .= "</tr>\n";
+ $result .= "</div>\n";
}
- $result .= "</table>\n\n\n";
+ $result .= "</div></fieldset>\n\n\n";
$result .= $buttons;
return $result;
@@ -1563,6 +1574,9 @@
<dropdown> takes an attribute "variable" to control which helper variable
the result is stored in.
+<dropdown> takes an attribute "id" to set a unique id in the select tag,
+if needed.
+
=head3 SUB-TAGS
<choice>, which acts just as it does in the "choices" element.
@@ -1599,6 +1613,7 @@
# Need to initialize the choices list, so everything can assume it exists
$paramHash->{'variable'} = $token->[2]{'variable'} if (!defined($paramHash->{'variable'}));
$helper->declareVar($paramHash->{'variable'});
+ $paramHash->{'id'} = $token->[2]{'id'} if (!defined($paramHash->{'id'}));
$paramHash->{CHOICES} = [];
return '';
}
@@ -1616,6 +1631,7 @@
sub render {
my $self = shift;
my $var = $self->{'variable'};
+ my $id = $self->{'id'};
my $result = '';
if (defined $self->{ERROR_MSG}) {
@@ -1650,8 +1666,11 @@
if (!$foundChoice) {
$checkedChoices{$self->{CHOICES}->[0]->[1]} = 1;
}
+ if ($id ne '') {
+ $id = " id='$id'";
+ }
- $result .= "<select name='${var}_forminput'>\n";
+ $result .= "<select name='${var}_forminput'$id>\n";
foreach my $choice (@{$self->{CHOICES}}) {
$result .= "<option value='" .
HTML::Entities::encode($choice->[1],"<>&\"'")
@@ -1765,6 +1784,7 @@
$helper->declareVar($paramHash->{'variable'});
$paramHash->{'hoursminutes'} = $token->[2]{'hoursminutes'};
$paramHash->{'anytime'} = $token->[2]{'anytime'};
+ $paramHash->{'aria-label'} = $token->[2]{'aria-label'};
}
sub end_date {
@@ -1824,9 +1844,20 @@
$result .= '<font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />';
}
+ my %arialabel;
+ if ($self->{'aria-label'}) {
+ my @items = ('month','day','year');
+ if ($self->{'hoursminutes'}) {
+ push(@items,('hour','minute'));
+ }
+ foreach my $item (@items) {
+ $arialabel{$item} = ' aria-label="'.$self->{'aria-label'}.' '.$item.'"';
+ }
+ }
+
# Month
my $i;
- $result .= "<select $onclick name='${var}month'>\n";
+ $result .= "<select $onclick name='${var}month'$arialabel{'month'}>\n";
for ($i = 0; $i < 12; $i++) {
if (($i + 1) == $date->mon) {
$result .= "<option value='$i' selected='selected'>";
@@ -1838,7 +1869,7 @@
$result .= "</select>\n";
# Day
- $result .= "<select $onclick name='${var}day'>\n";
+ $result .= "<select $onclick name='${var}day'$arialabel{'day'}>\n";
for ($i = 1; $i < 32; $i++) {
if ($i == $date->mday) {
$result .= '<option selected="selected">';
@@ -1850,7 +1881,7 @@
$result .= "</select>,\n";
# Year
- $result .= "<select $onclick name='${var}year'>\n";
+ $result .= "<select $onclick name='${var}year'$arialabel{'year'}>\n";
for ($i = 2000; $i < 2030; $i++) { # update this after 64-bit dates
if ($date->year == $i) {
$result .= "<option selected='selected'>";
@@ -1867,7 +1898,7 @@
my $am = &mt('a.m.');
my $pm = &mt('p.m.');
# Build hour
- $result .= "<select $onclick name='${var}hour'>\n";
+ $result .= "<select $onclick name='${var}hour'$arialabel{'hour'}>\n";
$result .= "<option " . ($date->hour == 0 ? 'selected="selected" ':'') .
" value='0'>" . &mt('midnight') . "</option>\n";
for ($i = 1; $i < 12; $i++) {
@@ -1890,7 +1921,7 @@
$result .= "</select> :\n";
- $result .= "<select $onclick name='${var}minute'>\n";
+ $result .= "<select $onclick name='${var}minute'$arialabel{'minute'}>\n";
my $selected=0;
for my $i ((0,15,30,45,59,undef,0..59)) {
my $printedMinute = $i;
@@ -2372,6 +2403,7 @@
my $option_texts = $self->{OPTION_TEXTS};
my $option_types = $self->{OPTION_TYPES};
my $addparts = $self->{'addparts'};
+ my $addstatus = $self->{'addstatus'};
my $modalLink = $self->{'modalLink'};
my $headings_done = 0;
@@ -2406,14 +2438,27 @@
my ($resource, $part, $params) = @_;
my $result = "";
- if(!$headings_done) {
+ if (!$headings_done) {
+ my $col = 1;
if ($option_texts) {
foreach my $text (@$option_texts) {
- $result .= "<th>$text</th>";
+ if ($text eq '') {
+ $result .= '<td class="LC_colheader"></td>';
+ } else {
+ $result .= "<th id=\"col$col\" class=\"LC_colheader\">$text</th>";
+ $col ++;
+ }
}
}
- $result .= '<th>'.&Apache::lonlocal::mt('Select').'</th>';
- # Close off the extra row and start a new one
+ $result .= '<th id="col'.$col.'" class="LC_colheader">'.&Apache::lonlocal::mt('Select').'</th>';
+ if ($addparts) {
+ $result .= '<th class="LC_colheader">'.&Apache::lonlocal::mt('Select parts').'</th>';
+ }
+ $result .= '<th class="LC_colheader">'.&Apache::lonlocal::mt('Name of Resource').'</th>';
+ if ($addstatus) {
+ $result .= '<th class="LC_colheader">'.&Apache::lonlocal::mt('Status').'</th>';
+ }
+ # Close off the extra row and start a new one.
$result .= &Apache::loncommon::end_data_table_row().
&Apache::loncommon::start_data_table_row();
$headings_done = 1;
@@ -2427,12 +2472,13 @@
$result .= '<td> </td>';
return $result;
} else {
+ my $option_num = 0;
+ my $colnum = 0;
my $col = "";
my $raw_name = &$valueFunc($resource);
my $resource_name =
HTML::Entities::encode($raw_name,"<>&\"'");
if($option_vars) {
- my $option_num = 0;
foreach my $option_var (@$option_vars) {
my $option_type = $option_types->[$option_num];
$option_num++;
@@ -2465,23 +2511,29 @@
# TODO: add an attribute to <option> that allows the
# programmer to set the width of the tex entry box.
+ $colnum ++;
$col .=
"<td align='center'><input type='text' name ='$option_var".
- "_forminput' value='".$text_value."' size='5' /> </td>";
+ "_forminput' value='".$text_value."' size='5' ".
+ "aria-labelledby='row".$params->{counter}." col".$colnum."' /></td>";
} elsif ($option_type eq 'hidden') {
- $col .= "<td align='center'><input type='hidden' name ='$option_var".
+ $col .=
+ "<td align='center'><input type='hidden' name ='$option_var".
"_forminput' value='".
- $resource_name . "'/> </td>";
+ $resource_name . "' /></td>";
} else {
+ $colnum ++;
$col .=
"<td align='center'><input type='$option_type' name ='$option_var".
"_forminput' value='".
- $resource_name . "' $checked /> </td>";
+ $resource_name . "' $checked ".
+ "aria-labelledby='row".$params->{counter}." col".$colnum."' /></td>";
}
}
}
$col .= "<td align='center'><input type='$inputType' name='${var}_forminput' ";
+ $colnum ++;
if (%defaultSymbs) {
my $symb=$resource->symb();
if (exists($defaultSymbs{$symb})) {
@@ -2498,8 +2550,8 @@
$checked = 1;
}
}
- $col .= "value='" . $resource_name . "' /></td>";
-
+ $col .= "value='" . $resource_name .
+ "' aria-labelledby='row".$params->{counter}." col".$colnum."' /></td>";
return $result.$col;
}
};
@@ -2548,11 +2600,12 @@
push(@$cols, Apache::lonnavmaps::resource());
if ($self->{'addstatus'}) {
push @$cols, (Apache::lonnavmaps::part_status_summary());
-
}
my $caller;
- if ($helper->{TITLE} eq 'Printing Helper') {
+ if ($env{'request.noversionuri'} eq '/adm/printout') {
$caller = 'printout';
+ } elsif ($env{'request.noversionuri'} =~ m{^\Q/adm/helper/\E(.+)\.helper$}) {
+ $caller = $1;
}
$result .=
&Apache::lonnavmaps::render( { 'cols' => $cols,
@@ -2782,7 +2835,7 @@
# Current personnel
- $result .= '<h4>'.$titles{'active'}.'</h4>';
+ $result .= '<h3 class="LC_heading_3">'.$titles{'active'}.'</h3>';
$result .= &Apache::lonselstudent::render_student_list( $current_members,
"helpform",
"current",
@@ -2797,7 +2850,7 @@
# And future.
- $result .= '<h4>'.$titles{'future'}.'</h4>';
+ $result .= '<h3 class="LC_heading_3">'.$titles{'future'}.'</h3>';
$result .= &Apache::lonselstudent::render_student_list( $future_members,
"helpform",
@@ -2810,7 +2863,7 @@
if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) {
# Past
- $result .= '<h4>'.$titles{'expired'}.'</h4>';
+ $result .= '<h3 class="LC_heading_3">'.$titles{'expired'}.'</h3>';
$result .= &Apache::lonselstudent::render_student_list($expired_members,
"helpform",
"past",
@@ -3385,7 +3438,9 @@
string elements provide a string entry field for the user. string elements
take the usual 'variable' and 'nextstate' parameters. string elements
-also pass through 'maxlength' and 'size' attributes to the input tag.
+also pass through 'maxlength', 'size', 'aria-label' and 'id'
+attributes to the input tag.
+
Since you could have multiple strings in a helper state, each with its own
validator, all but the last string should have
noproceed='1' so that _all_ validators are evaluated before the next
@@ -3426,6 +3481,8 @@
$paramHash->{'nextstate'} = $token->[2]{'nextstate'};
$paramHash->{'maxlength'} = $token->[2]{'maxlength'};
$paramHash->{'size'} = $token->[2]{'size'};
+ $paramHash->{'id'} = $token->[2]{'id'};
+ $paramHash->{'aria-label'} = $token->[2]{'aria-label'};
return '';
}
@@ -3477,6 +3534,13 @@
$result .= ' value="' . &$valueFunc($helper, $self) . '"';
}
+ if (defined($self->{'aria-label'})) {
+ $result .= ' aria-label="'.$self->{'aria-label'}.'"';
+ }
+ if (defined($self->{'id'})) {
+ $result .= ' id="'.$self->{'id'}.'"';
+ }
+
$result .= ' />';
return $result;
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.587 loncom/interface/lonnavmaps.pm:1.588
--- loncom/interface/lonnavmaps.pm:1.587 Sat Apr 18 23:20:57 2026
+++ loncom/interface/lonnavmaps.pm Sun Apr 19 03:47:18 2026
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.587 2026/04/18 23:20:57 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.588 2026/04/19 03:47:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1143,7 +1143,13 @@
}
# We're done preparing and finally ready to start the rendering
- my $result = '<td class="LC_middle">';
+ my $result;
+ if (($params->{'caller'} eq 'printout') || ($params->{'caller'} eq 'newslot') ||
+ ($params->{'caller'} eq 'resettimes')) {
+ $result = '<th scope="row" id="row'.$params->{counter}.'" class="LC_middle LC_rowheader">';
+ } else {
+ $result = '<td class="LC_middle">';
+ }
my $newfolderType = $resource->is_sequence() ? 'folder' : 'page';
my $indentLevel = $params->{'indentLevel'};
@@ -1195,7 +1201,13 @@
$linkopen = "<a href=\"$link\">";
}
}
- $result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$linkclose$editmapLink$nonLinkedText</td>";
+ $result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$linkclose$editmapLink$nonLinkedText";
+ if (($params->{'caller'} eq 'printout') || ($params->{'caller'} eq 'newslot') ||
+ ($params->{'caller'} eq 'resettimes')) {
+ $result .= "</th>";
+ } else {
+ $result .= "</td>";
+ }
return $result;
}
@@ -1214,7 +1226,7 @@
'<img alt="'.&mt('New Discussion').'" src="'.$location.'/chat.gif" title="'.&mt('New Discussion').'"/>' .
$linkclose;
}
-
+
if ($resource->getFeedback()) {
my $feedback = $resource->getFeedback();
foreach my $msgid (split(/\,/, $feedback)) {
@@ -1255,8 +1267,8 @@
my $link = $params->{"resourceLink"};
my $linkopen = "<a href=\"$link\">";
my $linkclose = "</a>";
-
- $result .= '<td class="LC_middle">';
+
+ $result .= '<td class="LC_noBorder LC_middle">';
if ($resource->is_gradable() &&
!$firstDisplayed) {
my $icon = $statusIconMap{$resource->simpleStatus($part)};
@@ -1264,14 +1276,17 @@
if ($icon) {
my $location=
&Apache::loncommon::lonhttpdurl("/adm/lonIcons/$icon");
- $result .= $linkopen.'<img src="'.$location.'" alt="'.&mt($alt).'" title="'.&mt($alt).'" />'.$linkclose;
+ $result .= $linkopen.
+ '<img style="display: inline-block; margin: 2px 0 0 0;"'.
+ ' src="'.$location.'" alt="'.&mt($alt).'" title="'.&mt($alt).'" />'.
+ $linkclose;
} else {
$result .= " ";
}
} else { # not problem, no icon
$result .= " ";
}
- $result .= "</td>\n";
+ $result .= "</td>\n";
return $result;
}
sub render_long_status {
@@ -1982,14 +1997,19 @@
$args->{'counter'}++;
unless ($tablestarted) {
- $result.=&Apache::loncommon::start_data_table("LC_tableOfContent").
- &Apache::loncommon::start_data_table_header_row('LC_visually_hidden').
- '<th>'.&mt('Resource or Folder').'</th>'.
- '<th>'.&mt('Alerts').'</th>'.
- '<th>'.&mt('Status Icon').'</th>'.
- '<th>'.&mt('Date/Completion Status').'</th>'.
- &Apache::loncommon::end_data_table_row()."\n";
- $tablestarted = 1;
+ if (($args->{'caller'} eq 'printout') || ($args->{'caller'} eq 'newslot') ||
+ ($args->{'caller'} eq 'resettimes')) {
+ $result .= &Apache::loncommon::start_data_table("LC_resourceList");
+ } else {
+ $result .= &Apache::loncommon::start_data_table("LC_tableOfContent").
+ &Apache::loncommon::start_data_table_header_row('LC_visually_hidden').
+ '<th>'.&mt('Resource or Folder').'</th>'.
+ '<th>'.&mt('Alerts').'</th>'.
+ '<th>'.&mt('Status Icon').'</th>'.
+ '<th>'.&mt('Date/Completion Status').'</th>'.
+ &Apache::loncommon::end_data_table_row()."\n";
+ }
+ $tablestarted = 1;
}
# Does it have multiple parts?
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.719 loncom/interface/lonprintout.pm:1.720
--- loncom/interface/lonprintout.pm:1.719 Sat Apr 18 23:35:18 2026
+++ loncom/interface/lonprintout.pm Sun Apr 19 03:47:18 2026
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.719 2026/04/18 23:35:18 raeburn Exp $
+# $Id: lonprintout.pm,v 1.720 2026/04/19 03:47:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2489,7 +2489,7 @@
$output ='<hr />';
}
if ($zip_result) {
- $output .='<h3>'.&mt('Recently generated printout zip files')."</h3>\n"
+ $output .='<h2 class="LC_heading_2">'.&mt('Recently generated printout zip files')."</h2>\n"
.&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
.'<th>'.&mt('Download').'</th>'
@@ -2500,7 +2500,7 @@
.&Apache::loncommon::end_data_table();
}
if ($pdf_result) {
- $output .='<h3>'.&mt('Recently generated printouts')."</h3>\n"
+ $output .='<h2 class="LC_heading_2">'.&mt('Recently generated printouts')."</h2>\n"
.&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
.'<th>'.&mt('Download').'</th>'
@@ -4329,8 +4329,7 @@
$helper->declareVar("STUDENTS");
$helper->declareVar("EXTRASPACE");
-
-
+ my $counter = 0;
# The page breaks and extra spaces
# can get loaded initially from the course environment:
@@ -4848,7 +4847,7 @@
</state>
$resource_selector
CHOOSE_STUDENTS1
-
+ $counter++;
&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON2);
<state name="CHOOSE_ANON2" title="Select CODEd Assignments">
<nextstate>SELECT_RESOURCES</nextstate>
@@ -5122,7 +5121,7 @@
# Early out if nothing to print
if (!$numchoices) {
$r->print(&Apache::loncommon::start_page('Printing Helper').
- '<h2>'.&mt('Unable to determine print context').'</h2>'.
+ '<h2 class="LC_heading_2">'.&mt('Unable to determine print context').'</h2>'.
'<p>'.&mt('Please display a resource, and then click the "Print" button/icon').'</p>');
my $footer = &Apache::loncommon::recently_generated('prtspool');
$r->print($footer.&Apache::loncommon::end_page());
@@ -5178,17 +5177,19 @@
if (($perm{'pav'} and $perm{'vgr'}) or
($helper->{VARS}->{'construction'} eq '1')) {
+ $counter ++;
&addMessage('<br />'
- .'<h3>'.&mt('Print Options').'</h3>'
+ .'<h3 class="LC_heading_3">'.&mt('Print Options').'</h3>'
.&Apache::lonhtmlcommon::start_pick_box()
.&Apache::lonhtmlcommon::row_title(
- '<label for="ANSWER_TYPE_forminput">'
+ '<label for="LC_printout_dropdown_'.$counter.'">'
.&mt('Print Answers')
.'</label>'
)
);
$paramHash = Apache::lonhelper::getParamHash();
$paramHash->{'variable'} = 'ANSWER_TYPE';
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
$helper->declareVar('ANSWER_TYPE');
$paramHash->{CHOICES} = [
['Without Answers', 'yes'],
@@ -5202,13 +5203,18 @@
#
# Select font size.
#
-
+ $counter++;
$helper->declareVar('fontsize');
- &addMessage(&Apache::lonhtmlcommon::row_title(&mt('Font Size')));
+ &addMessage(&Apache::lonhtmlcommon::row_title(
+ '<label for="LC_printout_dropdown_'.$counter.'">'
+ .&mt('Font Size')
+ .'</label>'
+ )
+ );
my $xmlfrag = << "FONT_SELECTION";
- <dropdown variable='fontsize' multichoice='0' allowempty='0'>
+ <dropdown variable='fontsize' multichoice='0' allowempty='0' id='LC_printout_dropdown_${counter}'>
<defaultvalue>
return 'normalsize';
</defaultvalue>
@@ -5225,25 +5231,31 @@
</dropdown>
FONT_SELECTION
&Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
- &addMessage(&Apache::lonhtmlcommon::row_closure(1));
+ my $closure = 1;
+ if ($perm{'pav'}) {
+ undef($closure);
+ }
+ &addMessage(&Apache::lonhtmlcommon::row_closure($closure));
}
if ($perm{'pav'}) {
+ $counter ++;
if (!$startedTable) {
addMessage("<hr width='33%' /><table><tr><td align='right'>".
- '<label for="LATEX_TYPE_forminput">'.
+ '<label for="LC_printout_dropdown_'.$counter.'">'.
&mt('LaTeX mode').
"</label>: </td><td>");
$startedTable = 1;
} else {
&addMessage(&Apache::lonhtmlcommon::row_title(
- '<label for="LATEX_TYPE_forminput">'
+ '<label for="LC_printout_dropdown_'.$counter.'">'
.&mt('LaTeX mode')
.'</label>'
)
);
}
$paramHash = Apache::lonhelper::getParamHash();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
$paramHash->{'variable'} = 'LATEX_TYPE';
$helper->declareVar('LATEX_TYPE');
if ($helper->{VARS}->{'construction'} eq '1') {
@@ -5257,14 +5269,16 @@
}
Apache::lonhelper::dropdown->new();
+ $counter ++;
&addMessage(&Apache::lonhtmlcommon::row_closure()
.&Apache::lonhtmlcommon::row_title(
- '<label for="TABLE_CONTENTS_forminput">'
+ '<label for="LC_printout_dropdown_'.$counter.'">'
.&mt('Print Table of Contents')
.'</label>'
)
);
$paramHash = Apache::lonhelper::getParamHash();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
$paramHash->{'variable'} = 'TABLE_CONTENTS';
$helper->declareVar('TABLE_CONTENTS');
$paramHash->{CHOICES} = [
@@ -5274,13 +5288,15 @@
&addMessage(&Apache::lonhtmlcommon::row_closure());
if (not $helper->{VARS}->{'construction'}) {
+ $counter ++;
&addMessage(&Apache::lonhtmlcommon::row_title(
- '<label for="TABLE_INDEX_forminput">'
+ '<label for="LC_printout_dropdown_'.$counter.'">'
.&mt('Print Index')
.'</label>'
)
);
$paramHash = Apache::lonhelper::getParamHash();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
$paramHash->{'variable'} = 'TABLE_INDEX';
$helper->declareVar('TABLE_INDEX');
$paramHash->{CHOICES} = [
@@ -5288,13 +5304,15 @@
['Yes', 'yes'] ];
Apache::lonhelper::dropdown->new();
&addMessage(&Apache::lonhtmlcommon::row_closure());
+ $counter ++;
&addMessage(&Apache::lonhtmlcommon::row_title(
- '<label for="PRINT_DISCUSSIONS_forminput">'
+ '<label for="LC_printout_dropdown_'.$counter.'">'
.&mt('Print Discussions')
.'</label>'
)
);
$paramHash = Apache::lonhelper::getParamHash();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
$paramHash->{'variable'} = 'PRINT_DISCUSSIONS';
$helper->declareVar('PRINT_DISCUSSIONS');
$paramHash->{CHOICES} = [
@@ -5305,13 +5323,15 @@
# Prompt for printing annotations too.
+ $counter ++;
&addMessage(&Apache::lonhtmlcommon::row_title(
- '<label for="PRINT_ANNOTATIONS_forminput">'
+ '<label for="LC_printout_dropdown_'.$counter.'">'
.&mt('Print Annotations')
.'</label>'
)
);
$paramHash = Apache::lonhelper::getParamHash();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
$paramHash->{'variable'} = "PRINT_ANNOTATIONS";
$helper->declareVar("PRINT_ANNOTATIONS");
$paramHash->{CHOICES} = [
@@ -5320,13 +5340,21 @@
Apache::lonhelper::dropdown->new();
&addMessage(&Apache::lonhtmlcommon::row_closure());
- &addMessage(&Apache::lonhtmlcommon::row_title(&mt('Foils')));
+ $counter ++;
+ &addMessage(&Apache::lonhtmlcommon::row_title(
+ '<label for="LC_printout_dropdown_'.$counter.'">'
+ .&mt('Show All Foils')
+ .'</label>'
+ )
+ );
$paramHash = Apache::lonhelper::getParamHash();
- $paramHash->{'multichoice'} = "true";
- $paramHash->{'allowempty'} = "true";
- $paramHash->{'variable'} = "showallfoils";
- $paramHash->{'CHOICES'} = [ [&mt('Show All Foils'), "1"] ];
- Apache::lonhelper::choices->new();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
+ $paramHash->{'variable'} = "showallfoils";
+ $helper->declareVar("showallfoils");
+ $paramHash->{CHOICES} = [
+ ['No', ''],
+ ['Yes', '1']];
+ Apache::lonhelper::dropdown->new();
&addMessage(&Apache::lonhtmlcommon::row_closure(1));
}
@@ -5336,44 +5364,58 @@
my $stylefiletext=&mt("Use style file");
my $selectfiletext=&mt("Select style file");
+ $counter ++;
my $xmlfrag .= '<message>'
- .&Apache::lonhtmlcommon::row_title('<label for="curseed_forminput">'
+ .&Apache::lonhtmlcommon::row_title('<label for="LC_printout_string_'.$counter.'">'
.$randseedtext
.'</label>'
)
.'</message>
- <string variable="curseed" size="15" maxlength="15">
+ <string variable="curseed" size="15" maxlength="15" id="LC_printout_string_'.$counter.'">
<defaultvalue>
return '.$helper->{VARS}->{'curseed'}.';
</defaultvalue>'
.'</string>'
.'<message>'
- .&Apache::lonhtmlcommon::row_closure()
- .&Apache::lonhtmlcommon::row_title('<label for="style_file">'
+ .&Apache::lonhtmlcommon::row_closure();
+ $counter ++;
+ $xmlfrag .=
+ &Apache::lonhtmlcommon::row_title('<label for="LC_printout_string_'.$counter.'">'
.$stylefiletext
.'</label>'
)
.'</message>
- <string variable="style_file" size="40">
+ <string variable="style_file" size="40" id="LC_printout_string_'.$counter.'">
<defaultvalue>
return '.$stylevalue.';
</defaultvalue>
</string><message> '
.qq|<a href="javascript:openbrowser('helpform','style_file_forminput','sty')">|
.$selectfiletext.'</a>'
- .&Apache::lonhtmlcommon::row_closure()
- .&Apache::lonhtmlcommon::row_title(&mt('Show All Foils'))
- .'</message>
- <choices allowempty="1" multichoice="true" variable="showallfoils">
- <choice computer="1"> </choice>
- </choices>'
- .'<message>'
- .&Apache::lonhtmlcommon::row_closure()
.'</message>';
&Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
+ &addMessage(&Apache::lonhtmlcommon::row_closure());
+ $counter ++;
+ &addMessage(&Apache::lonhtmlcommon::row_title(
+ '<label for="LC_printout_dropdown_'.$counter.'">'
+ .&mt('Show All Foils')
+ .'</label>'
+ )
+ );
+ $paramHash = Apache::lonhelper::getParamHash();
+ $paramHash->{'id'} = 'LC_printout_dropdown_'.$counter;
+ $paramHash->{'variable'} = "showallfoils";
+ $helper->declareVar("showallfoils");
+ $paramHash->{CHOICES} = [
+ ['No', ''],
+ ['Yes', '1']];
+ Apache::lonhelper::dropdown->new();
+ &addMessage(&Apache::lonhtmlcommon::row_closure());
- &addMessage(&Apache::lonhtmlcommon::row_title(&mt('Problem Type')));
+ $counter ++;
+ &addMessage(&Apache::lonhtmlcommon::row_title('<label for="LC_printout_dropdown_'.$counter.'">'.
+ &mt('Problem Type').'</label>'));
#
# Initial value from construction space:
#
@@ -5381,7 +5423,7 @@
$helper->{VARS}->{'probstatus'} = $env{'form.problemtype'}; # initial value
}
$xmlfrag = << "PROBTYPE";
- <dropdown variable="probstatus" multichoice="0" allowempty="0">
+ <dropdown variable="probstatus" multichoice="0" allowempty="0" id="LC_printout_dropdown_${counter}">
<defaultvalue>
return "$helper->{VARS}->{'probstatus'}";
</defaultvalue>
@@ -5508,24 +5550,25 @@
my $with=&mt('with Form Fields');
my $without=&mt('without Form Fields');
- $result.='<h3>'.&mt('Layout Options').'</h3>'
+ $result.='<h3 class="LC_heading_3">'.&mt('Layout Options').'</h3>'
.&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
.'<th>'.$PageLayout.'</th>'
- .'<th>'.$NumberOfColumns.'</th>'
- .'<th>'.$PaperType.'</th>';
+ .'<th id="col_numcolumns">'.$NumberOfColumns.'</th>'
+ .'<th id="col_papertype">'.$PaperType.'</th>';
if ($canuseforms) {
- $result .= '<th>'.$pdfFormLabel.'</th>';
+ $result .= '<th id="col_formfields">'.$pdfFormLabel.'</th>';
}
$result.= &Apache::loncommon::end_data_table_header_row()
.&Apache::loncommon::start_data_table_row()
- .'<td>'
+ .'<td style="line-height: 190%">'
+ .'<fieldset class="LC_borderless"><legend class="LC_visually_hidden">'.$PageLayout.'</legend>'
.'<label><input type="radio" name="'.${var}.'.layout" value="L" />'.$landscape.'</label><br />'
.'<label><input type="radio" name="'.${var}.'.layout" value="P" checked="checked" />'.$portrait.'</label>'
- .'</td>';
+ .'</fieldset></td>';
$result.='<td align="center">'
- .'<select name="'.${var}.'.cols">';
+ .'<select name="'.${var}.'.cols" aria-labelledby="col_numcolumns">';
my $i;
for ($i = 1; $i <= $maxColumns; $i++) {
@@ -5537,7 +5580,7 @@
}
$result .= "</select></td><td>\n";
- $result .= "<select name='${var}.paper'>\n";
+ $result .= "<select name='${var}.paper' aria-labelledby='col_papertype'>\n";
my %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'});
my $DefaultPaperSize=lc($parmhash{'default_paper_size'});
@@ -5572,7 +5615,7 @@
unless ($blocked) {
$result .= <<HTML;
<td align='center'>
- <select name='${var}.pdfFormFields'>
+ <select name='${var}.pdfFormFields' aria-labelledby="col_formfields">
<option selected="selected" value="no">$without</option>
<option value="yes">$with</option>
</select>
Index: loncom/html/adm/helper/newslot.helper
diff -u loncom/html/adm/helper/newslot.helper:1.36 loncom/html/adm/helper/newslot.helper:1.37
--- loncom/html/adm/helper/newslot.helper:1.36 Fri Jul 7 03:52:41 2023
+++ loncom/html/adm/helper/newslot.helper Sun Apr 19 03:47:19 2026
@@ -55,7 +55,7 @@
}
</exec>
<message>
- <br />Name: <br />
+ <br /><label>Name: <br />
</message>
<string variable="name" size="30">
<validator>
@@ -68,6 +68,9 @@
return $helper->{'VARS'}{'name'};
</defaultvalue>
</string>
+ <message>
+ </label>
+ </message>
<condition>
<clause>$helper->{DATA}{copy}</clause>
<message>
@@ -75,9 +78,9 @@
</message>
</condition>
<message>
- <br />Start time:<br />
+ <p>Start time:<br />
</message>
- <date variable="starttime" hoursminutes="1">
+ <date variable="starttime" hoursminutes="1" aria-label="Slot starting">
<defaultvalue>
return &{$helper->{DATA}{origslot}}('starttime');
</defaultvalue>
@@ -85,7 +88,7 @@
<message>
<br />End time:<br />
</message>
- <date variable="endtime" hoursminutes="1">
+ <date variable="endtime" hoursminutes="1" aria-label="Slot ending">
<defaultvalue>
return &{$helper->{DATA}{origslot}}('endtime');
</defaultvalue>
@@ -97,7 +100,9 @@
</validator>
</date>
<message>
- <br />Type:
+ </p><span aria-hidden="true">Type:</span><div>
+ <fieldset class="LC_borderless">
+ <legend class="LC_visually_hidden">Type</legend>
</message>
<choices variable="type">
<choice computer='preassigned'>Instructor assignable.</choice>
@@ -106,25 +111,32 @@
return &{$helper->{DATA}{origslot}}('type','preassigned');
</defaultvalue>
</choices>
+ <message>
+ </fieldset>
+ </div>
+ </message>
</state>
<state name="OPTIONAL" title="Specify Optional Attributes"
help="Slot_OptionalAttributes">
<message>
- <p>Description:<br />
+ <p><label>Description:<br />
</message>
<string variable="description" size="60">
<defaultvalue>
return &{$helper->{DATA}{origslot}}('description');
</defaultvalue>
</string>
+ <message>
+ </label>
+ </message>
<condition>
<clause>$helper->{'VARS'}{'type'} eq 'schedulable_student'</clause>
<message>
</p><p>Time students can start reserving:<br />
</message>
- <date variable="startreserve" hoursminutes="1" anytime="1">
+ <date variable="startreserve" hoursminutes="1" anytime="1" aria-label="Student reservation start">
<defaultvalue>
return &{$helper->{DATA}{origslot}}('startreserve','anytime');
</defaultvalue>
@@ -138,7 +150,7 @@
<message>
</p><p>Time students can no longer reserve:<br />
</message>
- <date variable="endreserve" hoursminutes="1" anytime="1">
+ <date variable="endreserve" hoursminutes="1" anytime="1" aria-label="Student reservation end">
<defaultvalue>
return &{$helper->{DATA}{origslot}}('endreserve','anytime');
</defaultvalue>
@@ -150,7 +162,7 @@
</validator>
</date>
<message>
- </p><p>Maximum number of students allowed in this slot:<br />
+ </p><p><label>Maximum number of students allowed in this slot:<br />
</message>
<string variable="maxspace" size="4">
<validator>
@@ -162,9 +174,11 @@
</defaultvalue>
</string>
<message>
- </p><p>Period of time when this slot can only be uniquely chosen:<br /> Start:
+ </label>
+ </p><p>Period of time when this slot can only be uniquely chosen:<br />
+ <span style="line-height: 180%"> Start:
</message>
- <date variable="startunique" hoursminutes="1" anytime="1">
+ <date variable="startunique" hoursminutes="1" anytime="1" aria-label="Period slot uniquely chosen -- start">
<defaultvalue>
my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime');
if ($default eq 'anytime') { return 'anytime' };
@@ -172,8 +186,8 @@
return 'anytime';
</defaultvalue>
</date>
- <message><br /> End: </message>
- <date variable="endunique" hoursminutes="1" anytime="1">
+ <message></span><br /><span style="line-height: 180%"> End: </message>
+ <date variable="endunique" hoursminutes="1" anytime="1" aria-label="Period slot uniquely chosen -- end">
<defaultvalue>
my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime');
if ($default eq 'anytime') { return 'anytime' };
@@ -188,7 +202,10 @@
</validator>
</date>
<message>
- </p><p>Message(s) triggered by reservation change by student
+ </span></p>
+ <span aria-hidden="true">Message(s) triggered by reservation change by student</span><div>
+ <fieldset class="LC_borderless" style="line-height: 155%;">
+ <legend class="LC_visually_hidden">Message(s) triggered by reservation change by student</legend>
</message>
<choices variable="reservationmsg">
<choice computer='only_student'>Sent to student</choice>
@@ -201,6 +218,9 @@
return 'none';
</defaultvalue>
</choices>
+ <message>
+ </fieldset></div>
+ </message>
</condition>
<condition>
<clause>$helper->{'VARS'}{'type'} eq 'preassigned'</clause>
@@ -210,9 +230,10 @@
delete($helper->{'VARS'}{'maxspace'});
</exec>
<message>
- </p><p>Period of time when this slot can only be uniquely assigned:<br /> Start:
+ <p>Period of time when this slot can only be uniquely assigned:<br />
+ <span style="line-height: 180%"> Start:
</message>
- <date variable="startunique" hoursminutes="1" anytime="1">
+ <date variable="startunique" hoursminutes="1" anytime="1" aria-label="Period slot uniquely assigned -- start">
<defaultvalue>
my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime');
if ($default eq 'anytime') { return 'anytime' };
@@ -220,8 +241,8 @@
return 'anytime';
</defaultvalue>
</date>
- <message><br /> End: </message>
- <date variable="endunique" hoursminutes="1" anytime="1">
+ <message></span><br /><span style="line-height: 180%"> End: </message>
+ <date variable="endunique" hoursminutes="1" anytime="1" aria-label="Period slot uniquely assigned -- end">
<defaultvalue>
my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime');
if ($default eq 'anytime') { return 'anytime' };
@@ -235,9 +256,12 @@
return undef;
</validator>
</date>
+ <message></span></message>
</condition>
<message>
- </p><p>Proctored access:
+ </p><span aria-hidden="true">Proctored access:</span><div>
+ <fieldset class="LC_borderless" style="line-height: 155%;">
+ <legend class="LC_visually_hidden">Proctored access</legend>
</message>
<choices variable="useproctor">
<choice computer='no'>No proctor checkin required for access.</choice>
@@ -248,9 +272,8 @@
return 'no';
</defaultvalue>
</choices>
-
<message>
- </p><p>Secret word proctors use to checkin users:<br />
+ </fieldset></div><p><label>Secret word proctors use to checkin users:<br />
</message>
<string variable="secret" size="12">
<validator>
@@ -261,10 +284,14 @@
</defaultvalue>
</string>
<message>
- </p><p>Slot is:
+ </label></p>Slot is:
</message>
<helpicon file="Slot_ChoosingResources" />
-
+ <message>
+ <div>
+ <fieldset class="LC_borderless" style="line-height: 155%;">
+ <legend class="LC_visually_hidden">Slot usability</legend>
+ </message>
<choices variable="restricttosymb">
<choice nextstate="PROCTOR" computer='any'>usable for any resource.</choice>
<choice nextstate="MAPSELECT" computer='map'>restricted to resources in specific folder(s)/composite page(s).</choice>
@@ -288,9 +315,8 @@
}
</defaultvalue>
</choices>
-
<message>
- </p><p>IP restrictions -- allow from all except: <br />
+ </fieldset></div><p><label>IP restrictions -- allow from all except: <br />
</message>
<string variable="ipdeny" size="30">
@@ -303,7 +329,7 @@
</string>
<message>
- </p><p>IP restrictions -- deny from all except: <br />
+ </label></p><p><label>IP restrictions -- deny from all except: <br />
</message>
<string variable="ipallow" size="30">
@@ -316,7 +342,9 @@
</string>
<message>
- </p><p>Does each student need to use a unique IP address to access a resource with this slot?</p>
+ </label></p>Does each student need to use a unique IP address to access a resource with this slot?<div>
+ <fieldset class="LC_borderless" style="line-height: 155%;">
+ <legend class="LC_visually_hidden">Uniqueness if student IP address</legend>
</message>
<choices variable="iptied">
<choice computer='no'>No. The student's IP address is not tied for later access to the same resource. </choice>
@@ -329,7 +357,7 @@
return 'no';
</defaultvalue>
</choices>
- <message> </p> </message>
+ <message> </fieldset></div> </message>
</state>
More information about the LON-CAPA-cvs
mailing list