--- loncom/interface/lonstatistics.pm	2002/07/29 21:00:53	1.35
+++ loncom/interface/lonstatistics.pm	2002/07/30 21:31:48	1.37
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstatistics.pm,v 1.35 2002/07/29 21:00:53 minaeibi Exp $
+# $Id: lonstatistics.pm,v 1.37 2002/07/30 21:31:48 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -128,16 +128,18 @@ sub ProcessFormData{
         }
     }
 
+    $cache->{'reportKey'} = 'false';
+    if($cache->{'reportSelected'} eq 'Analyze') {
+        $cache->{'reportKey'} = 'Analyze';
+    }
+
     foreach (keys(%ENV)) {
-        if(/form\.Analyze:::/) {
-#            $cache->{'reportSelected'} = 'Analyze';
-#            $cache->{'reportKey'} = 'Problem Analysis';
-            my ($uri, $title, $part, $problem);
-            (undef, $uri, $title, $part, $problem)=split(':::', $_);
-            $cache->{'AnalyzeURI'}     = $uri;
-            $cache->{'AnalyzeTitle'}   = $title;
-            $cache->{'AnalyzePart'}    = $part;
-            $cache->{'AnalyzeProblem'} = $problem;
+        if(/form\.Analyze/) {
+            $cache->{'reportSelected'} = 'Analyze';
+            $cache->{'reportKey'} = 'Analyze';
+            my $data;
+            (undef, $data)=split(':::', $_);
+            $cache->{'AnalyzeInfo'}=$data;
             
             &CheckFormElement($cache, 'Interval', 'Interval', '1');
         } elsif(/form\.HeadingColumn/) {
@@ -561,9 +563,11 @@ sub BuildStatistics {
     if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
         $GoToPage = $cache{'reportSelected'};
         $reports{'reportSelected'} = $cache{'reportSelected'};
-#        if(defined($cache{'reportKey'}) && $cache{'reportKey'} ne 'false') {
-#            $reports{$cache{'reportKey'}} = $cache{'reportSelected'};
-#        }
+        if(defined($cache{'reportKey'}) && 
+           !exists($reports{$cache{'reportKey'}}) && 
+           $cache{'reportKey'} ne 'false') {
+            $reports{$cache{'reportKey'}} = $cache{'reportSelected'};
+        }
 
         if(defined($cache{'OptionResponses'})) {
             $reports{'problem_analysis'} = 'Problem Analysis';
@@ -582,28 +586,27 @@ sub BuildStatistics {
     if($GoToPage eq 'Activity Log') {
         &Apache::lonproblemstatistics::Activity();
     } elsif($GoToPage eq 'Problem Statistics') {
-        $r->print(
         &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB, 
                                                                   $students, 
                                                                   $courseID, 
-                                                                  $c,$r));
+                                                                  $c,$r);
     } elsif($GoToPage eq 'Problem Analysis') {
         $r->print(
               &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB));
     } elsif($GoToPage eq 'Student Assessment') {
         $r->print(
             &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,
-                                                            $students,
-                                                            $courseID,
-                                                            'Statistics',
-                                                            \@headings,
-                                                            $spacing,
-                                                            \@studentInformation,
-                                                            $r, $c));
+                                                          $students,
+                                                          $courseID,
+                                                          'Statistics',
+                                                          \@headings,
+                                                          $spacing,
+                                                          \@studentInformation,
+                                                          $r, $c));
     } elsif($GoToPage eq 'Analyze') {
         $r->print(&Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, 
                                                                 $students, 
-                                                                $courseID));
+                                                                $courseID,$r));
     } elsif($GoToPage eq 'DoDiffGraph') {
         &Apache::lonproblemstatistics::BuildDiffGraph($r);
     } elsif($GoToPage eq 'PercentWrongGraph') {