version 1.78, 2007/04/11 16:07:51
|
version 1.83, 2008/09/20 02:53:13
|
Line 241 sub make_reservation {
|
Line 241 sub make_reservation {
|
$env{'user.domain'},$env{'user.name'}); |
$env{'user.domain'},$env{'user.name'}); |
&Apache::lonxml::debug("value is $value<br />"); |
&Apache::lonxml::debug("value is $value<br />"); |
|
|
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<br />"); |
&Apache::lonxml::debug("use_slots is $use_slots<br />"); |
|
|
if (&Apache::lonnet::error($value) |
if (&Apache::lonnet::error($value) |
Line 334 sub remove_registration {
|
Line 335 sub remove_registration {
|
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, |
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, |
"^$slot_name\0"); |
"^$slot_name\0"); |
if (&Apache::lonnet::error(%consumed)) { |
if (&Apache::lonnet::error(%consumed)) { |
$r->print("<p><span class=\"LC_error\">".&mt('A network error has occured.').'</span></p>'); |
$r->print("<p><span class=\"LC_error\">".&mt('A network error has occurred.').'</span></p>'); |
return; |
return; |
} |
} |
if (!%consumed) { |
if (!%consumed) { |
Line 459 sub release_reservation {
|
Line 460 sub release_reservation {
|
return (0,&mt('Not allowed to release Reservation: [_1], as it has already ended.',$description)); |
return (0,&mt('Not allowed to release Reservation: [_1], as it has already ended.',$description)); |
} |
} |
} |
} |
|
|
|
# if the reservation symb is for a map get a resource in that map |
|
# to check slot parameters on |
|
my $navmap=Apache::lonnavmaps::navmap->new; |
|
my $passed_resource = $navmap->getBySymb($symb); |
|
if ($passed_resource->is_map()) { |
|
my ($a_resource) = |
|
$navmap->retrieveResources($passed_resource, |
|
sub {$_[0]->is_problem()},0,1); |
|
$symb = $a_resource->symb(); |
|
} |
|
|
# get parameter string, check for existance, rebuild string with the slot |
# get parameter string, check for existance, rebuild string with the slot |
my @slots = split(/:/,&Apache::lonnet::EXT("resource.0.availablestudent", |
my $student = &Apache::lonnet::EXT("resource.0.availablestudent", |
$symb,$udom,$uname)); |
$symb,$udom,$uname); |
|
my @slots = split(/:/,$student); |
|
|
my @new_slots; |
my @new_slots; |
foreach my $exist_slot (@slots) { |
foreach my $exist_slot (@slots) { |
Line 482 sub release_reservation {
|
Line 496 sub release_reservation {
|
} |
} |
} |
} |
|
|
my $use_slots = &Apache::lonnet::EXT("resource.0.useslots"); |
my $use_slots = &Apache::lonnet::EXT("resource.0.useslots", |
|
$symb,$udom,$uname); |
&Apache::lonxml::debug("use_slots is $use_slots<br />"); |
&Apache::lonxml::debug("use_slots is $use_slots<br />"); |
|
|
if (&Apache::lonnet::error($use_slots)) { |
if (&Apache::lonnet::error($use_slots)) { |
Line 554 sub get_slot {
|
Line 569 sub get_slot {
|
my $slot_name=&check_for_conflict($symb,$env{'form.slotname'},\%slot); |
my $slot_name=&check_for_conflict($symb,$env{'form.slotname'},\%slot); |
|
|
if ($slot_name =~ /^error: (.*)/) { |
if ($slot_name =~ /^error: (.*)/) { |
$r->print("<p><span class=\"LC_error\">An error occured while attempting to make a reservation. ($1)</span></p>"); |
$r->print('<p><span class="LC_error">' |
|
.&mt('An error occurred while attempting to make a reservation. ([_1])',$1) |
|
.'</span></p>'); |
&return_link($r); |
&return_link($r); |
return 0; |
return 0; |
} |
} |
Line 595 STUFF
|
Line 612 STUFF
|
if (defined($reserved)) { |
if (defined($reserved)) { |
my $retvalue = 0; |
my $retvalue = 0; |
if ($slot_name =~ /^error: (.*)/) { |
if ($slot_name =~ /^error: (.*)/) { |
$r->print("<p><span class=\"LC_error\">An error occured while attempting to make a reservation. ($1)</span></p>"); |
$r->print('<p><span class="LC_error">' |
|
.&mt('An error occurred while attempting to make a reservation. ([_1])',$1) |
|
.'</span></p>'); |
} elsif ($reserved > -1) { |
} elsif ($reserved > -1) { |
$r->print("<p>Success: $description</p>"); |
$r->print("<p>Success: $description</p>"); |
$retvalue = 1; |
$retvalue = 1; |
Line 1108 sub show_table {
|
Line 1127 sub show_table {
|
my ($id_count,$ids); |
my ($id_count,$ids); |
|
|
if (exists($show{'scheduled'}) || exists($show{'space'}) ) { |
if (exists($show{'scheduled'}) || exists($show{'space'}) ) { |
my @this_slot = grep(/^$slot\0/,keys(%consumed)); |
my $re_str = "$slot\0"; |
|
my @this_slot = grep(/^\Q$re_str\E/,keys(%consumed)); |
$id_count = scalar(@this_slot); |
$id_count = scalar(@this_slot); |
if (exists($show{'scheduled'})) { |
if (exists($show{'scheduled'})) { |
foreach my $entry (sort { $consumed{$a}{name} cmp |
foreach my $entry (sort { $consumed{$a}{name} cmp |
$consumed{$b}{name} } |
$consumed{$b}{name} } |
(keys(%consumed))) { |
(@this_slot)) { |
my (undef,$id)=split("\0",$entry); |
my (undef,$id)=split("\0",$entry); |
my ($uname,$udom) = split(':',$consumed{$entry}{'name'}); |
my ($uname,$udom) = split(':',$consumed{$entry}{'name'}); |
$ids.= '<nobr>'; |
$ids.= '<nobr>'; |