version 1.35, 2005/11/21 21:20:06
|
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 626 sub show_table {
|
Line 637 sub show_table {
|
'endtime' => 'End Time', |
'endtime' => 'End Time', |
'startreserve' => 'Time students can start reserving', |
'startreserve' => 'Time students can start reserving', |
'secret' => 'Secret Word', |
'secret' => 'Secret Word', |
'maxspace' => 'Maxium # of students', |
'maxspace' => 'Maximum # of students', |
'ip' => 'IP or DNS restrictions', |
'ip' => 'IP or DNS restrictions', |
'symb' => 'Resource slot is restricted to.', |
'symb' => 'Resource slot is restricted to.', |
'uniqueperiod' => 'Period of time slot is unique', |
'uniqueperiod' => 'Period of time slot is unique', |
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 1129 sub handler {
|
Line 1144 sub handler {
|
} else { |
} else { |
my $symb=&Apache::lonnet::unescape($env{'form.symb'}); |
my $symb=&Apache::lonnet::unescape($env{'form.symb'}); |
my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb); |
my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb); |
if ($res !~ /\.task$/) { |
my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb); |
|
if ($useslots ne 'resource') { |
&fail($r,'not_valid'); |
&fail($r,'not_valid'); |
return OK; |
return OK; |
} |
} |
$env{'request.symb'}=$symb; |
$env{'request.symb'}=$symb; |
my ($status) = &Apache::lonhomework::check_task_access('0'); |
my $type = ($res =~ /\.task$/) ? 'Task' |
|
: 'problem'; |
|
my ($status) = &Apache::lonhomework::check_slot_access('0',$type); |
if ($status eq 'CAN_ANSWER' || |
if ($status eq 'CAN_ANSWER' || |
$status eq 'NEEDS_CHECKIN' || |
$status eq 'NEEDS_CHECKIN' || |
$status eq 'WAITING_FOR_GRADE') { |
$status eq 'WAITING_FOR_GRADE') { |
Line 1148 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>"); |
} |
} |