[LON-CAPA-cvs] cvs: loncom(version_2_2_X) /homework bridgetask.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 06 Nov 2006 16:36:10 -0000
This is a MIME encoded message
--albertel1162830970
Content-Type: text/plain
albertel Mon Nov 6 11:36:10 2006 EDT
Modified files: (Branch: version_2_2_X)
/loncom/homework bridgetask.pm
Log:
- backport 1.186 -> 1.191
--albertel1162830970
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20061106113610.txt"
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.184.2.1 loncom/homework/bridgetask.pm:1.184.2.2
--- loncom/homework/bridgetask.pm:1.184.2.1 Mon Nov 6 11:03:45 2006
+++ loncom/homework/bridgetask.pm Mon Nov 6 11:36:05 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.184.2.1 2006/11/06 16:03:45 albertel Exp $
+# $Id: bridgetask.pm,v 1.184.2.2 2006/11/06 16:36:05 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,7 +43,7 @@
BEGIN {
- &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','ClosingParagraph'));
+ &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','GraderNote','ClosingParagraph'));
}
my %dimension;
@@ -1142,34 +1142,13 @@
$env{'user.name'}.':'.$env{'user.domain'};
if ($review) {
$Apache::lonhomework::results{"resource.$version.0.status"}='review';
- if ($env{'form.queue'} eq 'reviewqueue') {
- &check_queue_unlock($env{'form.queue'});
- &Apache::lonxml::debug(" still needs review not changing status.");
- } else {
- if ($env{'form.queue'} ne 'none') {
- &move_between_queues($env{'form.queue'},'reviewqueue');
- } else {
- &add_to_queue('reviewqueue',\%queue_data);
- }
- }
} elsif ($ungraded) {
$Apache::lonhomework::results{"resource.$version.0.status"}='ungraded';
- if ($env{'form.queue'} eq 'reviewqueue') {
- &Apache::lonxml::debug("moving back.");
- &move_between_queues($env{'form.queue'},
- 'gradingqueue');
- } elsif ($env{'form.queue'} eq 'none' ) {
- &add_to_queue('gradingqueue',\%queue_data);
- } else {
- &check_queue_unlock($env{'form.queue'});
- }
} elsif ($mandatory_failed) {
$Apache::lonhomework::results{"resource.$version.0.status"}='fail';
$Apache::lonhomework::results{"resource.$version.0.solved"}='incorrect_by_override';
$Apache::lonhomework::results{"resource.$version.0.award"}='INCORRECT';
$Apache::lonhomework::results{"resource.$version.0.awarded"}='0';
- &remove_from_queue($env{'form.queue'});
-
my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
if ($env{'form.regrade'} ne 'yes') {
@@ -1186,8 +1165,6 @@
$Apache::lonhomework::results{"resource.$version.0.solved"}='correct_by_override';
$Apache::lonhomework::results{"resource.$version.0.award"}='EXACT_ANS';
$Apache::lonhomework::results{"resource.$version.0.awarded"}='1';
- &remove_from_queue($env{'form.queue'});
-
my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
if ($env{'form.regrade'} ne 'yes') {
$Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
@@ -1211,6 +1188,34 @@
}
&minimize_storage();
&Apache::structuretags::finalize_storage();
+
+ # data stored, now handle queue
+ if ($review) {
+ if ($env{'form.queue'} eq 'reviewqueue') {
+ &check_queue_unlock($env{'form.queue'});
+ &Apache::lonxml::debug(" still needs review not changing status.");
+ } else {
+ if ($env{'form.queue'} ne 'none') {
+ &move_between_queues($env{'form.queue'},'reviewqueue');
+ } else {
+ &add_to_queue('reviewqueue',\%queue_data);
+ }
+ }
+ } elsif ($ungraded) {
+ if ($env{'form.queue'} eq 'reviewqueue') {
+ &Apache::lonxml::debug("moving back.");
+ &move_between_queues($env{'form.queue'},
+ 'gradingqueue');
+ } elsif ($env{'form.queue'} eq 'none' ) {
+ &add_to_queue('gradingqueue',\%queue_data);
+ } else {
+ &check_queue_unlock($env{'form.queue'});
+ }
+ } elsif ($mandatory_failed) {
+ &remove_from_queue($env{'form.queue'});
+ } else {
+ &remove_from_queue($env{'form.queue'});
+ }
}
if (exists($Apache::lonhomework::results{'INTERNAL_store'})) {
# instance generation occured and hasn't yet been stored
@@ -1563,7 +1568,6 @@
foreach my $key (sort(keys(%queue))) {
my ($symb,$uname,$udom) = &decode_queue_key($key);
if (!defined($classlist->{$uname.':'.$udom})) { next; }
-
if ($key=~/locked$/) {
$locks++;
} elsif ($key=~/timestamp$/) {
@@ -2160,7 +2164,7 @@
} else {
my $dim_status=$Apache::lonhomework::history{"resource.$version.0.$dim.status"};
my $mandatory='Mandatory';
- if ($Apache::bridgetask::dimensionmandatory{$dim} eq 'N') {
+ if (&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval) eq 'N') {
$mandatory='Optional';
}
my $dim_info="<div class='LC_$dim_status LC_question_grade'>\n";
@@ -2207,33 +2211,6 @@
$result.=$dimension{$id}{'result'};
next;
}
- my $status= &get_criteria('status', $version,$dim,$id);
- my $comment=&get_criteria('comment',$version,$dim,$id);
- my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N');
- if ($mandatory) {
- $mandatory='Mandatory';
- } else {
- $mandatory='Optional';
- }
- if ($status eq 'fail') {
- } elsif ($status eq 'pass') {
- } else {
- &Apache::lonxml::error("Student viewing a graded bridgetask was shown a status of $status");
- }
- my $status_display=$status;
- $status_display=~s/^([a-z])/uc($1)/e;
- $result.=
- '<div class="LC_'.$status.' LC_criteria"><h4>'
- .$mandatory.' Criteria</h4><p>';
- $result.=
- &nested_parse(\$dimension{$dim}{'criteria.'.$id},
- [@_],{'set_dim_id' => $id});
- $result.='</p><p class="LC_grade">'.$status_display.'</p>';
- if ($comment =~ /\w/) {
- $result.='<p class="LC_comment">'.
- &mt('Comment: [_1]',$comment).'</p>';
- }
- $result.='</div>';
}
}
}
@@ -2491,6 +2468,7 @@
sub start_Criteria {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $criteria=&Apache::lonxml::get_all_text('/criteria',$parser,$style);
+ my $result = '';
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') {
my $dim = &get_dim_id();
my $id=&get_id($parstack,$safeeval);
@@ -2508,14 +2486,64 @@
$dimension{$dim}{'criteria.'.$id.'.mandatory'}=
&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
push(@{$dimension{$dim}{'criterias'}},$id);
+
+ my $version=&get_version();
+ my $task_status =
+ $Apache::lonhomework::history{"resource.$version.0.status"};
+ if ($target eq 'web'
+ && ($task_status eq 'pass' || $task_status eq 'fail')) {
+ my $status= &get_criteria('status', $version,$dim,$id);
+ my $comment=&get_criteria('comment',$version,$dim,$id);
+ my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N');
+ if ($mandatory) {
+ $mandatory='Mandatory';
+ } else {
+ $mandatory='Optional';
+ }
+ my $status_display=$status;
+ $status_display=~s/^([a-z])/uc($1)/e;
+ $result.=
+ '<div class="LC_'.$status.' LC_criteria"><h4>'
+ .$mandatory.' Criteria</h4><p>';
+ $result.=
+ &nested_parse(\$dimension{$dim}{'criteria.'.$id},[@_]);
+ $result.='</p><p class="LC_grade">'.$status_display.'</p>';
+ if ($comment =~ /\w/) {
+ $result.='<p class="LC_comment">'.
+ &mt('Comment: [_1]',$comment).'</p>';
+ }
+ $result.='</div>';
+ }
}
}
- return '';
+ return $result;
}
sub end_Criteria {
}
+sub start_GraderNote {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+
+ if ($target eq 'webgrade') {
+ return '<div class="LC_GRADING_gradernote"><b>'.
+ &mt('Note to graders:').'</b>';
+ }
+ my $note=&Apache::lonxml::get_all_text('/gradernote',$parser,$style);
+ return;
+}
+
+sub end_GraderNote {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+
+ if ($target eq 'webgrade') {
+ return '</div>';
+ }
+ return;
+}
+
+
+
sub proctor_validation_screen {
my ($slot) = @_;
my (undef,undef,$domain,$user) = &Apache::lonxml::whichuser();
--albertel1162830970--