--- loncom/interface/londocs.pm 2004/08/22 18:15:54 1.138 +++ loncom/interface/londocs.pm 2005/08/01 17:24:18 1.200 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.138 2004/08/22 18:15:54 raeburn Exp $ +# $Id: londocs.pm,v 1.200 2005/08/01 17:24:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,6 +30,7 @@ package Apache::londocs; use strict; use Apache::Constants qw(:common :http); +use Apache::imsexport; use Apache::lonnet; use Apache::loncommon; use Apache::lonratedt; @@ -40,6 +41,7 @@ use Apache::lonnavmaps; use HTML::Entities; use GDBM_File; use Apache::lonlocal; +use Cwd; my $iconpath; @@ -84,17 +86,17 @@ sub authorhosts { my %outhash=(); my $home=0; my $other=0; - foreach (keys %ENV) { + foreach (keys %env) { if ($_=~/^user\.role\.(au|ca)\.(.+)$/) { my $role=$1; my $realm=$2; - my ($start,$end)=split(/\./,$ENV{$_}); + my ($start,$end)=split(/\./,$env{$_}); if (($start) && ($start>time)) { next; } if (($end) && (time>$end)) { next; } my $ca; my $cd; if ($1 eq 'au') { - $ca=$ENV{'user.name'}; - $cd=$ENV{'user.domain'}; + $ca=$env{'user.name'}; + $cd=$env{'user.domain'}; } else { ($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/); } @@ -130,35 +132,41 @@ sub dumpbutton { } } +sub clean { + my ($title)=@_; + $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; + return $title; +} # -------------------------------------------------------- Actually dump course sub dumpcourse { my $r=shift; - $r->print('
');
# ''.&mt('Main Course Documents'). # ($allowed?' '.$help{'Main_Course_Documents'}:'').''); - my $folder=$ENV{'form.folder'}; + my $folder=$env{'form.folder'}; if ($folder eq '' || $folder eq 'supplemental') { $folder='default'; - $ENV{'form.folderpath'}='default&'.&Apache::lonnet::escape(&mt('Main Course Documents')); + $env{'form.folderpath'}='default&'.&Apache::lonnet::escape(&mt('Main Course Documents')); } my $postexec=''; if ($folder eq 'default') { @@ -1548,13 +2507,20 @@ ENDCOURSEVERIFY #$postexec='self.close();'; } $hadchanges=0; - &editor($r,$coursenum,$coursedom,$folder,$allowed); + &editor($r,$coursenum,$coursedom,$folder,$allowed,$upload_output); if ($hadchanges) { &mark_hash_old() } &changewarning($r,$postexec); my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. '.sequence'; + my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. + '.page'; + my $container='sequence'; + if ($env{'form.pagepath'}) { + $container='page'; + } + my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; $r->print(<$lt{'uplm'} |
@@ -1563,13 +2529,21 @@ ENDCOURSEVERIFY
$lt{'file'}: |
- $lt{'title'}: - +$uploadtag + + +
| +$uploadtag
- +$lt{'copm'} +
+ | + ');
+ unless ($env{'form.pagepath'}) {
+ $r->print(< | |
'. + $r->print("
'. &mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."