version 1.37, 2005/12/14 22:26:10
|
version 1.39, 2006/02/03 17:07:20
|
Line 275 sub release_slot {
|
Line 275 sub release_slot {
|
&& defined($env{'form.symb'})) { |
&& defined($env{'form.symb'})) { |
$symb = $env{'form.symb'}; |
$symb = $env{'form.symb'}; |
} |
} |
|
my %slot=&Apache::lonnet::get_slot($slot_name); |
|
my $description=&get_description($env{'form.slotname'},\%slot); |
|
|
|
if ($mgr ne 'F') { |
|
if ($slot{$slot_name}{'starttime'} < time) { |
|
$r->print("<p>Not allowed to release Reservation: $description, as it has already ended.</p>"); |
|
$r->print('<p><a href="/adm/flip?postdata=return:">'. |
|
&mt('Return to last resource').'</a></p>'); |
|
return 0; |
|
} |
|
} |
# 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 @slots = split(/:/,&Apache::lonnet::EXT("resource.0.availablestudent", |
$symb,$udom,$uname)); |
$symb,$udom,$uname)); |
Line 302 sub release_slot {
|
Line 312 sub release_slot {
|
'0_availablestudent', |
'0_availablestudent', |
1, $new_param, 'string', |
1, $new_param, 'string', |
$uname,$udom); |
$uname,$udom); |
my %slot=&Apache::lonnet::get_slot($slot_name); |
|
my $description=&get_description($env{'form.slotname'},\%slot); |
my $description=&get_description($env{'form.slotname'},\%slot); |
$r->print("<p>Released Reservation: $description</p>"); |
$r->print("<p>Released Reservation: $description</p>"); |
if ($mgr eq 'F') { |
if ($mgr eq 'F') { |
Line 325 sub delete_slot {
|
Line 334 sub delete_slot {
|
my ($cnum,$cdom)=&get_course(); |
my ($cnum,$cdom)=&get_course(); |
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, |
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, |
"^$slot_name\0"); |
"^$slot_name\0"); |
|
my ($tmp) = %consumed; |
|
if ($tmp =~ /error: 2/) { undef(%consumed); } |
|
|
if (%slot && !%consumed) { |
if (%slot && !%consumed) { |
$slot{'type'} = 'deleted'; |
$slot{'type'} = 'deleted'; |
Line 732 sub show_table {
|
Line 743 sub show_table {
|
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, |
my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, |
"^$slot\0"); |
"^$slot\0"); |
my $ids; |
my $ids; |
foreach my $entry (sort(keys(%consumed))) { |
|
my (undef,$id)=split("\0",$entry); |
my ($tmp)=%consumed; |
my ($uname,$udom) = split('@',$consumed{$entry}{'name'}); |
if ($tmp !~ /^error: /) { |
my $name = &Apache::loncommon::plainname($uname,$udom); |
foreach my $entry (sort(keys(%consumed))) { |
$ids.= '<nobr>'.$name.&remove_link($slot,$entry,$uname,$udom, |
my (undef,$id)=split("\0",$entry); |
$consumed{$entry}{'symb'}) |
my ($uname,$udom) = split('@',$consumed{$entry}{'name'}); |
.'</nobr><br />'; |
my $name = &Apache::loncommon::plainname($uname,$udom); |
|
$ids.= '<nobr>'.$name.&remove_link($slot,$entry,$uname,$udom, |
|
$consumed{$entry}{'symb'}) |
|
.'</nobr><br />'; |
|
} |
} |
} |
|
|
my $start=($slots{$slot}->{'starttime'}? |
my $start=($slots{$slot}->{'starttime'}? |
Line 1151 sub handler {
|
Line 1166 sub handler {
|
} elsif ($env{'form.command'} eq 'get') { |
} elsif ($env{'form.command'} eq 'get') { |
&get_slot($r,$symb); |
&get_slot($r,$symb); |
} elsif ($env{'form.command'} eq 'change') { |
} elsif ($env{'form.command'} eq 'change') { |
&release_slot($r,$symb,$env{'form.releaseslot'},1); |
if (&release_slot($r,$symb,$env{'form.releaseslot'},1)) { |
&get_slot($r,$symb); |
&get_slot($r,$symb); |
|
} |
} else { |
} else { |
$r->print("<p>Unknown command: ".$env{'form.command'}."</p>"); |
$r->print("<p>Unknown command: ".$env{'form.command'}."</p>"); |
} |
} |