--- loncom/interface/Attic/lonchart.pm 2002/07/01 21:12:06 1.49 +++ loncom/interface/Attic/lonchart.pm 2002/07/02 15:13:06 1.50 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonchart.pm,v 1.49 2002/07/01 21:12:06 stredwic Exp $ +# $Id: lonchart.pm,v 1.50 2002/07/02 15:13:06 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,7 +60,7 @@ my $jr; sub FormatStudentInformation { my ($cache,$name,$studentInformation,$reselected,$spacePadding)=@_; - my $Str='
';
+    my $Str='';
 
     for(my $index=0; $index<(scalar @$studentInformation); $index++) {
         if(!&ShouldShowColumn($reselected, 'heading', $index)) {
@@ -95,22 +95,15 @@ sub FormatStudentData {
 
     # Handle errors
     if($CacheData{$name.':error'} =~ /environment/) {
+        $Str .= '
'; untie(%CacheData); - $Str .= '
'; return $Str; -# my $errorMessage = $CacheData{$name.':error'}; -# return ''.$sname.''.$sdom. -# ''.$errorMessage.''; } if($CacheData{$name.':error'} =~ /course/) { + $Str .= '
'; untie(%CacheData); - $Str .= ''; - return $Str; -# my $errorMessage = 'May have no course data or '. -# $CacheData{$name.':error'}; -# return ''.$sname.''.$sdom. -# ''.$errorMessage.''; + return $Str; } # Handle problem data ------------------------------------------------ @@ -216,7 +209,7 @@ sub FormatStudentData { } $Str .= ''.$problemsSolved. - ' / '.$totalProblems.''; + ' / '.$totalProblems.'
'; untie(%CacheData); return $Str; @@ -265,9 +258,9 @@ sub CreateColumnSelectionBox { my ($CacheData,$studentInformation,$headings,$reselected,$spacePadding)=@_; my $missing=0; - my $notThere='

Select column to view:

'; + my $notThere='Select column to view:'; my $name; - $notThere .= '   '; + $notThere .= ''; $notThere .= '

'; + $notThere .= ''; } else { - $notThere=''; + $notThere=''; } - return $notThere; + return $notThere.''; } sub CreateColumnSelectors { @@ -356,42 +349,46 @@ sub CreateForm { elsif ($Status eq 'Expired' ) { $OpSel2 = 'selected'; } else { $OpSel1 = 'selected'; } - my $Ptr = '
'."\n"; - $Ptr .= ''; - $Ptr .= "\n"; - $Ptr .= '   '; - $Ptr .= ''; - $Ptr .= "\n"; - $Ptr .= '

'; - $Ptr .= ' Sort by:   '."\n"; + my $Ptr .= ''."\n"; + $Ptr .= ''; + $Ptr .= ''; return $Ptr; } sub CreateLegend { - my $Str = '

'.$ENV{'course.'.$ENV{'request.course.id'}.'.description'}. - '

'.localtime(). - "

1..9: correct by student in 1..9 tries\n".
+    my $Str = "

".
+              "1..9: correct by student in 1..9 tries\n".
               "   *: correct by student in more than 9 tries\n".
 	      "   +: correct by override\n".
               "   -: incorrect by override\n".
 	      "   .: incorrect attempted\n".
 	      "   #: ungraded attempted\n".
               "    : not attempted\n".
-	      "   x: excused

"; + " x: excused". + "

"; return $Str; } @@ -403,7 +400,11 @@ sub StartDocument { $Str .= ''; $Str .= ''; $Str .= ''; - $Str .= '

Assessment Chart

'; + $Str .= '

Assessment Chart'.(' 'x8).localtime();
+    $Str .= '

'; + $Str .= '

'.$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; + $Str .= '

'; +# $Str .= '

'.localtime().'

'; return $Str; } @@ -955,7 +956,6 @@ sub ShouldShowColumn { sub CheckForStringInArray { my ($inputArray,$checkString)=@_; foreach (@$inputArray) { -# $jr->print('a:'.$_.' b:'.$checkString.'
'); if($_ eq $checkString) { return 1; } @@ -1027,8 +1027,10 @@ sub BuildChart { # Sort students and print out table desciptive data if(tie(%CacheData,'GDBM_File',$ChartDB,&GDBM_READER,0640)) { if(!$c->aborted()) { @students=&SortStudents(\@students,\%CacheData); } - if(!$c->aborted()) { $r->print(&CreateLegend()); } + if(!$c->aborted()) { $r->print('

'.(scalar @students). + ' students

'); } if(!$c->aborted()) { $r->rflush(); } + if(!$c->aborted()) { $r->print(&CreateLegend()); } if(!$c->aborted()) { $r->print(&CreateForm()); } if(!$c->aborted()) { $r->print(&CreateColumnSelectionBox( \%CacheData, @@ -1036,8 +1038,6 @@ sub BuildChart { \@headings, \@reselected, $spacePadding)); } - if(!$c->aborted()) { $r->print('

'.(scalar @students). - ' students

'); } if(!$c->aborted()) { $r->print(&CreateColumnSelectors( \%CacheData, \@studentInformation, @@ -1059,21 +1059,15 @@ sub BuildChart { my @updateStudentList = (); my $courseData; + $r->print('
');
     foreach (@students) {
         if($c->aborted()) {
-            if(!$isCached && 
-               tie(%CacheData,'GDBM_File',$ChartDB,&GDBM_WRCREAT,0640)) {
-                $CacheData{'NamesOfStudents'}=join(":::", @updateStudentList);
-#		    $CacheData{'NamesOfStudents'}=
-#		            &Apache::lonnet::arrayref2str(\@updateStudentList);
-                untie(%CacheData);
-            }
             last;
         }
 
         if(!$isCached) {
             $courseData=&DownloadStudentCourseInformation($_, $cid);
-            if($c->aborted()) { next; }
+            if($c->aborted()) { last; }
             push(@updateStudentList, $_);
             &ExtractStudentData($courseData, $_, $ChartDB);
         }
@@ -1083,7 +1077,14 @@ sub BuildChart {
         $r->rflush();
     }
 
-    $r->print('');
+    if(!$isCached && tie(%CacheData,'GDBM_File',$ChartDB,&GDBM_WRCREAT,0640)) {
+        $CacheData{'NamesOfStudents'}=join(":::", @updateStudentList);
+#		    $CacheData{'NamesOfStudents'}=
+#		            &Apache::lonnet::arrayref2str(\@updateStudentList);
+        untie(%CacheData);
+    }
+
+    $r->print('
'); $r->rflush(); return;
'; + $Ptr .= ''; + $Ptr .= ''. ' '."\n"; + $Ptr .= '