--- loncom/xml/lonxml.pm 2005/05/03 06:44:56 1.373 +++ loncom/xml/lonxml.pm 2005/06/29 19:02:14 1.379 @@ -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.379 2005/06/29 19:02:14 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -180,8 +180,8 @@ sub xmlend { $status=$Apache::inputtags::status[-1]; } my $discussion; - &Apache::loncommon::get_unprocessed_cgi - ($env{'query_string'},['LONCAPA_INTERNAL_no_discussion']); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['LONCAPA_INTERNAL_no_discussion']); if (! exists($env{'form.LONCAPA_INTERNAL_no_discussion'}) || $env{'form.LONCAPA_INTERNAL_no_discussion'} ne 'true') { $discussion=&Apache::lonfeedback::list_discussion($mode,$status); @@ -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') { @@ -424,6 +397,7 @@ sub latex_special_symbols { $string=~s/\\\%|\%/\\\%/g; $string=~s/\\{|{/\\{/g; $string=~s/\\}|}/\\}/g; + $string=~s/\\ensuremath\\{\\backslash\\}/\\ensuremath{\\backslash}/g; $string=~s/\\\$|\$/\\\$/g; $string=~s/\\\_|\_/\\\_/g; $string=~s/([^\\]|^)(\~|\^)/$1\\$2\\strut /g; @@ -1092,7 +1066,7 @@ sub parstring { sub writeallows { unless ($#extlinks>=0) { return; } - my $thisurl='/res/'.&Apache::lonnet::declutter(shift); + my $thisurl = &Apache::lonnet::clutter(shift); if ($env{'httpref.'.$thisurl}) { $thisurl=$env{'httpref.'.$thisurl}; } @@ -1238,10 +1212,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 +1300,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 +1339,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 @@ -1489,8 +1456,6 @@ sub warning { if ($env{'form.grade_target'} ne 'tex') { if ( &show_error_warn_msg() ) { - my $request=$Apache::lonxml::request; - if (!$request) { $request=Apache->request; } push(@Apache::lonxml::warning_messages, $Apache::lonxml::warnings_error_header. "WARNING:".join('
',@_)."
\n");