[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm lonuserutils.pm

raeburn raeburn at source.lon-capa.org
Mon May 25 21:52:21 EDT 2026


raeburn		Tue May 26 01:52:21 2026 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm lonuserutils.pm 
  Log:
  - WCAG 2.2 compliance for Domain Coordinator's "Support settings" config.
    - Replace use of <table> for layout with <div>.
    - Include labels for form elements.
  
  
-------------- next part --------------
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.496 loncom/interface/loncreateuser.pm:1.497
--- loncom/interface/loncreateuser.pm:1.496	Tue May  5 21:36:01 2026
+++ loncom/interface/loncreateuser.pm	Tue May 26 01:52:21 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.496 2026/05/05 21:36:01 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.497 2026/05/26 01:52:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -9288,17 +9288,17 @@
                           ' onclick="helpdeskAccess('."'$role'".');"'.$disabled.' />'.$lt{$access}.'</label>');
                 if ($access eq 'status') {
                     $r->print('<div id="'.$role.'_bystatus" style="display:'.$displaydiv{$access}.'">'.
-                              &Apache::lonuserutils::adhoc_status_types($cdom,undef,$role,$selected{$access},
+                              &Apache::lonuserutils::adhoc_status_types($cdom,$description{$role},undef,$role,$selected{$access},
                                                                         $othertitle,$usertypes,$types,$disabled).
                               '</div>');
                 } elsif (($access eq 'inc') && (keys(%domhelpdesk) > 0)) {
                     $r->print('<div id="'.$role.'_notinc" style="display:'.$displaydiv{$access}.'">'.
-                              &Apache::lonuserutils::adhoc_staff($access,undef,$role,$selected{$access},
+                              &Apache::lonuserutils::adhoc_staff($access,$description{$role},undef,$role,$selected{$access},
                                                                  \%domhelpdesk,$disabled).
                               '</div>');
                 } elsif (($access eq 'exc') && (keys(%domhelpdesk) > 0)) {
                     $r->print('<div id="'.$role.'_notexc" style="display:'.$displaydiv{$access}.'">'.
-                              &Apache::lonuserutils::adhoc_staff($access,undef,$role,$selected{$access},
+                              &Apache::lonuserutils::adhoc_staff($access,$description{$role},undef,$role,$selected{$access},
                                                                  \%domhelpdesk,$disabled).
                               '</div>');
                 }
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.233 loncom/interface/lonuserutils.pm:1.234
--- loncom/interface/lonuserutils.pm:1.233	Mon May  4 19:42:58 2026
+++ loncom/interface/lonuserutils.pm	Tue May 26 01:52:21 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.233 2026/05/04 19:42:58 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.234 2026/05/26 01:52:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7959,19 +7959,30 @@
 }
 
 sub adhoc_status_types {
-    my ($cdom,$context,$role,$selectedref,$othertitle,$usertypes,$types,$disabled) = @_;
-    my $output = &Apache::loncommon::start_data_table();
-    my $numinrow = 3;
+    my ($cdom,$name,$context,$role,$selectedref,$othertitle,$usertypes,$types,$disabled) = @_;
+    my $output = '<div class="LC_grid" role="grid" style="margin: 0; border: 1px solid black;">';
+    my $numinrow = 5;
     my $rem;
+    my $labeltext;
+    if ($context eq '') {
+        $labeltext = '';
+    } else {
+        if ($name eq '') {
+            $labeltext = &mt('Institutional status type can use new helpdesk role');
+        } else {
+            $labeltext = &mt('Institutional status type can use helpdesk role: [_1]',
+                             $name);
+        }
+    }
     if (ref($types) eq 'ARRAY') {
         for (my $i=0; $i<@{$types}; $i++) {
             if (defined($usertypes->{$types->[$i]})) {
                 my $rem = $i%($numinrow);
                 if ($rem == 0) {
                     if ($i > 0) {
-                        $output .= &Apache::loncommon::end_data_table_row();
+                        $output .= '</div>';
                     }
-                    $output .= &Apache::loncommon::start_data_table_row();
+                    $output .= '<div class="LC_grid_row" role="row">';
                 }
                 my $check;
                 if (ref($selectedref) eq 'ARRAY') {
@@ -7979,24 +7990,19 @@
                         $check = ' checked="checked"';
                     }
                 }
-                $output .= '<td>'.
+                $output .= '<div class="LC_grid_cell" role="gridcell">'.
                            '<span class="LC_nobreak"><label>'.
                            '<input type="checkbox" name="'.$context.$role.'_status" '.
-                           'value="'.$types->[$i].'"'.$check.$disabled.' />'.
-                           $usertypes->{$types->[$i]}.'</label></span></td>';
+                           'value="'.$types->[$i].'"'.$check.$disabled.' aria-label="'.$labeltext.'" />'.
+                           $usertypes->{$types->[$i]}.'</label></span></div>';
             }
         }
         $rem = @{$types}%($numinrow);
     }
-    my $colsleft = $numinrow - $rem;
     if (($rem == 0) && (@{$types} > 0)) {
-        $output .= &Apache::loncommon::start_data_table_row();
-    }
-    if ($colsleft > 1) {
-        $output .= '<td colspan="'.$colsleft.'">';
-    } else {
-        $output .= '<td>';
+        $output .= '</div><div class="LC_grid_row" role="row">';
     }
+    $output .= '<div class="LC_grid_cell" role="gridcell">';
     my $defcheck;
     if (ref($selectedref) eq 'ARRAY') {
         if (grep(/^default$/,@{$selectedref})) {
@@ -8004,16 +8010,14 @@
         }
     }
     $output .= '<span class="LC_nobreak"><label>'.
-               '<input type="checkbox" name="'.$context.$role.'_status"'.
-               'value="default"'.$defcheck.$disabled.' />'.
-               $othertitle.'</label></span></td>'.
-               &Apache::loncommon::end_data_table_row().
-               &Apache::loncommon::end_data_table();
+               '<input type="checkbox" name="'.$context.$role.'_status" '.
+               'value="default"'.$defcheck.$disabled.' aria-label="'.$labeltext.'" />'.
+               $othertitle.'</label></span></div></div></div>';
     return $output;
 }
 
 sub adhoc_staff {
-    my ($access,$context,$role,$selectedref,$adhocref,$disabled) = @_;
+    my ($access,$name,$context,$role,$selectedref,$adhocref,$disabled) = @_;
     my $output;
     if (ref($adhocref) eq 'HASH') {
         my %by_fullname;
@@ -8028,14 +8032,34 @@
             }
             my @sorted = sort(keys(%by_fullname));
             my $count = scalar(@sorted);
-            $output = &Apache::loncommon::start_data_table();
+            $output = '<div class="LC_grid" role="grid" style="margin: 0; border: 1px solid black;">';
+            my $labeltext;
+            if ($context eq '') {
+                $labeltext = '';
+            } else {
+                if ($access eq 'inc') {
+                    if ($name eq '') {
+                        $labeltext = &mt('Specific user excluded from using new helpdesk role');
+                    } else {
+                        $labeltext = &mt('Specific user excluded from using helpdesk role: [_1]',
+                                         $name);
+                    }
+                } elsif ($access eq 'exc') {
+                    if ($name eq '') {
+                        $labeltext = &mt('Specific user permitted to use new helpdesk role');
+                    } else {
+                        $labeltext = &mt('Specific user permitted to use helpdesk role: [_1]',
+                                         $name);
+                    }
+                }
+            }
             for (my $i=0; $i<$count; $i++) {
                 my $rem = $i%($numinrow);
                 if ($rem == 0) {
                     if ($i > 0) {
-                        $output .= &Apache::loncommon::end_data_table_row();
+                        $output .= '</div>';
                     }
-                    $output .= &Apache::loncommon::start_data_table_row();
+                    $output .= '<div class="LC_grid_row" role="row">';
                 }
                 my $check;
                 my $user = $by_fullname{$sorted[$i]};
@@ -8044,25 +8068,16 @@
                         $check = ' checked="checked"';
                     }
                 }
-                if ($i == $count-1) {
-                    my $colsleft = $numinrow - $rem;
-                    if ($colsleft > 1) {
-                        $output .= '<td colspan="'.$colsleft.'">';
-                    } else {
-                        $output .= '<td>';
-                    }
-                } else {
-                    $output .= '<td>';
-                }
-                $output .= '<span class="LC_nobreak"><label>'.
+                $output .= '<div class="LC_grid_cell" role="gridcell">'.
+                           '<span class="LC_nobreak"><label>'.
                            '<input type="checkbox" name="'.$context.$role.'_staff_'.$access.'" '.
-                           'value="'.$user.'"'.$check.$disabled.' />'.$sorted[$i].
-                           '</label></span></td>';
+                           'value="'.$user.'"'.$check.$disabled.' aria-label="'.$labeltext.'" />'.$sorted[$i].
+                           '</label></span></div>';
                 if ($i == $count-1) {
-                    $output .= &Apache::loncommon::end_data_table_row();
+                    $output .= '</div>';
                 }
             }
-            $output .= &Apache::loncommon::end_data_table();
+            $output .= '</div>';
         }
     }
     return $output;


More information about the LON-CAPA-cvs mailing list