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

raeburn raeburn@source.lon-capa.org
Mon, 25 Jan 2010 04:34:37 -0000


raeburn		Mon Jan 25 04:34:37 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonfeedback.pm 
  Log:
  - Backport 1.283, 1.284, 1.285.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.273.4.6 loncom/interface/lonfeedback.pm:1.273.4.7
--- loncom/interface/lonfeedback.pm:1.273.4.6	Mon Jan 25 03:56:00 2010
+++ loncom/interface/lonfeedback.pm	Mon Jan 25 04:34:37 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.273.4.6 2010/01/25 03:56:00 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.273.4.7 2010/01/25 04:34:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -400,8 +400,8 @@
             my $manifestfilename = $tempexport.$manifest;
             if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {
                 $manifestok=1;
-                print $manifestfile qq|
-<?xml version="1.0" encoding="UTF-8"?>
+                print $manifestfile qq|<?xml version="1.0" encoding="UTF-8"?>
+
 <manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 identifier="MANIFEST-$ressymb" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 
@@ -528,11 +528,11 @@
                         print $manifestfile "\n". 
       '<item identifier="ITEM-'.$ressymb.'-'.$alldiscussion{$post}.'" isvisible="'.
         $imsitems{$alldiscussion{$post}}{'isvisible'}.'" identifieref="RES-'.$ressymb.'-'.$alldiscussion{$post}.'">'.
-        '<title>'.$imsitems{$alldiscussion{$post}}{'title'}.'</title>';
+        '<title>'.$imsitems{$alldiscussion{$post}}{'title'}.'</title></item>';
                         $imsresources .= "\n".
     '<resource identifier="RES-'.$ressymb.'-'.$alldiscussion{$post}.'" type="webcontent" href="'.$postfilename.'">'."\n".
       '<file href="'.$postfilename.'">'."\n".
-      $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}."\n".
+      $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}.'</file>'."\n".
     '</resource>';
                     }
                     my $postingfile;
@@ -1397,7 +1397,9 @@
         my ($timesent,$attachmsg);
         my %currattach = ();
         $timesent = &Apache::lonlocal::locallocaltime($postversions[$i]);
-	&newline_to_br(\$messages->{$i});
+        unless (&contains_block_html($messages->{$i})) {
+            &newline_to_br(\$messages->{$i});
+        }
         $$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i});
         $$subjects{$i}=~s/\n/\<br \/\>/g;
         $$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i});
@@ -1411,7 +1413,7 @@
                 foreach my $key (sort(keys(%currattach))) {
                     if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {
                         my $fname = $1.$3.'/'.$4;
-                        $$imsfiles{$idx}{$i} .= '<file href="'.$fname.'">'."\n";
+                        $$imsfiles{$idx}{$i} .= '<file href="'.$fname.'" />'."\n";
                         $$attachtxt{$i}.= '<a href="'.$fname.'">'.$4.'</a><br />';
                     }
                 }
@@ -1671,7 +1673,10 @@
 				     {'add_entries' => \%onload});
 
   if ($quote ne '') {
-      &newline_to_br(\$quote);
+      $quote = &HTML::Entities::decode($quote);
+      unless (&contains_block_html($quote)) {
+          &newline_to_br(\$quote);
+      }
       $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($quote).'</blockquote>';
   }
 
@@ -1705,7 +1710,6 @@
 <p>
 <textarea name="comment" id="comment" cols="60" rows="10">$comment
 </textarea></p>
-<p>
 END
     if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
         if ($env{'form.origpage'}) {
@@ -1727,6 +1731,7 @@
         }
     } else {
         $r->print(<<END);
+<p>
 $lt{'atta'} $attachmaxtext: <input type="file" name="attachment" />
 </p>
 END
@@ -2643,7 +2648,7 @@
                    .$msgoptions;
     }
     if ($discussoptions) { 
-	$discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" />'
+	$discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" alt="" />'
                         .' '.&mt('Discussion Contributions').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'</p>'
                         .$discussoptions;
     }
@@ -2675,11 +2680,13 @@
       ($override)) {
       # allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG> 
       # <BLOCKQUOTE> <DIV .*> <DIV> <IMG> <M> <SPAN> <H1> <H2> <H3> <H4> <SUB>
-      # <SUP>
+      # <SUP> <TABLE> <TR> <TD> <TH> <TBODY>
       %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1,
 	     BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1,
 	     M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1, 
-	     H1=>1, H2=>1, H3=>1, H4=>1, H5=>1);
+	     H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1, 
+	     TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);
+
   }
 # Do the substitution of everything that is not explicitly allowed
   $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/