--- loncom/interface/slotrequest.pm 2007/04/11 16:07:51 1.78
+++ loncom/interface/slotrequest.pm 2009/01/23 21:34:47 1.86
@@ -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.78 2007/04/11 16:07:51 albertel Exp $
+# $Id: slotrequest.pm,v 1.86 2009/01/23 21:34:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -165,6 +165,9 @@ sub check_for_reservation {
sub get_consumed_uniqueperiods {
my ($slots) = @_;
my $navmap=Apache::lonnavmaps::navmap->new;
+ if (!defined($navmap)) {
+ return 'error: Unable to determine current status';
+ }
my @problems = $navmap->retrieveResources(undef,
sub { $_[0]->is_problem() },1,0);
my %used_slots;
@@ -214,9 +217,13 @@ sub check_for_conflict {
if (!ref($consumed_uniqueperiods)) {
$consumed_uniqueperiods = &get_consumed_uniqueperiods($slots);
- if (&Apache::lonnet::error(%$consumed_uniqueperiods)) {
- return 'error: Unable to determine current status';
- }
+ if (ref($consumed_uniqueperiods) eq 'HASH') {
+ if (&Apache::lonnet::error(%$consumed_uniqueperiods)) {
+ return 'error: Unable to determine current status';
+ }
+ } else {
+ return 'error: Unable to determine current status';
+ }
}
my ($new_uniq_start,$new_uniq_end) = @{$new_slot->{'uniqueperiod'}};
@@ -229,7 +236,6 @@ sub check_for_conflict {
}
}
return undef;
-
}
sub make_reservation {
@@ -241,7 +247,8 @@ sub make_reservation {
$env{'user.domain'},$env{'user.name'});
&Apache::lonxml::debug("value is $value
");
- my $use_slots = &Apache::lonnet::EXT("resource.0.useslots");
+ my $use_slots = &Apache::lonnet::EXT("resource.0.useslots",$symb,
+ $env{'user.domain'},$env{'user.name'});
&Apache::lonxml::debug("use_slots is $use_slots
");
if (&Apache::lonnet::error($value)
@@ -334,7 +341,7 @@ sub remove_registration {
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
"^$slot_name\0");
if (&Apache::lonnet::error(%consumed)) {
- $r->print("
".&mt('A network error has occured.').'
'); + $r->print("".&mt('A network error has occurred.').'
'); return; } if (!%consumed) { @@ -412,7 +419,11 @@ sub release_all_slot { my ($result,$msg) = &release_reservation($slot_name,$uname,$udom, $consumed{$entry}{'symb'},$mgr); - $r->print("$msg
"); + if (!$result) { + $r->print(''.&mt($msg).'
'); + } else { + $r->print("$msg
"); + } $r->rflush(); } $r->print('' + .&mt('Slot: [_1] has unknown status.',$description) + .' |