version 1.57, 2006/04/10 07:37:16
|
version 1.58, 2006/04/24 23:23:02
|
Line 1420 sub csv_upload_assign {
|
Line 1420 sub csv_upload_assign {
|
if ($entries{$fields{'endtime'}}) { |
if ($entries{$fields{'endtime'}}) { |
$slot{'endtime'}=&UnixDate($entries{$fields{'endtime'}},"%s"); |
$slot{'endtime'}=&UnixDate($entries{$fields{'endtime'}},"%s"); |
} |
} |
|
|
|
# start/endtime must be defined and greater than zero |
|
if (!$slot{'starttime'}) { |
|
push(@errors,"$name not created -- Invalid start time"); |
|
next; |
|
} |
|
if (!$slot{'endtime'}) { |
|
push(@errors,"$name not created -- Invalid end time"); |
|
next; |
|
} |
|
if ($slot{'starttime'} > $slot{'endtime'}) { |
|
push(@errors,"$name not created -- Slot starts after it ends"); |
|
next; |
|
} |
|
|
if ($entries{$fields{'startreserve'}}) { |
if ($entries{$fields{'startreserve'}}) { |
$slot{'startreserve'}= |
$slot{'startreserve'}= |
&UnixDate($entries{$fields{'startreserve'}},"%s"); |
&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', |
foreach my $key ('ip','proctor','description','maxspace', |
'secret','symb') { |
'secret','symb') { |
if ($entries{$fields{$key}}) { |
if ($entries{$fields{$key}}) { |
$slot{$key}=$entries{$fields{$key}}; |
$slot{$key}=$entries{$fields{$key}}; |
} |
} |
} |
} |
|
|
if ($entries{$fields{'uniqueperiod'}}) { |
if ($entries{$fields{'uniqueperiod'}}) { |
my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}}); |
my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}}); |
my @times=(&UnixDate($start,"%s"), |
my @times=(&UnixDate($start,"%s"), |
&UnixDate($end,"%s")); |
&UnixDate($end,"%s")); |
$slot{'uniqueperiod'}=\@times; |
$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); |
&Apache::lonnet::cput('slots',{$name=>\%slot},$cdom,$cname); |
$r->print('.'); |
$r->print('.'); |