version 1.330, 2011/11/14 00:20:39
|
version 1.334, 2011/12/20 22:46:06
|
Line 246 sub check_slot_access {
|
Line 246 sub check_slot_access {
|
# } |
# } |
my $slotstatus='NOT_IN_A_SLOT'; |
my $slotstatus='NOT_IN_A_SLOT'; |
my ($returned_slot,$slot_name); |
my ($returned_slot,$slot_name); |
|
my $now = time; |
|
my $num_usable_slots = 0; |
foreach my $slot (@slots) { |
foreach my $slot (@slots) { |
$slot =~ s/(^\s*|\s*$)//g; |
$slot =~ s/(^\s*|\s*$)//g; |
&Apache::lonxml::debug("getting $slot"); |
&Apache::lonxml::debug("getting $slot"); |
my %slot=&Apache::lonnet::get_slot($slot); |
my %slot=&Apache::lonnet::get_slot($slot); |
&Apache::lonhomework::showhash(%slot); |
&Apache::lonhomework::showhash(%slot); |
if ($slot{'starttime'} < time && |
next if ($slot{'endtime'} < $now); |
$slot{'endtime'} > time && |
$num_usable_slots ++; |
|
if ($slot{'starttime'} < $now && |
|
$slot{'endtime'} > $now && |
&Apache::loncommon::check_ip_acc($slot{'ip'})) { |
&Apache::loncommon::check_ip_acc($slot{'ip'})) { |
&Apache::lonxml::debug("$slot is good"); |
&Apache::lonxml::debug("$slot is good"); |
$slotstatus='NEEDS_CHECKIN'; |
$slotstatus='NEEDS_CHECKIN'; |
$returned_slot=\%slot; |
$returned_slot=\%slot; |
$slot_name=$slot; |
$slot_name=$slot; |
last; |
last; |
} |
} |
} |
} |
if ($slotstatus eq 'NEEDS_CHECKIN' && |
if ($slotstatus eq 'NEEDS_CHECKIN' && |
&proctor_checked_in($slot_name,$returned_slot,$type)) { |
&proctor_checked_in($slot_name,$returned_slot,$type)) { |
Line 299 sub check_slot_access {
|
Line 303 sub check_slot_access {
|
# However, the problem is not closed, and potentially, another slot might be |
# However, the problem is not closed, and potentially, another slot might be |
# used to gain access to it to work on it, until the due date is reached, and the |
# used to gain access to it to work on it, until the due date is reached, and the |
# problem then becomes CLOSED. Therefore return the slotstatus - |
# problem then becomes CLOSED. Therefore return the slotstatus - |
# (which will be NOT_IN_SLOT). |
# (which will be one of: NOT_IN_A_SLOT, RESERVABLE, RESERVABLE_LATER, or NOTRESERVABLE. |
if (!defined($slot_name) |
if (!defined($slot_name) && $type eq 'problem') { |
&& $checkedin |
if ($slotstatus eq 'NOT_IN_A_SLOT') { |
&& $type eq 'problem') { |
if (!$num_usable_slots) { |
return ($slotstatus); |
if ($env{'request.course.id'}) { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my ($symb)=&Apache::lonnet::whichuser(); |
|
$slotstatus = 'NOTRESERVABLE'; |
|
my ($reservable_now_order,$reservable_now,$reservable_future_order, |
|
$reservable_future) = |
|
&Apache::loncommon::get_future_slots($cnum,$cdom,$now,$symb); |
|
if ((ref($reservable_now_order) eq 'ARRAY') && (ref($reservable_now) eq 'HASH')) { |
|
if (@{$reservable_now_order} > 0) { |
|
$slotstatus = 'RESERVABLE'; |
|
$datemsg = $reservable_now->{$reservable_now_order->[-1]}{'endreserve'}; |
|
} |
|
} |
|
unless ($slotstatus eq 'RESERVABLE') { |
|
if ((ref($reservable_future_order) eq 'ARRAY') && (ref($reservable_future) eq 'HASH')) { |
|
if (@{$reservable_future_order} > 0) { |
|
$slotstatus = 'RESERVABLE_LATER'; |
|
$datemsg = $reservable_future->{$reservable_future_order->[0]}{'startreserve'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return ($slotstatus,$datemsg); |
} |
} |
|
|
if ($slotstatus eq 'NOT_IN_A_SLOT' |
if ($slotstatus eq 'NOT_IN_A_SLOT' |
Line 442 sub check_access {
|
Line 471 sub check_access {
|
$Apache::lonhomework::results{'resource.'.$id.'.maxtries'}=$maxtries; |
$Apache::lonhomework::results{'resource.'.$id.'.maxtries'}=$maxtries; |
if ($maxtries && $tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } |
if ($maxtries && $tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } |
# if (correct and show prob status) or excused then CANNOT_ANSWER |
# if (correct and show prob status) or excused then CANNOT_ANSWER |
if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/ |
if ( ($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/) |
&& |
&& (&show_problem_status()) ) { |
&show_problem_status() |
if (($Apache::lonhomework::history{"resource.$id.awarded"} >= 1) || |
&& |
(&Apache::lonnet::EXT("resource.$id.retrypartial") !~/^1|on|yes$/i)) { |
$Apache::lonhomework::history{"resource.$id.awarded"}==1) |
$status = 'CANNOT_ANSWER'; |
|| |
} |
$Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) { |
} elsif ($Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) { |
$status = 'CANNOT_ANSWER'; |
$status = 'CANNOT_ANSWER'; |
} |
} |
if ($status eq 'CANNOT_ANSWER' |
if ($status eq 'CANNOT_ANSWER' |
Line 1125 sub get_template_list {
|
Line 1154 sub get_template_list {
|
my $filename=$file->[0]; |
my $filename=$file->[0]; |
$filename=~s{^\Q$londocroot\E}{}; |
$filename=~s{^\Q$londocroot\E}{}; |
$result.=' <span class="LC_fontsize_small">' |
$result.=' <span class="LC_fontsize_small">' |
.'<a href="'.$filename.'?inhibitmenu=yes" target="sample">'.&mt('Example').'</a>' |
.&Apache::loncommon::modal_link($filename.'?inhibitmenu=yes',&mt('Example'),600,420,'sample') |
.'</span><br />'."\n"; |
.'</span><br />'."\n"; |
$count ++; |
$count ++; |
} |
} |