--- loncom/homework/bridgetask.pm 2010/10/12 16:07:43 1.255 +++ loncom/homework/bridgetask.pm 2010/11/01 16:32:32 1.256 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.255 2010/10/12 16:07:43 raeburn Exp $ +# $Id: bridgetask.pm,v 1.256 2010/11/01 16:32:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,6 +37,7 @@ use Apache::lonmenu; use Apache::lonlocal; use Apache::lonxml; use Apache::slotrequest(); +use Apache::structuretags(); use Time::HiRes qw( gettimeofday tv_interval ); use LONCAPA; @@ -380,6 +381,7 @@ sub show_task { ( $status eq 'BANNED') || ( $status eq 'UNAVAILABLE') || ( $status eq 'NOT_IN_A_SLOT') || + ( $status eq 'NOT_YET_VIEWED') || ( $status eq 'NEEDS_CHECKIN') || ( $status eq 'WAITING_FOR_GRADE') || ( $status eq 'INVALID_ACCESS') || @@ -627,6 +629,14 @@ sub start_Task { &Apache::structuretags::page_start($target,$token,$tagstack, $parstack,$parser,$safeeval, $name,&style($target)); + + } + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || + $target eq 'tex') { + if ($env{'form.markaccess'}) { + my @interval=&Apache::lonnet::EXT("resource.0.interval"); + &Apache::lonnet::set_first_access($interval[1]); + } } if ($target eq 'web' && $env{'request.state'} ne 'construct') { @@ -669,8 +679,8 @@ sub start_Task { my ($version,$previous)=&get_version(); ($status,$accessmsg,my $slot_name,$slot) = &Apache::lonhomework::check_slot_access('0','Task'); - if ($status eq 'CAN_ANSWER' && $version eq '') { - # CAN_ANSWER mode, and no current version, unproctored access + if ((($status eq 'CAN_ANSWER') || ($status eq 'NOT_YET_VIEWED')) && ($version eq '')) { + # CAN_ANSWER or NOT_YET_VIEWED mode, and no current version, unproctored access # thus self-checkedin my $check = &check_in('Task',undef,undef,$slot_name); if ($check =~ /^error: /) { @@ -714,7 +724,10 @@ sub start_Task { $msg.='

'.&mt('Your submission is in the grading queue.').'

'; } elsif ($env{'form.donescreen'}) { $result .= &done_screen($version); - } elsif ($status ne 'NOT_YET_VIEWED') { + } elsif ($status eq 'NOT_YET_VIEWED') { + my $symb=&Apache::lonnet::symbread(); + $msg.=&Apache::structuretags::firstaccess_msg($accessmsg,$symb); + } else { $msg.='

'.&mt('Not open to be viewed').'

'; } if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') { @@ -1339,10 +1352,10 @@ DONEBUTTON $Apache::lonhomework::results{"resource.$version.0.solved"}; } &minimize_storage(); - my ($canstore,$domain,$name); + my ($canstore,$domain,$name,$symb,$courseid); + ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser(); + if ($env{'form.gradingkey'}) { - (my $symb,my $courseid,$domain,$name) = - &Apache::lonnet::whichuser(); my $todo=&unescape($env{'form.gradingkey'}); my ($keysymb,$uname,$udom)=&decode_queue_key($todo); if ($symb eq $keysymb) { @@ -1353,6 +1366,16 @@ DONEBUTTON } if ($canstore) { &Apache::structuretags::finalize_storage(); + my @interval = &Apache::lonnet::EXT("resource.0.interval"); + if ($interval[0] =~ /^\d+$/ && $interval[1] eq 'resource') { + my $key=$courseid."\0".$symb; + my %times=&Apache::lonnet::get('firstaccesstimes', + [$key],$domain,$name); + if ($times{$key}) { + my $delresult.=&Apache::lonnet::del('firstaccesstimes', + [$key],$domain,$name); + } + } # data stored, now handle queue if ($review) { if ($env{'form.queue'} eq 'reviewqueue') {