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

raeburn raeburn at source.lon-capa.org
Mon Feb 17 21:38:06 EST 2025


raeburn		Tue Feb 18 02:38:06 2025 EDT

  Modified files:              
    /loncom/interface	createaccount.pm loncommon.pm 
  Log:
  - WCAG 2 compliance.
  
  
-------------- next part --------------
Index: loncom/interface/createaccount.pm
diff -u loncom/interface/createaccount.pm:1.88 loncom/interface/createaccount.pm:1.89
--- loncom/interface/createaccount.pm:1.88	Fri Nov  3 01:12:15 2023
+++ loncom/interface/createaccount.pm	Tue Feb 18 02:38:06 2025
@@ -4,7 +4,7 @@
 # kerberos, or SSO) or an e-mail address. Requests to use an e-mail address as
 # username may be processed automatically, or may be queued for approval.
 #
-# $Id: createaccount.pm,v 1.88 2023/11/03 01:12:15 raeburn Exp $
+# $Id: createaccount.pm,v 1.89 2025/02/18 02:38:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -94,17 +94,24 @@
     my $lonhost = $r->dir_config('lonHostID');
     my $include = $r->dir_config('lonIncludes');
     my $start_page;
+    my $args = {};
 
+    (undef,undef,undef,my $clientmathml,my $clientunicode) =
+        &Apache::loncommon::decode_user_agent();
+    if ($clientunicode && !$clientmathml) {
+        $args->{'browser.unicode'} = 1;
+    }
     my $handle = &Apache::lonnet::check_for_valid_session($r);
     if (($handle ne '') && ($handle !~ /^publicuser_\d+$/)) {
         $start_page =
-            &Apache::loncommon::start_page('Already logged in');
+            &Apache::loncommon::start_page('Already logged in',undef,$args);
         my $end_page =
             &Apache::loncommon::end_page();
-        $r->print($start_page."\n".'<h2>'.&mt('You are already logged in').'</h2>'.
+        $r->print($start_page."\n".'<div class="LC_landmark" role="main">'.
+                  '<h2 class="LC_heading_2">'.&mt('You are already logged in').'</h2>'.
                   '<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
                             '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').
-                  '</p><p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'.$end_page);
+                  '</p><p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p></div>'.$end_page);
         return OK;
     }
 
@@ -139,7 +146,7 @@
             &print_footer($r);
             return OK;
         } else {
-            $start_page = &Apache::loncommon::start_page($title,$js); 
+            $start_page = &Apache::loncommon::start_page($title,$js,$args); 
             &print_header($r,$start_page,$courseid);
             $r->print($output);
             &print_footer($r);    
@@ -152,7 +159,7 @@
     my ($cancreate,$statustocreate,$statusforemail,$emailusername,
         $emailoptions,$verification,$emaildomain,$types,$usertypes,$othertitle) =
         &get_creation_controls($domain,$domconfig{'usercreation'});
-    my ($additems,$pagetitle);
+    my $pagetitle;
     if (ref($cancreate) eq 'ARRAY') {
         unless (($env{'form.token'}) || ($sso_username ne '') || ($env{'form.phase'}) ||
                 ($env{'form.create_with_email'})) {
@@ -161,7 +168,7 @@
                 if ((($usertype eq '') || (!grep(/^\Q$usertype\E$/,@{$statusforemail}))) && 
                     (@{$statusforemail} > 0)) {
                     $js .= &setelements_js($statusforemail,$types,$usertypes,$othertitle);
-                    $additems = {'add_entries' => { 'onload' => "setElements();"} };
+                    $args->{'add_entries'} = { 'onload' => "setElements();"};
                     if ((@{$cancreate} == 1) && (@{$statusforemail} > 0)) {
                         $pagetitle = 'Select affiliation';
                     }
@@ -171,10 +178,10 @@
             }
         }
     }
-    $start_page = &Apache::loncommon::start_page($title,$js,$additems);
+    $start_page = &Apache::loncommon::start_page($title,$js,$args);
     if (@{$cancreate} == 0) {
         &print_header($r,$start_page,$courseid,$pagetitle);
-        my $output = '<h3>'.&mt('Account creation unavailable').'</h3>'.
+        my $output = '<h2 class="LC_heading_2">'.&mt('Account creation unavailable').'</h2>'.
                      '<span class="LC_warning">'.
                      &mt('Creation of a new user account using an institutional log-in ID or e-mail verification is not permitted for: [_1].',$domdesc).
                      '</span><br /><br />';
@@ -188,7 +195,7 @@
         my ($msg,$sso_logout);
         $sso_logout = &sso_logout_frag($r,$domain);
         if (grep(/^sso$/,@{$cancreate})) {
-            $msg = '<h3>'.&mt('Account creation').'</h3>'.
+            $msg = '<h2 class="LC_heading_2">'.&mt('Account creation').'</h2>'.
                    &mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution.").'<br />';
             my $shibenv;
             if (($r->dir_config('lonOtherAuthen') eq 'yes') && 
@@ -222,7 +229,7 @@
                                     $lonhost,$contact_email,$contact_name,
                                     $sso_logout,$statustocreate,$shibenv);
         } else {
-            $msg = '<h3>'.&mt('Account creation unavailable').'</h3>'.
+            $msg = '<h2 class="LC_heading_2">'.&mt('Account creation unavailable').'</h2>'.
                    '<span class="LC_warning">'.&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution, and you are not permitted to create one.").'</span><br /><br />'.&mt('Please contact the [_1] ([_2]) for assistance.',$contact_name,$contact_email).'<hr />'.
                    $sso_logout;
         }
@@ -614,7 +621,7 @@
         if (grep(/^login$/,@{$cancreate})) {
             my %domdefaults = &Apache::lonnet::get_domain_defaults($domain);
             if ((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) {
-                $output = '<div class="LC_left_float"><h3>'.$lt{'crac'}.'</h3>';
+                $output = '<div class="LC_left_float"><h2 class="LC_heading_2">'.$lt{'crac'}.'</h2>';
                 $output .= &mt('If you already have a log-in ID at this institution [_1]you may be able to use it for LON-CAPA.','<br />').
                            '<br /><br />'.
                            $lt{'type'}.
@@ -624,7 +631,7 @@
             }
         }
         if (grep(/^email$/,@{$cancreate})) {
-            $output .= '<div class="LC_left_float"><h3>'.$lt{'crae'}.'</h3>';
+            $output .= '<div class="LC_left_float"><h2 class="LC_heading_2">'.$lt{'crae'}.'</h2>';
             if ($usertype ne '') {
                 if ((ref($statusforemail) eq 'ARRAY') && (@{$statusforemail} > 0)) {
                     unless (grep(/^\Q$usertype\E$/,@{$statusforemail})) {
@@ -640,9 +647,9 @@
                 unless (grep(/^default$/, at posstypes)) {
                     push(@posstypes,'default');
                 }
-                $output .= '<p>'.&mt('Choose your affiliation at [_1]',$domdesc).'</p>'."\n".
-                           '<form name="reportstatus" id="LC_reportstatus" action="/adm/createaccount" method="post" '.
-                           'onsubmit="return checkVerification();"><p>';
+                $output .= '<form name="reportstatus" id="LC_reportstatus" action="/adm/createaccount" method="post" '.
+                           'onsubmit="return checkVerification();"><fieldset><legend>'.
+                           &mt('Choose your affiliation at [_1]',$domdesc).'</legend>';
                 foreach my $type (@posstypes) {
                     my $name;
                     if ($type eq 'default') {
@@ -665,7 +672,8 @@
                 if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) {
                     $output .= "\n".'<input type="hidden" name="courseid" value="'.$env{'form.courseid'}.'" />';
                 }
-                $output .= '</p>'."\n".'<p><input type="submit" name="reportedtype" value="'.&mt('Submit').'" /></p></form>';
+                $output .= "\n".'<p><input type="submit" name="reportedtype" value="'.&mt('Submit').'" />'.
+                           '</p></fieldset></form>'."\n";
             } else {
                 my ($captchaform,$error,$captcha,$recaptchaversion) = 
                     &Apache::loncommon::captcha_display('usercreation',$lonhost);
@@ -739,15 +747,15 @@
     my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount',
                                        $lonhost);
     $output = &serverform($logtoken,$lonhost,undef,$courseid,$context);
-    my $unameform = '<input type="text" name="uname" size="20" value="" autocomplete="off" />';
-    my $upassform = '<input type="password" name="upass'.$now.'" size="20" autocomplete="new-password" />';
+    my $unameform = '<input type="text" name="uname" id="uname" size="20" value="" autocomplete="off" />';
+    my $upassform = '<input type="password" name="upass'.$now.'" id="upass'.$now.'" size="20" autocomplete="new-password" />';
     $output .= '<form name="client" method="post" action="" onsubmit="return(send('."'server','client'".'));">'."\n".
                &Apache::lonhtmlcommon::start_pick_box()."\n".
-               &Apache::lonhtmlcommon::row_title($titles{$context},
+               &Apache::lonhtmlcommon::row_title('<label for="uname">'.$titles{$context}.'</label>',
                                                  'LC_pick_box_title')."\n".
                $unameform."\n".
                &Apache::lonhtmlcommon::row_closure(1)."\n".
-               &Apache::lonhtmlcommon::row_title(&mt('Password'),
+               &Apache::lonhtmlcommon::row_title('<label for="upass'.$now.'">'.&mt('Password').'</label>',
                                                 'LC_pick_box_title')."\n".
                $upassform;
     if ($context eq 'selfenroll') {
@@ -761,7 +769,8 @@
         $output .= '<input type="hidden" name="udom" value="'.$domain.'" />';
     }
     $output .= &Apache::lonhtmlcommon::row_closure(1).
-               &Apache::lonhtmlcommon::row_title().
+               &Apache::lonhtmlcommon::row_title('<span class="LC_visually_hidden">'.
+                                                 &mt('Submit').'</span>','','','',1).
                '<br /><input type="submit" name="username_validation" value="'.
                $submit_text.'" />'."\n";
     if ($context eq 'selfenroll') {
@@ -890,7 +899,7 @@
                               $contact_email,$courseid,$emailusername,$usertype,
                               $uname);
     }
-    return $output;
+    return '<div class="LC_landmark" role="main">'.$output.'</div>';
 }
 
 sub call_rulecheck {
@@ -910,7 +919,7 @@
 sub send_token {
     my ($domain,$email,$server,$domdesc,$contact_name,$contact_email,$courseid,$emailusername,
         $usertype,$uname) = @_;
-    my $msg = '<h3>'.&mt('Account creation status').'</h3>'.
+    my $msg = '<h2 class="LC_heading_2">'.&mt('Account creation status').'</h2>'.
               &mt('Thank you for your request to create a new LON-CAPA account.').
               '<br /><br />';
     my $now = time;
@@ -1538,7 +1547,7 @@
     } else {
         $url = "/adm/createaccount";
     }
-    my $output = '<h4>'.&mt('Authentication failed').'</h4><div class="LC_warning">'.
+    my $output = '<h3 class="LC_heading_3">'.&mt('Authentication failed').'</h3><div class="LC_warning">'.
                  &mt('Username and/or password could not be authenticated.').
                  '</div>'.
                  &mt('Please check the username and password.').'<br /><br />';
@@ -1617,7 +1626,7 @@
         }
     }
     if ($checkfail) { 
-        $msg = '<br /><h4>'.&mt('Account creation unavailable').'</h4>';
+        $msg = '<br /><h3 class="LC_heading_3">'.&mt('Account creation unavailable').'</h3>';
         if ($checkfail eq 'username') {
             $msg .= '<span class="LC_warning">'.
                      &mt('A LON-CAPA account may not be created with the username you use.').
@@ -1643,18 +1652,18 @@
         if ($rowcount) {
             if ($editable) {
                 if ($courseid ne '') { 
-                    $msg = '<br /><h4>'.&mt('User information').'</h4>';
+                    $msg = '<br /><h3 class="LC_heading_3">'.&mt('User information').'</h3>';
                 }
                 $msg .= &mt('To create one, use the table below to provide information about yourself, then click the [_1]Create LON-CAPA account[_2] button.','<span class="LC_cusr_emph">','</span>').'<br />';
             } else {
                  if ($courseid ne '') {
-                     $msg = '<h4>'.&mt('Review user information').'</h4>';
+                     $msg = '<h3 class="LC_heading_3">'.&mt('Review user information').'</h3>';
                  }
                  $msg .= &mt('A user account will be created with information displayed in the table below, when you click the [_1]Create LON-CAPA account[_2] button.','<span class="LC_cusr_emph">','</span>').'<br />';
             }
         } else {
             if ($courseid ne '') {
-                $msg = '<h4>'.&mt('Confirmation').'</h4>';
+                $msg = '<h3 class="LC_heading_3">'.&mt('Confirmation').'</h3>';
             }
             $msg .= &mt('Confirm that you wish to create an account.');
         }
@@ -1795,7 +1804,7 @@
 
 sub invalid_state {
     my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_;
-    my $msg = '<h3>'.&mt('Account creation unavailable').'</h3><span class="LC_error">';
+    my $msg = '<h2 class="LC_heading_2">'.&mt('Account creation unavailable').'</h2><span class="LC_error">';
     if ($error eq 'baduseremail') {
         $msg .= &mt('The e-mail address you provided does not appear to be a valid address.');
     } elsif ($error eq 'badusername') {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1456 loncom/interface/loncommon.pm:1.1457
--- loncom/interface/loncommon.pm:1.1456	Mon Feb 17 18:48:06 2025
+++ loncom/interface/loncommon.pm	Tue Feb 18 02:38:06 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1456 2025/02/17 18:48:06 raeburn Exp $
+# $Id: loncommon.pm,v 1.1457 2025/02/18 02:38:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7061,7 +7061,7 @@
                 return $bodytag;
             }
 
-            $bodytag .= '<div class="LC_landmark" role="navigation" aria-label="'.$labeltext.'">';
+            $bodytag .= '<div class="LC_landmark" style="margin: 3px 0 0 0;" role="navigation" aria-label="'.$labeltext.'">';
             unless ($env{'request.symb'} =~ m/\.page___\d+___/) {
                 $bodytag .= qq|<div id="LC_nav_bar">$left $role</div>|;
             }
@@ -7072,8 +7072,9 @@
                 $dc_info = &dc_courseid_toggle($dc_info);
             }
             unless (($realm eq '') && ($dc_info eq '')) {
-                $bodytag .= qq|<div id="LC_realm">$realm $dc_info</div>|;
+                $bodytag .= qq|<div id="LC_realm" role="complementary">$realm $dc_info</div>|;
             }
+            $bodytag .= qq|<div style="clear: both; margin: 5px 0 0 0;"></div>|;
         }
 
         #if directed to not display the secondary menu, don't.  


More information about the LON-CAPA-cvs mailing list