--- loncom/xml/lonxml.pm 2001/08/10 15:49:46 1.109 +++ loncom/xml/lonxml.pm 2001/08/20 14:53:12 1.119 @@ -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,8/16,8/17,8/18,8/20 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,82 @@ sub xmlend { return $discussion.''; } +sub tokeninputfield { + my $defhost=$Apache::lonnet::perlvar{'lonhostID'}; + return (< + + + + +
DocID Checkin
+ + + + + + + +
Scan in Barcode
or Type in DocID + + + + + +
+
+ +ENDINPUTFIELD +} + +sub maketoken { + my ($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'}; + } + + return &Apache::lonnet::checkout($symb,$tuname,$tudom,$tcrsid); +} + +sub printtokenheader { + my ($target,$token,$symb,$tuname,$tudom,$tcrsid)=@_; + unless ($token) { return ''; } + + unless ($symb) { + $symb=&Apache::lonnet::symbread(); + } + unless ($tuname) { + $tuname=$ENV{'user.name'}; + $tudom=$ENV{'user.domain'}; + $tcrsid=$ENV{'request.course.id'}; + } + + my %reply=&Apache::lonnet::get('environment', + ['firstname','middlename','lastname','generation'], + $tudom,$tuname); + my $plainname=$reply{'firstname'}.' '. + $reply{'middlename'}.' '. + $reply{'lastname'}.' '. + $reply{'generation'}; + + if ($target eq 'web') { + return + ''. + 'Checked out for '.$plainname. + '
User: '.$tuname.' at '.$tudom. + '
CourseID: '.$tcrsid. + '
DocID: '.$token. + '
Time: '.localtime().'
'; + } else { + return $token; + } +} + sub fontsettings() { my $headerstring=''; if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { @@ -308,8 +401,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 +853,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=();