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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 17 Mar 2005 19:02:45 -0000


matthew		Thu Mar 17 14:02:45 2005 EDT

  Modified files:              
    /loncom/interface/statistics	lonsurveyreports.pm 
  Log:
  Moved call to Compile_Student_Answers from make_Excel & make_html routines to
      preceed their calling.
  CreateInterface: Added "Show Problem" checkbox, and minor html cleanups.
  
  
Index: loncom/interface/statistics/lonsurveyreports.pm
diff -u loncom/interface/statistics/lonsurveyreports.pm:1.5 loncom/interface/statistics/lonsurveyreports.pm:1.6
--- loncom/interface/statistics/lonsurveyreports.pm:1.5	Mon Mar 14 15:28:22 2005
+++ loncom/interface/statistics/lonsurveyreports.pm	Thu Mar 17 14:02:45 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonsurveyreports.pm,v 1.5 2005/03/14 20:28:22 matthew Exp $
+# $Id: lonsurveyreports.pm,v 1.6 2005/03/17 19:02:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -125,10 +125,13 @@
             my $resource = $current_problem->{'resource'};
             $r->print('<h1>'.$resource->compTitle.'</h1>');
             $r->print('<h3>'.$resource->src.'</h3>');
-            $r->print(&Apache::lonstathelpers::render_resource($resource));
+            if ($ENV{'form.renderprob'} eq 'true') {
+                $r->print(&Apache::lonstathelpers::render_resource($resource));
+            }
             $r->rflush();
             my %Data = &Apache::lonstathelpers::get_problem_data
                 ($resource->src);
+            &Compile_Student_Answers($current_problem,\%Data,\@Students);
             if ($ENV{'form.output'} eq 'HTML' || 
                 ! defined($ENV{'form.output'})) {
                 &make_HTML_report($r,$current_problem,\%Data,\@Students);
@@ -268,7 +271,6 @@
 #########################################################
 sub make_Excel_report {
     my ($r,$problem,$problem_data,$students) = @_;
-    &Compile_Student_Answers($problem,$problem_data,$students);
     my ($workbook,$filename,$format) = &Apache::loncommon::create_workbook($r);
     if (! defined($workbook)) { return '';}
     $r->print('<script>'.
@@ -384,8 +386,6 @@
 #########################################################
 sub make_HTML_report {
     my ($r,$problem,$ProblemData,$Students) = @_;
-    &Compile_Student_Answers($problem,$ProblemData,$Students);
-    # &output_hash('',$ProblemData);
     my $resource = $problem->{'resource'};
     foreach my $partid (@{$resource->parts}) {
         my @response_ids   = $resource->responseIds($partid);
@@ -532,9 +532,10 @@
     $Str .= '<p>';
     $Str .= '<table cellspacing="5">'."\n";
     $Str .= '<tr>';
-    $Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>';
-    $Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>';
-    $Str .= '<td align="center"><b>'.&mt('Output Format').'</b></td>';
+    $Str .= '<th>'.&mt('Sections').'</th>';
+    $Str .= '<th>'.&mt('Enrollment Status').'</th>';
+    $Str .= '<th>'.&mt('Output Format').'</th>';
+    $Str .= '<th>'.'&nbsp;'.'</th>';
     $Str .= '</tr>'."\n";
     #
     $Str .= '<tr><td align="center">'."\n";
@@ -547,6 +548,18 @@
     #
     $Str .= '<td align="center">'.$output_selector.'</td>';
     #
+    # Render problem checkbox
+    my $prob_checkbox = '<input type="checkbox" name="renderprob" ';
+    if (exists($ENV{'form.renderprob'}) && $ENV{'form.renderprob'} eq 'true') {
+        $prob_checkbox .= 'checked ';
+    }
+    $prob_checkbox .= 'value="true" />';
+    $Str .= '<td align="right" valign="top">'.
+        '<label><b>'.
+        &mt('Show problem [_1]',$prob_checkbox).'</b></label><br />'.
+        '<label><b>'.
+        '</td>';
+    #
     $Str .= '</tr>'."\n";
     $Str .= '</table>'."\n";
     #