[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 20 Dec 2005 18:09:49 -0000


This is a MIME encoded message

--albertel1135102189
Content-Type: text/plain

albertel		Tue Dec 20 13:09:49 2005 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - add in the missing .0. from the expected location in the internal data sturctures for BT's
  - move .grader to .regrader
  
  
--albertel1135102189
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20051220130949.txt"

Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.88 loncom/homework/bridgetask.pm:1.89
--- loncom/homework/bridgetask.pm:1.88	Tue Dec  6 05:13:15 2005
+++ loncom/homework/bridgetask.pm	Tue Dec 20 13:09:49 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.88 2005/12/06 10:13:15 albertel Exp $
+# $Id: bridgetask.pm,v 1.89 2005/12/20 18:09:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -81,11 +81,11 @@
 	    }
 	    if ($authenticated && $type eq 'Task') {
 		my $version=
-		    $Apache::lonhomework::results{'resource.version'}=
-		    ++$Apache::lonhomework::history{'resource.version'};
-		$Apache::lonhomework::results{"resource.$version.checkedin"}=
+		    $Apache::lonhomework::results{'resource.0.version'}=
+		    ++$Apache::lonhomework::history{'resource.0.version'};
+		$Apache::lonhomework::results{"resource.$version.0.checkedin"}=
 		    $user.'@'.$domain;
-		$Apache::lonhomework::results{"resource.$version.checkedin.slot"}=
+		$Apache::lonhomework::results{"resource.$version.0.checkedin.slot"}=
 		    $slot_name;
 		foreach my $key (keys(%Apache::lonhomework::history)) {
 		    if ($key=~/^resource\.0\./) {
@@ -109,11 +109,11 @@
     my ($version,$previous);
     if ($env{'form.previousversion'} && 
 	$env{'form.previousversion'} ne 'current' &&
-	defined($Apache::lonhomework::history{'resource.'.$env{'form.previousversion'}.'.status'})) {
+	defined($Apache::lonhomework::history{'resource.'.$env{'form.previousversion'}.'.0.status'})) {
 	$version=$env{'form.previousversion'};
 	$previous=1;
     } else {
-	$version=$Apache::lonhomework::history{'resource.version'};
+	$version=$Apache::lonhomework::history{'resource.0.version'};
 	$previous=0;
     }
     if (wantarray) {
@@ -125,10 +125,10 @@
 sub add_previous_version_button {
     my ($status)=@_;
     my $result;
-    if ($Apache::lonhomework::history{'resource.version'} eq '') {
+    if ($Apache::lonhomework::history{'resource.0.version'} eq '') {
 	return '';
     }
-    if ($Apache::lonhomework::history{'resource.version'} < 2 &&
+    if ($Apache::lonhomework::history{'resource.0.version'} < 2 &&
 	$status ne 'NEEDS_CHECKIN') {
 	return '';
     }
@@ -139,8 +139,8 @@
 	    "</h3>\n";
     }
     my @to_show;
-    foreach my $test_version (1..$Apache::lonhomework::history{'resource.version'}) {
-	if (defined($Apache::lonhomework::history{'resource.'.$test_version.'.status'})) {
+    foreach my $test_version (1..$Apache::lonhomework::history{'resource.0.version'}) {
+	if (defined($Apache::lonhomework::history{'resource.'.$test_version.'.0.status'})) {
 	    push(@to_show,$test_version);
 	}
     }
@@ -322,7 +322,7 @@
 sub submission_time_stamp {
     my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
     my $submissiontime;
-    my $version=$Apache::lonhomework::history{'resource.version'};
+    my $version=$Apache::lonhomework::history{'resource.0.version'};
     for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) {
 	if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})) {
 	    $submissiontime=$Apache::lonhomework::history{$v.':timestamp'};
@@ -330,7 +330,7 @@
     }
     my $result;
     if ($submissiontime) {
-	my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.checkedin.slot'};
+	my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.0.checkedin.slot'};
 	my %slot=&Apache::lonnet::get_slot($slot_name);
 	my $diff = $slot{'endtime'} - $submissiontime;
 	my ($color,$when)=('#FF6666','after');
@@ -426,7 +426,7 @@
 	push(@Apache::inputtags::status,$status);
 	$Apache::inputtags::slot_name=$slot_name;
 	my $expression='$external::datestatus="'.$status.'";';
-	$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$version.solved"}.'";';
+	$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$version.0.solved"}.'";';
 	&Apache::run::run($expression,$safeeval);
 	&Apache::lonxml::debug("Got $status");
 	$body_tag_start.=&add_previous_version_button($status);
@@ -717,12 +717,12 @@
 DONEBUTTON
                 }
 		if (&show_task($status,$previous) &&
-		    $Apache::lonhomework::history{"resource.$version.status"} =~ /^(pass|fail)$/) {
-		    my $bt_status=$Apache::lonhomework::history{"resource.$version.status"};
+		    $Apache::lonhomework::history{"resource.$version.0.status"} =~ /^(pass|fail)$/) {
+		    my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"};
 		    my $title=&Apache::lonnet::gettitle();
 
 		    my $slot_name=
-			$Apache::lonhomework::history{"resource.$version.checkedin.slot"};
+			$Apache::lonhomework::history{"resource.$version.0.checkedin.slot"};
 		    my %slot=&Apache::lonnet::get_slot($slot_name);
 		    my $start_time=
 			&Apache::lonlocal::locallocaltime($slot{'starttime'});
@@ -747,7 +747,7 @@
 			if ($Apache::bridgetask::dimensionmandatory{$dim_id}
 			    eq 'N') {
 			    $opt_count++;
-			    if ($Apache::lonhomework::history{"resource.$version.$dim_id.status"} eq 'pass') {
+			    if ($Apache::lonhomework::history{"resource.$version.0.$dim_id.status"} eq 'pass') {
 				$opt_passed++;
 			    }
 			} else {
@@ -806,7 +806,7 @@
 	    &Apache::lonhomework::showhash(%Apache::lonhomework::results);
 	    foreach my $dim_id (@Apache::bridgetask::dimensionlist) {
 		my $status=
-		    $Apache::lonhomework::results{"resource.$version.$dim_id.status"};
+		    $Apache::lonhomework::results{"resource.$version.0.$dim_id.status"};
 		my $mandatory=
 		    ($Apache::bridgetask::dimensionmandatory{$dim_id} ne 'N');
 		if ($status eq 'pass') {
@@ -825,10 +825,10 @@
 		$mandatory_failed++;
 	    }
 	    &Apache::lonxml::debug("all dim ".join(':',@Apache::bridgetask::dimensionlist)."results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review");
-	    $Apache::lonhomework::results{'resource.grader'}=
+	    $Apache::lonhomework::results{'resource.0.regrader'}=
 		$env{'user.name'}.'@'.$env{'user.domain'};
 	    if ($review) {
-		$Apache::lonhomework::results{"resource.$version.status"}='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.");
@@ -836,7 +836,7 @@
 		    &move_between_queues($env{'form.queue'},'reviewqueue');
 		}
 	    } elsif ($ungraded) {
-		$Apache::lonhomework::results{"resource.$version.status"}='ungraded';
+		$Apache::lonhomework::results{"resource.$version.0.status"}='ungraded';
 		if ($env{'form.queue'} eq 'reviewqueue' ||
 		    $env{'form.queue'} eq 'none' ) {
 		    &Apache::lonxml::debug("moving back.");
@@ -845,7 +845,7 @@
 		    &check_queue_unlock($env{'form.queue'});
 		}
 	    } elsif ($mandatory_failed) {
-		$Apache::lonhomework::results{"resource.$version.status"}='fail';
+		$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';
@@ -863,7 +863,7 @@
 						       ["$version.0.bridgetask"]);
 		}
 	    } else {
-		$Apache::lonhomework::results{"resource.$version.status"}='pass';
+		$Apache::lonhomework::results{"resource.$version.0.status"}='pass';
 		$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';
@@ -880,8 +880,8 @@
 						       ["$version.0.bridgetask"]);
 		}
 	    }
-	    $Apache::lonhomework::results{"resource.status"}=
-		$Apache::lonhomework::results{"resource.$version.status"};
+	    $Apache::lonhomework::results{"resource.0.status"}=
+		$Apache::lonhomework::results{"resource.$version.0.status"};
 	    if (defined($Apache::lonhomework::results{"resource.$version.0.awarded"})) {
 		$Apache::lonhomework::results{"resource.0.award"}=
 		    $Apache::lonhomework::results{"resource.$version.0.award"};
@@ -1461,9 +1461,9 @@
     if ($type eq 'Task') {
 	my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},
 					  $udom,$uname);
-	$status{'status'}=$record{'resource.status'};
-	$status{'version'}=$record{'resource.version'};
-	$status{'grader'}=$record{'resource.grader'};
+	$status{'status'}=$record{'resource.0.status'};
+	$status{'version'}=$record{'resource.0.version'};
+	$status{'grader'}=$record{'resource.0.regrader'};
     }
     $status{'reviewqueue'}=
 	&check_queue_for_key($cdom,$cnum,'reviewqueue',
@@ -1570,10 +1570,10 @@
 	    foreach my $instance (@instances) {
 		@Apache::scripttag::parser_env = @_;
 		$result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});
-		if ($Apache::lonhomework::history{"resource.$version.status"} eq 'pass' ||
-		    $Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
+		if ($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass' ||
+		    $Apache::lonhomework::history{"resource.$version.0.status"} eq 'fail') {
 
-		    my $dim_status=$Apache::lonhomework::history{"resource.$version.$dim.status"};
+		    my $dim_status=$Apache::lonhomework::history{"resource.$version.0.$dim.status"};
 		    my $mandatory='Mandatory';
 		    if ($Apache::bridgetask::dimensionmandatory{$dim} eq 'N') {
 			$mandatory='Optional';
@@ -1593,12 +1593,12 @@
 			if ($dimension{$instance.'.criteria.'.$id.'.mandatory'} 
 			    eq 'N') {
 			    $opt_count++;
-			    if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"} eq 'pass') {
+			    if ($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"} eq 'pass') {
 				$opt_passed++;
 			    }
 			} else {
 			    $man_count++;
-			    if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"} eq 'pass') {
+			    if ($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"} eq 'pass') {
 				$man_passed++;
 			    }
 			}
@@ -1612,8 +1612,8 @@
 		    $result=~s/\Q$internal_location\E/$dim_info/;
 
 		    foreach my $id (@{$dimension{$instance.'.criterias'}}) {
-			my $status=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"};
-			my $comment=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"};
+			my $status=$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"};
+			my $comment=$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"};
 			my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N');
 			if ($mandatory) {
 			    $mandatory='Mandatory';
@@ -1633,8 +1633,8 @@
 			@Apache::scripttag::parser_env = @_;
 			$result.=&Apache::scripttag::xmlparse($dimension{$instance.'.criteria.'.$id});
 			$result.='</p><p class="grade">'.$status_display.'</p>';
-			if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}) {
-			    $result.='<p class="comment">'.$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}.'</p>';
+			if ($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"}) {
+			    $result.='<p class="comment">'.$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"}.'</p>';
 			}
 			$result.='</div>';
 		    }
@@ -1648,7 +1648,7 @@
 	    &Apache::scripttag::xmlparse($dimension{$instance.'.text'});
 	    foreach my $id (@{$dimension{$instance.'.criterias'}}) {
 		my $link='criteria_'.$instance.'_'.$id;
-		my $status=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"};
+		my $status=$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"};
 		$result.='<tr><td width="100%" valign="top">'.
 		    '<a name="'.$link.'" />'.
 		    '<a name="next_'.$last_link.'" />'.
@@ -1659,7 +1659,7 @@
 		    #$dimension{$instance.'.criteria.'.$id}.
 		    '</td>'.
 		    '<td><nobr>Additional Comment for Student</nobr> <br />'.
-		    '<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}).'</textarea>'.
+		    '<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"}).'</textarea>'.
 		    '</td>'.
 		    '<td>'.
 		    '<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').' />'.&mt('Ungraded').'</label></nobr><br />'.
@@ -1679,8 +1679,8 @@
 	    my $ungraded=0;
 	    my $review=0;
 	    foreach my $id (@{$dimension{$instance.'.criterias'}}) {
-		my $status=$Apache::lonhomework::results{"resource.$version.$dim.$instance.$id.status"}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id};
-		$Apache::lonhomework::results{"resource.$version.$dim.$instance.$id.comment"}=$env{'form.HWVAL_comment_criteria_'.$instance.'_'.$id};
+		my $status=$Apache::lonhomework::results{"resource.$version.0.$dim.$instance.$id.status"}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id};
+		$Apache::lonhomework::results{"resource.$version.0.$dim.$instance.$id.comment"}=$env{'form.HWVAL_comment_criteria_'.$instance.'_'.$id};
 		my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N');
 		if ($status eq 'pass') {
 		    if (!$mandatory) { $optional_passed++; }
@@ -1699,13 +1699,13 @@
 	    }
 	    &Apache::lonxml::debug("all instance ".join(':',@{$dimension{$instance.'.criterias'}})." results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review");
 	    if ($review) {
-		$Apache::lonhomework::results{"resource.$version.$dim.status"}=
+		$Apache::lonhomework::results{"resource.$version.0.$dim.status"}=
 		    'review';
 	    } elsif ($ungraded) {
-		$Apache::lonhomework::results{"resource.$version.$dim.status"}=
+		$Apache::lonhomework::results{"resource.$version.0.$dim.status"}=
 		    'ungraded';
 	    } elsif ($mandatory_failed) {
-		$Apache::lonhomework::results{"resource.$version.$dim.status"}=
+		$Apache::lonhomework::results{"resource.$version.0.$dim.status"}=
 		    'fail';
 	    } else {
 		$Apache::lonhomework::results{"resource.$version.$dim.status"}=

--albertel1135102189--