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

stredwic lon-capa-cvs@mail.lon-capa.org
Tue, 02 Jul 2002 15:13:07 -0000


This is a MIME encoded message

--stredwic1025622787
Content-Type: text/plain

stredwic		Tue Jul  2 11:13:07 2002 EDT

  Modified files:              
    /loncom/interface	lonchart.pm 
  Log:
  Changed <pre> tag to be around the entire chart data instead of each line of
  the chart.  This reduces the gaps between each line.  Also, this brought 
  forward a bug which was fixed.  Students with no course data were not being
  displayed, but now are.  This bug only occurred with the chaning of pre.
  
  
--stredwic1025622787
Content-Type: text/plain
Content-Disposition: attachment; filename="stredwic-20020702111307.txt"

Index: loncom/interface/lonchart.pm
diff -u loncom/interface/lonchart.pm:1.49 loncom/interface/lonchart.pm:1.50
--- loncom/interface/lonchart.pm:1.49	Mon Jul  1 17:12:06 2002
+++ loncom/interface/lonchart.pm	Tue Jul  2 11:13:06 2002
@@ -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 @@
 
 sub FormatStudentInformation {
     my ($cache,$name,$studentInformation,$reselected,$spacePadding)=@_;
-    my $Str='<pre>';
+    my $Str='';
 
     for(my $index=0; $index<(scalar @$studentInformation); $index++) {
         if(!&ShouldShowColumn($reselected, 'heading', $index)) {
@@ -95,22 +95,15 @@
 
     # Handle errors
     if($CacheData{$name.':error'} =~ /environment/) {
+        $Str .= '<br>';
         untie(%CacheData);
-        $Str .= '</pre>';
         return $Str;
-#	my $errorMessage = $CacheData{$name.':error'};
-#	return '<td>'.$sname.'</td><td>'.$sdom.
-#	    '</td><td><font color="#000088">'.$errorMessage.'</font></td>';
     }
 
     if($CacheData{$name.':error'} =~ /course/) {
+        $Str .= '<br>';
         untie(%CacheData);
-        $Str .= '</pre>';
-	return $Str;
-#	my $errorMessage = 'May have no course data or '.
-#	                   $CacheData{$name.':error'};
-#	return '<td>'.$sname.'</td><td>'.$sdom.
-#	    '</td><td><font color="#000088">'.$errorMessage.'</font></td>';
+        return $Str;
     }
 
     # Handle problem data ------------------------------------------------
@@ -216,7 +209,7 @@
     }
 
     $Str .= '<font color="#000088">'.$problemsSolved.
-	    ' / '.$totalProblems.'</font></pre>';
+	    ' / '.$totalProblems.'</font><br>';
 
     untie(%CacheData);
     return $Str;
@@ -265,9 +258,9 @@
     my ($CacheData,$studentInformation,$headings,$reselected,$spacePadding)=@_;
 
     my $missing=0;
-    my $notThere='<br><br><b>Select column to view:</b><br><br>';
+    my $notThere='<tr><td align="right"><b>Select column to view:</b>';
     my $name;
-    $notThere .= '&nbsp;&nbsp;&nbsp';
+    $notThere .= '<td align="left">';
     $notThere .= '<select name="reselect" size="4" multiple="true">'."\n";
 
     for(my $index=0; $index<(scalar @$headings); $index++) {
@@ -291,12 +284,12 @@
     }
 
     if($missing) {
-        $notThere .= '</select><br><br>';
+        $notThere .= '</select>';
     } else {
-        $notThere='';
+        $notThere='<tr><td>';
     }
 
-    return $notThere;
+    return $notThere.'</td></tr></tbody></table>';
 }
 
 sub CreateColumnSelectors {
@@ -356,42 +349,46 @@
     elsif ($Status eq 'Expired' ) { $OpSel2 = 'selected'; }
     else { $OpSel1 = 'selected'; }
 
-    my $Ptr = '<form name="stat" method="post" action="/adm/chart" >'."\n";
-    $Ptr .= '<input type="submit" name="sort" value="Recalculate Chart"/>';
-    $Ptr .= "\n";
-    $Ptr .= '&nbsp;&nbsp;&nbsp;';
-    $Ptr .= '<input type="submit" name="refresh" value="Refresh Chart"/>';
-    $Ptr .= "\n";
-    $Ptr .= '<br><br>';
-    $Ptr .= '<b> Sort by: &nbsp; </b>'."\n";
+    my $Ptr .= '<form name="stat" method="post" action="/adm/chart" >'."\n";
+    $Ptr .= '<table border="0"><tbody>';
+    $Ptr .= '<tr><td align="right">';
+    $Ptr .= '</td><td align="left">';
+    $Ptr .= '<input type="submit" name="sort" ';
+    $Ptr .= 'value="Recalculate Chart"/>'."\n";
     $Ptr .= '&nbsp;&nbsp;&nbsp;';
+    $Ptr .= '<input type="submit" name="refresh" ';
+    $Ptr .= 'value="Refresh Chart"/></td>'."\n";
+    $Ptr .= '</tr><tr><td align="right">';
+    $Ptr .= '<b> Sort by: </b>'."\n";
+    $Ptr .= '</td><td align="left">';
     $Ptr .= '<input type="submit" name="sort" value="User Name" />'."\n";
     $Ptr .= '&nbsp;&nbsp;&nbsp;';
     $Ptr .= '<input type="submit" name="sort" value="Last Name" />'."\n";
     $Ptr .= '&nbsp;&nbsp;&nbsp;';
     $Ptr .= '<input type="submit" name="sort" value="Section"/>'."\n";
-    $Ptr .= '<br><br>';
+    $Ptr .= '</td></tr><tr><td align="right">';
     $Ptr .= '<b> Student Status: &nbsp; </b>'."\n".
-            '&nbsp;&nbsp;&nbsp;'.
+            '</td><td align="left">'.
             '<select name="status">'. 
             '<option '.$OpSel1.' >Active</option>'."\n".
             '<option '.$OpSel2.' >Expired</option>'."\n".
 	    '<option '.$OpSel3.' >Any</option> </select> '."\n";
+    $Ptr .= '</td></tr>';
 
     return $Ptr;
 }
 
 sub CreateLegend {
-    my $Str = '<h1>'.$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.
-              '</h1><h3>'.localtime().
-              "</h3><p><pre>1..9: correct by student in 1..9 tries\n".
+    my $Str = "<p><pre>".
+              "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</pre><p>"; 
+	      "   x: excused".
+              "</pre><p>"; 
     return $Str;
 }
 
@@ -403,7 +400,11 @@
     $Str .= '<body bgcolor="#FFFFFF">';
     $Str .= '<script>window.focus();</script>';
     $Str .= '<img align=right src=/adm/lonIcons/lonlogos.gif>';
-    $Str .= '<h1>Assessment Chart</h1>';
+    $Str .= '<h1><pre>Assessment Chart'.(' 'x8).localtime();
+    $Str .= '</pre></h1>';
+    $Str .= '<h1>'.$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
+    $Str .= '</h1>';
+#    $Str .= '<h3>'.localtime().'</h3>';
 
     return $Str;
 }
@@ -955,7 +956,6 @@
 sub CheckForStringInArray {
     my ($inputArray,$checkString)=@_;
     foreach (@$inputArray) {
-#        $jr->print('a:'.$_.' b:'.$checkString.'<br>');
         if($_ eq $checkString) {
             return 1;
         }
@@ -1027,8 +1027,10 @@
     # 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('<h1>'.(scalar @students).
+                                       ' students</h1>'); }
 	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 @@
 						       \@headings, 
                                                        \@reselected,
                                                        $spacePadding)); }
-        if(!$c->aborted()) { $r->print('<h3>'.(scalar @students).
-                                       ' students</h3>'); }
 	if(!$c->aborted()) { $r->print(&CreateColumnSelectors(
                                                        \%CacheData,
                                                        \@studentInformation, 
@@ -1059,21 +1059,15 @@
 
     my @updateStudentList = ();
     my $courseData;
+    $r->print('<pre>');
     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 @@
         $r->rflush();
     }
 
-    $r->print('</body></html>');
+    if(!$isCached && tie(%CacheData,'GDBM_File',$ChartDB,&GDBM_WRCREAT,0640)) {
+        $CacheData{'NamesOfStudents'}=join(":::", @updateStudentList);
+#		    $CacheData{'NamesOfStudents'}=
+#		            &Apache::lonnet::arrayref2str(\@updateStudentList);
+        untie(%CacheData);
+    }
+
+    $r->print('</pre></body></html>');
     $r->rflush();
 
     return;

--stredwic1025622787--