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

ng lon-capa-cvs@mail.lon-capa.org
Tue, 29 Jul 2003 20:54:39 -0000


ng		Tue Jul 29 16:54:39 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Finally the appending of messages/keyword highlights do not get appended
  on the pop-up window - thanks to Guy - was missing doc.close() at end.
  
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.127 loncom/homework/grades.pm:1.128
--- loncom/homework/grades.pm:1.127	Tue Jul 29 10:24:24 2003
+++ loncom/homework/grades.pm	Tue Jul 29 16:54:39 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.127 2003/07/29 14:24:24 ng Exp $
+# $Id: grades.pm,v 1.128 2003/07/29 20:54:39 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -298,7 +298,7 @@
     my %record     = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
     my %partstatus = ();
     foreach (@$partlist) {
-	my ($status,$foo)    = split(/_/,$record{"resource.$_.solved"},2);
+	my ($status,undef)   = split(/_/,$record{"resource.$_.solved"},2);
 	$status              = 'nothing' if ($status eq '');
 	$partstatus{$_}      = $status;
 	my $subkey           = "resource.$_.submitted_by";
@@ -834,8 +834,8 @@
     if (nret==null) return;
     formname.keywords.value = nret;
 
-    formname.refresh.value = "on";
     if (formname.keywords.value != "") {
+	formname.refresh.value = "on";
 	formname.submit();
     }
     return;
@@ -929,7 +929,6 @@
 	height = 600;
 	scrollbar = "yes";
     }
-//    if (window.pWin) {window.pWin.close(); window.pWin=null}
     var xpos = (screen.width-600)/2;
     xpos = (xpos < 0) ? '0' : xpos;
     var ypos = (screen.height-height)/2-30;
@@ -938,6 +937,7 @@
     pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height);
     pWin.focus();
     pDoc = pWin.document;
+    pDoc.open('text/html','replace');
     pDoc.write("<html><head>");
     pDoc.write("<title>Message Central</title>");
 
@@ -1024,6 +1024,7 @@
     pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");
     pDoc.write("</form>");
     pDoc.write("</body></html>");
+    pDoc.close();
 }
 
 //====================== Script for keyword highlight options ==============
@@ -1067,6 +1068,7 @@
     hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos);
     hwdWin.focus();
     var hDoc = hwdWin.document;
+    hDoc.open('text/html','replace');
     hDoc.write("<html><head>");
     hDoc.write("<title>Highlight Central</title>");
 
@@ -1115,6 +1117,7 @@
     hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");
     hDoc.write("</form>");
     hDoc.write("</body></html>");
+    hDoc.close();
   }
 
 </script>
@@ -1764,17 +1767,14 @@
 	}
     }
     $ctr = 0;
-    my ($partlist,$handgrade) = &response_type($ENV{'form.url'},$symb);
     @parsedlist = reverse @parsedlist if ($button eq 'Previous');
     foreach my $student (@parsedlist) {
 	my ($uname,$udom) = split(/:/,$student);
 	if ($ENV{'form.submitonly'} eq 'yes') {
-	    my (%status) = &student_gradeStatus($ENV{'form.url'},$symb,$udom,$uname,$partlist) ;
+	    my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
 	    my $statusflg = '';
-	    foreach (keys(%status)) {
-		$statusflg = 1 if ($status{$_} ne 'nothing');
-		my ($foo,$partid,$foo1) = split(/\./);
-		$statusflg = '' if ($status{'resource.'.$partid.'.submitted_by'} ne '');
+	    foreach (split(/:/,$ENV{'form.partlist0'})){
+		$statusflg = 1 if (exists ($record{'resource.'.$_.'.solved'}));
 	    }
 	    next if ($statusflg eq '');
 	}