--- loncom/homework/bridgetask.pm 2005/05/20 21:23:42 1.29 +++ loncom/homework/bridgetask.pm 2005/11/21 21:51:29 1.81 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.29 2005/05/20 21:23:42 albertel Exp $ +# $Id: bridgetask.pm,v 1.81 2005/11/21 21:51:29 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 { @@ -59,7 +60,7 @@ sub initialize_bridgetask { } sub proctor_check_auth { - my ($slot_name,$slot)=@_; + my ($slot_name,$slot,$type)=@_; my $user=$env{'form.proctorname'}; my $domain=$env{'form.proctordomain'}; @@ -67,8 +68,18 @@ sub proctor_check_auth { foreach my $possible (@allowed) { my ($puser,$pdom)=(split('@',$possible)); if ($puser eq $user && $pdom eq $domain) { - my $authhost=&Apache::lonnet::authenticate($puser,$env{'form.proctorpassword'},$pdom); - if ($authhost ne 'no_host') { + my $authenticated=0; + if ( $slot->{'secret'} =~ /\S/ && + $env{'form.proctorpassword'} eq $slot->{'secret'} ) { + $authenticated=1; + } else { + + my $authhost=&Apache::lonnet::authenticate($puser,$env{'form.proctorpassword'},$pdom); + if ($authhost ne 'no_host') { + $authenticated=1; + } + } + if ($authenticated && $type eq 'Task') { my $version= $Apache::lonhomework::results{'resource.version'}= ++$Apache::lonhomework::history{'resource.version'}; @@ -82,6 +93,12 @@ sub proctor_check_auth { } } return 1; + } elsif ($authenticated && $type eq 'problem') { + &Apache::lonxml::debug("authed #slot_name"); + $Apache::lonhomework::results{"resource.0.checkedin"}= + $user.'@'.$domain; + $Apache::lonhomework::results{"resource.0.checkedin.slot"}= + $slot_name; } } } @@ -91,6 +108,7 @@ sub proctor_check_auth { 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; @@ -129,6 +147,7 @@ sub add_previous_version_button { my $list='\n\n"; + $list.=''; $result.='