[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm lonstatistics.pm /interface/statistics lonstudentassessment.pm

raeburn raeburn at source.lon-capa.org
Wed Dec 17 20:10:40 EST 2025


raeburn		Thu Dec 18 01:10:40 2025 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm lonstatistics.pm 
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  - Shorter titles for a couple of tabs, so all tabs remain in a single row.
  - WCAG 2 compliance
     - Headings descend sequentially
     - Include labels for form elements
     - Replace layout table with div
     - Header for each column in a data table by using <th></th>.
  
  
-------------- next part --------------
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.131 loncom/interface/lonquickgrades.pm:1.132
--- loncom/interface/lonquickgrades.pm:1.131	Sat Dec 13 05:56:01 2025
+++ loncom/interface/lonquickgrades.pm	Thu Dec 18 01:10:39 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.131 2025/12/13 05:56:01 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.132 2025/12/18 01:10:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,6 +76,12 @@
         return OK;
     }
 
+    if ($env{'request.course.id'} eq '') {
+        my $requrl = $r->uri;
+        $env{'user.error.msg'} = "$requrl:bre:0:0:Choose course";
+        return HTTP_NOT_ACCEPTABLE;
+    }
+
     my $cangrade=&Apache::lonnet::allowed('mgr');
     my $showPoints =
         (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard')
@@ -195,36 +201,38 @@
     my $stdid;
     if ($cangrade) {
         $r->print("<h2>".&mt("Download Multiple")."</h2>".
+                  '<div>'.
+                  '<div class="LC_floatleft" style="margin-top: 0;">'.
                   '<table cellspacing="5">'."\n".
                   '<tr>'.
-                  '<td align="center"><b>'.&mt('Sections').'</b>'.
+                  '<th><label for="Section">'.&mt('Sections').'</label>'.
                   &Apache::loncommon::help_open_topic("Chart_Sections").
-                  '</td>'.
-                  '<td align="center"><b>'.&mt('Groups').'</b>'.
-                  '</td>'.
-                  '<td align="center"><b>'.&mt('Student Data').'</b>'.
+                  '</th>'.
+                  '<th><label for="Group">'.&mt('Groups').'</label></th>'.
+                  '<th><label for="StudentData">'.&mt('Student Data').'</label>'.
                   &Apache::loncommon::help_open_topic("Chart_Student_Data").
-                  '</td>'.
-                  '<td align="center"><b>'.&mt('Access Status').'</b>'.
+                  '</th>'.
+                  '<th><label for="Status">'.&mt('Access Status').'</label>'.
                   &Apache::loncommon::help_open_topic("Chart_Enrollment_Status").
-                  '</td>'.
-                  '<td align="center"><b>'.&mt('Output Format').'</b>'.
+                  '</th>'.
+                  '<th><label for="chartoutputmode">'.&mt('Output Format').'</label>'.
                   &Apache::loncommon::help_open_topic("Chart_Output_Formats").
-                  '</td><td> </td></tr>'."\n".
+                  '</th></tr>'."\n".
                   '<tr><td align="center">'."\n".
-                  &Apache::lonstatistics::SectionSelect('Section','multiple',5).
+                  &Apache::lonstatistics::SectionSelect('Section','multiple',5,'Section').
                   '</td><td align="center">'.
-                  &Apache::lonstatistics::GroupSelect('Group','multiple',5).
+                  &Apache::lonstatistics::GroupSelect('Group','multiple',5,'Group').
                   '</td><td align="center">'.
-                  &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',5,undef).
+                  &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',5,'StudentData').
                   '</td><td>'."\n".
-                  &Apache::lonhtmlcommon::StatusOptions(undef,undef,5).
+                  &Apache::lonhtmlcommon::StatusOptions(undef,undef,5,'','','Status').
                   '</td><td>'."\n".
                   &Apache::lonstudentassessment::CreateAndParseOutputSelector().
-                  '</td><td>'.
-                  '<input type="submit" name="download" value="'.&mt('Display/Download Multiple Students').'" />'.
                   '</td></tr>'."\n".
-                  '</table>'."\n"
+                  '</table></div>'."\n".
+                  '<div class="LC_floatleft">'.
+                  '<input type="submit" name="download" value="'.&mt('Display/Download Multiple Students').'" />'.
+                  '</div><div style="padding:0;clear:both;margin:0;border:0"></div>'."\n"
                  );
         $r->print("<hr /><h2>".&mt("Display Individual")."</h2>");
         if ($env{'form.uname'}) { $uname=$env{'form.uname'}; }
@@ -242,13 +250,16 @@
             $udom = $env{'user.domain'};
         }
         $r->print('<form method="post" name="quickform" action="/adm/quickgrades">');
-        my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
+        my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom','','','',undef,undef,'','udom').' '.
            &Apache::loncommon::selectstudent_link('quickform','uname','udom');
         $r->print("<p>\n".&Apache::loncommon::studentbrowser_javascript()."\n");
-        $r->print(&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]'
-                 ,'<input type="text" value="'.$uname.'" size="12" name="uname" />'
-                 ,'<input type="text" value="'.$stdid.'" size="12" name="id" /> '
-                 ,$chooseopt).
+        $r->print(&mt('[_1]For User [_2] or [_3]Student/Employee ID [_4] at [_5]Domain[_6]'
+                 ,'<label>',
+                 ,'<input type="text" value="'.$uname.'" size="12" name="uname" /></label>'
+                 ,'<label>',
+                 ,'<input type="text" value="'.$stdid.'" size="12" name="id" /></label>'
+                 ,'<label for="udom">',
+                 ,'</label> '.$chooseopt).
                  '  <input type="submit" name="display" value="'.&mt('Display Individual Student').'" /></p>');
         if (($uname) && ($udom)) {
             $r->print('<p>'.&mt('Full Name: [_1]',&Apache::loncommon::plainname($uname,$udom)).'</p>');
@@ -433,12 +444,12 @@
     $r->print("\n".'<div class="LC_landmark" role="main" id="LC_main_content">');
     $r->print("\n".'<ul class="LC_TabContentBigger" id="main">');
     $r->print("\n".'<li'.($mode eq 'quick'?' class="active"':'').'><a href="/adm/quickgrades"><b>    '.
-                                          ($showPoints?&mt('Individual Points Overview'):($showCategories?&mt('Grades Overview'):&mt('Completion Overview'))).
+                                          ($showPoints?&mt('Points Overview'):($showCategories?&mt('Grades Overview'):&mt('Completion Overview'))).
                                           '    </b></a></li>');
 
     if (!($showPoints || $notshowSPRSlink) || ($allowed_to_view)) {
        $r->print("\n".'<li'.($mode eq 'spreadsheet'?' class="active"':'').'><a href="/adm/'.($allowed_to_view?'classcalc':'studentcalc').'"><b>'.
-                                                                 &mt('Spreadsheet (Detailed)').'</b></a></li>');
+                                                                 &mt('Spreadsheet (Detail)').'</b></a></li>');
     }
     if ($allowed_to_view) {
        $r->print("\n".'<li'.($mode eq 'statistics'?' class="active"':'').'><a href="/adm/statistics"><b>'.
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.166 loncom/interface/lonstatistics.pm:1.167
--- loncom/interface/lonstatistics.pm:1.166	Sat Dec 13 13:33:33 2025
+++ loncom/interface/lonstatistics.pm	Thu Dec 18 01:10:39 2025
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.166 2025/12/13 13:33:33 raeburn Exp $
+# $Id: lonstatistics.pm,v 1.167 2025/12/18 01:10:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -392,7 +392,7 @@
 
 
 sub StudentDataSelect {
-    my ($elementname,$status,$numvisible)=@_;
+    my ($elementname,$status,$numvisible,$elementid)=@_;
     if ($numvisible < 1) {
         return;
     }
@@ -403,7 +403,11 @@
     if ($status ne 'single') {
         $Str .= 'multiple="multiple" ';
     }
-    $Str .= 'size="'.$numvisible.'" >'."\n";
+    $Str .= 'size="'.$numvisible.'"';
+    if ($elementid ne '') {
+        $Str .= ' id="'.$elementid.'"';
+    }
+    $Str .= '>'."\n";
     #
     # Deal with 'all'
     $Str .= '    <option value="all"';
@@ -490,7 +494,7 @@
 
 
 sub map_select {
-    my ($elementname,$status,$numvisible)=@_;
+    my ($elementname,$status,$numvisible,$elementid)=@_;
     if ($numvisible < 1) {
         return;
     }
@@ -504,7 +508,11 @@
     if ($status ne 'single') {
         $form .= 'multiple="multiple" ';
     }
-    $form .= 'size="'.$numvisible.'" >'."\n";
+    $form .= 'size="'.$numvisible.'"';
+    if ($elementid ne '') {
+        $form .= ' id="'.$elementid.'"';
+    }
+    $form .= '>'."\n";
     #
     # Put in option for 'all'
     $form .= '    <option value="all"';
@@ -537,7 +545,7 @@
 
 
 sub SectionSelect {
-    my ($elementname,$status,$numvisible)=@_;
+    my ($elementname,$status,$numvisible,$elementid)=@_;
     if ($numvisible < 1) {
         return;
     }
@@ -558,7 +566,11 @@
     if ($status ne 'single') {
         $Str .= 'multiple="multiple" ';
     }
-    $Str .= 'size="'.$numvisible.'" >'."\n";
+    $Str .= 'size="'.$numvisible.'"';
+    if ($elementid ne '') {
+        $Str .= ' id="'.$elementid.'"';
+    }
+    $Str .= '>'."\n";
     #
     # Loop through the sequences
     foreach my $s (@Sections) {
@@ -577,7 +589,7 @@
 
 
 sub GroupSelect {
-    my ($elementname,$status,$numvisible)=@_;
+    my ($elementname,$status,$numvisible,$elementid)=@_;
     if ($numvisible < 1) {
         return;
     }
@@ -601,7 +613,11 @@
     if ($status ne 'single') {
         $Str .= 'multiple="multiple" ';
     }
-    $Str .= 'size="'.$numvisible.'" >'."\n";
+    $Str .= 'size="'.$numvisible.'"';
+    if ($elementid ne '') {
+        $Str .= ' id="'.$elementid.'"';
+    }
+    $Str .= '>'."\n";
     #
     # Loop through the groups
     foreach my $s (@Groups) {
@@ -1124,7 +1140,7 @@
 Returns a pointer to a hash containing data about the next student
 to be viewed. 
 
-=item &StudentDataSelect($elementname,$status,$numvisible,$selected)
+=item &StudentDataSelect($elementname,$status,$numvisible,$elementid)
 
 Returns html for a selection box allowing the user to choose one (or more) 
 of the fields of student data available (fullname, username, id, section, etc)
@@ -1172,7 +1188,7 @@
 
 =back
 
-=item &SectionSelect($elementname,$status,$numvisible) 
+=item &SectionSelect($elementname,$status,$numvisible,$elementid) 
 
 Returns html for a selection box allowing the user to choose one (or more) 
 of the sections in the course.  
@@ -1189,7 +1205,7 @@
 
 =back
 
-=item &GroupSelect($elementname,$status,$numvisible)
+=item &GroupSelect($elementname,$status,$numvisible,$elementid)
                                                                                     
 Returns html for a selection box allowing the user to choose one (or more)
 of the groups in the course.
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.178 loncom/interface/statistics/lonstudentassessment.pm:1.179
--- loncom/interface/statistics/lonstudentassessment.pm:1.178	Sat Jun 28 14:34:53 2025
+++ loncom/interface/statistics/lonstudentassessment.pm	Thu Dec 18 01:10:40 2025
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.178 2025/06/28 14:34:53 raeburn Exp $
+# $Id: lonstudentassessment.pm,v 1.179 2025/12/18 01:10:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -183,9 +183,9 @@
     if (! exists($env{'form.notfirstrun'}) && ! $single_student_mode) {
         return;
     }
-    $r->print('<h4>'.
+    $r->print('<b>'.
               &Apache::lonstatistics::section_and_enrollment_description().
-              '</h4>');
+              '</b>');
     #
     my $initialize     = \&html_initialize;
     my $output_student = \&html_outputstudent;
@@ -325,39 +325,39 @@
     my $Str = '';
     $Str .= '<table cellspacing="5">'."\n";
     $Str .= '<tr>';
-    $Str .= '<td align="center"><b>'.&mt('Sections').'</b>'.
+    $Str .= '<th><label for="Section">'.&mt('Sections').'</label>'.
 	&Apache::loncommon::help_open_topic("Chart_Sections").
-	'</td>';
-    $Str .= '<td align="center"><b>'.&mt('Groups').'</b>'.
-	'</td>';
-    $Str .= '<td align="center"><b>'.&mt('Student Data').'</b>'.
+	'</th>';
+    $Str .= '<th><label for="Group">'.&mt('Groups').'</label>'.
+	'</th>';
+    $Str .= '<th><label for="StudentData">'.&mt('Student Data').'</label>'.
 	&Apache::loncommon::help_open_topic("Chart_Student_Data").
-	'</td>';
-    $Str .= '<td align="center"><b>'.&mt('Access Status').'</b>'.
+	'</th>';
+    $Str .= '<th><label for="Status">'.&mt('Access Status').'</label>'.
 	&Apache::loncommon::help_open_topic("Chart_Enrollment_Status").
-	'</td>';
-    $Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b>'.
+	'</th>';
+    $Str .= '<th><label for="Maps">'.&mt('Sequences and Folders').'</label>'.
 	&Apache::loncommon::help_open_topic("Chart_Sequences").
-	'</td>';
-    $Str .= '<td align="center"><b>'.&mt('Output Format').'</b>'.
+	'</th>';
+    $Str .= '<th><label for="chartoutputmode">'.&mt('Output Format').'</label>'.
         &Apache::loncommon::help_open_topic("Chart_Output_Formats").
-        '</td>';
-    $Str .= '<td align="center"><b>'.&mt('Output Data').'</b>'.
+        '</th>';
+    $Str .= '<th><label for="chartoutputdata">'.&mt('Output Data').'</label>'.
         &Apache::loncommon::help_open_topic("Chart_Output_Data").
-        '</td>';
+        '</th>';
     $Str .= '</tr>'."\n";
     #
     $Str .= '<tr><td align="center">'."\n";
-    $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
+    $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5,'Section');
     $Str .= '</td><td align="center">';
-    $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
+    $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5,'Group');
     $Str .= '</td><td align="center">';
     $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',
-                                                      5,undef);
+                                                      5,'StudentData');
     $Str .= '</td><td>'."\n";
-    $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
+    $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5,'','','Status');
     $Str .= '</td><td>'."\n";
-    $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5);
+    $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5,'Maps');
     $Str .= '</td><td>'."\n";
     $Str .= &CreateAndParseOutputSelector();
     $Str .= '</td><td>'."\n";
@@ -443,6 +443,7 @@
 sub CreateAndParseOutputSelector {
     my $Str = '';
     my $elementname = 'chartoutputmode';
+    my $elementid = 'chartoutputmode';
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             [$elementname]);
     #
@@ -462,7 +463,7 @@
 
     #
     # Build the form element
-    $Str = qq/<select size="5" name="$elementname">/;
+    $Str = qq/<select size="5" name="$elementname" id="$elementid">/;
     foreach my $option (@OutputOptions) {
         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
         $Str .= ' selected="selected"' if ($option->{'value'} eq $selected);
@@ -566,6 +567,7 @@
 sub CreateAndParseOutputDataSelector {
     my $Str = '';
     my $elementname = 'chartoutputdata';
+    my $elementid = 'chartoutputdata';
     #
     my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
     $selected = 'scores' if (!$selected);
@@ -579,7 +581,7 @@
     }
     #
     # Build the form element
-    $Str = qq/<select size="5" name="$elementname">/;
+    $Str = qq/<select size="5" name="$elementname" id="$elementid">/;
     foreach my $option (@OutputDataOptions) {
         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
         $Str .= ' selected="selected"' if ($option->{'value'} eq $chosen_output->{'value'});
@@ -681,11 +683,11 @@
     }
 
     #
-    $r->print("<h3>".$env{'course.'.$env{'request.course.id'}.'.description'}.
-              "  ".&Apache::lonlocal::locallocaltime(time)."</h3>");
+    $r->print("<h2 class=\"LC_heading_2\">".$env{'course.'.$env{'request.course.id'}.'.description'}.
+              "  ".&Apache::lonlocal::locallocaltime(time)."</h2>");
     #
     if ($chosen_output->{'base'} !~ /^final table/) {
-        $r->print("<h3>".&mt($chosen_output->{'shortdesc'})."</h3>");        
+        $r->print("<h3>".&mt($chosen_output->{'shortdesc'})."</h3>");
     }
     my $Str = "<pre>\n";
     # First, the @StudentData fields need to be listed


More information about the LON-CAPA-cvs mailing list