--- loncom/interface/slotrequest.pm 2019/06/28 19:46:03 1.141 +++ loncom/interface/slotrequest.pm 2023/07/12 15:48:23 1.147 @@ -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.141 2019/06/28 19:46:03 raeburn Exp $ +# $Id: slotrequest.pm,v 1.147 2023/07/12 15:48:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,16 +50,19 @@ sub fail { } else { $r->print('
'.&mt('Failed.').'
'); } - + &return_link($r); &end_page($r); } sub start_page { - my ($r,$title,$brcrum,$js)=@_; + my ($r,$title,$brcrum,$bread_crumbs_component,$js,$mgr)=@_; my $args; if (ref($brcrum) eq 'ARRAY') { $args = {bread_crumbs => $brcrum}; + if ($bread_crumbs_component) { + $args->{bread_crumbs_component} = $bread_crumbs_component; + } } if (($env{'form.requestattempt'}) || ($env{'form.command'} eq 'manageresv')) { my %loaditems = ( @@ -71,6 +74,31 @@ sub start_page { $args = { 'add_entries' => \%loaditems }; } } + unless (($env{'form.context'} eq 'usermanage') || (($mgr eq 'F') && + (($env{'form.command'} eq 'release') || + ($env{'form.command'} eq 'remove_registration')))) { + if ($env{'form.symb'}) { + my $symb=&unescape($env{'form.symb'}); + my ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($symb); + if ($resurl =~ /ext\.tool$/) { + my $target; + my ($marker,$exttool) = (split(m{/},$resurl))[3,4]; + $marker=~s/\D//g; + if (($marker) && ($exttool) && ($env{'request.course.id'})) { + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my ($idx,$crstool,$is_tool,%toolhash,%toolsettings); + if ($resurl eq "adm/$cdom/$cnum/$marker/$exttool") { + my %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); + $target = $toolsettings{'target'}; + } + } + if ($target eq 'iframe') { + $args->{'only_body'} = 1; + } + } + } + } $r->print(&Apache::loncommon::start_page($title,$js,$args)); } @@ -256,7 +284,7 @@ function uncheckSlotRadio() { } if (slotpicks.length) { for (var i=0; i'.&mt('Releasing reservations').'
'); foreach my $entry (sort { $consumed{$a}{'name'} cmp @@ -769,11 +797,11 @@ sub release_slot { my ($result,$msg) = &release_reservation($slot_name,$uname,$udom,$symb,$mgr); if (!$result) { - $r->print(''.&mt($msg).'
'); + $r->print(''.&mt($msg).'
'); } else { $r->print("$msg
"); } - + if ($mgr eq 'F') { $r->print(''. &mt('Return to slot list').'
'); @@ -941,7 +969,7 @@ sub release_reservation { } else { if (keys(%to_delete)) { $msg = &mt('Reservation release partially complete for [_1]',$description); - } else { + } else { $msg = &mt('No entries found for this user to release for [_1].',$description); } return (0,$msg); @@ -995,7 +1023,7 @@ sub release_reservation { # # If release is *not* because of a reservation change, i.e., this is a "drop" - # by a student, or a removal for a single student by an instructor then + # by a student, or a removal for a single student by an instructor then # only remove one entry from slot_reservations.db, where both the user # and the symb match the current context. If useslots was set to map or # map_map, then the symb to match in slot_reservations.db is the symb of @@ -1006,7 +1034,7 @@ sub release_reservation { if ($parm_level == 2) { $symb_to_check = $map_symb; } else { - $symb_to_check = $parm_symb; + $symb_to_check = $parm_symb; } foreach my $entry (keys(%consumed)) { if ( $consumed{$entry}->{'name'} eq ($uname.':'.$udom) ) { @@ -1024,16 +1052,16 @@ sub release_reservation { $cnum,$udom,$uname,$context) =~ /^error/) { if ($mgr eq 'F') { $msg = &mt('Reservation release partially complete for: [_1]',"$uname:$udom").''.&mt('Slot [_1] marked as deleted.',''.$slot_name.'').'
'); } else { - $r->print(''.&mt('An error occurred when attempting to delete slot: [_1]',''.$slot_name.'')." ($ret)
"); + $r->print(''.&mt('An error occurred when attempting to delete slot: [_1]',''.$slot_name.'')." ($ret)
"); } } else { if (%consumed) { @@ -1135,15 +1163,32 @@ sub delete_slot { sub return_link { my ($r) = @_; + my $target = &return_target(); if (($env{'form.command'} eq 'manageresv') || ($env{'form.context'} eq 'usermanage')) { - $r->print(''.
- &mt('Return to reservations'));
+ $r->print(' '.
+ &mt('Return to reservations').' '.
+ $r->print(' '.
&mt('Return to last resource').' '
+ $r->print(' '
.&mt('An error occurred while attempting to make a reservation. ([_1])',$1)
- .' '
+ $r->print(' '
.&mt('An error occurred while attempting to make a reservation. ([_1])',$1)
- .'
'.&mt('Successfully signed up: [_1]',$description).'
'); $retvalue = 1; @@ -1295,7 +1340,7 @@ sub allowed_slot { if (($slot->{'endreserve'}) && ($slot->{'endreserve'} < time)) { return 0; - } + } &Apache::lonxml::debug("$slot_name reserve good"); my $userallowed=0; @@ -1403,7 +1448,8 @@ sub show_choices { if (!@{$available}) { $output = ''.&mt('No available times.').''; if ($env{'form.command'} ne 'manageresv') { - $output .= ' '. + my $target = &return_target(); + $output .= ' '. &mt('Return to last resource').''; } if ($class) { @@ -1441,7 +1487,7 @@ sub show_choices { ); foreach my $option (@options) { my $onclick = "toggleSlotDisplay(this.form,'$num');"; - if (($option eq 'show') && ($env{'form.command'} eq 'manageresv')) { + if (($option eq 'show') && ($env{'form.command'} eq 'manageresv')) { $onclick .= "currSlotDisplay$num(this.form,'$num');"; } $output .= '