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

raeburn raeburn at source.lon-capa.org
Sun Jan 18 00:27:12 EST 2026


raeburn		Sun Jan 18 05:27:12 2026 EDT

  Modified files:              
    /loncom/interface	selfenroll.pm createaccount.pm 
  Log:
  - WCAG 2 compliance
    - Include landmark for page's main content to support "Skip to main content"
    - Sequential headings
    - Include labels for form elements
    - Replace use of <table> with <div> for layout
  
  
-------------- next part --------------
Index: loncom/interface/selfenroll.pm
diff -u loncom/interface/selfenroll.pm:1.38 loncom/interface/selfenroll.pm:1.39
--- loncom/interface/selfenroll.pm:1.38	Sun Jan 18 02:30:14 2026
+++ loncom/interface/selfenroll.pm	Sun Jan 18 05:27:12 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Allow users to self-enroll in a course
 #
-# $Id: selfenroll.pm,v 1.38 2026/01/18 02:30:14 raeburn Exp $
+# $Id: selfenroll.pm,v 1.39 2026/01/18 05:27:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,7 +60,8 @@
 
     unless ($courseid) {
         &page_header($r,$env{'form.courseid'},$js);
-        $r->print('<h3>'.&mt('Self-enrollment error').'</h3>'.
+        $r->print("\n".'<div class="LC_landmark" role="main" id="LC_main_content">'."\n".
+                  '<h2 class="LC_heading_2">'.&mt('Self-enrollment error').'</h2>'."\n".
                   '<span class="LC_error">'.
                   &mt('Invalid domain or course number').'</span>');
         &page_footer($r);
@@ -81,6 +82,7 @@
         my $jsh=Apache::File->new($include."/londes.js");
         $r->print(<$jsh>);
     }
+    $r->print("\n".'<div class="LC_landmark" role="main" id="LC_main_content">'."\n");
     my ($canenroll,$selfenroll_types,$selfenroll_registered, at cancreate,
         $knownuser,$selfenroll_access_start,$selfenroll_access_end,
         $selfenroll_section,$selfenroll_future,%curr_role,$cdomdesc,
@@ -131,7 +133,7 @@
     }
     $knownuser = &user_is_known();
     if (!$canenroll) {
-        $r->print('<h3>'.&mt('Self-enrollment unavailable').'</h3><span class="LC_warning">'.
+        $r->print('<h2 class="LC_heading_2">'.&mt('Self-enrollment unavailable').'</h2><span class="LC_warning">'.
                   &mt('Self-enrollment is not currently available for this course.').
                   '</span><br /><br />');
         if ($nospace) {
@@ -226,7 +228,7 @@
     &js_escape(\$missing_formitem);
     if ($knownuser) {
         if (keys(%curr_role)) {
-            $r->print('<h3>'.&mt('Self-enrollment unavailable').'</h3>'.
+            $r->print('<h2 class="LC_heading_2">'.&mt('Self-enrollment unavailable').'</h2>'.
                       '<span class="LC_warning">'.&has_role(%curr_role).'</span>');
             &page_footer($r);
             return OK;
@@ -237,7 +239,7 @@
                              $selfenroll_notifylist,$owner,$crstype,$lonhost,$handle);
     } elsif ($env{'form.phase'} eq 'login') {
         my $submit_text = &mt('Log in');
-        $r->print('<h3>'.&mt('Log-in to LON-CAPA').'</h3>');
+        $r->print('<h2 class="LC_heading_2">'.&mt('Log-in to LON-CAPA').'</h2>');
         my $udom = &Apache::lonnet::default_login_domain();
         $r->print(&Apache::createaccount::login_box($now,$lonhost,$courseid,
                                            $submit_text,$udom,'selfenroll'));
@@ -267,7 +269,7 @@
 
 </script>
 END
-        $r->print('<h3>'.&mt('LON-CAPA account required').'</h3>'.
+        $r->print('<h2 class="LC_heading_2">'.&mt('LON-CAPA account required').'</h2>'.
                   &mt('You need to be logged into LON-CAPA to self-enroll in a course.').'<ul><li>'.&mt('If you have an account in LON-CAPA, [_1]log-in[_2].','<a href="javascript:setPath('."'$form','','phase','login'".')">','</a>').'</li>');
         if (@cancreate > 1) {
             $r->print('<li>'.&mt('Otherwise:').'<br />');
@@ -307,7 +309,7 @@
         }
     } else {
         my $cdomdesc = &Apache::lonnet::domain($cdom,'description');
-        $r->print('<h3>'.&mt('LON-CAPA account required').'</h3>');
+        $r->print('<h2 class="LC_heading_2">'.&mt('LON-CAPA account required').'</h2>');
         $r->print(&mt('You must [_1]log-in[_2] to LON-CAPA with an existing account to be able to enroll in this course, as account creation at this institution ([_3]) is not permitted when self-enrolling.','<a href="'.$login_path.'">','</a>',$cdomdesc));
         if ($selfenroll_types ne '*') {
             my ($enrolltypes,$longtypes,$alldoms) =
@@ -363,7 +365,7 @@
     my ($r) = @_;
     $r->print('<form name="backupcrumbs" method="post" action="/adm/coursecatalog">'."\n".
               &Apache::lonhtmlcommon::echo_form_input(['backto','courseid','phase','context']).
-              '</form>'.&Apache::loncommon::end_page());
+              '</form></div>'.&Apache::loncommon::end_page());
     return;
 }
 
@@ -444,7 +446,7 @@
             my ($registered,$instsec,$instcid,$message) = &check_registered($cdom,$cnum);
             $usec = $instsec;
             if (!$registered) {
-                $r->print('<h3>'.&mt('Self-enrollment unavailable').'</h3>'.
+                $r->print('<h2 class="LC_heading_2">'.&mt('Self-enrollment unavailable').'</h2>'.
                           &mt('Self-enrollment is restricted to students officially registered for this course.').'<br />');
                 if ($message) {
                     $r->print($message);
@@ -479,7 +481,7 @@
                 &Apache::lonnet::set_userprivs(\%userroles,\%newrole,\%newgroups);
                 $userroles{'user.role.'.$spec} = $selfenroll_access_start.'.'.$selfenroll_access_end;
                 &Apache::lonnet::appenv(\%userroles,[$role,'cm']);
-                $r->print('<h3>'.&mt('Enrollment process complete').'</h3>');
+                $r->print('<h2 class="LC_heading_2">'.&mt('Enrollment process complete').'</h2>');
                 if ($selfenroll_access_end && $selfenroll_access_end <= $now) {
                     $r->print(&mt('The end date for access to this course for users who self-enroll has passed.').'<br />'.&mt('Consequently, although a new role was created for you in the course, it is an inactive role which does not provide access to the course.'));
                 } else {
@@ -499,7 +501,7 @@
                     }
                 }
             } else {
-                $r->print('<h3>'.&mt('Enrollment incomplete').'</h3>'.
+                $r->print('<h2 class="LC_heading_2">'.&mt('Enrollment incomplete').'</h2>'.
                           &mt('Self-enrollment in this course failed.'));
                 if ($enrollresult ne '') {
                     $r->print('<span class="LC_error">'.$enrollresult.'</span>');
@@ -507,7 +509,7 @@
             }
         }
     } else {
-        $r->print('<h3>'.&mt('Self-enrollment unavailable').'</h3>'.
+        $r->print('<h2 class="LC_heading_2">'.&mt('Self-enrollment unavailable').'</h2>'.
                   &mt('You are not permitted to enroll yourself in this course.').'<br />');
         $r->print(&print_selfenroll_types($longtypes));
     }
Index: loncom/interface/createaccount.pm
diff -u loncom/interface/createaccount.pm:1.92 loncom/interface/createaccount.pm:1.93
--- loncom/interface/createaccount.pm:1.92	Sat Dec 13 05:56:01 2025
+++ loncom/interface/createaccount.pm	Sun Jan 18 05:27:12 2026
@@ -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.92 2025/12/13 05:56:01 raeburn Exp $
+# $Id: createaccount.pm,v 1.93 2026/01/18 05:27:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -768,10 +768,10 @@
                                                 'LC_pick_box_title')."\n".
                $upassform;
     if ($context eq 'selfenroll') {
-        my $udomform = '<input type="text" name="udom" size="10" value="'.
+        my $udomform = '<input type="text" name="udom" id="udom" size="10" value="'.
                         $domain.'" />';
         $output .= &Apache::lonhtmlcommon::row_closure(1)."\n".
-                   &Apache::lonhtmlcommon::row_title(&mt('Domain'),
+                   &Apache::lonhtmlcommon::row_title('<label for="udom">'.&mt('Domain').'</label>',
                                                      'LC_pick_box_title')."\n".
                    $udomform."\n";
     } else {
@@ -783,10 +783,10 @@
                '<br /><input type="submit" name="username_validation" value="'.
                $submit_text.'" />'."\n";
     if ($context eq 'selfenroll') {
-        $output .= '<br /><br /><table width="100%"><tr><td align="right">'.
+        $output .= '<br /><br /><div style="text-align: right;">'.
                    '<span class="LC_fontsize_medium">'.
                    '<a href="/adm/resetpw">'.&mt('Forgot password?').'</a>'.
-                   '</span></td></tr></table>'."\n";
+                   '</span></div>'."\n";
     }
     $output .= &Apache::lonhtmlcommon::row_closure(1)."\n".
                &Apache::lonhtmlcommon::end_pick_box().'<br />'."\n";


More information about the LON-CAPA-cvs mailing list