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

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 10 Aug 2004 18:01:26 -0000


sakharuk		Tue Aug 10 14:01:26 2004 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Bug 2838 (print attached discussions too) is fixed (finally). I am open to change any info (which can be relevant or not) but the general scheme seems works.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.113 loncom/interface/lonfeedback.pm:1.114
--- loncom/interface/lonfeedback.pm:1.113	Wed Aug  4 14:04:57 2004
+++ loncom/interface/lonfeedback.pm	Tue Aug 10 14:01:25 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.113 2004/08/04 18:04:57 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.114 2004/08/10 18:01:25 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -65,7 +65,7 @@
 }
 
 sub list_discussion {
-    my ($mode,$status,$symb)=@_;
+    my ($mode,$status,$symb,$ttarget,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $outputtarget=$ENV{'form.grade_target'};
     if (not &discussion_visible($status)) { return ''; }
     my @bgcols = ("#cccccc","#eeeeee");
@@ -682,11 +682,11 @@
 	    }
 	    $discussion .= '</tr></table></td></tr>';
 	} else {
-	    $discussion.='\vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}'.
+	    $discussion.='<tex>\vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}'.
                          '\textbf{DISCUSSIONS}\makebox[2 cm][b]{\hrulefill}'.
                          '\vskip 0 mm\noindent\textbf{'.$lt{'cuse'}.'}:\vskip 0 mm'.
                          '\noindent\textbf{'.$lt{'disa'}.'}: \textit{'.$currdisp.'}\vskip 0 mm'.
-                         '\noindent\textbf{'.$lt{'npce'}.'}: \textit{'.$currmark.'}';
+                         '\noindent\textbf{'.$lt{'npce'}.'}: \textit{'.$currmark.'}</tex>';
 	}
         my $numhidden = keys %notshown;
         if ($numhidden > 0) {
@@ -739,8 +739,6 @@
             unless ( ($notshown{$alldiscussion{$_}} eq '1') || ($shown{$alldiscussion{$_}} == 0) ) {
                 if ($outputtarget ne 'tex') {
 		    $discussion.="\n<tr>";
-		} else {
-		    $discussion.='\vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}';
 		}
 	        my $thisdepth=$depth[$alldiscussion{$_}];
                 if ($outputtarget ne 'tex') {
@@ -764,13 +762,12 @@
 		    $discussionitems[$alldiscussion{$_}]=~s/<\/td><td([^>]*)>/$threadinsert<\/td><td TeXwidth="65 mm" align="left">/;
 		    $discussionitems[$alldiscussion{$_}]=~s/<a([^>]+)>(Edit|Hide|Delete|Reply|Submissions)<\/a>//g;
                     $discussionitems[$alldiscussion{$_}]=~s/(<b>|<\/b>|<\/a>|<a([^>]+)>)//g;
-		    
-                    #FIXME xmlparse can't be safely called from inside xmlparse
-                    #   due to the global variables that are use, the safe
-                    #   space etc. I expect this has unforseen issues that
-                    #   need resolving.
-		    
-                    $discussion.=&Apache::lonxml::xmlparse('','tex',$discussionitems[$alldiscussion{$_}]);
+
+		    $discussionitems[$alldiscussion{$_}]='<tex>\vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}</tex>'.$discussionitems[$alldiscussion{$_}];
+		    if ($_ eq $showposts[-1]) {
+			$discussionitems[$alldiscussion{$_}].='<tex>\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\end{document}</tex>';
+		    }
+		    $discussion.=$discussionitems[$alldiscussion{$_}];
 		}
 	    }
         }
@@ -829,7 +826,7 @@
            </table>
            <br /><br /></form>
 END
-	}
+        } 
     }
     if ($discussiononly) {
         my $now = time;
@@ -901,7 +898,7 @@
 	    }
 	}
     }
-   return $discussion;
+    return $discussion;
 }
 
 sub mail_screen {