--- loncom/homework/bridgetask.pm 2005/05/10 20:29:26 1.22 +++ loncom/homework/bridgetask.pm 2005/06/04 08:17:06 1.37 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.22 2005/05/10 20:29:26 albertel Exp $ +# $Id: bridgetask.pm,v 1.37 2005/06/04 08:17:06 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use Apache::File(); use Apache::lonmenu; use Apache::lonlocal; use Apache::lonxml; +use Apache::slotrequest(); use Time::HiRes qw( gettimeofday tv_interval ); BEGIN { @@ -69,10 +70,18 @@ sub proctor_check_auth { if ($puser eq $user && $pdom eq $domain) { my $authhost=&Apache::lonnet::authenticate($puser,$env{'form.proctorpassword'},$pdom); if ($authhost ne 'no_host') { - $Apache::lonhomework::results{'resource.checkedin'}= + my $version= + $Apache::lonhomework::results{'resource.version'}= + ++$Apache::lonhomework::history{'resource.version'}; + $Apache::lonhomework::results{"resource.$version.checkedin"}= $user.'@'.$domain; - $Apache::lonhomework::results{'resource.checkedin.slot'}= + $Apache::lonhomework::results{"resource.$version.checkedin.slot"}= $slot_name; + foreach my $key (keys(%Apache::lonhomework::history)) { + if ($key=~/^resource\.0\./) { + $Apache::lonhomework::results{$key}=''; + } + } return 1; } } @@ -80,24 +89,114 @@ sub proctor_check_auth { return 0; } +sub get_version { + my ($version,$previous); + if ($env{'form.previousversion'} && + $env{'form.previousversion'} ne 'current' && + defined($Apache::lonhomework::history{'resource.'.$env{'form.previousversion'}.'.status'})) { + $version=$env{'form.previousversion'}; + $previous=1; + } else { + $version=$Apache::lonhomework::history{'resource.version'}; + $previous=0; + } + if (wantarray) { + return ($version,$previous); + } + return $version; +} + sub add_previous_version_button { + my ($status)=@_; my $result; - $result.=&mt(' Show a previously done version: [_1]',''); + if ($Apache::lonhomework::history{'resource.version'} eq '') { + return ''; + } + if ($Apache::lonhomework::history{'resource.version'} < 2 && + $status ne 'NEEDS_CHECKIN') { + return ''; + } + my $version=&get_version(); + if ($env{'form.previousversion'} ne '' && + $env{'form.previousversion'} eq $version) { + $result.="
'.&mt("Grading Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks); + + $result.='
'."\n"; + + ($entries,$ready,$locks)=&get_queue_counts('reviewqueue'); + $result.=''.&mt("Review Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks); + $result.='
'."\n"; + } return $result; } sub add_request_another_attempt_button { - + my $result; + my $symb=&Apache::lonnet::symbread(); + my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb); + if ($slot_name) { + my $description=&Apache::slotrequest::get_description($slot_name, + $slot); + $result.=(<