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

ng lon-capa-cvs@mail.lon-capa.org
Tue, 29 Jul 2003 14:24:24 -0000


ng		Tue Jul 29 10:24:24 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  fix bug 1816 - put the proper codes for extracting handgrade value 
  in response to bug fix 1991.
  Also, clean up a few more javascript codes.
  
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.126 loncom/homework/grades.pm:1.127
--- loncom/homework/grades.pm:1.126	Mon Jul 28 14:04:39 2003
+++ loncom/homework/grades.pm	Tue Jul 29 10:24:24 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.126 2003/07/28 18:04:39 ng Exp $
+# $Id: grades.pm,v 1.127 2003/07/29 14:24:24 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -109,9 +109,8 @@
 	    my ($responsetype,$part) = split(/_/,$_,2);
 	    my ($partid,$respid) = split(/_/,$part);
 	    $responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!!
-#	    my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
-#	    $handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no'); #a bug $value is 'yes' regardless
-	    $handgrade{$part} = $responsetype.':'.(($allkeys =~ /parameter_$part\_handgrade/) ? 'yes' : 'no');
+	    my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
+	    $handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no'); 
 	    next if ($seen{$partid} > 0);
 	    $seen{$partid}++;
 	    push @partlist,$partid;
@@ -755,8 +754,7 @@
 	    for (i=0;i<=total;i++) {
 		for (j=0;j<parttot;j++) {
 		    var partid = formname["partid"+i+"_"+j].value;
-		    var selopt = formname["GD_SEL"+i+"_"+partid];
-		    if (selopt[0].selected) {
+		    if (formname["GD_SEL"+i+"_"+partid][0].selected) {
 			var points = formname["GD_BOX"+i+"_"+partid].value;
 			if (points == "") {
 			    var name = formname["name"+i].value;
@@ -788,8 +786,7 @@
 	var ptr = 0;
 	for (i=1;i<total;i++) {
 	    var partid = formname["q_"+i].value;
-	    var selopt = formname["GD_SEL"+i+"_"+partid];
-	    if (selopt[0].selected) {
+	    if (formname["GD_SEL"+i+"_"+partid][0].selected) {
 		var points = formname["GD_BOX"+i+"_"+partid].value;
 		var status = formname["solved"+i+"_"+partid].value;
 		if (points == "" && status != "correct_by_student") {
@@ -865,10 +862,9 @@
     }
     var nret = prompt("Add selection to keyword list? Edit if desired.",cleantxt);
     if (nret==null) return;
-    var curlist = document.SCORE.keywords.value;
-    document.SCORE.keywords.value = curlist+" "+nret;
-    document.SCORE.refresh.value = "on";
+    document.SCORE.keywords.value = document.SCORE.keywords.value+" "+nret;
     if (document.SCORE.keywords.value != "") {
+	document.SCORE.refresh.value = "on";
 	document.SCORE.submit();
     }
     return;
@@ -885,8 +881,7 @@
     var Nmsg  = msgform.savemsgN.value;
     savedMsgHeader(Nmsg,usrctr,fullname);
     var subject = msgform.msgsub.value;
-    var rtrchk  = document.SCORE["includemsg"+usrctr];
-    var msgchk = rtrchk.value;
+    var msgchk = document.SCORE["includemsg"+usrctr].value;
     re = /msgsub/;
     var shwsel = "";
     if (re.test(msgchk)) { shwsel = "checked" }