[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm slotrequest.pm

raeburn raeburn at source.lon-capa.org
Thu Mar 20 11:46:05 EDT 2025


raeburn		Thu Mar 20 15:46:05 2025 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm loncommon.pm 
  Log:
  - WCAG 2 compliance.
  
  
-------------- next part --------------
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.148 loncom/interface/slotrequest.pm:1.149
--- loncom/interface/slotrequest.pm:1.148	Tue Mar 18 18:57:28 2025
+++ loncom/interface/slotrequest.pm	Thu Mar 20 15:46:05 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for requesting to have slots added to a students record
 #
-# $Id: slotrequest.pm,v 1.148 2025/03/18 18:57:28 raeburn Exp $
+# $Id: slotrequest.pm,v 1.149 2025/03/20 15:46:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -104,7 +104,7 @@
 
 sub end_page {
     my ($r)=@_;
-    $r->print(&Apache::loncommon::end_page());
+    $r->print('</div>'.&Apache::loncommon::end_page());
 }
 
 sub reservation_js {
@@ -1473,7 +1473,7 @@
             }
         }
         my $showfilter = 'none';
-        $output .= '<fieldset><legend>'.&mt('Actions').'</legend>'."\n".
+        $output .= '<fieldset><legend>'.&mt('Actions').':</legend>'."\n".
                    '<form method="post" name="reservationdisplay_'.$num.
                    '" action="" onsubmit="toggleSlotDisplay(this.form,'."'$num'".');">';
         my @options = ('all','filter');
@@ -1833,40 +1833,36 @@
 <input type="hidden" name="command" value="showslots" />');
     $r->print('<div>');
     $r->print('<table class="inline">
-      <tr><th>'.&mt('Show').'</th>
-          <th>'.&mt('Student Display').'</th>
-          <th>'.&mt('Open').'</th>
-          <th>'.&mt('Slot Name Filter').'</th>
+      <tr><th><label for="show">'.&mt('Show').'</label></th>
+          <th><label for="studisplay">'.&mt('Student Display').'</label></th>
+          <th><label for="when">'.&mt('Open').'</label></th>
+          <th><label for="name_filter_type">'.&mt('Slot Name Filter').'</label></th>
           <th>'.&mt('Options').'</th>
       </tr>
-      <tr><td valign="top">'.&Apache::loncommon::multiple_select_form('show',\@show,6,\%show_fields,\@show_order).
+      <tr><td valign="top">'.&Apache::loncommon::multiple_select_form('show',\@show,6,\%show_fields,\@show_order,'show').
 	      '</td>
            <td valign="top">
          '.&Apache::loncommon::multiple_select_form('studisplay',\@stu_display,
 						    6,\%stu_display_fields,
-						    \@stu_display_order).'
+						    \@stu_display_order,'studisplay').'
            </td>
-           <td valign="top">'.&Apache::loncommon::select_form($when,'when',\%when_fields).
+           <td valign="top">'.&Apache::loncommon::select_form($when,'when',\%when_fields,'','','when').
           '</td>
-           <td valign="top">'.&Apache::loncommon::select_form($name_filter_type,
+           <td valign="top"><span class="LC_nobreak">'.&Apache::loncommon::select_form($name_filter_type,
 						 'name_filter_type',
-						 \%name_filter_type_fields).
-	      '<br />'.
+						 \%name_filter_type_fields,'','','name_filter_type').
+	      ' '.
 	      &Apache::lonhtmlcommon::textbox('name_filter_value',
 					      $env{'form.name_filter_value'},
-					      15).
-          '</td>
+					      15,'aria-label="'.&mt('Name filter').'"').
+          '</span></td>
            <td valign="top">
-            <table>
-              <tr>
-                <td rowspan="2">'.&mt('Deleted slots:').'</td>
-                <td><label>'.$show_radio.&mt('Show').'</label></td>
-              </tr>
-              <tr>
-                <td><label>'.$hide_radio.&mt('Hide').'</label></td>
-              </tr>
-            </table>
-	  </td>
+             <fieldset class="LC_delete_slot">
+              <legend>'.&mt('Deleted slots').'</legend>
+               <span class="LC_nobreak"><label>'.$show_radio.&mt('Show').'</label>   
+               <label>'.$hide_radio.&mt('Hide').'</label></span>
+             </fieldset>
+	   </td>
        </tr>
     </table>');
     $r->print('</div>');
@@ -1874,7 +1870,7 @@
     my $linkstart='<a href="/adm/slotrequest?command=showslots&order=';
     my $tableheader = &Apache::loncommon::start_data_table().
 	              &Apache::loncommon::start_data_table_header_row().'
-	              <th></th>';
+	              <th><span class="LC_visually_hidden">'.&mt('Action').'</span></th>';
     foreach my $which (@show_order) {
 	if ($which ne 'proctor' && exists($show{$which})) {
 	    $tableheader .= '<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>';
@@ -2041,11 +2037,11 @@
         my ($edit,$delete,$showlog,$remove_all);
         if ($mgr) {
 	    $edit=(<<"EDITLINK");
-<a href="/adm/helper/newslot.helper?name=$slot">$lt{'edit'}</a>
+<p class="LC_medium_line"><a href="/adm/helper/newslot.helper?name=$slot">$lt{'edit'}</a></p>
 EDITLINK
 
 	    $delete=(<<"DELETELINK");
-<a href="/adm/slotrequest?command=delete&slotname=$slot">$lt{'delete'}</a>
+<p class="LC_medium_line"><a href="/adm/slotrequest?command=delete&slotname=$slot">$lt{'delete'}</a></p>
 DELETELINK
 
             $remove_all=&remove_link($slot,'remove all').'<br />';
@@ -2058,7 +2054,7 @@
         }
 
         $showlog=(<<"LOGLINK");
-<a href="/adm/slotrequest?command=slotlog&slotname=$slot">$lt{'slotlog'}</a>
+<p class="LC_medium_line"><a href="/adm/slotrequest?command=slotlog&slotname=$slot">$lt{'slotlog'}</a></p>
 LOGLINK
 
 	if ($slots{$slot}{'type'} ne 'schedulable_student') {
@@ -2298,7 +2294,10 @@
     my $slotheader = '<p>'.
                  &mt('Your reservation status for any such assignments is listed below:').
                  '</p>'.
-                 '<table class="LC_data_table LC_tableOfContent" id="LC_slot_reservations">'."\n";
+                 '<table class="LC_data_table LC_tableOfContent" id="LC_slot_reservations">'."\n".
+                 '<tr class="LC_visually_hidden">'.
+                 '<th>'.&mt('Resource or Folder').'</th>'.
+                 '<th colspan="2">'.&mt('Reservation Status').'</th></tr>'."\n";
     my $shownheader = 0;
     my $currmap;
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
@@ -2914,11 +2913,19 @@
     my ($formname,$cdom,$cnum,$curr,$version,$allsymbs) = @_;
     my $nolink = 1;
     my (%titles,%maptitles);
-    my $output = '<br /><table><tr><td valign="top">'.
-                 '<span class="LC_nobreak"><b>'.&mt('Changes/page:').'</b><br />'.
-                 &Apache::lonmeta::selectbox('show',$curr->{'show'},'','',undef,
-                                              (&mt('all'),5,10,20,50,100,1000,10000)).
-                 '</td><td>  </td>';
+    my $output = '<br /><table><tr><th class="LC_log_filter">'.
+                 '<span class="LC_nobreak"><label for="show">'.&mt('Changes/page:').'</label></span></th>'.
+                 '<th class="LC_log_filter">'.&mt('Window during which changes occurred:').'</th>';
+    if (ref($allsymbs) eq 'ARRAY') {
+        $output.= '<th class="LC_log_filter"><label for="resource">'.&mt('Resource').'</label></th>'.
+                  '<th class="LC_log_filter"><label for="chgcontext">'.&mt('Context').'</label></th>';
+    } else {
+        $output.= '<th class="LC_log_filter"><label for="action">'.&mt('Action').'</label></th>';
+    }
+    $output .= '</tr><tr><td class="LC_log_filter">'.
+               &Apache::lonmeta::selectbox('show',$curr->{'show'},'','show',undef,
+                                           (&mt('all'),5,10,20,50,100,1000,10000)).
+               '</td>';
     my $startform =
         &Apache::lonhtmlcommon::date_setter($formname,'log_start_date',
                                             $curr->{'log_start_date'},undef,
@@ -2929,13 +2936,13 @@
                                             undef,undef,undef,undef,undef,undef,$nolink);
     my $crstype = &Apache::loncommon::course_type();
     my %lt = &reservationlog_contexts($crstype);
-    $output .= '<td valign="top"><b>'.&mt('Window during which changes occurred:').
-               '</b><br /><table><tr><td>'.&mt('After:').
-               '</td><td>'.$startform.'</td></tr><tr><td>'.&mt('Before:').'</td><td>'.
-               $endform.'</td></tr></table></td><td>  </td>';
+    $output .= '<td class="LC_log_filter"><table><tr><th>'.&mt('After:').'</th>'.
+               '<td>'.$startform.'</td></tr>'.
+               '<tr><th>'.&mt('Before:').'</th>'.
+               '<td>'.$endform.'</td></tr></table>'.
+               '</td>';
     if (ref($allsymbs) eq 'ARRAY') {
-        $output .= '<td valign="top"><b>'.&mt('Resource').'</b><br />'.
-                   '<select name="resource"><option value="any"';
+        $output .= '<td class="LC_log_filter"><select name="resource" id="resource"><option value="any"';
         if ($curr->{'resource'} eq 'any') {
             $output .= ' selected="selected"';
         }
@@ -2948,8 +2955,8 @@
             }
             $output .= '  <option value="'.$symb.'"'.$selstr.'>'.$title.'</option>';
         }
-        $output .= '</select></td><td>  </td><td valign="top"><b>'.
-                   &mt('Context:').'</b><br /><select name="chgcontext">';
+        $output .= '</select></td>'.
+                   '<td class="LC_log_filter"><select name="chgcontext" id="chgcontext">';
         foreach my $chgtype ('any','user','manage','parameter') {
             my $selstr = '';
             if ($curr->{'chgcontext'} eq $chgtype) {
@@ -2959,8 +2966,7 @@
         }
         $output .= '</select></td>';
     } else {
-        $output .= '<td valign="top"><b>'.&mt('Action').'</b><br />'.
-                   '<select name="action"><option value="any"';
+        $output .= '<td class="LC_log_filter"><select name="action" id="action"><option value="any"';
         if ($curr->{'action'} eq 'any') {
             $output .= ' selected="selected"';
         }
@@ -2974,7 +2980,7 @@
         }
         $output .= '</select></td>';
     }
-    $output .= '<td>  </td></tr></table>'.
+    $output .= '</tr></table>'.
                '<p><input type="submit" value="'.
                &mt('Update Display').'" /></p>'.
                '<p class="LC_info">'.
@@ -3027,12 +3033,12 @@
     my ($r)=@_;
     $r->print(
         &Apache::grades::checkforfile_js()
-       .'<h2>'.&mt('Upload a file containing the slot definitions').'</h2>'
+       .'<h2 class="LC_heading_2">'.&mt('Upload a file containing the slot definitions').'</h2>'
        .'<form method="post" enctype="multipart/form-data"'
        .' action="/adm/slotrequest" name="slotupload">'
        .'<input type="hidden" name="command" value="csvuploadmap" />'
        .&Apache::lonhtmlcommon::start_pick_box()
-       .&Apache::lonhtmlcommon::row_title(&mt('File'))
+       .&Apache::lonhtmlcommon::row_title('<label for="upfile">'.&mt('File').'</label>')
        .&Apache::loncommon::upfile_select_html()
        .&Apache::lonhtmlcommon::row_closure()
        .&Apache::lonhtmlcommon::row_title(
@@ -3065,7 +3071,7 @@
 
     $r->print(
         '<form method="post" enctype="multipart/form-data" action="/adm/slotrequest" name="slotupload">'
-       .'<h2>'.&mt('Identify fields in uploaded list').'</h2>'
+       .'<h2 class="LC_heading_2">'.&mt('Identify fields in uploaded list').'</h2>'
        .'<div class="LC_columnSection">'
        .&Apache::loncommon::help_open_topic(
             'Slot About',&mt('Help on slots'))
@@ -3520,6 +3526,7 @@
         $js = &reservation_js(\%slots,$consumed_uniqueperiods,$available,$got_slots,$symb);
     }
     &start_page($r,$title,$brcrum,$bread_crumbs_component,$js,$mgr);
+    $r->print('<div class="LC_landmark" role="main">'."\n");
 
     if ($env{'form.command'} eq 'manageresv') {
         $allavailable = $available;
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1472 loncom/interface/loncommon.pm:1.1473
--- loncom/interface/loncommon.pm:1.1472	Wed Mar 19 15:18:59 2025
+++ loncom/interface/loncommon.pm	Thu Mar 20 15:46:05 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1472 2025/03/19 15:18:59 raeburn Exp $
+# $Id: loncommon.pm,v 1.1473 2025/03/20 15:46:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8173,6 +8173,13 @@
   background-color: $data_table_light;
 }
 
+td.LC_log_filter,
+th.LC_log_filter {
+  vertical-align: top;
+  text-align: left;
+  padding: 0 4px;
+}
+
 span.LC_helpform_receipt_cat {
   font-weight: bold;
 }
@@ -8720,6 +8727,20 @@
   border: 0;
 }
 
+fieldset.LC_delete_slot {
+  display:inline;
+  margin: 0 4px 4px;
+  padding: 4px;
+}
+
+fieldset.LC_delete_slot > legend {
+  font-weight: normal;
+}
+
+p.LC_medium_line {
+  line-height: 0.85em;
+}
+
 article.geogebraweb div {
     margin: 0;
 }
@@ -15678,12 +15699,12 @@
                  tab   => &mt('Tabulator separated'),
 #                 xml   => &mt('HTML/XML'),
                  );
-    my $Str = '<input type="file" name="upfile" size="50" />'.
-        '<br />'.&mt('Type').': <select name="upfiletype">';
+    my $Str = '<input type="file" name="upfile" id="upfile" size="50" />'.
+        '<br /><label>'.&mt('Type').': <select name="upfiletype">';
     foreach my $type (sort(keys(%Types))) {
         $Str .= '<option value="'.$type.'" >'.$Types{$type}."</option>\n";
     }
-    $Str .= "</select>\n";
+    $Str .= "</select></label>\n";
     return $Str;
 }
 
@@ -15767,9 +15788,9 @@
               &end_data_table_header_row()."\n");
     foreach my $array_ref (@$d) {
 	my ($value,$display,$defaultcol)=@{ $array_ref };
-	$r->print(&start_data_table_row().'<td>'.$display.'</td>');
+	$r->print(&start_data_table_row().'<td><label for="f'.$i.'">'.$display.'</label></td>');
 
-	$r->print('<td><select name="f'.$i.'"'.
+	$r->print('<td><select name="f'.$i.'" id="f'.$i.'"'.
 		  ' onchange="javascript:flip(this.form,'.$i.');">');
 	$r->print('<option value="none"></option>');
 	foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {
@@ -15814,8 +15835,10 @@
               &end_data_table_header_row());
 
     foreach my $key (sort(keys(%{ $samples->[0] }))) {
+        my $num = $i+1;
+        my $labeltext = &HTML::Entities::encode(&mt('Field for data in column [_1]',$num));
 	$r->print(&start_data_table_row().'<td><select name="f'.$i.'"'.
-		  ' onchange="javascript:flip(this.form,'.$i.');">');
+		  ' onchange="javascript:flip(this.form,'.$i.');" aria-label="'.$labeltext.'">');
 	foreach my $option (@$d) {
 	    my ($value,$display,$defaultcol)=@{ $option };
 	    $r->print('<option value="'.$value.'"'.


More information about the LON-CAPA-cvs mailing list