--- loncom/xml/lonxml.pm 2001/05/13 21:40:32 1.75 +++ loncom/xml/lonxml.pm 2001/10/26 17:09:04 1.136 @@ -7,14 +7,27 @@ # 2/21,3/13 Guy # 3/29,5/4 Gerd Kortemeyer # 5/10 Scott Harrison +# 5/26 Gerd Kortemeyer +# 5/27 H. K. Ng +# 6/2,6/3,6/8,6/9 Gerd Kortemeyer +# 6/12,6/13 H. K. Ng +# 6/16 Gerd Kortemeyer +# 7/27 H. K. Ng +# 8/7,8/9,8/10,8/11,8/15,8/16,8/17,8/18,8/20,8/23,8/24 Gerd Kortemeyer +# Guy Albertelli +# 9/26 Gerd Kortemeyer + package Apache::lonxml; use vars -qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist); +qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace); use strict; use HTML::TokeParser; +use HTML::TreeBuilder; use Safe; use Safe::Hole; +use Math::Cephes qw(:trigs :hypers :bessels erf erfc); +use Math::Random qw(:all); use Opcode; sub register { @@ -34,6 +47,10 @@ use Apache::run; use Apache::londefdef; use Apache::scripttag; use Apache::edit; +use Apache::lonnet; +use Apache::File; +use Apache::loncommon; + #================================================== Main subroutine: xmlparse #debugging control, to turn on debugging modify the correct handler $Apache::lonxml::debug=0; @@ -60,6 +77,12 @@ $evaluate = 1; # data structure for eidt mode, determines what tags can go into what other tags %insertlist=(); +# stores the list of active tag namespaces +@namespace=(); + +# has the dynamic menu been updated to know about this resource +$Apache::lonxml::registered=0; + sub xmlbegin { my $output=''; if ($ENV{'browser.mathml'}) { @@ -72,11 +95,165 @@ sub xmlbegin { } else { $output=''; } + my $date=localtime; + $output .=&Apache::loncommon::cacheheader(); return $output; } sub xmlend { - return ''; + my $discussion=''; + if ($ENV{'request.course.id'}) { + my $crs='/'.$ENV{'request.course.id'}; + if ($ENV{'request.course.sec'}) { + $crs.='_'.$ENV{'request.course.sec'}; + } + $crs=~s/\_/\//g; + my $seeid=&Apache::lonnet::allowed('rin',$crs); + my $symb=&Apache::lonnet::symbread(); + if ($symb) { + my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + if ($contrib{'version'}) { + $discussion.= + '
'.$sender.' ('. + localtime($contrib{$idx.':timestamp'}). + '):
'.$message. + ''; + } + } + } + $discussion.=''; + } + } + } + return $discussion.'