--- loncom/homework/bridgetask.pm 2005/10/01 04:01:14 1.61
+++ loncom/homework/bridgetask.pm 2005/12/06 10:13:15 1.88
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.61 2005/10/01 04:01:14 albertel Exp $
+# $Id: bridgetask.pm,v 1.88 2005/12/06 10:13:15 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,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'};
@@ -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 && $type eq 'Task') {
my $version=
$Apache::lonhomework::results{'resource.version'}=
++$Apache::lonhomework::history{'resource.version'};
@@ -83,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;
}
}
}
@@ -294,6 +310,7 @@ sub show_task {
( $status eq 'INVALID_ACCESS') )) {
return 0;
}
+ if ($env{'form.donescreen'}) { return 0; }
return 1;
}
@@ -316,8 +333,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,13 +351,46 @@ 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 ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my ($status,$accessmsg,$slot);
if ($target ne 'webgrade') {
+ &Apache::structuretags::init_problem_globals('Task');
&Apache::structuretags::initialize_storage();
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
+ if ($env{'request.state'} eq 'construct') {
+ &Apache::structuretags::setup_rndseed($safeeval);
+ }
}
$Apache::lonhomework::parsing_a_task=1;
@@ -348,7 +398,7 @@ sub start_Task {
my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=
&Apache::structuretags::page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
- if ($target eq 'web') {
+ if ($target eq 'web' && $env{'request.state'} ne 'construct') {
if ($Apache::lonhomework::modifygrades) {
$body_tag_start.='';
+ $result.=<
+
+
+
+DONEBUTTON
+ }
if (&show_task($status,$previous) &&
$Apache::lonhomework::history{"resource.$version.status"} =~ /^(pass|fail)$/) {
my $bt_status=$Apache::lonhomework::history{"resource.$version.status"};
my $title=&Apache::lonnet::gettitle();
- my %slot=&Apache::lonnet::get_slot($Apache::inputtags::slot_name);
+
+ my $slot_name=
+ $Apache::lonhomework::history{"resource.$version.checkedin.slot"};
+ my %slot=&Apache::lonnet::get_slot($slot_name);
my $start_time=
&Apache::lonlocal::locallocaltime($slot{'starttime'});
- my $status;
- $status.="\n\n";
+ my $status = "\n
\n";
if ($bt_status eq 'pass') {
$status.='
You passed the '.$title.' given on '.
- $start_time.'.
';
+ $start_time.'';
}
if ($bt_status eq 'fail') {
$status.='You did not pass the '.$title.' given on '.
- $start_time.'.
';
+ $start_time.'';
if (!$previous) {
$status.=&add_request_another_attempt_button();
}
@@ -680,12 +782,18 @@ 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"});
+ $award = '';
}
&Apache::lonhomework::showhash(%Apache::lonhomework::results);
&Apache::structuretags::finalize_storage();
- if ($award eq 'SUBMITTED') {
- &add_to_queue('gradingqueue',$Apache::inputtags::slot_name);
+ if ($award eq 'SUBMITTED'
+ && defined($Apache::inputtags::slot_name)) {
+ &add_to_queue('gradingqueue',[$Apache::inputtags::slot_name]);
}
+ } elsif ($Apache::lonhomework::results{'INTERNAL_store'}) {
+ &Apache::structuretags::finalize_storage();
}
if ($target eq 'grade' && $env{'form.webgrade'} eq 'yes') {
my $optional_required=
@@ -796,9 +904,15 @@ sub end_Task {
# &mt('Save Partial Grade and Continue Grading').'" /> ';
$result.=''.&Apache::loncommon::endbodytag().'