[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm

minaeibi lon-capa-cvs@mail.lon-capa.org
Sun, 17 Mar 2002 01:30:00 -0000


minaeibi		Sat Mar 16 20:30:00 2002 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
  Log:
  Fixed some bugs
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.10 loncom/interface/lonstatistics.pm:1.11
--- loncom/interface/lonstatistics.pm:1.10	Wed Mar  6 19:28:55 2002
+++ loncom/interface/lonstatistics.pm	Sat Mar 16 20:30:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstatistics.pm,v 1.10 2002/03/07 00:28:55 minaeibi Exp $
+# $Id: lonstatistics.pm,v 1.11 2002/03/17 01:30:00 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -30,7 +30,7 @@
 # 5/05,7/09,7/25/01,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei
 # 11/1, 11/4, 11/16, 12/14, 12/16, 12/18,12/20,12/31 Behrouz Minaei
 # YEAR=2002
-# 1/22, 2/1, 2/6, 2/25, 3/2, 3/6 Behrouz Minaei
+# 1/22, 2/1, 2/6, 2/25, 3/2, 3/6, 3/17 Behrouz Minaei
 ###
 
 package Apache::lonstatistics; 
@@ -80,6 +80,35 @@
               4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff",
               9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd");
 
+
+sub get_student_answers {
+  my ($symb,$username,$domain,$courseid) = @_;
+  my ($map,$id,$feedurl) = split(/___/,$symb);
+  my (%old,%moreenv);
+  my @elements=('symb','courseid','domain','username');
+  foreach my $element (@elements) {
+    $old{$element}=$ENV{'form.grade_'.$element};
+    $moreenv{'form.grade_'.$element}=eval '$'.$element #'
+  }
+  $moreenv{'form.grade_target'}='answer';
+  &Apache::lonnet::appenv(%moreenv);
+  my $userview=&Apache::lonnet::ssi('/res/'.$feedurl);
+  &Apache::lonnet::delenv('form.grade_');
+  foreach my $element (@elements) {
+    $ENV{'form.grade_'.$element}=$old{$element};
+  }
+  $userview=~s/\<body[^\>]*\>//gi;
+  $userview=~s/\<\/body\>//gi;
+  $userview=~s/\<html\>//gi;
+  $userview=~s/\<\/html\>//gi;
+  $userview=~s/\<head\>//gi;
+  $userview=~s/\<\/head\>//gi;
+  $userview=~s/action\s*\=/would_be_action\=/gi;
+  return $userview;
+}
+
+
+
 #------- Processing upperlist and lowerlist according to each problem
 sub ProcessDisc {
     my @List = @_;
@@ -562,7 +591,7 @@
             }
 	    #else { 
 		#for(my $n=0; $n<$PartNo; $n++) {
-		#    push (@list, "$hash{'title_'.$ResId}*$ResId:0:0:U");
+		#    push (@list, "$TempHash{'0'.'.PrOrd'}.':'.$ResId:0:0:U");
 		#    $ProbTot++; 
 		#}
 	    #}
@@ -620,7 +649,7 @@
 			       $P_Order++;
 			       $mapsort{$HWN} .= '&'.$P_Order;
 			       $PartNo++;
-			       $r->print('<br>'.$PartNo.'---'.$P_Order);
+			       #$r->print('<br>'.$PartNo.'---'.$P_Order);
 			   }
 		       }
 		   }