--- loncom/xml/lonxml.pm 2001/07/27 18:16:22 1.104 +++ loncom/xml/lonxml.pm 2001/10/05 16:55:12 1.135 @@ -13,12 +13,17 @@ # 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 @namespace); use strict; use HTML::TokeParser; +use HTML::TreeBuilder; use Safe; use Safe::Hole; use Math::Cephes qw(:trigs :hypers :bessels erf erfc); @@ -95,6 +100,12 @@ sub xmlbegin { sub xmlend { 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'}, @@ -105,13 +116,37 @@ sub xmlend { '
'.$contrib{$idx.':sendername'}.' at '.
- $contrib{$idx.':senderdomain'}.' ('.
+ my $hidden=($contrib{'hidden'}=~/\.$idx\./);
+ unless (($hidden) && (!$seeid)) {
+ my $message=$contrib{$idx.':message'};
+ $message=~s/\n/\
/g;
+ if ($message) {
+ if ($hidden) {
+ $message=''.$message.'';
+ }
+ my $sender='Anonymous';
+ if ((!$contrib{$idx.':anonymous'}) || ($seeid)) {
+ $sender=$contrib{$idx.':sendername'}.' at '.
+ $contrib{$idx.':senderdomain'};
+ if ($contrib{$idx.':anonymous'}) {
+ $sender.=' (anonymous)';
+ }
+ if ($seeid) {
+ if ($hidden) {
+ $sender.=' Make Visible';
+ } else {
+ $sender.=' Hide';
+ }
+ }
+ }
+ $discussion.='
'.$sender.' ('. localtime($contrib{$idx.':timestamp'}). '):
'.$message. - ''; + ''; + } + } } $discussion.=''; } @@ -120,6 +155,104 @@ sub xmlend { return $discussion.'