[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm
raeburn
raeburn at source.lon-capa.org
Sun Feb 23 00:16:01 EST 2025
raeburn Sun Feb 23 05:16:01 2025 EDT
Modified files:
/loncom/auth lonroles.pm
Log:
- WCAG 2 compliance.
-------------- next part --------------
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.375 loncom/auth/lonroles.pm:1.376
--- loncom/auth/lonroles.pm:1.375 Fri Dec 20 00:24:39 2024
+++ loncom/auth/lonroles.pm Sun Feb 23 05:16:01 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.375 2024/12/20 00:24:39 raeburn Exp $
+# $Id: lonroles.pm,v 1.376 2025/02/23 05:16:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -181,6 +181,7 @@
</script>
ENDREDIR
}
+ $r->print('<div class="LC_landmark" role="main">'."\n");
return;
}
@@ -210,6 +211,7 @@
// ]]>
</script>
$link
+</div>
$end_page
END
return;
@@ -682,17 +684,24 @@
$env{'environment.key.'.$cdom.'_'.$cnum},
$authdom,$authnum)) {
# there is no valid key
+ my $swinfo=&Apache::lonmenu::rawconfig();
+ my $crumbtext = 'User Roles';
+ my $show_course=&Apache::loncommon::show_course();
+ if ($show_course) {
+ $crumbtext = 'Courses';
+ }
if ($env{'form.newkey'}) {
# student attempts to register a new key
&Apache::loncommon::content_type($r,'text/html');
&Apache::loncommon::no_cache($r);
$r->send_http_header;
- my $swinfo=&Apache::lonmenu::rawconfig();
+ my $pagetitle = 'Verifying Access Key to Unlock this Course';
+ my $brcrum =[{href=>"/adm/roles",text=>$crumbtext},
+ {href=>"/adm/roles",text=>'Verify Access Key'}];
my $start_page=&Apache::loncommon::start_page
- ('Verifying Access Key to Unlock this Course');
+ ($pagetitle, undef,{bread_crumbs=>$brcrum,});
my $end_page=&Apache::loncommon::end_page();
- my $buttontext=&mt('Enter Course');
- my $message=&mt('Successfully registered key');
+ my ($buttontext,$message,$inputitem,$accessheader);
my $ip = &Apache::lonnet::get_requestor_ip();
my $assignresult=
&Apache::lonnet::assign_access_key(
@@ -706,38 +715,60 @@
,&Apache::lonlocal::locallocaltime($now)
,$trolecode)
);
- unless ($assignresult eq 'ok') {
- $assignresult=~s/^error\:\s*//;
- $message=&mt($assignresult).
- '<br /><a href="/adm/logout">'.
- &mt('Logout').'</a>';
- $buttontext=&mt('Re-Enter Key');
- }
- $r->print(<<ENDENTEREDKEY);
+ if ($assignresult eq 'ok') {
+ $buttontext=&mt('Enter Course');
+ $message=&mt('Successfully registered key');
+ $accessheader = &mt('Access key validation complete');
+ } else {
+ $buttontext=&mt('Submit');
+ $assignresult=~s/^error\:\s*//;
+ $accessheader = &mt('Access key validation incomplete');
+ $message = &mt('Key: [_1]',
+ &HTML::Entities::encode($env{'form.newkey'},
+ '\':<>&"')).' <br />'.
+ &mt('Result').': '.&mt($assignresult);
+ my $labeltext = &mt('Enter access key');
+ $inputitem = '<label>'.$labeltext.':'.
+ '<input type="text" size="20" name="newkey" value="'.
+ $env{'form.newkey'}.'" /></label>';
+ }
+ $r->print(<<"ENDREGKEY");
$start_page
<script type="text/javascript">
// <![CDATA[
$swinfo
// ]]>
</script>
-<form action="" method="post">
+<div class="LC_landmark" role="contentinfo">
+<h2 class="LC_heading_2">$accessheader</h2>
+<p>$message</p>
+</div>
+<div class="LC_landmark" role="main">
+<form action="/adm/roles" method="post">
<input type="hidden" name="selectrole" value="1" />
<input type="hidden" name="$trolecode" value="1" />
-<span class="LC_fontsize_large">$message</span><br />
+$inputitem
<input type="submit" value="$buttontext" />
</form>
+</div>
$end_page
-ENDENTEREDKEY
+ENDREGKEY
return OK;
} else {
# print form to enter a new key
&Apache::loncommon::content_type($r,'text/html');
&Apache::loncommon::no_cache($r);
$r->send_http_header;
- my $swinfo=&Apache::lonmenu::rawconfig();
+ my $pagetitle = 'Enter Access Key to Unlock this Course';
+ my $brcrum =[{href=>"/adm/roles",text=>$crumbtext},
+ {href=>"/adm/roles",text=>'Enter Access Key'}];
my $start_page=&Apache::loncommon::start_page
- ('Enter Access Key to Unlock this Course');
+ ($pagetitle,undef,{bread_crumbs=>$brcrum,});
my $end_page=&Apache::loncommon::end_page();
+ my $accessheader = &mt('Access to this course requires an access key');
+ my $preamble = &mt('Once you have successfully entered a valid key, you will no longer be prompted for one when entering the course.');
+ my $labeltext = &mt('Enter access key');
+ my $submittext = &mt('Submit');
$r->print(<<ENDENTERKEY);
$start_page
<script type="text/javascript">
@@ -745,12 +776,17 @@
$swinfo
// ]]>
</script>
+<div class="LC_landmark" role="main">
+<h2 class="LC_heading_2">$accessheader</h2>
+<p>$preamble</p>
<form action="" method="post">
<input type="hidden" name="selectrole" value="1" />
<input type="hidden" name="$trolecode" value="1" />
-<input type="text" size="20" name="newkey" value="$env{'form.newkey'}" />
-<input type="submit" value="Enter key" />
+<label>$labeltext:
+<input type="text" size="20" name="newkey" value="$env{'form.newkey'}" /></label>
+<input type="submit" value="$submittext" />
</form>
+</div>
$end_page
ENDENTERKEY
return OK;
@@ -806,6 +842,9 @@
</script>
ENDCLOSE
&start_loading_course($r,$title,$only_body);
+ if ($only_body) {
+ $r->print('<h1 class="LC_visually_hidden">'.$title.'</h1>');
+ }
my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble);
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Loading ...'));
$r->rflush();
@@ -956,6 +995,7 @@
$env{'course.'.$cdom.'_'.$cnum.'.description'}).
'</p>'.
'<p><a href="'.$furl.'">'.&mt('Please try again.').'</a></p>'.
+ '</div>'.
&Apache::loncommon::end_page());
}
} else {
@@ -1356,17 +1396,18 @@
}
}
if ($nochoose) {
- $r->print("<h2>".&mt('Sorry ...')."</h2>\n<span class='LC_error'>".
+ $r->print("<div class=\"LC_landmark\" role=\"main\">
+ <h2>".&mt('Sorry ...')."</h2>\n<span class='LC_error'>".
&mt('This action is currently not authorized.').'</span>');
if ($error && $norolelist) {
- $r->print('<br /><br /><h4><span class="LC_error">'.
+ $r->print('<br /><br /><h3 class="LC_heading_3"><span class="LC_error">'.
&mt('As your session was launched from a web page external to LON-CAPA some course content may be unavailable, including the resource you were trying to access.').
- '</span></h4>'.
- '<h4><span class="LC_error">'.
+ '</span></h3>'.
+ '<h3 class="LC_heading_3"><span class="LC_error">'.
&mt('You may need to login to LON-CAPA directly, or re-launch from a different external system.').
- '</span></h4>');
+ '</span></h3>');
}
- $r->print(&Apache::loncommon::end_page());
+ $r->print('</div>'.&Apache::loncommon::end_page());
return OK;
} else {
if ($updateresult || $reqauthor || $hotlist) {
@@ -1961,7 +2002,7 @@
.&Apache::loncommon::start_data_table('LC_textsize_mobile')
.&Apache::loncommon::start_data_table_header_row()
);
- if (!$nochoose) { $r->print('<th> </th>'); }
+ if (!$nochoose) { $r->print('<th><span class="LC_visually_hidden">'.&mt('Action').'</span></th>'); }
$r->print('<th>'.&mt('User Role').'</th>'
.'<th>'.&mt('Extent').'</th>'
.'<th>'.&mt('Start').'</th>'
@@ -3456,7 +3497,7 @@
foreach my $link (@links) {
$funcs .= &Apache::lonhtmlcommon::add_item_funclist(
'<a href="'.$link->[0].'" class="LC_menubuttons_link">'.
- '<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].'" />'.
+ '<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].' '.&mt('icon').'" aria-hidden="true" />'.
$link->[2].'</a>');
}
$funcs .= &Apache::lonhtmlcommon::end_funclist();
More information about the LON-CAPA-cvs
mailing list