--- loncom/homework/lonhomework.pm 2005/01/31 21:57:32 1.196 +++ loncom/homework/lonhomework.pm 2005/03/17 21:56:04 1.200 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.196 2005/01/31 21:57:32 albertel Exp $ +# $Id: lonhomework.pm,v 1.200 2005/03/17 21:56:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -162,8 +162,11 @@ sub send_footer { $request->print(&Apache::lontexconvert::footer()); } -$Apache::lonxml::browse=''; +sub proctor_checked_in { + return 0; +} +$Apache::lonxml::browse=''; sub check_ip_acc { my ($acc)=@_; if (!defined($acc) || $acc =~ /^\s*$/) { return 1; } @@ -209,6 +212,41 @@ sub check_ip_acc { } return $allowed; } + +sub check_task_access { + #does it pass normal muster + my ($status,$datemsg)=&check_access; + if ($status eq 'SHOW_ANSWER' || + $status eq 'CLOSED' || + $status eq 'CANNOT_ANSWER' || + $status eq 'INVALID_ACCESS' || + $status eq 'UNAVAILABLE') { + return ($status,$datemsg); + } + + + my ($id)=@_; + my @slots=split(':',&Apache::lonnet::EXT("resource.$id.available")); +# if (!@slots) { +# return ($status,$datemsg); +# } + my $slotstatus='NOT_IN_A_SLOT'; + foreach my $slot (@slots) { + my %slot=&Apache::lonnet::get_slot($slot); + if ($slot{'starttime'} < time && + $slot{'endtime'} > time && + &check_ip_access($slot{'ip'})) { + $slotstatus='IN_A_SLOT'; + last; + } + } + if ($slotstatus eq 'IN_A_SLOT' && + &proctor_checked_in()) { + $slotstatus='CAN_ANSWER'; + } + return ($slotstatus,$datemsg); +} + # JB, 9/24/2002: Any changes in this function may require a change # in lonnavmaps::resource::getDateStatus. sub check_access { @@ -431,11 +469,7 @@ sub setuppermissions { sub setupheader { my $request=$_[0]; - if ($ENV{'browser.mathml'}) { - &Apache::loncommon::content_type($request,'text/xml'); - } else { - &Apache::loncommon::content_type($request,'text/html'); - } + &Apache::loncommon::content_type($request,'text/html'); if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) { &Apache::loncommon::no_cache($request); } @@ -496,7 +530,8 @@ sub analyze_header { if ($ENV{'environment.remote'} eq 'off') { $bodytag=&Apache::loncommon::bodytag(); } - my $result.=' + my $html=&Apache::lonxml::xmlbegin(); + my $result.=$html.' '.&mt("Analyzing a problem").' '.$bodytag.&Apache::lonxml::message_location().'
'. &Apache::structuretags::remember_problem_state().' @@ -636,7 +672,7 @@ sub editxmlmode {
' . $xml_help . ' -
'; &Apache::lonxml::add_messages(\$result);