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

raeburn raeburn at source.lon-capa.org
Wed Apr 29 10:53:14 EDT 2026


raeburn		Wed Apr 29 14:53:14 2026 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  - WCAG 2 compliance for first Custom Role editing screen.
    Group form elements in fieldset with legend.
    Replace use of <table> for layout with <div>.
    Include labels for form elements.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.492 loncom/interface/loncreateuser.pm:1.493
--- loncom/interface/loncreateuser.pm:1.492	Sun Jan 18 05:22:52 2026
+++ loncom/interface/loncreateuser.pm	Wed Apr 29 14:53:14 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.492 2026/01/18 05:22:52 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.493 2026/04/29 14:53:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -978,35 +978,36 @@
             $r->print('<form action="/adm/createuser" method="post" name="docustom">'.
                       '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'.
                       '<input type="hidden" name="phase" value="selected_custom_edit" />'.
-                      '<h3>'.$lt{'ecrp'}.'</h3>'.
-                      &Apache::loncommon::start_data_table().
-                      &Apache::loncommon::start_data_table_row().
-                      '<td>');
+                      '<fieldset class="LC_wcag"><legend>'.$lt{'ecrp'}.'</legend>'.
+                      '<div role="grid" class="LC_grid" style="margin: 0; padding: 0;">'.
+                      '<div role="row" class="LC_grid_row" style="line-height: 160%;">'.
+                      '<div role="gridcell" class="LC_grid_cell" style="vertical-align: middle;">');
             if (keys(%existingroles) > 0) {
-                $r->print('<br /><label><input type="radio" name="customroleaction" value="new" checked="checked" onclick="setCustomFields();" /><b>'.$newroletext.'</b></label>');
+                $r->print('<label><input type="radio" name="customroleaction" value="new" checked="checked" onclick="setCustomFields();" />'.$newroletext.'</label>');
             } else {
-                $r->print('<br /><input type="hidden" name="customroleaction" value="new" /><b>'.$newroletext.'</b>');
+                $r->print('<input type="hidden" name="customroleaction" value="new" />'.$newroletext);
             }
-            $r->print('</td><td align="center">'.$lt{'nr'}.'<br /><input type="text" size="15" name="newrolename" onfocus="setCustomAction('."'new'".');" /></td>'.
-                      &Apache::loncommon::end_data_table_row());
+            $r->print('</div>'.
+                      '<div role="gridcell" class="LC_grid_cell" style="text-align: center;">'.
+                      '<label>'.$lt{'nr'}.'<br /><input type="text" size="15" name="newrolename" onfocus="setCustomAction('."'new'".');" /></label></div></div>');
             if (keys(%existingroles) > 0) {
-                $r->print(&Apache::loncommon::start_data_table_row().'<td><br />'.
-                          '<label><input type="radio" name="customroleaction" value="edit" onclick="setCustomFields();"/><b>'.
-                          &mt('View/Modify existing role:').'</b></label></td>'.
-                          '<td align="center"><br />'.
-                          '<select name="rolename" onchange="setCustomAction('."'edit'".');">'.
+                $r->print('<div role="row" class="LC_grid_row" style="line-height: 180%;">'.
+                          '<div role="gridcell" class="LC_grid_cell">'.
+                          '<label><input type="radio" name="customroleaction" value="edit" onclick="setCustomFields();"/>'.
+                          &mt('View/Modify existing role:').'</label></div>'.
+                          '<div role="gridcell" class="LC_grid_cell">'.
+                          '<select name="rolename" onchange="setCustomAction('."'edit'".');" aria-label="'.&mt('Existing role').'">'.
                           '<option value="" selected="selected">'.
-                          &mt('Select'));
+                          &mt('Select').'</option>');
                 foreach my $role (sort(keys(%existingroles))) {
                     $r->print('<option value="'.$role.'">'.$role.'</option>');
                 }
-                $r->print('</select>'.
-                          '</td>'.
-                          &Apache::loncommon::end_data_table_row());
+                $r->print('</select></div></div>');
             }
-            $r->print(&Apache::loncommon::end_data_table().'<p>'.
+            $r->print('</div></fieldset>'.
+                      '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
                       '<input name="customeditor" type="submit" value="'.
-                      $lt{'cre'}.'" /></p>'.
+                      $lt{'cre'}.'" />'.
                       '</form>');
         }
     } else {
@@ -9497,7 +9498,17 @@
             $ineffect = $customstatus;
         }
         if ($permission->{'owner'}) {
-            $output .= '<input type="checkbox" name="'.$role.'_override" value="'.$priv.'"'.$checked.' />';
+            my $no_mt_privtext = $Apache::lonnet::prp{$priv}{'std'};
+            if ($crstype eq 'Community') {
+                $no_mt_privtext = $Apache::lonnet::prp{$priv}{'alt1'};
+            }
+            my $arialabel;
+            if ($default) {
+                $arialabel = &mt("'$no_mt_privtext' disabled if checked");
+            } else {
+                $arialabel = &mt("'$no_mt_privtext' enabled if checked");
+            }
+            $output .= '<input type="checkbox" name="'.$role.'_override" value="'.$priv.'"'.$checked.' aria-label="'.$arialabel.'" />';
         } else {
             $output .= $customstatus;
         }




More information about the LON-CAPA-cvs mailing list