[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm lonparmset.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 28 Oct 2002 23:28:52 -0000
albertel Mon Oct 28 18:28:52 2002 EDT
Modified files:
/loncom/interface lonfeedback.pm lonparmset.pm
Log:
- fixes BUG#776, a limited selection of HTML is allowed in messages in course that allow it.
- xhtml the course parms screen
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.36 loncom/interface/lonfeedback.pm:1.37
--- loncom/interface/lonfeedback.pm:1.36 Mon Oct 28 09:00:18 2002
+++ loncom/interface/lonfeedback.pm Mon Oct 28 18:28:52 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.36 2002/10/28 14:00:18 www Exp $
+# $Id: lonfeedback.pm,v 1.37 2002/10/28 23:28:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -227,9 +227,22 @@
sub clear_out_html {
my $message=$ENV{'form.comment'};
- $message=~s/\<\/*m\s*\>//g;
- $message=~s/\</\<\;/g;
- $message=~s/\>/\>\;/g;
+ my $cid=$ENV{'request.course.id'};
+ if ($ENV{"course.$cid.allow_limited_html_in_feedback"} =~ m/yes/i) {
+ # allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG>
+ # <BLOCKQUOTE> <DIV .*> <DIV> <IMG>
+ my %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);
+
+ $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/
+ {($html{uc($2)}&(length($1)<1000))?"\<$1":"\<$1"}/ge;
+ $message =~ s/(\<?\s*(\w+)[^\<\>]*)\>/
+ {($html{uc($2)}&(length($1)<1000))?"$1\>":"$1\>"}/ge;
+ } else {
+ $message=~s/\<\/*m\s*\>//g;
+ $message=~s/\</\<\;/g;
+ $message=~s/\>/\>\;/g;
+ }
return $message;
}
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.74 loncom/interface/lonparmset.pm:1.75
--- loncom/interface/lonparmset.pm:1.74 Mon Oct 28 09:00:18 2002
+++ loncom/interface/lonparmset.pm Mon Oct 28 18:28:52 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.74 2002/10/28 14:00:18 www Exp $
+# $Id: lonparmset.pm,v 1.75 2002/10/28 23:28:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1393,51 +1393,54 @@
('url' => '<b>Top Level Map</b> '.
'<a href="javascript:openbrowser'.
"('envform','url','sequence')\">".
- 'Browse</a><br><font color=red> '.
+ 'Browse</a><br /><font color=red> '.
'Modification may make assessment data '.
'inaccessible</font>',
'description' => '<b>Course Description</b>',
- 'courseid' => '<b>Course ID or number</b><br>'.
+ 'courseid' => '<b>Course ID or number</b><br />'.
'(internal, optional)',
'default_xml_style' => '<b>Default XML Style File</b> '.
'<a href="javascript:openbrowser'.
"('envform','default_xml_style'".
",'sty')\">Browse</a><br>",
'question.email' => '<b>Feedback Addresses for Resource Content '.
- 'Questions</b><br>(<tt>user:domain,'.
+ 'Questions</b><br />(<tt>user:domain,'.
'user:domain(section;section;...;*;...),...</tt>)',
- 'comment.email' => '<b>Feedback Addresses for Course Content Comments</b><br>'.
+ 'comment.email' => '<b>Feedback Addresses for Course Content Comments</b><br />'.
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
'policy.email' => '<b>Feedback Addresses for Course Policy</b>'.
- '<br>(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
- 'hideemptyrows' => '<b>Hide Empty Rows in Spreadsheets</b><br>'.
+ '<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
+ 'hideemptyrows' => '<b>Hide Empty Rows in Spreadsheets</b><br />'.
'("<tt>yes</tt>" for default hiding)',
- 'pageseparators' => '<b>Visibly Separate Items on Pages</b><br>'.
+ 'pageseparators' => '<b>Visibly Separate Items on Pages</b><br />'.
'("<tt>yes</tt>" for visible separation)',
'pch.roles.denied'=> '<b>Disallow Resource Discussion for '.
- 'Roles</b><br>"<tt>st</tt>": '.
+ 'Roles</b><br />"<tt>st</tt>": '.
'student, "<tt>ta</tt>": '.
'TA, "<tt>in</tt>": '.
- 'instructor;<br><tt>role,role,...</tt>) '.
+ 'instructor;<br /><tt>role,role,...</tt>) '.
Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
'pch.users.denied' =>
- '<b>Disallow Resource Discussion for Users</b><br>'.
+ '<b>Disallow Resource Discussion for Users</b><br />'.
'(<tt>user:domain,user:domain,...</tt>)',
'spreadsheet_default_classcalc'
=> '<b>Default Course Spreadsheet</b> '.
'<a href="javascript:openbrowser'.
"('envform','spreadsheet_default_classcalc'".
- ",'spreadsheet')\">Browse</a><br>",
+ ",'spreadsheet')\">Browse</a><br />",
'spreadsheet_default_studentcalc'
=> '<b>Default Student Spreadsheet</b> '.
'<a href="javascript:openbrowser'.
"('envform','spreadsheet_default_calc'".
- ",'spreadsheet')\">Browse</a><br>",
+ ",'spreadsheet')\">Browse</a><br />",
'spreadsheet_default_assesscalc'
=> '<b>Default Assessment Spreadsheet</b> '.
'<a href="javascript:openbrowser'.
"('envform','spreadsheet_default_assesscalc'".
- ",'spreadsheet')\">Browse</a><br>",
+ ",'spreadsheet')\">Browse</a><br />",
+ 'allow_limited_html_in_feedback'
+ => '<b>Allow limited HTML in discussion posts</b><br />'.
+ '(Set value to yes to allow)'
);
foreach (keys(%values)) {
unless ($descriptions{$_}) {