--- loncom/xml/lonxml.pm 2001/08/10 15:49:46 1.109 +++ loncom/xml/lonxml.pm 2001/08/15 14:03:03 1.112 @@ -13,7 +13,7 @@ # 6/12,6/13 H. K. Ng # 6/16 Gerd Kortemeyer # 7/27 H. K. Ng -# 8/7,8/9,8/10 Gerd Kortemeyer +# 8/7,8/9,8/10,8/11,8/15 Gerd Kortemeyer package Apache::lonxml; use vars @@ -113,20 +113,37 @@ sub xmlend { '

Course Discussion of Resource

'; my $idx; for ($idx=1;$idx<=$contrib{'version'};$idx++) { - my $message=$contrib{$idx.':message'}; - $message=~s/\n/\
/g; + 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.='
'; } @@ -135,6 +152,39 @@ sub xmlend { return $discussion.''; } +sub checkout { + my ($target,$symb,$tuname,$tudom,$tcrsid)=@_; + unless ($symb) { + $symb=&Apache::lonnet::symbread(); + } + unless ($tuname) { + $tuname=$ENV{'user.name'}; + $tudom=$ENV{'user.domain'}; + $tcrsid=$ENV{'request.course.id'}; + } + my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; + my $infostr=&Apache::lonnet::escape( + $tuname.'&'. + $tudom.'&'. + $tcrsid.'&'. + $symb.'&'. + time.'&'.$ENV{'REMOTE_ADDR'}); + my $token=Apache::lonnet::reply('tmpput:'.$infostr,$lonhost); + if ($token=~/^error\:/) { return ''; } + $token=~s/^(\d+)\_.*\_(\d+)$/$1\_$2\_$lonhost/; + if (&Apache::lonnet::log($tudom,$tuname, + &Apache::lonnet::homeserver($tuname,$tudom), + &Apache::lonnet::escape('Checkout '.$infostr.' - '. + $token)) ne 'ok') { + return ''; + } + if ($target eq 'web') { + return ''; + } else { + return $token; + } +} + sub fontsettings() { my $headerstring=''; if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { @@ -308,8 +358,8 @@ sub htmlclean { my $output= $tree->as_HTML(undef,' '); - $output=~s/\<(br|hr|img)([^\>\/]*)\>/\<$1$2 \/\>/gis; - $output=~s/\<\/(br|hr|img)\>//gis; + $output=~s/\<(br|hr|img|meta|allow)([^\>\/]*)\>/\<$1$2 \/\>/gis; + $output=~s/\<\/(br|hr|img|meta|allow)\>//gis; unless ($full) { $output=~s/\<[\/]*(body|head|html)\>//gis; } @@ -760,6 +810,9 @@ sub parstring { sub writeallows { my $thisurl='/res/'.&Apache::lonnet::declutter(shift); + if ($ENV{'httpref.'.$thisurl}) { + $thisurl=$ENV{'httpref.'.$thisurl}; + } my $thisdir=$thisurl; $thisdir=~s/\/[^\/]+$//; my %httpref=();