Diff for /loncom/xml/lonxml.pm between versions 1.109 and 1.113

version 1.109, 2001/08/10 15:49:46 version 1.113, 2001/08/15 14:22:07
Line 13 Line 13
 # 6/12,6/13 H. K. Ng  # 6/12,6/13 H. K. Ng
 # 6/16 Gerd Kortemeyer  # 6/16 Gerd Kortemeyer
 # 7/27 H. K. Ng  # 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;   package Apache::lonxml; 
 use vars   use vars 
Line 113  sub xmlend { Line 113  sub xmlend {
                   '<address><hr /><h2>Course Discussion of Resource</h2>';                    '<address><hr /><h2>Course Discussion of Resource</h2>';
               my $idx;                my $idx;
               for ($idx=1;$idx<=$contrib{'version'};$idx++) {                for ($idx=1;$idx<=$contrib{'version'};$idx++) {
                   my $message=$contrib{$idx.':message'};   my $hidden=($contrib{'hidden'}=~/\.$idx\./);
                   $message=~s/\n/\<br \/\>/g;   unless (($hidden) && (!$seeid)) {
                    my $message=$contrib{$idx.':message'};
                    $message=~s/\n/\<br \/\>/g;
                    if ($message) {
                     if ($hidden) {
         $message='<font color="#888888">'.$message.'</font>';
                     }
                   my $sender='Anonymous';                    my $sender='Anonymous';
                   if ((!$contrib{$idx.':anonymous'}) || ($seeid)) {                    if ((!$contrib{$idx.':anonymous'}) || ($seeid)) {
                       $sender=$contrib{$idx.':sendername'}.' at '.                        $sender=$contrib{$idx.':sendername'}.' at '.
       $contrib{$idx.':senderdomain'};        $contrib{$idx.':senderdomain'};
                       if ($contrib{$idx.':anonymous'}) {                        if ($contrib{$idx.':anonymous'}) {
   $sender.=' (anonymous)';    $sender.=' (anonymous)';
                         }
                         if ($seeid) {
     if ($hidden) {
                                $sender.=' <a href="/adm/feedback?unhide='.
    $symb.':::'.$idx.'">Make Visible</a>';
                             } else {
                                $sender.=' <a href="/adm/feedback?hide='.
    $symb.':::'.$idx.'">Hide</a>';
     }
                       }                                           }                   
                   }                    }
   $discussion.='<p><b>'.$sender.'</b> ('.    $discussion.='<p><b>'.$sender.'</b> ('.
                       localtime($contrib{$idx.':timestamp'}).                        localtime($contrib{$idx.':timestamp'}).
                       '):<blockquote>'.$message.                        '):<blockquote>'.$message.
                       '</blockquote></p>';                         '</blockquote></p>';
           }
                  } 
               }                }
               $discussion.='</address>';                $discussion.='</address>';
           }            }
Line 135  sub xmlend { Line 152  sub xmlend {
     return $discussion.'</html>';      return $discussion.'</html>';
 }  }
   
   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/;
       $token=~tr/a-z/A-Z/;
       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 '<img src="/cgi-bin/barcode.gif?encode='.$token.'" />';
       } else {
           return $token;                         
       }
   }
   
 sub fontsettings() {  sub fontsettings() {
     my $headerstring='';      my $headerstring='';
     if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) {       if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { 
Line 308  sub htmlclean { Line 359  sub htmlclean {
   
     my $output= $tree->as_HTML(undef,' ');      my $output= $tree->as_HTML(undef,' ');
             
     $output=~s/\<(br|hr|img)([^\>\/]*)\>/\<$1$2 \/\>/gis;      $output=~s/\<(br|hr|img|meta|allow)([^\>\/]*)\>/\<$1$2 \/\>/gis;
     $output=~s/\<\/(br|hr|img)\>//gis;      $output=~s/\<\/(br|hr|img|meta|allow)\>//gis;
     unless ($full) {      unless ($full) {
        $output=~s/\<[\/]*(body|head|html)\>//gis;         $output=~s/\<[\/]*(body|head|html)\>//gis;
     }      }
Line 760  sub parstring { Line 811  sub parstring {
   
 sub writeallows {  sub writeallows {
     my $thisurl='/res/'.&Apache::lonnet::declutter(shift);      my $thisurl='/res/'.&Apache::lonnet::declutter(shift);
       if ($ENV{'httpref.'.$thisurl}) {
    $thisurl=$ENV{'httpref.'.$thisurl};
       }
     my $thisdir=$thisurl;      my $thisdir=$thisurl;
     $thisdir=~s/\/[^\/]+$//;      $thisdir=~s/\/[^\/]+$//;
     my %httpref=();      my %httpref=();

Removed from v.1.109  
changed lines
  Added in v.1.113


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>