--- loncom/interface/lonfeedback.pm 2009/12/08 13:33:12 1.282
+++ loncom/interface/lonfeedback.pm 2010/01/24 15:30:04 1.285
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.282 2009/12/08 13:33:12 wenzelju Exp $
+# $Id: lonfeedback.pm,v 1.285 2010/01/24 15:30:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,7 @@ use Apache::lonnavmaps;
use Apache::lonenc();
use Apache::lonrss();
use HTML::LCParser();
+#use HTML::Tidy::libXML;
use Apache::lonspeller();
use Apache::longroup;
use Cwd;
@@ -402,8 +403,7 @@ sub list_discussion {
my $manifestfilename = $tempexport.$manifest;
if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {
$manifestok=1;
- print $manifestfile qq|
-
+ print $manifestfile qq|
'.
- ''.$imsitems{$alldiscussion{$post}}{'title'}.'';
+ ''.$imsitems{$alldiscussion{$post}}{'title'}.'';
$imsresources .= "\n".
''."\n".
''."\n".
- $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}."\n".
+ $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}.''."\n".
'';
}
my $postingfile;
@@ -1410,7 +1410,7 @@ sub get_post_contents {
foreach my $key (sort(keys(%currattach))) {
if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {
my $fname = $1.$3.'/'.$4;
- $$imsfiles{$idx}{$i} .= ''."\n";
+ $$imsfiles{$idx}{$i} .= ''."\n";
$$attachtxt{$i}.= ''.$4.'
';
}
}
@@ -1709,7 +1709,6 @@ $lt{'title'}: $comment
-
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1731,6 +1730,7 @@ END
}
} else {
$r->print(<
$lt{'atta'} $attachmaxtext:
END
@@ -2646,7 +2646,7 @@ sub screen_header {
.$msgoptions;
}
if ($discussoptions) {
- $discussoptions='
'
+ $discussoptions='
'
.' '.&mt('Discussion Contributions').'
'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'
'
.$discussoptions;
}
@@ -2678,11 +2678,12 @@ sub clear_out_html {
($override)) {
# allows
#
- #
+ # | |
%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+)[^\>\<]*)/
@@ -2958,9 +2959,21 @@ sub contains_block_html {
(
[\s]*[\/]>|
>.*<\/\1[\s]*>
- )/x );
+ )/xs );
+}
+
+sub tidy_html {
+ my ($message)=@_;
+# my $tidy = HTML::Tidy::libXML->new();
+# my $xhtml = $tidy->clean($message, 'utf-8', 1);
+# $xhtml =~ m/(.*)<\/body>/is;
+# my $clean = $1;
+# # remove any empty block-level tags
+# $clean =~ s/<(table|p|div|tbody|blockquote|m|pre|algebra|center|ol|ul|span|h1|h2|h3|h4|h5|h6)\s*\/>//i;
+# $message=$clean;
+ return $message;
}
-
+
sub newline_to_br {
my ($message)=@_;
my $newmessage;
@@ -4145,6 +4158,8 @@ None
=item newline_to_br()
+=item tidy_html()
+
=item generate_preview_button()
=item modify_attachments()