--- rat/lonpage.pm 2004/08/29 18:34:36 1.57 +++ rat/lonpage.pm 2004/11/12 00:25:23 1.62 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Page Handler # -# $Id: lonpage.pm,v 1.57 2004/08/29 18:34:36 raeburn Exp $ +# $Id: lonpage.pm,v 1.62 2004/11/12 00:25:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,7 +74,7 @@ sub tracetable { my ($sofar,$rid,$beenhere)=@_; my $further=$sofar; my $randomout=0; - if ($ENV{'request.role'} =~ /^st/) { + unless ($ENV{'request.role.adv'}) { $randomout = $hash{'randomout_'.$rid}; } unless ($beenhere=~/\&$rid\&/) { @@ -232,9 +232,13 @@ sub handler { $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1)); foreach (@colcont) { my $src=$hash{'src_'.$_}; - $src=~/\.(\w+)$/; + my ($extension)=($src=~/\.(\w+)$/); + if ($hash{'encrypted_'.$_}) { + $src=&Apache::lonenc::encrypted($src); + } $metalink{$_}=$src.'.meta'; - $cellemb{$_}=Apache::loncommon::fileembstyle($1); + $cellemb{$_}= + &Apache::loncommon::fileembstyle($extension); if ($cellemb{$_} eq 'ssi') { # --------------------------------------------------------- This is an SSI cell my $prefix=$_.'_'; @@ -257,8 +261,7 @@ sub handler { } } my $output=Apache::lonnet::ssi($src,%posthash); - $output=~ - s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs; + $output=~s|//(\s*)?\s||gs; if ($target eq 'tex') { $output =~ s/^([^&]+)\\begin{document}//; $output =~ s/\\end{document}//; @@ -351,7 +354,17 @@ sub handler { unless ($contents) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - $r->print(''.&mt('Empty page').'.'); + $r->print(''."\n". + ''."\n". + &Apache::lonmenu::registerurl(1,undef)."\n". + ''."\n". + ''. + &Apache::lonmenu::menubuttons(undef,$target,1) + ); + $r->print(&mt('This page is either empty or it only contains resources that are currently hidden').'. '); + $r->print('

'.&mt('Please use the LON-CAPA navigation arrows to move to another item in the course').'.'); } else { # ------------------------------------------------------------------ Build page @@ -387,7 +400,8 @@ sub handler { # ------------------------------------------------------------------ Start form if ($nforms) { $r->print('
'); + &Apache::lonenc::check_encrypt($requrl) + .'">'); } } elsif ($target eq 'tex') { $r->print('\documentclass{article} @@ -414,19 +428,26 @@ sub handler { my $avespan=$lcm/($#colcont+1); for ($j=0;$j<=$#colcont;$j++) { my $rid=$colcont[$j]; - my $metainfo=''. - ''. - ''. - ''. - ''. - ''; + my $metainfo = ''; + my $esrc=&Apache::lonnet::declutter($hash{'src_'.$rid}); + if ($hash{'encrypted_'.$rid}) { + $esrc=&Apache::lonenc::encrypted($esrc); + } + unless ($hash{'src_'.$rid} =~ m-^/uploaded/-) { + $metainfo =''. + ''. + ''. + ''; + } + $metainfo .= ''. + ''. + ''; if ( ($hash{'src_'.$rid}=~/\.(problem|exam|quiz|assess|survey|form)$/) && - (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}))) { + (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && + ($hash{'src_'.$rid} !~ m-^/uploaded/-)) { my ($mapid,$resid)=split(/\./,$rid); my $symb= &Apache::lonnet::declutter($hash{'map_id_'.$mapid}). @@ -494,6 +515,10 @@ sub handler { } elsif ($cellemb{$rid} eq 'emb') { $r->print('>'.$metainfo.''); + } elsif (&Apache::lonnet::declutter($hash{'src_'.$rid}) !~/\.(sequence|page)$/) { + $r->print($metainfo.''.$hash{'title_'.$rid}.'
'. + &mt('It is recommended that you use an up-to-date virus scanner before handling this file.').'

'. + &Apache::londocs::entryline(0,&mt("Click to download or use your browser's Save Link function"),'/'.&Apache::lonnet::declutter($hash{'src_'.$rid})).'


'); } unless ($target eq 'tex') { $r->print('');