--- loncom/homework/bridgetask.pm 2005/10/01 04:06:29 1.62 +++ loncom/homework/bridgetask.pm 2005/10/05 20:24:59 1.68 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.62 2005/10/01 04:06:29 albertel Exp $ +# $Id: bridgetask.pm,v 1.68 2005/10/05 20:24:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -294,6 +294,7 @@ sub show_task { ( $status eq 'INVALID_ACCESS') )) { return 0; } + if ($env{'form.donescreen'}) { return 0; } return 1; } @@ -392,6 +393,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').'

'; } @@ -613,7 +626,8 @@ sub end_Task { 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 +637,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 +709,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(); @@ -928,6 +951,10 @@ sub show_queue { &Apache::grades::init_perm(); my ($classlist,$section,$fullname)=&Apache::grades::getclasslist(\@chosen_sections,); &Apache::grades::reset_perm(); + if (!(grep(/^all$/,@chosen_sections))) { + $result.='

Showing only sections '.join(', ',@chosen_sections). + '.

'."\n"; + } my $regexp="^$symb\0"; my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp); @@ -1062,6 +1089,8 @@ sub queue_key_locked { sub pick_from_queue_data { my ($queue,$check_section,$queuedata,$cdom,$cnum)=@_; foreach my $key (keys(%$queuedata)) { + if ($key =~ /\0locked$/) { next; } + if ($key =~ /\0timestamp$/) { next; } my ($symb,$uname,$udom)=&decode_queue_key($key); if ($check_section) { my $section=&Apache::lonnet::getsection($uname,$udom); @@ -1187,13 +1216,19 @@ sub get_from_queue { sub select_user { my ($symb,$cid)=&Apache::lonxml::whichuser(); - my $result.=''; my @chosen_sections= &Apache::loncommon::get_env_multiple('form.chosensections'); &Apache::grades::init_perm(); my ($classlist,$section,$fullname)=&Apache::grades::getclasslist(\@chosen_sections,); &Apache::grades::reset_perm(); + + my $result; + if (!(grep(/^all$/,@chosen_sections))) { + $result.='

Showing only sections '.join(', ',@chosen_sections). + '.

'."\n"; + } + $result.='
'; foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { my ($uname,$udom) = split(/:/,$student); @@ -1370,6 +1405,7 @@ sub get_instance { $dim_info.='

Question : you did not pass this '.$mandatory.' question

'; } my $man_count=0; + my $man_passed=0; my $opt_count=0; my $opt_passed=0; foreach my $id (@{$dimension{$instance.'.criterias'}}) { @@ -1381,12 +1417,15 @@ sub get_instance { } } else { $man_count++; + if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"} eq 'pass') { + $man_passed++; + } } } - my $opt_req=&Apache::lonxml::get_param('OptionalRequired', - $parstack,$safeeval); + if ($man_passed eq $man_count) { $man_passed='all'; } + my $opt_req=$dimension{$instance.'.optionalrequired'}; if ($opt_req !~ /\S/) { $opt_req='0'; } - $dim_info.="\n

".&mt('You passed all of the mandatory components and [_1] of the [_2] optional components, of which you were required to pass [_3].',$opt_passed,$opt_count,$opt_req)."

\n"; + $dim_info.="\n

".&mt('You passed [_1] of the [_2] mandatory components and [_3] of the [_4] optional components, of which you were required to pass [_5].',$man_passed,$man_count,$opt_passed,$opt_count,$opt_req)."

\n"; my $internal_location=&internal_location($dim); $result=~s/\Q$internal_location\E/$dim_info/;