--- loncom/interface/slotrequest.pm 2006/03/30 04:35:58 1.55
+++ loncom/interface/slotrequest.pm 2006/05/30 12:46:09 1.63
@@ -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.55 2006/03/30 04:35:58 albertel Exp $
+# $Id: slotrequest.pm,v 1.63 2006/05/30 12:46:09 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,12 +36,15 @@ use Apache::lonlocal;
use Apache::lonnet;
use Apache::lonnavmaps();
use Date::Manip;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
sub fail {
my ($r,$code)=@_;
if ($code eq 'not_valid') {
$r->print('
'.&mt('Unable to understand what resource you wanted to sign up for.').'
\n");
}
if (exists($show{'scheduled'})) {
- $colspan++;$r->print("
$ids
\n
\n");
+ $colspan++;$r->print("
$remove_all $ids
\n\n");
}
if (exists($show{'proctor'})) {
$r->print(< $slot{'endtime'}) {
+ push(@errors,"$name not created -- Slot starts after it ends");
+ next;
+ }
+
if ($entries{$fields{'startreserve'}}) {
$slot{'startreserve'}=
&UnixDate($entries{$fields{'startreserve'}},"%s");
}
+ if (defined($slot{'startreserve'})
+ && $slot{'startreserve'} > $slot{'starttime'}) {
+ push(@errors,"$name not created -- Slot's reservation start time is after the slot's start time.");
+ next;
+ }
+
foreach my $key ('ip','proctor','description','maxspace',
'secret','symb') {
if ($entries{$fields{$key}}) {
$slot{$key}=$entries{$fields{$key}};
}
}
+
if ($entries{$fields{'uniqueperiod'}}) {
my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}});
my @times=(&UnixDate($start,"%s"),
&UnixDate($end,"%s"));
$slot{'uniqueperiod'}=\@times;
}
+ if (defined($slot{'uniqueperiod'})
+ && $slot{'uniqueperiod'}[0] > $slot{'uniqueperiod'}[1]) {
+ push(@errors,"$name not created -- Slot's unique period start time is later than the unique period's end time.");
+ next;
+ }
&Apache::lonnet::cput('slots',{$name=>\%slot},$cdom,$cname);
$r->print('.');
@@ -1497,11 +1552,15 @@ sub handler {
&csv_upload_map($r);
}
} else {
- my $symb=&Apache::lonnet::unescape($env{'form.symb'});
+ my $symb=&unescape($env{'form.symb'});
+ if (!defined($symb)) {
+ &fail($r,'not_valid');
+ return OK;
+ }
my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb);
my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb);
- if ($useslots ne 'resource') {
- &fail($r,'not_valid');
+ if ($useslots ne 'resource' && $useslots ne 'map') {
+ &fail($r,'not_available');
return OK;
}
$env{'request.symb'}=$symb;