--- loncom/xml/lonxml.pm 2002/03/25 20:06:08 1.162 +++ loncom/xml/lonxml.pm 2002/05/01 21:40:25 1.168 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.162 2002/03/25 20:06:08 matthew Exp $ +# $Id: lonxml.pm,v 1.168 2002/05/01 21:40:25 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,7 +62,7 @@ package Apache::lonxml; use vars qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace); use strict; -use HTML::TokeParser(); +use HTML::LCParser(); use HTML::TreeBuilder(); use HTML::Entities(); use Safe(); @@ -176,10 +176,12 @@ sub xmlend { } my $sender='Anonymous'; if ((!$contrib{$idx.':anonymous'}) || ($seeid)) { - $sender=$contrib{$idx.':sendername'}.' at '. - $contrib{$idx.':senderdomain'}; + $sender=$contrib{$idx.':plainname'}.' ('. + $contrib{$idx.':sendername'}.' at '. + $contrib{$idx.':senderdomain'}.')'; if ($contrib{$idx.':anonymous'}) { - $sender.=' (anonymous)'; + $sender.=' [anonymous] '. + $contrib{$idx.':screenname'}; } if ($seeid) { if ($hidden) { @@ -190,6 +192,10 @@ sub xmlend { $symb.':::'.$idx.'">Hide'; } } + } else { + if ($contrib{$idx.':screenname'}) { + $sender=''.$contrib{$idx.':screenname'}.''; + } } $discussion.='

'.$sender.' ('. localtime($contrib{$idx.':timestamp'}). @@ -330,26 +336,20 @@ sub registerurl { if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; } if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) { my $hwkadd=''; - if ($ENV{'REQUEST_URI'}=~/\.(problem|exam|quiz|assess|survey|form)$/) { + if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) { if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) { $hwkadd.=(< + menu.currentURL=null; var editbrowser; function openbrowser(formname,elementname,only,omit) { var url = '/res/?'; @@ -630,7 +635,7 @@ sub inner_xmlparse { $finaloutput .= &Apache::run::evaluate($result,$safeeval,''); } $result = ''; - } + } if ($token->[0] eq 'E') { &end_tag($stack,$parstack,$token); } @@ -643,6 +648,8 @@ sub inner_xmlparse { # $finaloutput.=&endredirection; # } + # Encode any high ASCII characters + $finaloutput=&HTML::Entities::encode($finaloutput,"\200-\377"); if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) { $finaloutput=&afterburn($finaloutput); } @@ -814,6 +821,11 @@ sub setup_globals { $Apache::lonxml::metamode = 0; $Apache::lonxml::evaluate = 0; $Apache::lonxml::import = 0; + } elsif ($target eq 'analyze') { + $Apache::lonxml::redirection = 0; + $Apache::lonxml::metamode = 0; + $Apache::lonxml::evaluate = 1; + $Apache::lonxml::import = 1; } else { $Apache::lonxml::redirection = 0; $Apache::lonxml::metamode = 0; @@ -987,7 +999,7 @@ sub get_all_text { sub newparser { my ($parser,$contentref,$dir) = @_; - push (@$parser,HTML::TokeParser->new($contentref)); + push (@$parser,HTML::LCParser->new($contentref)); $$parser['-1']->xml_mode('1'); if ( $dir eq '' ) { push (@Apache::lonxml::pwd, $Apache::lonxml::pwd[$#Apache::lonxml::pwd]); @@ -1231,7 +1243,8 @@ sub debug { sub error { if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) { - print "ERROR:".join('
',@_)."
\n"; + # If printing in construction space, put the error inside


+    print "ERROR:".join("\n",@_)."\n";
   } else {
     print "An Error occured while processing this resource. The instructor has been notified. 
"; #notify author