--- loncom/homework/bridgetask.pm 2005/10/01 04:14:51 1.63
+++ loncom/homework/bridgetask.pm 2005/10/24 18:40:21 1.73
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.63 2005/10/01 04:14:51 albertel Exp $
+# $Id: bridgetask.pm,v 1.73 2005/10/24 18:40:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -68,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) {
my $version=
$Apache::lonhomework::results{'resource.version'}=
++$Apache::lonhomework::history{'resource.version'};
@@ -294,6 +304,7 @@ sub show_task {
( $status eq 'INVALID_ACCESS') )) {
return 0;
}
+ if ($env{'form.donescreen'}) { return 0; }
return 1;
}
@@ -316,8 +327,8 @@ sub submission_time_stamp {
my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.checkedin.slot'};
my %slot=&Apache::lonnet::get_slot($slot_name);
my $diff = $slot{'endtime'} - $submissiontime;
- my ($color,$when)=('red','after');
- if ($diff > 0) { ($color,$when)=('green','before'); }
+ my ($color,$when)=('#FF6666','after');
+ if ($diff > 0) { ($color,$when)=('#336600','before'); }
my $info;
if ($diff%60) { $info=($diff%60).' seconds'; }
$diff=int($diff/60);
@@ -334,11 +345,41 @@ sub submission_time_stamp {
return $result;
}
+sub webgrade_standard_info {
+ my ($version)=&get_version();
+ my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+ my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
+ my $file_list="
\n";
+ foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
+ my $file=$file_url.$partial_file;
+ $file=~s|/+|/|g;
+ &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
+ $file_list.=' '.$file.
+ ' '."\n";
+ }
+ $file_list.=" \n";
+
+ my %lt=&Apache::lonlocal::texthash('done' => 'Done',
+ 'stop' => 'Stop',
+ );
+
+ my $result=<
+
+
+ $file_list
+
+INFO
+ return $result;
+}
+
sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my ($status,$accessmsg,$slot);
if ($target ne 'webgrade') {
+ &Apache::structuretags::init_problem_globals('Task');
&Apache::structuretags::initialize_storage();
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
}
@@ -392,6 +433,18 @@ sub start_Task {
''.&proctor_validation_screen($slot);
} elsif ($status eq 'WAITING_FOR_GRADE') {
$msg.=''.&mt('Your submission is in the grading queue.').' ';
+ } elsif ($env{'form.donescreen'}) {
+ my $title=&Apache::lonnet::gettitle();
+ my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
+ my $files='';
+ $result.=<$title
+ Files submitted: $files
+ You are now done with this Bridge Task
+
+ Logout
+ Change to a different course
+DONESCREEN
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.=''.&mt('Not open to be viewed').' ';
}
@@ -498,6 +551,7 @@ sub start_Task {
value="'.$sec.'" />';
}
}
+ if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
}
} else {
# page_start returned a starting result, delete it if we don't need it
@@ -605,15 +659,13 @@ sub end_Task {
my ($version,$previous)=&get_version();
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex') {
- if (
- (($target eq 'web') && ($env{'request.state'} ne 'construct')) ||
- ($target eq 'answer') || ($target eq 'tex')
- ) {
+ if ($target eq 'web' || $target eq 'answer' || $target eq 'tex') {
if ($target eq 'web') {
if (&show_task($status,$previous)) {
$result.=&Apache::lonxml::endredirection();
}
- if ($status eq 'CAN_ANSWER' && !$previous) {
+ if ($status eq 'CAN_ANSWER' && !$previous &&
+ !$env{'form.donescreen'}) {
$result.="\n".''.
&Apache::inputtags::file_selector("$version.0",
"bridgetask","*",
@@ -623,6 +675,13 @@ sub end_Task {
'.&mt('Indicate the files from your portfolio to be evaluated in grading this task.').'
').
"
";
$result.=&Apache::inputtags::gradestatus('0');
+ $result.='';
+ $result.=<
+
+
+
+DONEBUTTON
}
if (&show_task($status,$previous) &&
$Apache::lonhomework::history{"resource.$version.status"} =~ /^(pass|fail)$/) {
@@ -688,6 +747,8 @@ sub end_Task {
$award;
$Apache::lonhomework::results{"resource.0.submission"}=
$Apache::lonhomework::results{"resource.$version.0.submission"}='';
+ } else {
+ delete($Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"});
}
&Apache::lonhomework::showhash(%Apache::lonhomework::results);
&Apache::structuretags::finalize_storage();
@@ -804,9 +865,14 @@ sub end_Task {
# &mt('Save Partial Grade and Continue Grading').'" /> ';
$result.=''.&Apache::loncommon::endbodytag().'