--- loncom/xml/lonxml.pm 2005/05/03 06:44:56 1.373 +++ loncom/xml/lonxml.pm 2005/05/28 01:32:33 1.374 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.373 2005/05/03 06:44:56 albertel Exp $ +# $Id: lonxml.pm,v 1.374 2005/05/28 01:32:33 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -382,33 +382,6 @@ sub xmlparse { return $finaloutput; } -sub htmlclean { - my ($raw,$full)=@_; -# Take care of CRLF etc - - $raw=~s/\r\f/\n/gs; $raw=~s/\f\r/\n/gs; - $raw=~s/\r\n/\n/gs; $raw=~s/\n\r/\n/gs; - $raw=~s/\f/\n/gs; $raw=~s/\r/\n/gs; - $raw=~s/\&\#10\;/\n/gs; $raw=~s/\&\#13\;/\n/gs; - -# Generate empty tags, remove wrong end tags - $raw=~s/\<(br|hr|img|meta|allow|basefont)([^\>\/]*?)\>/\<$1$2 \/\>/gis; - $raw=~s/\<\/(br|hr|img|meta|allow|basefont)\>//gis; - unless ($full) { - $raw=~s/\<[\/]*(body|head|html)\>//gis; - } -# Make standard tags lowercase - foreach ('html','body','head','meta','h1','h2','h3','h4','b','i','m', - 'table','tr','td','th','p','br','hr','img','embed','font', - 'a','strong','center','title','basefont','li','ol','ul', - 'input','select','form','option','script','pre') { - $raw=~s/\<$_\s*\>/\<$_\>/gis; - $raw=~s/\<\/$_\s*\>/<\/$_\>/gis; - $raw=~s/\<$_\s([^\>]*)\>/<$_ $1\>/gis; - } - return $raw; -} - sub latex_special_symbols { my ($string,$where)=@_; if ($where eq 'header') { @@ -1238,10 +1211,7 @@ FULLPAGE $xml_help=&Apache::loncommon::helpLatexCheatsheet(); } my $cleanbut = ''; - if ($filetype eq 'html') { - $cleanbut=''; - } + my $titledisplay=&display_title(); my %lt=&Apache::lonlocal::texthash('st' => 'Save this', 'vi' => 'View', @@ -1329,7 +1299,7 @@ sub handler { # Edit action? Save file. # unless ($env{'request.state'} eq 'published') { - if (($env{'form.savethisfile'}) || ($env{'form.attemptclean'})) { + if ($env{'form.savethisfile'}) { if (&storefile($file,$env{'form.filecont'})) { &Apache::lonxml::info("". &mt('Updated').": ". @@ -1368,10 +1338,6 @@ ENDNOTFOUND if ($filecontents=~/BEGIN LON-CAPA Internal/) { &Apache::lonxml::error(&mt('This file appears to be a rendering of a Lon-CAPA resource. If this is correct, this resource will act very oddly and incorrectly.')); } - - if ($env{'form.attemptclean'}) { - $filecontents=&htmlclean($filecontents,1); - } # # we are in construction space, see if edit mode forced &Apache::loncommon::get_unprocessed_cgi