--- loncom/interface/slotrequest.pm 2006/12/18 14:59:16 1.72 +++ loncom/interface/slotrequest.pm 2007/04/10 23:28:20 1.75 @@ -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.72 2006/12/18 14:59:16 rezaferry Exp $ +# $Id: slotrequest.pm,v 1.75 2007/04/10 23:28:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -548,7 +548,7 @@ sub return_link { } sub get_slot { - my ($r,$symb)=@_; + my ($r,$symb,$conflictable_slot,$inhibit_return_link)=@_; my %slot=&Apache::lonnet::get_slot($env{'form.slotname'}); my $slot_name=&check_for_conflict($symb,$env{'form.slotname'},\%slot); @@ -556,9 +556,9 @@ sub get_slot { if ($slot_name =~ /^error: (.*)/) { $r->print("
An error occured while attempting to make a reservation. ($1)
"); &return_link($r); - return; + return 0; } - if ($slot_name) { + if ($slot_name && $slot_name ne $conflictable_slot) { my %slot=&Apache::lonnet::get_slot($slot_name); my $description1=&get_description($slot_name,\%slot); %slot=&Apache::lonnet::get_slot($env{'form.slotname'}); @@ -586,28 +586,35 @@ STUFF } else { &return_link($r); } - return; + return 0; } my $reserved=&make_reservation($env{'form.slotname'}, \%slot,$symb); my $description=&get_description($env{'form.slotname'},\%slot); if (defined($reserved)) { + my $retvalue = 0; if ($slot_name =~ /^error: (.*)/) { $r->print("An error occured while attempting to make a reservation. ($1)
"); } elsif ($reserved > -1) { $r->print("Success: $description
"); + $retvalue = 1; } elsif ($reserved < 0) { $r->print("Already reserved: $description
"); } - &return_link($r); - return; + if (!$inhibit_return_link) { &return_link($r); } + return 1; } my %lt=('request'=>"Availibility list", 'try' =>'Try again'); %lt=&Apache::lonlocal::texthash(%lt); + my $extra_input; + if ($conflictable_slot) { + $extra_input=''; + } + $r->print(<@@ -615,7 +622,8 @@ STUFF - + + $extra_input ?
@@ -629,8 +637,8 @@ or or STUFF - &return_link($r); - return; + if (!$inhibit_return_link) { &return_link($r); } + return 0; } sub allowed_slot { @@ -893,7 +901,7 @@ sub show_table { my $available; if ($mgr eq 'F') { # FIXME: This line should be deleted once Slots uses breadcrumbs - $r->print(&Apache::loncommon::help_open_topic('Slot About', 'Help on slots')); + $r->print(&Apache::loncommon::help_open_topic('Slot About', 'Help on slots')); $r->print('