version 1.223, 2005/11/15 18:23:17
|
version 1.227, 2005/12/15 23:20:55
|
Line 166 sub send_footer {
|
Line 166 sub send_footer {
|
} |
} |
|
|
sub proctor_checked_in { |
sub proctor_checked_in { |
my ($slot_name,$slot)=@_; |
my ($slot_name,$slot,$type)=@_; |
my @allowed=split(",",$slot->{'proctor'}); |
my @possible_proctors=split(",",$slot->{'proctor'}); |
my $version=$Apache::lonhomework::history{'resource.version'}; |
|
foreach my $possible (@allowed) { |
my $key; |
if ($Apache::lonhomework::history{"resource.$version.checkedin"} eq |
if ($type eq 'Task') { |
$possible && |
my $version=$Apache::lonhomework::history{'resource.version'}; |
$Apache::lonhomework::history{"resource.$version.checkedin.slot"} |
$key ="resource.$version.checkedin"; |
eq $slot_name) { |
} elsif ($type eq 'problem') { |
|
$key ='resource.0.checkedin'; |
|
} |
|
|
|
foreach my $possible (@possible_proctors) { |
|
if ($Apache::lonhomework::history{$key} eq $possible |
|
&& $Apache::lonhomework::history{$key.'.slot'} eq $slot_name) { |
return 1; |
return 1; |
} |
} |
} |
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
Line 230 sub check_ip_acc {
|
Line 237 sub check_ip_acc {
|
return $allowed; |
return $allowed; |
} |
} |
|
|
sub check_task_access { |
sub check_slot_access { |
|
my ($id,$type)=@_; |
|
|
# does it pass normal muster |
# does it pass normal muster |
# yes we really do want the default args passing |
my ($status,$datemsg)=&check_access($id); |
my ($status,$datemsg)=&check_access; |
|
|
my $useslots = &Apache::lonnet::EXT("resource.$id.useslots"); |
|
if ($useslots ne 'resource') { |
|
return ($status,$datemsg); |
|
} |
|
|
if ($status eq 'SHOW_ANSWER' || |
if ($status eq 'SHOW_ANSWER' || |
$status eq 'CLOSED' || |
$status eq 'CLOSED' || |
$status eq 'CANNOT_ANSWER' || |
|
$status eq 'INVALID_ACCESS' || |
$status eq 'INVALID_ACCESS' || |
$status eq 'UNAVAILABLE') { |
$status eq 'UNAVAILABLE') { |
return ($status,$datemsg); |
return ($status,$datemsg); |
Line 244 sub check_task_access {
|
Line 257 sub check_task_access {
|
if ($env{'request.state'} eq "construct") { |
if ($env{'request.state'} eq "construct") { |
return ($status,$datemsg); |
return ($status,$datemsg); |
} |
} |
my $version=$Apache::lonhomework::history{'resource.version'}; |
|
if ($Apache::lonhomework::history{"resource.$version.checkedin"} && |
if ($type eq 'Task') { |
$Apache::lonhomework::history{"resource.$version.status"} eq 'pass') { |
my $version=$Apache::lonhomework::history{'resource.version'}; |
return ('SHOW_ANSWER'); |
if ($Apache::lonhomework::history{"resource.$version.checkedin"} && |
|
$Apache::lonhomework::history{"resource.$version.status"} eq 'pass') { |
|
return ('SHOW_ANSWER'); |
|
} |
} |
} |
my ($id)=@_; |
|
my @slots= |
my @slots= |
(split(':',&Apache::lonnet::EXT("resource.$id.availablestudent")), |
(split(':',&Apache::lonnet::EXT("resource.$id.availablestudent")), |
split(':',&Apache::lonnet::EXT("resource.$id.available"))); |
split(':',&Apache::lonnet::EXT("resource.$id.available"))); |
Line 274 sub check_task_access {
|
Line 290 sub check_task_access {
|
} |
} |
} |
} |
if ($slotstatus eq 'NEEDS_CHECKIN' && |
if ($slotstatus eq 'NEEDS_CHECKIN' && |
&proctor_checked_in($slot_name,$returned_slot)) { |
&proctor_checked_in($slot_name,$returned_slot,$type)) { |
&Apache::lonxml::debug("protoctor checked in"); |
&Apache::lonxml::debug("protoctor checked in"); |
$slotstatus='CAN_ANSWER'; |
$slotstatus='CAN_ANSWER'; |
} |
} |
if ( $slotstatus eq 'NOT_IN_A_SLOT' && |
|
$Apache::lonhomework::history{"resource.$version.checkedin"}) { |
my ($pass_status,$checkedin); |
if ($Apache::lonhomework::history{"resource.$version.status"} eq 'fail') { |
if ($type eq 'Task') { |
|
my $version=$Apache::lonhomework::history{'resource.version'}; |
|
$pass_status = |
|
$Apache::lonhomework::history{"resource.$version.status"} eq 'fail'; |
|
$checkedin = |
|
$Apache::lonhomework::history{"resource.$version.checkedin"}; |
|
} elsif ($type eq 'problem') { |
|
$pass_status = 1; |
|
$checkedin = $Apache::lonhomework::history{"resource.0.checkedin"}; |
|
} |
|
|
|
if ($slotstatus eq 'NOT_IN_A_SLOT' |
|
&& $checkedin ) { |
|
|
|
if ($pass_status) { |
return ('SHOW_ANSWER'); |
return ('SHOW_ANSWER'); |
} else { |
} else { |
return ('WAITING_FOR_GRADE'); |
return ('WAITING_FOR_GRADE'); |
} |
} |
|
|
|
} |
|
if ( $status eq 'CANNOT_ANSWER' && |
|
($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) { |
|
return ($status,$datemsg); |
} |
} |
|
|
return ($slotstatus,$datemsg,$slot_name,$returned_slot); |
return ($slotstatus,$datemsg,$slot_name,$returned_slot); |
} |
} |
|
|
Line 297 sub check_access {
|
Line 333 sub check_access {
|
my $status; |
my $status; |
my $datemsg = ''; |
my $datemsg = ''; |
my $lastdate = ''; |
my $lastdate = ''; |
my $temp; |
|
my $type; |
my $type; |
my $passed; |
my $passed; |
|
|
Line 334 sub check_access {
|
Line 369 sub check_access {
|
return($status,$date); |
return($status,$date); |
} |
} |
|
|
foreach $temp ("opendate","duedate","answerdate") { |
foreach my $temp ("opendate","duedate","answerdate") { |
$lastdate = $date; |
$lastdate = $date; |
$date = &Apache::lonnet::EXT("resource.$id.$temp"); |
$date = &Apache::lonnet::EXT("resource.$id.$temp"); |
my $thistype = &Apache::lonnet::EXT("resource.$id.$temp.type"); |
my $thistype = &Apache::lonnet::EXT("resource.$id.$temp.type"); |
Line 718 sub editxmlmode {
|
Line 753 sub editxmlmode {
|
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef, |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef, |
($env{'environment.remote'} ne 'off')); |
($env{'environment.remote'} ne 'off')); |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
$result.=$html.$bodytag. |
my $head="<head><title>EditXML $file</title>". |
|
&Apache::edit::js_change_detection()."</head>"; |
|
|
|
$result.=$html.$head.$bodytag. |
&renderpage($request,$file,['no_output_web'],1). |
&renderpage($request,$file,['no_output_web'],1). |
&Apache::lonxml::message_location().' |
&Apache::lonxml::message_location().' |
<form name="lonhomework" method="POST" action="'. |
<form '.&Apache::edit::form_change_detection().' name="lonhomework" method="POST" action="'. |
&HTML::Entities::encode($env{'request.uri'},'<>&"').'">'. |
&HTML::Entities::encode($env{'request.uri'},'<>&"').'">'. |
&Apache::structuretags::remember_problem_state().' |
&Apache::structuretags::remember_problem_state().' |
<input type="hidden" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="hidden" name="problemmode" value="'.&mt('EditXML').'" /> |
Line 733 sub editxmlmode {
|
Line 771 sub editxmlmode {
|
<input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" /> |
<input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" /> |
<hr /> |
<hr /> |
' . $xml_help . ' |
' . $xml_help . ' |
<textarea style="width:100%" rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'. |
<textarea '.&Apache::edit::element_change_detection().' style="width:100%" rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'. |
&HTML::Entities::encode($problem,'<>&"').'</textarea> |
&HTML::Entities::encode($problem,'<>&"').'</textarea> |
</form></body></html>'; |
</form></body></html>'; |
&Apache::lonxml::add_messages(\$result); |
&Apache::lonxml::add_messages(\$result); |
Line 939 sub handler {
|
Line 977 sub handler {
|
if ($Apache::lonhomework::browse ne 'F' && |
if ($Apache::lonhomework::browse ne 'F' && |
$env{'request.state'} ne "construct") { |
$env{'request.state'} ne "construct") { |
#should know where we are, so ask |
#should know where we are, so ask |
if ( &Apache::lonnet::mod_perl_version() == 2 ) { |
|
&Apache::lonnet::cleanenv(); |
|
} |
|
&Apache::lonnet::logthis(&Apache::lonnet::mod_perl_version()); |
|
$request->internal_redirect('/adm/ambiguous'); return OK; |
$request->internal_redirect('/adm/ambiguous'); return OK; |
} |
} |
} |
} |