version 1.147, 2006/05/12 01:18:50
|
version 1.149, 2006/05/12 05:18:34
|
Line 223 sub add_request_another_attempt_button {
|
Line 223 sub add_request_another_attempt_button {
|
if (!$text) { $text="Request another attempt"; } |
if (!$text) { $text="Request another attempt"; } |
my $result; |
my $result; |
my $symb=&Apache::lonnet::symbread(); |
my $symb=&Apache::lonnet::symbread(); |
|
# not a slot access based resource |
|
my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb); |
|
if ($useslots =~ /^\s*no\s*$/i) { |
|
return ''; |
|
} |
|
|
my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb); |
my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb); |
my $action='get_reservation'; |
my $action='get_reservation'; |
if ($slot_name) { |
if ($slot_name) { |
Line 496 DONESCREEN
|
Line 502 DONESCREEN
|
if ($status eq 'NEEDS_CHECKIN') { |
if ($status eq 'NEEDS_CHECKIN') { |
if(&proctor_check_auth($slot_name,$slot,'Task') |
if(&proctor_check_auth($slot_name,$slot,'Task') |
&& defined($Apache::inputtags::slot_name)) { |
&& defined($Apache::inputtags::slot_name)) { |
my $result=&add_to_queue('gradingqueue', |
my $result= |
[$Apache::inputtags::slot_name]); |
&add_to_queue('gradingqueue', |
|
{'type' => 'task', |
|
'time' => time, |
|
'slot' => |
|
$Apache::inputtags::slot_name}); |
&Apache::lonxml::debug("add_to_queue said $result"); |
&Apache::lonxml::debug("add_to_queue said $result"); |
} |
} |
} |
} |
Line 803 DONEBUTTON
|
Line 813 DONEBUTTON
|
my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"}; |
my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"}; |
my $title=&Apache::lonnet::gettitle(); |
my $title=&Apache::lonnet::gettitle(); |
|
|
|
my $start_time; |
|
|
my $slot_name= |
my $slot_name= |
$Apache::lonhomework::history{"resource.$version.0.checkedin.slot"}; |
$Apache::lonhomework::history{"resource.$version.0.checkedin.slot"}; |
my %slot=&Apache::lonnet::get_slot($slot_name); |
if ($slot_name) { |
my $start_time= |
my %slot=&Apache::lonnet::get_slot($slot_name); |
&Apache::lonlocal::locallocaltime($slot{'starttime'}); |
|
|
$start_time=$slot{'starttime'} |
|
} else { |
|
$start_time= |
|
&Apache::lonnet::EXT('resource.0.opendate'); |
|
} |
|
$start_time=&Apache::lonlocal::locallocaltime($start_time); |
|
|
my $status = "\n<div class='LC_$bt_status LC_criteria'>\n"; |
my $status = "\n<div class='LC_$bt_status LC_criteria'>\n"; |
|
|
Line 844 DONEBUTTON
|
Line 862 DONEBUTTON
|
my $internal_location=&internal_location(); |
my $internal_location=&internal_location(); |
$result=~s/\Q$internal_location\E/$status/; |
$result=~s/\Q$internal_location\E/$status/; |
} |
} |
} |
|
if ($target eq 'web') { |
|
$result.="\n</div>\n". |
$result.="\n</div>\n". |
&Apache::loncommon::end_page({'discussion' => 1}); |
&Apache::loncommon::end_page({'discussion' => 1}); |
} |
} |
Line 871 DONEBUTTON
|
Line 887 DONEBUTTON
|
} |
} |
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
&Apache::structuretags::finalize_storage(); |
&Apache::structuretags::finalize_storage(); |
if ($award eq 'SUBMITTED' |
if ($award eq 'SUBMITTED') { |
&& defined($Apache::inputtags::slot_name)) { |
my $useslots = &Apache::lonnet::EXT("resource.0.useslots"); |
&add_to_queue('gradingqueue',[$Apache::inputtags::slot_name]); |
if ($useslots =~ /^\s*no\s*$/i) { |
|
&add_to_queue('gradingqueue', |
|
{'type' => 'task', |
|
'time' => time}); |
|
} elsif (defined($Apache::inputtags::slot_name)) { |
|
&add_to_queue('gradingqueue', |
|
{'type' => 'task', |
|
'time' => time, |
|
'slot' => $Apache::inputtags::slot_name}); |
|
} |
} |
} |
} elsif ($Apache::lonhomework::results{'INTERNAL_store'}) { |
} elsif ($Apache::lonhomework::results{'INTERNAL_store'}) { |
&Apache::structuretags::finalize_storage(); |
&Apache::structuretags::finalize_storage(); |
Line 1012 sub move_between_queues {
|
Line 1037 sub move_between_queues {
|
} else { |
} else { |
$cur_data = ['none']; |
$cur_data = ['none']; |
} |
} |
my $result=&add_to_queue($dest_queue,[$cur_data->[0]]); |
my $result=&add_to_queue($dest_queue,$cur_data); |
if ($result ne 'ok') { |
if ($result ne 'ok') { |
return $result; |
return $result; |
} |
} |
Line 1111 sub check_queue_for_key {
|
Line 1136 sub check_queue_for_key {
|
if (defined($results{"$todo\0locked"})) { |
if (defined($results{"$todo\0locked"})) { |
return 'locked'; |
return 'locked'; |
} |
} |
my $slot; |
if (my $slot=&slotted_access($results{$todo})) { |
if (ref($results{$todo}) eq 'ARRAY') { |
|
$slot = $results{$todo}[0]; |
|
} elsif (ref($results{$todo}) eq 'HASH') { |
|
$slot = $results{$todo}{'slot'}; |
|
} |
|
if (defined($slot)) { |
|
my %slot_data=&Apache::lonnet::get_slot($slot); |
my %slot_data=&Apache::lonnet::get_slot($slot); |
if ($slot_data{'endtime'} > time) { |
if ($slot_data{'endtime'} > time) { |
return 'in_progress'; |
return 'in_progress'; |
} |
} |
|
} else { |
|
my ($symb) = &decode_queue_key($todo); |
|
my $due_date = &Apache::lonhomework::due_date('0',$symb); |
|
if ($due_date > time) { |
|
return 'in_progress'; |
|
} |
} |
} |
return 'enqueued'; |
return 'enqueued'; |
} |
} |
Line 1181 sub show_queue {
|
Line 1206 sub show_queue {
|
&Apache::lonlocal::locallocaltime($queue{$key})."</td></tr>"; |
&Apache::lonlocal::locallocaltime($queue{$key})."</td></tr>"; |
} elsif ($key!~/(timestamp|locked)$/) { |
} elsif ($key!~/(timestamp|locked)$/) { |
$result.="<tr>"; |
$result.="<tr>"; |
my $slot=$queue{$key}->[0]; |
my ($end_time,$slot_text); |
my %slot_data=&Apache::lonnet::get_slot($slot); |
if (my $slot=&slotted_access($queue{$key})) { |
|
my %slot_data=&Apache::lonnet::get_slot($slot); |
|
$end_time = $slot_data{'endtime'}; |
|
$slot_text = &mt('Slot: [_1]',$slot); |
|
} else { |
|
$end_time = &Apache::lonhomework::due_date('0',$symb); |
|
$slot_text = ''; |
|
} |
if ($with_selects) { |
if ($with_selects) { |
my $ekey=&Apache::lonnet::escape($key); |
my $ekey=&Apache::lonnet::escape($key); |
my ($action,$description,$status)=('select',&mt('Select')); |
my ($action,$description,$status)=('select',&mt('Select')); |
Line 1200 sub show_queue {
|
Line 1232 sub show_queue {
|
$seclist.='<input type="hidden" name="chosensections" |
$seclist.='<input type="hidden" name="chosensections" |
value="'.$sec.'" />'; |
value="'.$sec.'" />'; |
} |
} |
if (time > $slot_data{'endtime'}) { |
if ($end_time ne '' && time > $end_time) { |
$result.=(<<FORM); |
$result.=(<<FORM); |
<td>$status</td> |
<td>$status</td> |
<td> |
<td> |
Line 1217 sub show_queue {
|
Line 1249 sub show_queue {
|
FORM |
FORM |
|
|
} else { |
} else { |
$result.='<td>'.&mt("In Progress").'</td>' |
$result.='<td>'.&mt("In Progress").'</td><td> </td>' |
} |
} |
} |
} |
$result.= "<td>".$fullname->{$uname.':'.$udom}. |
$result.= "<td>".$fullname->{$uname.':'.$udom}. |
" <tt>($uname:$udom)</tt> </td>"; |
" <tt>($uname:$udom)</tt> </td>"; |
$result.='<td>Slot: '.$slot.' End time: '. |
$result.='<td>'.$slot_text.' End time: '. |
&Apache::lonlocal::locallocaltime($slot_data{'endtime'}). |
&Apache::lonlocal::locallocaltime($end_time). |
"</td></tr>"; |
"</td></tr>"; |
} |
} |
} |
} |
Line 1253 sub get_queue_counts {
|
Line 1285 sub get_queue_counts {
|
} elsif ($key!~/(timestamp|locked)$/) { |
} elsif ($key!~/(timestamp|locked)$/) { |
my ($symb,$uname,$udom) = &decode_queue_key($key); |
my ($symb,$uname,$udom) = &decode_queue_key($key); |
$entries++; |
$entries++; |
my $slot=$queue{$key}->[0]; |
if (my $slot=&slotted_access($queue{$key})) { |
if (!exists($slot_cache{$slot})) { |
if (!exists($slot_cache{$slot})) { |
my %slot_data=&Apache::lonnet::get_slot($slot); |
my %slot_data=&Apache::lonnet::get_slot($slot); |
$slot_cache{$slot} = \%slot_data; |
$slot_cache{$slot} = \%slot_data; |
} |
} |
if (time > $slot_cache{$slot}{'endtime'}) { |
if (time > $slot_cache{$slot}{'endtime'}) { |
$ready_to_grade++; |
$ready_to_grade++; |
|
} |
|
} else { |
|
my $due_date = &Apache::lonhomework::due_date('0',$symb); |
|
if ($due_date ne '' && time > $due_date) { |
|
$ready_to_grade++; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1293 sub queue_key_locked {
|
Line 1331 sub queue_key_locked {
|
return undef; |
return undef; |
} |
} |
|
|
|
sub slotted_access { |
|
my ($queue_entry) = @_; |
|
if (ref($queue_entry) eq 'ARRAY') { |
|
if (defined($queue_entry->[0])) { |
|
return $queue_entry->[0]; |
|
} |
|
return undef; |
|
} elsif (ref($queue_entry) eq 'HASH') { |
|
if (defined($queue_entry->{'slot'})) { |
|
return $queue_entry->{'slot'}; |
|
} |
|
return undef; |
|
} |
|
return undef; |
|
} |
|
|
sub pick_from_queue_data { |
sub pick_from_queue_data { |
my ($queue,$check_section,$queuedata,$cdom,$cnum)=@_; |
my ($queue,$check_section,$queuedata,$cdom,$cnum)=@_; |
my @possible; # will hold queue entries that are valid to be selected |
my @possible; # will hold queue entries that are valid to be selected |
Line 1307 sub pick_from_queue_data {
|
Line 1361 sub pick_from_queue_data {
|
next; |
next; |
} |
} |
} |
} |
my $slot=$queuedata->{$key}[0]; |
my $end_time; |
my %slot_data=&Apache::lonnet::get_slot($slot); |
if (my $slot=&slotted_access($queuedata->{$key})) { |
if ($slot_data{'endtime'} > time) { |
my %slot_data=&Apache::lonnet::get_slot($slot); |
|
if ($slot_data{'endtime'} < time) { |
|
$end_time = $slot_data{'endtime'}; |
|
} |
|
} else { |
|
my $due_date = &Apache::lonhomework::due_date('0',$symb); |
|
if ($due_date > time) { |
|
$end_time = $due_date; |
|
} |
|
} |
|
if ($end_time ne '') { |
&Apache::lonxml::debug("not time"); |
&Apache::lonxml::debug("not time"); |
next; |
next; |
} |
} |
|
|
if (exists($queuedata->{"$key\0locked"})) { |
if (exists($queuedata->{"$key\0locked"})) { |
&Apache::lonxml::debug("someone already has um."); |
&Apache::lonxml::debug("someone already has um."); |
next; |
next; |
} |
} |
push(@possible,[$key,$slot_data{'endtime'}]); |
push(@possible,[$key,$end_time]); |
} |
} |
if (@possible) { |
if (@possible) { |
# sort entries in order by slot end time |
# sort entries in order by slot end time |