--- loncom/xml/lonxml.pm 2002/09/11 13:36:50 1.195 +++ loncom/xml/lonxml.pm 2002/11/06 22:36:08 1.211 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.195 2002/09/11 13:36:50 www Exp $ +# $Id: lonxml.pm,v 1.211 2002/11/06 22:36:08 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,7 +60,7 @@ package Apache::lonxml; use vars -qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $prevent_entity_encode); +qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $prevent_entity_encode $errorcount $warningcount); use strict; use HTML::LCParser(); use HTML::TreeBuilder(); @@ -99,11 +99,17 @@ use Apache::edit(); use Apache::lonnet(); use Apache::File(); use Apache::loncommon(); +use Apache::lonfeedback(); +use Apache::lonmsg(); #================================================== Main subroutine: xmlparse #debugging control, to turn on debugging modify the correct handler $Apache::lonxml::debug=0; +# keeps count of the number of warnings and errors generated in a parse +$warningcount=0; +$errorcount=0; + #path to the directory containing the file currently being processed @pwd=(); @@ -138,6 +144,10 @@ $Apache::lonxml::registered=0; # a pointer the the Apache request object $Apache::lonxml::request=''; +# a problem number counter, and check on hether it is used +$Apache::lonxml::counter=0; +$Apache::lonxml::counter_changed=0; + sub xmlbegin { my $output=''; if ($ENV{'browser.mathml'}) { @@ -186,17 +196,24 @@ sub xmlend { if ($hidden) { $message=''.$message.''; } + my $screenname=&Apache::loncommon::screenname( + $contrib{$idx.':sendername'}, + $contrib{$idx.':senderdomain'}); + my $plainname=&Apache::loncommon::nickname( + $contrib{$idx.':sendername'}, + $contrib{$idx.':senderdomain'}); + my $sender='Anonymous'; if ((!$contrib{$idx.':anonymous'}) || ($seeid)) { $sender=&Apache::loncommon::aboutmewrapper( - $contrib{$idx.':plainname'}, + $plainname, $contrib{$idx.':sendername'}, $contrib{$idx.':senderdomain'}).' ('. $contrib{$idx.':sendername'}.' at '. $contrib{$idx.':senderdomain'}.')'; if ($contrib{$idx.':anonymous'}) { $sender.=' [anonymous] '. - $contrib{$idx.':screenname'}; + $screenname; } if ($seeid) { if ($hidden) { @@ -208,8 +225,8 @@ sub xmlend { } } } else { - if ($contrib{$idx.':screenname'}) { - $sender=''.$contrib{$idx.':screenname'}.''; + if ($screenname) { + $sender=''.$screenname.''; } } $discussion.='

'.$sender.' ('. @@ -225,7 +242,7 @@ sub xmlend { } if ($discussiononly) { $discussion.=(< +

@@ -236,6 +253,7 @@ course faculty
ENDDISCUSS + $discussion.=&Apache::lonfeedback::generate_preview_button(); } } } @@ -356,6 +374,7 @@ sub registerurl { my $forcereg=shift; my $target = shift; my $result = ''; + if ($target eq 'edit') { $result .="