--- loncom/interface/slotrequest.pm 2009/02/02 02:56:12 1.87 +++ loncom/interface/slotrequest.pm 2009/03/20 10:05:08 1.90 @@ -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.87 2009/02/02 02:56:12 raeburn Exp $ +# $Id: slotrequest.pm,v 1.90 2009/03/20 10:05:08 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -239,9 +239,7 @@ sub check_for_conflict { } sub make_reservation { - my ($slot_name,$slot,$symb)=@_; - - my ($cnum,$cdom)=&get_course(); + my ($slot_name,$slot,$symb,$cnum,$cdom)=@_; my $value=&Apache::lonnet::EXT("resource.0.availablestudent",$symb, $env{'user.domain'},$env{'user.name'}); @@ -315,13 +313,7 @@ sub make_reservation { if ($value) { $new_value=$value.':'.$new_value; } - my $result=&Apache::lonparmset::storeparm_by_symb($symb, - '0_availablestudent', - $parm_level, $new_value, - 'string', - $env{'user.name'}, - $env{'user.domain'}); - &Apache::lonxml::debug("hrrm $result"); + &store_slot_parm($symb,$slot_name,$parm_level,$new_value,$cnum,$cdom); return $wanted; } @@ -329,6 +321,28 @@ sub make_reservation { return undef; } +sub store_slot_parm { + my ($symb,$slot_name,$parm_level,$new_value,$cnum,$cdom) = @_; + my $result=&Apache::lonparmset::storeparm_by_symb($symb, + '0_availablestudent', + $parm_level, $new_value, + 'string', + $env{'user.name'}, + $env{'user.domain'}); + &Apache::lonxml::debug("hrrm $result"); + my %storehash = ( + symb => $symb, + slot => $slot_name, + action => 'reserve', + context => $env{'form.context'}, + ); + + &Apache::lonnet::instructor_log('slotreservationslog',\%storehash, + '',$env{'user.name'},$env{'user.domain'}, + $cnum,$cdom); + return; +} + sub remove_registration { my ($r) = @_; if ($env{'form.entry'} ne 'remove all') { @@ -354,7 +368,7 @@ sub remove_registration { my $names = join(' ',@names); my $msg = &mt('Remove all of [_1] from slot [_2]?',$names,$slot_name); - &remove_registration_confirmation($r,$msg,['entry','slotname']); + &remove_registration_confirmation($r,$msg,['entry','slotname','context']); } sub remove_registration_user { @@ -371,7 +385,7 @@ sub remove_registration_user { $name,$slot_name,$title); &remove_registration_confirmation($r,$msg,['uname','udom','slotname', - 'entry','symb']); + 'entry','symb','context']); } sub remove_registration_confirmation { @@ -383,8 +397,10 @@ sub remove_registration_confirmation { '&\'').'" />'."\n"; } - my %lt = &Apache::lonlocal::texthash('yes' => 'Yes', - 'no' => 'No',); + my %lt = &Apache::lonlocal::texthash( + 'yes' => 'Yes', + 'no' => 'No', + ); $r->print(<<"END_CONFIRM");

$msg

@@ -510,6 +526,14 @@ sub release_reservation { if ( $consumed{$entry}->{'name'} eq ($uname.':'.$udom) ) { &Apache::lonnet::del('slot_reservations',[$entry], $cdom,$cnum); + my %storehash = ( + symb => $symb, + slot => $slot_name, + action => 'release', + context => $env{'form.context'}, + ); + &Apache::lonnet::instructor_log('slotreservationslog',\%storehash, + 1,$uname,$udom,$cnum,$cdom); } } @@ -530,7 +554,6 @@ sub release_reservation { '0_availablestudent', $parm_level, $new_param, 'string', $uname, $udom); - my $msg; if ($mgr eq 'F') { $msg = &mt('Released Reservation for user: [_1]',"$uname:$udom"); @@ -606,7 +629,14 @@ sub get_slot { STUFF - $r->print('

'.&mt('You can either [_1] your reservation from [2] to [_3] or [_4]','',''.$description1.'',''.$description2.'
','

')); + $r->print('

' + .&mt('You can either [_1]Change[_2] your reservation from [_3] to [_4] or' + ,'' + ,''.$description1.'' + ,''.$description2.'') + .'

' + ); &return_link($r); $r->print(< @@ -617,8 +647,9 @@ STUFF return 0; } + my ($cnum,$cdom)=&get_course(); my $reserved=&make_reservation($env{'form.slotname'}, - \%slot,$symb); + \%slot,$symb,$cnum,$cdom); my $description=&get_description($env{'form.slotname'},\%slot); if (defined($reserved)) { my $retvalue = 0; @@ -636,10 +667,11 @@ STUFF return 1; } - my %lt=('request'=>"Availibility list", - 'try' =>'Try again?', - 'or' => 'or'); - %lt=&Apache::lonlocal::texthash(%lt); + my %lt = &Apache::lonlocal::texthash( + 'request' => 'Availibility list', + 'try' => 'Try again?', + 'or' => 'or', + ); my $extra_input; if ($conflictable_slot) { @@ -843,6 +875,7 @@ sub show_choices { + STUFF } @@ -943,7 +976,7 @@ sub remove_link { $symb = &escape($symb); return <<"END_LINK"; - ($remove) END_LINK