--- loncom/interface/slotrequest.pm 2005/11/21 17:50:45 1.32 +++ loncom/interface/slotrequest.pm 2005/11/21 18:55:41 1.33 @@ -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.32 2005/11/21 17:50:45 albertel Exp $ +# $Id: slotrequest.pm,v 1.33 2005/11/21 18:55:41 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -231,17 +231,55 @@ sub make_reservation { return undef; } +sub remove_registration { + my ($r) = @_; + my $name = &Apache::loncommon::plainname($env{'form.uname'}, + $env{'form.udom'}); + + my $title = &Apache::lonnet::gettitle($env{'form.symb'}); + + my $hidden_input; + foreach my $parm ('uname','udom','slotname','entry','symb') { + $hidden_input .= + '&\'').'" />'."\n"; + } + $r->print(<<"END_CONFIRM"); +
Remove $name from slot $env{'form.slotname'} for $title
+ + +END_CONFIRM + +} + sub release_slot { - my ($r,$symb,$slot_name,$inhibit_return_link)=@_; + my ($r,$symb,$slot_name,$inhibit_return_link,$mgr)=@_; if ($slot_name eq '') { $slot_name=$env{'form.slotname'}; } my ($cnum,$cdom)=&get_course(); + my ($uname,$udom) = ($env{'user.name'}, $env{'user.domain'}); + if ($mgr eq 'F' + && defined($env{'form.uname'}) && defined($env{'form.udom'})) { + ($uname,$udom) = ($env{'form.uname'}, $env{'form.udom'}); + } + + if ($mgr eq 'F' + && defined($env{'form.symb'})) { + $symb = $env{'form.symb'}; + } + # get parameter string, check for existance, rebuild string with the slot - my @slots = split(/:/,&Apache::lonnet::EXT("resource.0.availablestudent", - $symb,$env{'user.domain'}, - $env{'user.name'})); + $symb,$udom,$uname)); + my @new_slots; foreach my $exist_slot (@slots) { if ($exist_slot eq $slot_name) { next; } @@ -253,21 +291,24 @@ sub release_slot { my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, "^$slot_name\0"); foreach my $entry (keys(%consumed)) { - if ( $consumed{$entry}->{'name'} eq - ($env{'user.name'}.'@'.$env{'user.domain'}) ) { + if ( $consumed{$entry}->{'name'} eq ($uname.'@'.$udom) ) { &Apache::lonnet::del('slot_reservations',[$entry], $cdom,$cnum); } } + # store new parameter string my $result=&Apache::lonparmset::storeparm_by_symb($symb, '0_availablestudent', 1, $new_param, 'string', - $env{'user.name'}, - $env{'user.domain'}); + $uname,$udom); my %slot=&Apache::lonnet::get_slot($slot_name); my $description=&get_description($env{'form.slotname'},\%slot); $r->print("Released Reservation: $description
"); + if ($mgr eq 'F') { + $r->print(''. + &mt('Return to slot list').'
'); + } if (!$inhibit_return_link) { $r->print(''. &mt('Return to last resource').'
'); @@ -493,6 +534,24 @@ sub to_show { return 1; } +sub remove_link { + my ($slotname,$entry,$uname,$udom,$symb) = @_; + + $slotname = &Apache::lonnet::escape($slotname); + $entry = &Apache::lonnet::escape($entry); + $uname = &Apache::lonnet::escape($uname); + $udom = &Apache::lonnet::escape($udom); + $symb = &Apache::lonnet::escape($symb); + + my $remove= &mt('Remove'); + + return <<"END_LINK"; + ($remove) +END_LINK + +} + sub show_table { my ($r,$mgr)=@_; @@ -611,8 +670,13 @@ sub show_table { my $ids; foreach my $entry (sort(keys(%consumed))) { my (undef,$id)=split("\0",$entry); - $ids.= $id.'-> '.$consumed{$entry}->{'name'}.'