From raeburn at source.lon-capa.org Mon Mar 31 09:55:09 2025 From: raeburn at source.lon-capa.org (raeburn) Date: Mon, 31 Mar 2025 13:55:09 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm /interface loncommon.pm slotrequest.pm Message-ID: 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('

'.&mt($msg).'

'); } else { - $r->print("

$msg

"); + $r->print($msg); } $r->rflush(); } @@ -1061,7 +1065,8 @@ if ($mgr eq 'F') { $msg = &mt('Released Reservation for user: [_1]',"$uname:$udom"); } else { - $msg = ''.&mt('Released reservation: [_1]',$description).'

'; + $msg = '

'. + &mt('Released reservation: [_1]',$description).'

'; 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 = ''.&mt('No available times.').''; + $output = '

'.&mt('No available times.').'

'; if ($env{'form.command'} ne 'manageresv') { my $target = &return_target(); $output .= ' '. @@ -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 .= '

'.$headertext.'

'; } if (@{$available} > 1) { my $numavailable = scalar(@{$available}); @@ -1522,18 +1531,22 @@ $output .= '
'. '
'. - ''. &Apache::loncommon::end_data_table_header_row(); } + my $shownsymb; + if ($env{'request.role.adv'}) { + $shownsymb = $symb; + } elsif (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i) { + $shownsymb = &Apache::lonenc::encrypted($symb); + } else { + $shownsymb = $symb; + } + $shownsymb = &escape($shownsymb); foreach my $slot (@{$available}) { my $description=&get_description($slot,$slots->{$slot}); my $form; @@ -1572,7 +1591,6 @@ } } } - my $escsymb=&escape($symb); if (!$form) { my $name; if ($formname) { @@ -1585,7 +1603,7 @@ $form=< - + @@ -1698,11 +1716,20 @@ undef($udom); } + my $shownsymb; + if ($env{'request.role.adv'}) { + $shownsymb = $symb; + } elsif (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i) { + $shownsymb = &Apache::lonenc::encrypted($symb); + } else { + $shownsymb = $symb; + } + $slotname = &escape($slotname); $entry = &escape($entry); $uname = &escape($uname); $udom = &escape($udom); - $symb = &escape($symb); + $symb = &escape($shownsymb); return <<"END_LINK"; symb(); + my $src = $resource->src(); + my ($shownsymb,$shownsrc); + $shownsymb = $resource->shown_symb(); + if ($resource->encrypted()) { + $shownsrc = &Apache::lonenc::encrypted($src); + } else { + $shownsrc = $src; + } next if (!$resource->is_problem() && !$resource->is_tool() && !$resource->is_sequence() && !$resource->is_page()); $count ++; @@ -2409,7 +2444,7 @@ for (my $i=0; $i<$depth; $i++) { $r->print(''); } - $r->print(''. + $r->print(''. ''.&mt('Task'));
@@ -3558,6 +3593,9 @@
         }
         if ($env{'form.requestattempt'}) {
             $symb=&unescape($env{'form.symb'});
+            if ($symb =~ m{^/enc/}) {
+                $symb = &Apache::lonenc::unencrypted($symb);
+            }
             if ($symb) {
                 $brcrum = &get_user_breadcrumbs($symb);
             }
@@ -3587,16 +3625,22 @@
                 push(@{$brcrum},{href=>$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 =[]; - } + if ($env{'form.symb'}) { + $symb = &unescape($env{'form.symb'}); + if ($symb =~ m{^/enc/}) { + $symb = &Apache::lonenc::unencrypted($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'}); + if ($symb =~ m{^/enc/}) { + $symb = &Apache::lonenc::unencrypted($symb); + } $brcrum = &get_user_breadcrumbs($symb); } else { $brcrum =[]; @@ -3654,6 +3698,9 @@ &show_reservations_log($r); } else { $symb = &unescape($env{'form.symb'}); + if ($symb =~ m{^/enc/}) { + $symb = &Apache::lonenc::unencrypted($symb); + } if (!defined($symb)) { &fail($r,'not_valid'); return OK; Index: loncom/interface/lonnavmaps.pm diff -u loncom/interface/lonnavmaps.pm:1.572 loncom/interface/lonnavmaps.pm:1.573 --- loncom/interface/lonnavmaps.pm:1.572 Wed Feb 26 19:50:21 2025 +++ loncom/interface/lonnavmaps.pm Wed Apr 2 23:44:01 2025 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.572 2025/02/26 19:50:21 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.573 2025/04/02 23:44:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3067,7 +3067,7 @@ } sub recurseup_maps { - my ($self,$mapname,$getsymb) = @_; + my ($self,$mapname,$getsymb,$inclusive) = @_; my @recurseup; if ($mapname) { my $res = $self->getResourceByUrl($mapname); @@ -3081,6 +3081,13 @@ @recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->src()); } reverse(@pcs); } } + if ($inclusive) { + if ($getsymb) { + unshift(@recurseup,$res->symb()); + } else { + unshift(@recurseup,$mapname); + } + } } } return @recurseup; Index: loncom/homework/bridgetask.pm diff -u loncom/homework/bridgetask.pm:1.274 loncom/homework/bridgetask.pm:1.275 --- loncom/homework/bridgetask.pm:1.274 Mon Mar 31 13:55:08 2025 +++ loncom/homework/bridgetask.pm Wed Apr 2 23:44:02 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.274 2025/03/31 13:55:08 raeburn Exp $ +# $Id: bridgetask.pm,v 1.275 2025/04/02 23:44:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -412,11 +412,16 @@ .'

'; } - if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); } - $symb=&escape($symb); + my $shownsymb; + if ($env{'request.enc'}) { + $shownsymb = &Apache::lonenc::encrypted($symb); + } else { + $shownsymb = $symb; + } + $shownsymb=&escape($shownsymb); $result.= "\n\t".'
'."\n\t\t". - ''."\n\t\t". + ''."\n\t\t". ''."\n\t\t". ''."\n\t". Index: loncom/lonnet/perl/lonnet.pm diff -u loncom/lonnet/perl/lonnet.pm:1.1537 loncom/lonnet/perl/lonnet.pm:1.1538 --- loncom/lonnet/perl/lonnet.pm:1.1537 Wed Mar 19 14:44:04 2025 +++ loncom/lonnet/perl/lonnet.pm Wed Apr 2 23:44:03 2025 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1537 2025/03/19 14:44:04 raeburn Exp $ +# $Id: lonnet.pm,v 1.1538 2025/04/02 23:44:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -13216,6 +13216,15 @@ # When this was last done my $cachedmaptime=''; +# Cache (5 seconds) of mapsymb hierarchy for speedup of reservations display +# +# The course for which we cache +my $cachedmapsymbkey=''; +# The cached recursive map symbs for this course +my %cachedmapsymbs=(); +# When this was last done +my $cachedmapsymbtime=''; + sub clear_EXT_cache_status { &delenv('cache.EXT.'); } @@ -13407,6 +13416,43 @@ #print '
'.$space.' - '.$qualifier.' - '.$spacequalifierrest; +# --------------------------------------------- Special handling for encrypturl + + if ($spacequalifierrest eq '0.encrypturl') { + unless ($recursed) { + my ($map_from_symb, at mapsymbs); + if ($symbparm =~ /\.(page|sequence)$/) { + push(@mapsymbs,$symbparm); + $map_from_symb = &deversion((&decode_symb($symbparm))[2]); + } else { + $map_from_symb = &deversion((&decode_symb($symbparm))[0]); + } + if (($map_from_symb ne '') && ($map_from_symb !~ /default\.sequence$/)) { + my @parents = &get_mapsymb_hierarchy($map_from_symb,$courseid); + if (@parents) { + push(@mapsymbs, at parents); + } + } + if (@mapsymbs) { + my $earlyout; + my %parmhash=(); + if (tie(%parmhash,'GDBM_File', + $env{'request.course.fn'}.'_parms.db', + &GDBM_READER(),0640)) { + foreach my $mapsymb (@mapsymbs) { + if ((exists($parmhash{$mapsymb.'.'.$spacequalifierrest})) && + (lc($parmhash{$mapsymb.'.'.$spacequalifierrest}) eq 'yes')) { + $earlyout = $parmhash{$mapsymb.'.'.$spacequalifierrest}; + last; + } + } + untie(%parmhash); + } + if ($earlyout) { return &get_reply([$earlyout,'map']); } + } + } + } + # ----------------------------------------------------- Cascading lookup scheme my $symbp=$symbparm; $mapp=&deversion((&decode_symb($symbp))[0]); @@ -13610,6 +13656,30 @@ return @recurseup; } +sub get_mapsymb_hierarchy { + my ($mapname,$courseid) = @_; + my @recurseup; + if ($mapname) { + if (($cachedmapsymbkey eq $courseid) && + (abs($cachedmapsymbtime-time)<5)) { + if (ref($cachedmapsymbs{$mapname}) eq 'ARRAY') { + return @{$cachedmapsymbs{$mapname}}; + } + } + my $navmap = Apache::lonnavmaps::navmap->new(); + if (ref($navmap)) { + my $getsymb = 1; + my $inclusive = 1; + @recurseup = $navmap->recurseup_maps($mapname,$getsymb,$inclusive); + undef($navmap); + $cachedmapsymbs{$mapname} = \@recurseup; + $cachedmapsymbtime=time; + $cachedmapsymbkey=$courseid; + } + } + return @recurseup; +} + } sub sort_course_groups { # Sort groups based on defined rankings. Default is sort().
'.&mt('Open after').''. + '
'.&mt('Open after').''. &Apache::lonhtmlcommon::date_setter($chooserform,'start',$starttime,'','','','','','','',1,1). - '
'.&mt('Closed before').''. + '
'.&mt('Closed before').''. &Apache::lonhtmlcommon::date_setter($chooserform,'end',$endtime,'','','','','','','',1,1). '

'. ''. ' +
+$lt{'stui'} +

+$studenttable +
+ ENDCHECKOUT - - return $result; } 1; From raeburn at source.lon-capa.org Wed Apr 2 19:44:03 2025 From: raeburn at source.lon-capa.org (raeburn) Date: Wed, 02 Apr 2025 23:44:03 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm /interface lonhtmlcommon.pm lonnavmaps.pm slotrequest.pm /lonnet/perl lonnet.pm Message-ID: raeburn Wed Apr 2 23:44:03 2025 EDT Modified files: /loncom/interface lonhtmlcommon.pm slotrequest.pm lonnavmaps.pm /loncom/homework bridgetask.pm /loncom/lonnet/perl lonnet.pm Log: - Reservation setting screens support URLs with encrypturl set to yes. Note: Checking "URL hidden" for a folder in Course Editor will override any encrypturl settings set using the Parameter Manager. -------------- next part -------------- Index: loncom/interface/lonhtmlcommon.pm diff -u loncom/interface/lonhtmlcommon.pm:1.358.2.19.2.7 loncom/interface/lonhtmlcommon.pm:1.358.2.19.2.8 --- loncom/interface/lonhtmlcommon.pm:1.358.2.19.2.7 Fri Feb 3 04:29:22 2023 +++ loncom/interface/lonhtmlcommon.pm Mon Sep 11 12:10:39 2023 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.358.2.19.2.7 2023/02/03 04:29:22 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.358.2.19.2.8 2023/09/11 12:10:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1762,6 +1762,48 @@ END } +## +# Client-side javascript to convert any dashes in text pasted +# into textbox(es) for numericalresponse item(s) to a standard +# minus, i.e., - . Calls to dash_to_minus_js() in end_problem() +# and in loncommon::endbodytag() for a .page (arg: dashjs => 1) +# +# Will apply to any input tag with class: LC_numresponse_text. +# Currently set in start_textline for numericalresponse items. +# + +sub dash_to_minus_js { + return <<'ENDJS'; + + + +ENDJS +} + ############################################################ ############################################################ Index: loncom/interface/slotrequest.pm diff -u loncom/interface/slotrequest.pm:1.151 loncom/interface/slotrequest.pm:1.152 --- loncom/interface/slotrequest.pm:1.151 Mon Mar 31 13:55:06 2025 +++ loncom/interface/slotrequest.pm Wed Apr 2 23:44:01 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.151 2025/03/31 13:55:06 raeburn Exp $ +# $Id: slotrequest.pm,v 1.152 2025/04/02 23:44:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -83,6 +83,9 @@ ($env{'form.command'} eq 'remove_registration')))) { if ($env{'form.symb'}) { my $symb=&unescape($env{'form.symb'}); + if ($symb =~ m{^/enc/}) { + $symb = &Apache::lonenc::unencrypted($symb); + } my ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($symb); if ($resurl =~ /ext\.tool$/) { my $target; @@ -714,7 +717,11 @@ my $name = &Apache::loncommon::plainname($env{'form.uname'}, $env{'form.udom'}); - my $title = &Apache::lonnet::gettitle($env{'form.symb'}); + my $symb = &unescape($env{'form.symb'}); + if ($symb =~ m{^/enc/}) { + $symb = &Apache::lonenc::unencrypted($symb); + } + my $title = &Apache::lonnet::gettitle($symb); my $msg = &mt('Remove [_1] from slot [_2] for [_3]', $name,$slot_name,$title); @@ -796,6 +803,9 @@ if ($mgr eq 'F' && defined($env{'form.symb'})) { $symb = &unescape($env{'form.symb'}); + if ($symb =~ m{^/enc/}) { + $symb = &Apache::lonenc::unencrypted($symb); + } } my ($result,$msg) = @@ -1548,6 +1558,15 @@ '
'.&mt('Action').''.&mt('Name').'