[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm /xml lontexconvert.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 28 Jan 2004 20:48:35 -0000


albertel		Wed Jan 28 15:48:35 2004 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
    /loncom/xml	lontexconvert.pm 
  Log:
  - Fixes BUG#2499, emails with large <m> where getting shoved onto one line because
     - we use <pre>
     - we strip out extra returns before processing
  
  - I tired these changes out with a variety of messages both with and without <m> sections, and post discussion, looks good to me. let me know if you see anything else that looks ugly
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.80 loncom/interface/lonmsg.pm:1.81
--- loncom/interface/lonmsg.pm:1.80	Thu Jan 15 13:25:36 2004
+++ loncom/interface/lonmsg.pm	Wed Jan 28 15:48:35 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.80 2004/01/15 18:25:36 www Exp $
+# $Id: lonmsg.pm,v 1.81 2004/01/28 20:48:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1084,7 +1084,7 @@
            '"><b>'.&mt('Next').'</b></a></td>');
        }
        $r->print('</tr></table><p><pre>'.
-             &Apache::lontexconvert::msgtexconverted($content{'message'}).
+             &Apache::lontexconvert::msgtexconverted($content{'message'},1).
              '</pre><hr>'.$content{'citation'});
   } elsif ($ENV{'form.replyto'}) {
       &comprep($r,$ENV{'form.replyto'});
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.29 loncom/xml/lontexconvert.pm:1.30
--- loncom/xml/lontexconvert.pm:1.29	Wed Jan 28 12:16:27 2004
+++ loncom/xml/lontexconvert.pm	Wed Jan 28 15:48:35 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.29 2004/01/28 17:16:27 albertel Exp $
+# $Id: lontexconvert.pm,v 1.30 2004/01/28 20:48:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,9 +68,6 @@
 	    &tth::tthoptions('-L -u0 '.$options);
 	}
     }
-    &Apache::lonnet::logthis("caled and use $options");
-    &Apache::lonnet::logthis("caller ".join(':',caller(0)));
-
 }
 
 sub header {
@@ -139,7 +136,7 @@
 sub to_convert {
     my ($string) = @_;
     $string=~s/\<br\s*\/?\>/ /gs;
-    $string=~s/\s/ /gs;
+#    $string=~s/\s/ /gs;
     $string=&HTML::Entities::decode($string);
     return &converted(\$string);
 }
@@ -170,14 +167,18 @@
 
 sub msgtexconverted {
     my $message=shift;
-
+    my $email=shift;
     $errorstring='';
     &init_tth();
     my $outmessage='';
     my $tex=0;
     foreach (split(/(?:\&lt\;|\<)\/*m\s*(?:\&gt\;|\>)/i,$message)) {
 	if ($tex) {
-	    $outmessage.=&to_convert($_); $tex=0;
+	    if ($email) {
+		$outmessage.='</pre><tt>'.&to_convert($_).'</tt><pre>'; $tex=0;
+	    } else {
+		$outmessage.=&to_convert($_); $tex=0;
+	    }
 	} else {
             $outmessage.=&smiley($_); $tex=1;
 	}