[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm /interface loncommon.pm slotrequest.pm
raeburn
raeburn at source.lon-capa.org
Mon Mar 31 09:55:09 EDT 2025
raeburn Mon Mar 31 13:55:09 2025 EDT
Modified files:
/loncom/interface slotrequest.pm loncommon.pm
/loncom/homework bridgetask.pm
Log:
- WCAG 2 compliance.
-------------- next part --------------
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.150 loncom/interface/slotrequest.pm:1.151
--- loncom/interface/slotrequest.pm:1.150 Thu Mar 20 17:59:20 2025
+++ loncom/interface/slotrequest.pm Mon Mar 31 13:55:06 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for requesting to have slots added to a students record
#
-# $Id: slotrequest.pm,v 1.150 2025/03/20 17:59:20 raeburn Exp $
+# $Id: slotrequest.pm,v 1.151 2025/03/31 13:55:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -63,6 +63,10 @@
if ($bread_crumbs_component) {
$args->{bread_crumbs_component} = $bread_crumbs_component;
}
+ if ((($env{'form.requestattempt'}) || ($env{'form.context'} eq 'user')) &&
+ ($env{'form.symb'})) {
+ $args->{'bread_crumbs_nomenu'} = 1;
+ }
}
if (($env{'form.requestattempt'}) || ($env{'form.command'} eq 'manageresv')) {
my %loaditems = (
@@ -769,7 +773,7 @@
if (!$result) {
$r->print('<p class="LC_error">'.&mt($msg).'</p>');
} else {
- $r->print("<p>$msg</p>");
+ $r->print($msg);
}
$r->rflush();
}
@@ -1061,7 +1065,8 @@
if ($mgr eq 'F') {
$msg = &mt('Released Reservation for user: [_1]',"$uname:$udom");
} else {
- $msg = '<span style="font-weight: bold;">'.&mt('Released reservation: [_1]',$description).'</span><br /><br />';
+ $msg = '<p style="font-weight: bold;">'.
+ &mt('Released reservation: [_1]',$description).'</p>';
my $person = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'});
my $subject = &mt('Reservation change: [_1]',$description);
my $msgbody = &mt('Reservation released by [_1] for [_2].',$person,$description);
@@ -1446,7 +1451,7 @@
return;
}
if (!@{$available}) {
- $output = '<span class="LC_info">'.&mt('No available times.').'</span>';
+ $output = '<p class="LC_info">'.&mt('No available times.').'</p>';
if ($env{'form.command'} ne 'manageresv') {
my $target = &return_target();
$output .= ' <a href="/adm/flip?postdata=return:" target="'.$target.'">'.
@@ -1457,6 +1462,10 @@
} else {
return $output;
}
+ } elsif ($env{'form.command'} ne 'manageresv') {
+ my $title = &Apache::lonnet::gettitle($symb);
+ my $headertext = &mt('Manage Reservation(s) for [_1]',$title);
+ $output .= '<h2 class="LC_heading_3">'.$headertext.'</h2>';
}
if (@{$available} > 1) {
my $numavailable = scalar(@{$available});
@@ -1522,18 +1531,22 @@
$output .=
'<div id="LC_slotfilter_'.$num.'" style="display:'.$showfilter.'">'.
'<form method="post" name="'.$chooserform.'" action="">'.
- '<table><tr><td>'.&mt('Open after').'</td><td>'.
+ '<table class="LC_manage_reservations"><tr><th>'.&mt('Open after').'</th><td>'.
&Apache::lonhtmlcommon::date_setter($chooserform,'start',$starttime,'','','','','','','',1,1).
- '</td></tr><tr><td>'.&mt('Closed before').'</td><td>'.
+ '</td></tr><tr><th>'.&mt('Closed before').'</th><td>'.
&Apache::lonhtmlcommon::date_setter($chooserform,'end',$endtime,'','','','','','','',1,1).
'</td></tr></table><br />'.
'<input type="button" name="slotfilter" value="Search for reservable slots" onclick="updateSlotDisplay(this.form,'."'$num'".');" />'.
'</form></div><div id="LC_slotsearch_'.$num.'" style="display:none"><hr />';
}
if ($env{'form.command'} eq 'manageresv') {
- $output .= '<table border="0">';
+ $output .= '<table border="0" class="LC_manage_reservations">'.
+ '<tr><th>'.&mt('Action').'</th><th>'.&mt('Name').'</th></tr>';
} else {
- $output .= &Apache::loncommon::start_data_table();
+ $output .= &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ '<th>'.&mt('Action').'</th><th>'.&mt('Name').'</th>'.
+ &Apache::loncommon::end_data_table_header_row();
}
foreach my $slot (@{$available}) {
my $description=&get_description($slot,$slots->{$slot});
@@ -3445,6 +3458,61 @@
return %options;
}
+sub get_user_breadcrumbs {
+ my ($symb) = @_;
+ my ($mapurl, $rid, $resurl) = &Apache::lonnet::decode_symb($symb);
+ return [] unless (&Apache::lonnet::symbverify($symb,$resurl));
+ my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
+ my $maptitle = &Apache::lonnet::gettitle($mapurl);
+ my $restitle = &Apache::lonnet::gettitle($symb);
+ my $crstype = &Apache::loncommon::course_type();
+ my ($ltiscope,$ltiuri);
+ my (@crumbs, at mapcrumbs);
+ if (($env{'request.course.id'}) && ($env{'request.lti.login'})) {
+ ($ltiscope,$ltiuri) =
+ &LONCAPA::ltiutils::lti_provider_scope($env{'request.lti.uri'},
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
+ }
+ if (($resurl ne '/adm/navmaps') && ($mapurl ne '') &&
+ (!(($crstype eq 'Placement') && !$env{'request.role.adv'}))) {
+ unless ($ltiscope eq 'resource') {
+ if (($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) &&
+ !(($ltiscope eq 'map') && (&Apache::lonnet::clutter($resurl) eq $ltiuri))) {
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ @mapcrumbs = $navmap->recursed_crumbs($mapurl,$restitle);
+ }
+ }
+ }
+ }
+ unless ((($crstype eq 'Placement') && (!$env{'request.role.adv'})) ||
+ ($ltiscope eq 'map') || ($ltiscope eq 'resource')) {
+ @crumbs = ({text => $crstype.' Contents',
+ href => "javascript:gopost('/adm/navmaps','')"});
+ }
+ if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
+ if (@mapcrumbs) {
+ push(@crumbs, at mapcrumbs);
+ } elsif (!(($crstype eq 'Placement') && (!$env{'request.role.adv'})) &&
+ ($ltiscope ne 'map') && ($ltiscope ne 'resource')) {
+ push(@crumbs, {text => '...',
+ no_mt => 1});
+ }
+ }
+ unless ((($crstype eq 'Placement') && (!$env{'request.role.adv'})) || (@mapcrumbs) ||
+ (!$maptitle) || ($maptitle eq 'default.sequence') ||
+ ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'}) ||
+ ($ltiscope eq 'resource')) {
+ push(@crumbs, {text => $maptitle, no_mt => 1,
+ href => &Apache::lonnet::clutter($mapurl).'?navmap=1'});
+ }
+ if ($restitle && !@mapcrumbs) {
+ push(@crumbs,{text => $restitle, no_mt => 1});
+ }
+ return \@crumbs;
+}
+
sub handler {
my $r=shift;
@@ -3458,7 +3526,7 @@
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
my %crumb_titles = &slot_command_titles();
- my ($brcrum,$bread_crumbs_component);
+ my ($symb,$brcrum,$bread_crumbs_component);
my $vgr=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
my $mgr=&Apache::lonnet::allowed('mgr',$env{'request.course.id'});
@@ -3488,6 +3556,12 @@
$title = 'Manage Reservations';
$brcrum =[{href=>"/adm/slotrequest?command=manageresv",text=>$title}];
}
+ if ($env{'form.requestattempt'}) {
+ $symb=&unescape($env{'form.symb'});
+ if ($symb) {
+ $brcrum = &get_user_breadcrumbs($symb);
+ }
+ }
my ($cnum,$cdom)=&get_course();
%slots = &Apache::lonnet::get_course_slots($cnum,$cdom);
$consumed_uniqueperiods = &get_consumed_uniqueperiods(\%slots);
@@ -3507,19 +3581,32 @@
} elsif ($env{'form.command'} eq 'release') {
if ($env{'form.context'} eq 'usermanage') {
$brcrum =[{href=>"/adm/slotrequest?command=manageresv",
- text=>$crumb_titles{'showslots'}}];
+ text=>$crumb_titles{'manageresv'}}];
$title = 'Manage Reservations';
if (ref($brcrum) eq 'ARRAY') {
push(@{$brcrum},{href=>"/adm/slotrequest?command=$env{'form.command'}",text=>$crumb_titles{$env{'form.command'}}});
}
+ } elsif ($env{'form.context'} eq 'user') {
+ if ($env{'form.symb'}) {
+ $symb=&unescape($env{'form.symb'});
+ $brcrum = &get_user_breadcrumbs($symb);
+ } else {
+ $brcrum =[];
+ }
+ }
+ } elsif (($env{'form.command'} eq 'get') && ($env{'form.context'} eq 'user')) {
+ if ($env{'form.symb'}) {
+ $symb=&unescape($env{'form.symb'});
+ $brcrum = &get_user_breadcrumbs($symb);
+ } else {
+ $brcrum =[];
}
} else {
$brcrum =[];
}
- my ($symb,$js,$available,$allavailable,$got_slots);
+ my ($js,$available,$allavailable,$got_slots);
$available = [];
if ($env{'form.requestattempt'}) {
- $symb=&unescape($env{'form.symb'});
@{$got_slots}=&check_for_reservation($symb,'allslots');
}
if (($env{'form.requestattempt'}) || ($env{'form.command'} eq 'manageresv')) {
@@ -3566,7 +3653,7 @@
} elsif (($env{'form.command'} eq 'slotlog') && ($vgr eq 'F')) {
&show_reservations_log($r);
} else {
- my $symb=&unescape($env{'form.symb'});
+ $symb = &unescape($env{'form.symb'});
if (!defined($symb)) {
&fail($r,'not_valid');
return OK;
@@ -3591,9 +3678,9 @@
return OK;
}
if ($env{'form.requestattempt'}) {
- $r->print('<div class="LC_left_float">');
- $r->print(&show_choices($symb,undef,undef,undef,\%slots,$consumed_uniqueperiods,$available,$got_slots));
- $r->print('</div><div style="padding:0;clear:both;margin:0;border:0"></div>');
+ $r->print('<div class="LC_left_float">'.
+ &show_choices($symb,undef,0,undef,\%slots,$consumed_uniqueperiods,$available,$got_slots).
+ '</div><div style="padding:0;clear:both;margin:0;border:0"></div>');
} elsif ($env{'form.command'} eq 'release') {
&release_slot($r,$symb);
} elsif ($env{'form.command'} eq 'get') {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1476 loncom/interface/loncommon.pm:1.1477
--- loncom/interface/loncommon.pm:1.1476 Tue Mar 25 01:02:59 2025
+++ loncom/interface/loncommon.pm Mon Mar 31 13:55:07 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1476 2025/03/25 01:02:59 raeburn Exp $
+# $Id: loncommon.pm,v 1.1477 2025/03/31 13:55:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7992,6 +7992,14 @@
line-height: 250%;
}
+table.LC_manage_reservations tr th {
+ font-weight: normal;
+ font-style: italic;
+ text-align: left;
+ background: transparent;
+ font-size: 100%;
+}
+
span.LC_current_location {
font-size:larger;
background: $pgbg;
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.273 loncom/homework/bridgetask.pm:1.274
--- loncom/homework/bridgetask.pm:1.273 Mon Jan 23 20:31:13 2023
+++ loncom/homework/bridgetask.pm Mon Mar 31 13:55:08 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.273 2023/01/23 20:31:13 raeburn Exp $
+# $Id: bridgetask.pm,v 1.274 2025/03/31 13:55:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,12 +32,14 @@
use strict;
use Apache::lonnet;
+use Apache::loncommon;
use Apache::File();
use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
use Apache::slotrequest();
use Apache::structuretags();
+use HTML::Entities();
use Time::HiRes qw( gettimeofday tv_interval );
use LONCAPA;
@@ -3278,14 +3280,8 @@
my ($slot) = @_;
my (undef,undef,$domain,$user) = &Apache::lonnet::whichuser();
my $url=&Apache::lonnet::studentphoto($domain,$user,'jpg');
- if ($url ne '/adm/lonKaputt/lonlogo_broken.gif') {
- $url = "<tr><td colspan=\"2\"><img src=\"$url\" /></td></tr>";
- } else {
- undef($url);
- }
-
my $name=&Apache::loncommon::plainname($user,$domain);
-
+
my $msg;
if ($env{'form.proctorpassword'}) {
$msg.='<p><span class="LC_warning">'
@@ -3313,43 +3309,77 @@
my %lt = &Apache::lonlocal::texthash(
'prva' => "Proctor Validation",
'yoro' => "Your room's proctor needs to validate your access to this resource.",
- 'prus' => "Proctor's Username:",
- 'pasw' => "Password:",
- 'prdo' => "Proctor's Domain:",
+ 'prus' => "Proctor's Username",
+ 'pasw' => "Password",
+ 'prdo' => "Proctor's Domain",
'vali' => 'Validate',
'stui' => "Student who should be logged in is:",
- 'name' => "Name:",
+ 'name' => "Name",
'sid' => "Student/Employee ID",
- 'unam' => "Username:",
+ 'unam' => "Username",
+ 'phot' => "Photo",
);
- my $result= (<<ENDCHECKOUT);
-<h2>$lt{'prva'}</h2>
- <p>$lt{'yoro'}</p>
- $msg
+ my $proctortable =
+ &Apache::lonhtmlcommon::start_pick_box()."\n".
+ &Apache::lonhtmlcommon::row_title('<label for="proctorname">'.$lt{'prus'}.'</label>').
+ '<input type="text" name="proctorname" value="'.$env{'form.proctorname'}.'" '.
+ 'id="proctorname" autocomplete="new-password" />'.
+ &Apache::lonhtmlcommon::row_closure()."\n".
+ &Apache::lonhtmlcommon::row_title('<label for="proctorpassword">'.$lt{'pasw'}.'</label>').
+ '<input type="password" name="proctorpassword" value="" '.
+ 'id="proctorpassword" autocomplete="new-password" />'.
+ &Apache::lonhtmlcommon::row_closure()."\n".
+ &Apache::lonhtmlcommon::row_title('<label for="proctordomain">'.$lt{'prdo'}.'</label>').
+ '<input type="text" name="proctordomain" value="'.$env{'form.proctordomain'}.'" '.
+ 'id="proctordomain" autocomplete="off" />'.
+ &Apache::lonhtmlcommon::row_closure(1)."\n".
+ &Apache::lonhtmlcommon::end_pick_box()."\n";
+
+ my $studenttable =
+ &Apache::loncommon::start_data_table('LC_manage_reservations').
+ &Apache::loncommon::start_data_table_row().
+ '<th>'.$lt{'name'}.':</th><td>'.$name.'</td>'.
+ &Apache::loncommon::end_data_table_row()."\n".
+ &Apache::loncommon::start_data_table_row().
+ '<th>'.$lt{'sid'}.':</th><td>'.$env{'environment.id'}.'</td>'.
+ &Apache::loncommon::end_data_table_row()."\n".
+ &Apache::loncommon::start_data_table_row().
+ '<th>'.$lt{'unam'}.':</th><td>'.$user.':'.$domain.'</td>'.
+ &Apache::loncommon::end_data_table_row();
+ if ($url ne '/adm/lonKaputt/lonlogo_broken.gif') {
+ $studenttable .= &Apache::loncommon::start_data_table_row().
+ '<th valign="top">'.$lt{'phot'}.'</th>'.
+ '<td valign="top"><img src="'.&HTML::Entities::encode($url,'&<>"').'" '.
+ 'alt="'.&mt('Photo of [_1]',$name).'" /></td>'.
+ &Apache::loncommon::end_data_table_row()."\n";
+ }
+ $studenttable .= &Apache::loncommon::end_data_table()."\n";
+ if ($msg ne '') {
+ $msg = "<p>$msg</p>";
+ } else {
+ $msg = '<br /><br />';
+ }
+ return (<<ENDCHECKOUT);
+<div style="padding:0;clear:both;margin:0;border:0">
+<h2 class="LC_heading_2">$lt{'prva'}</h2><hr />
+<div class="LC_left_float">
+$lt{'yoro'}
+$msg
<form name="checkout" method="post" action="$uri">
<input type="hidden" name="validate" value="yes" />
<input type="hidden" name="submitted" value="yes" />
-<table>
- <tr><td>$lt{'prus'}</td><td><input type="text" name="proctorname" value="$env{'form.proctorname'}" autocomplete="new-password" /></td></tr>
- <tr><td>$lt{'pasw'}</td><td><input type="password" name="proctorpassword" value="" autocomplete="new-password" /></td></tr>
- <tr><td>$lt{'prdo'}</td><td><input type="text" name="proctordomain" value="$env{'form.proctordomain'}" autocomplete="off" /></td></tr>
-</table>
-<input type="submit" name="checkoutbutton" value="$lt{'vali'}" /><br />
-<table border="1">
- <tr><td>
- <table>
- <tr><td colspan="2">$lt{'stui'}</td></tr>
- <tr><td>$lt{'name'}</td><td>$name</td></tr>
- <tr><td>$lt{'sid'}</td><td>$env{'environment.id'}</td></tr>
- <tr><td>$lt{'unam'}</td><td>$user:$domain</td></tr>
- $url
- </table>
- </tr></td>
-</table>
+$proctortable
+<br />
+<input type="submit" name="checkoutbutton" value="$lt{'vali'}" />
</form>
+</div>
+<div class="LC_left_float">
+$lt{'stui'}
+<br /><br />
+$studenttable
+</div>
+</div>
ENDCHECKOUT
-
- return $result;
}
1;
More information about the LON-CAPA-cvs
mailing list