--- loncom/interface/slotrequest.pm 2006/03/21 16:05:57 1.48.2.1
+++ 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.48.2.1 2006/03/21 16:05:57 albertel Exp $
+# $Id: slotrequest.pm,v 1.147 2023/07/12 15:48:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,34 +36,362 @@ use Apache::lonlocal;
use Apache::lonnet;
use Apache::lonnavmaps();
use Date::Manip;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA qw(:DEFAULT :match);
sub fail {
my ($r,$code)=@_;
if ($code eq 'not_valid') {
$r->print('
'.&mt('Unable to understand what resource you wanted to sign up for.').'
');
-
+ } elsif ($code eq 'not_available') {
+ $r->print(''.&mt('No slots are available.').'
');
} elsif ($code eq 'not_allowed') {
$r->print(''.&mt('Not allowed to sign up or change reservations at this time.').'
');
} else {
$r->print(''.&mt('Failed.').'
');
}
-
+
&return_link($r);
&end_page($r);
}
sub start_page {
- my ($r,$title)=@_;
- my $html=&Apache::lonxml::xmlbegin();
- $r->print($html.''.&mt($title).'');
- $r->print(&Apache::loncommon::bodytag($title));
+ 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 = (
+ onload => 'javascript:uncheckSlotRadio();',
+ );
+ if (ref($args) eq 'HASH') {
+ $args->{'add_entries'} = \%loaditems;
+ } else {
+ $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));
}
sub end_page {
my ($r)=@_;
- $r->print(&Apache::loncommon::endbodytag().'