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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 28 Nov 2006 21:44:37 -0000


albertel		Tue Nov 28 16:44:37 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - need to make sure that start page occurs before mstextconverted gets called and before end_page gets called
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.217 loncom/interface/lonfeedback.pm:1.218
--- loncom/interface/lonfeedback.pm:1.217	Thu Nov  9 15:44:37 2006
+++ loncom/interface/lonfeedback.pm	Tue Nov 28 16:44:37 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.217 2006/11/09 20:44:37 albertel Exp $
+# $Id: lonfeedback.pm,v 1.218 2006/11/28 21:44:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1486,14 +1486,11 @@
                       $numoldver = 1;
                   }
               }
-              my $message;
               if ($idx > 0) {
                   my %msgversions = ();
                   &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
-                  $message = $msgversions{$numoldver};
+                  $quote = $msgversions{$numoldver};
               }
-	      &newline_to_br(\$message);
-	      $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>';
               if ($idx > 0) {
                   my %subversions = ();
                   &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver);
@@ -1588,6 +1585,11 @@
       &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
 				     {'add_entries' => \%onload});
 
+  if ($quote ne '') {
+      &newline_to_br(\$quote);
+      $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($quote).'</blockquote>';
+  }
+
   $r->print(<<END);
 $start_page
 <h2><tt>$title</tt></h2>
@@ -2813,6 +2815,10 @@
     my ($r) = @_;
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
+    my $start_page=
+	&Apache::loncommon::start_page('Preview',undef,
+				       {'only_body'   => 1,});
+
     my $message=&clear_out_html($env{'form.comment'});
     &newline_to_br(\$message);
     $message=&Apache::lonspeller::markeduptext($message);
@@ -2820,9 +2826,6 @@
     my $subject=&clear_out_html($env{'form.subject'},undef,1);
     $subject=~s/\n/\<br \/\>/g;
     $subject=&Apache::lontexconvert::msgtexconverted($subject);
-    my $start_page=
-	&Apache::loncommon::start_page('Preview',undef,
-				       {'only_body'   => 1,});
 					
     my $end_page = &Apache::loncommon::end_page();
 
@@ -2871,6 +2874,19 @@
 
 sub modify_attachments {
     my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;
+
+    my $js = <<END;
+<script type="text/javascript">
+ function setAction () {
+   document.modattachments.action = document.modattachments.origpage.value;
+   document.modattachments.submit();
+ }
+</script> 
+END
+
+    my $start_page = 
+	&Apache::loncommon::start_page('Discussion Post Attachments',$js);
+
     my $orig_subject = &unescape($env{'form.subject'});
     my $subject=&clear_out_html($orig_subject,undef,1);
     $subject=~s/\n/\<br \/\>/g;
@@ -2885,17 +2901,7 @@
         &extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold);
     }
     &Apache::lonenc::check_encrypt(\$symb);
-    my $js = <<END;
-<script type="text/javascript">
- function setAction () {
-   document.modattachments.action = document.modattachments.origpage.value;
-   document.modattachments.submit();
- }
-</script> 
-END
 
-    my $start_page = 
-	&Apache::loncommon::start_page('Discussion Post Attachments',$js);
     my $end_page = 
 	&Apache::loncommon::end_page();