[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 11 Jan 2006 07:33:46 -0000
albertel Wed Jan 11 02:33:46 2006 EDT
Modified files: (Branch: version_2_1_X)
/loncom/lonnet/perl lonnet.pm
Log:
- backport 1.694 1.695
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.683.2.6 loncom/lonnet/perl/lonnet.pm:1.683.2.7
--- loncom/lonnet/perl/lonnet.pm:1.683.2.6 Fri Jan 6 19:28:34 2006
+++ loncom/lonnet/perl/lonnet.pm Wed Jan 11 02:33:45 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.683.2.6 2006/01/07 00:28:34 albertel Exp $
+# $Id: lonnet.pm,v 1.683.2.7 2006/01/11 07:33:45 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3405,7 +3405,8 @@
my $filename=$uriparts[$#uriparts];
my $pathname=$uri;
$pathname=~s|/\Q$filename\E$||;
- $pathname=~s/^adm\/wrapper\///;
+ $pathname=~s/^adm\/wrapper\///;
+ $pathname=~s/^adm\/coursedocs\/showdoc\///;
#Trying to find the conditional for the file
my $match=($env{'acc.res.'.$env{'request.course.id'}.'.'.$pathname}=~
/\&\Q$filename\E\:([\d\|]+)\&/);
@@ -4975,7 +4976,8 @@
# if it is a non metadata possible uri return quickly
if (($uri eq '') ||
(($uri =~ m|^/*adm/|) &&
- ($uri !~ m|^adm/includes|) && ($uri !~ m|/bulletinboard$|)) ||
+ ($uri !~ m|^adm/includes|) && ($uri !~ m|/bulletinboard$|)
+ && ($uri !~ m|^adm/coursedocs/|) && ($uri !~ m|^adm/wrapper/|)) ||
($uri =~ m|/$|) || ($uri =~ m|/.meta$|) || ($uri =~ /^~/) ||
($uri =~ m|home/[^/]+/public_html/|)) {
return undef;
@@ -5293,6 +5295,7 @@
my $thisfn=$thisurl;
# wrapper not part of symbs
$thisfn=~s/^\/adm\/wrapper//;
+ $thisfn=~s/^\/adm\/coursedocs\/showdoc\///;
$thisfn=&declutter($thisfn);
# direct jump to resource in page or to a sequence - will construct own symbs
if ($thisfn=~/\.(page|sequence)$/) { return 1; }
@@ -5347,6 +5350,7 @@
# remove wrapper
$symb=~s/(\_\_\_\d+\_\_\_)adm\/wrapper\/(res\/)*/$1/;
+ $symb=~s/(\_\_\_\d+\_\_\_)adm\/coursedocs\/showdoc\/(res\/)*/$1/;
return $symb;
}
@@ -6081,6 +6085,8 @@
$thisfn=~s/^\///;
$thisfn=~s/^res\///;
$thisfn=~s/\?.+$//;
+ $thisfn=~s|^adm/wrapper/||;
+ $thisfn=~s|^adm/coursedocs/showdoc/||;
return $thisfn;
}
@@ -6091,6 +6097,23 @@
unless ($thisfn=~/^\/(uploaded|editupload|adm|userfiles|ext|raw|priv|public)\//) {
$thisfn='/res'.$thisfn;
}
+ if ($thisfn !~m|/adm|) {
+ if ($thisfn =~ m|/ext/|) {
+ $thisfn='/adm/wrapper'.$thisfn;
+ } else {
+ my ($ext) = ($thisfn =~ /\.(\w+)$/);
+ my $embstyle=&Apache::loncommon::fileembstyle($ext);
+ if (($embstyle eq 'img')
+ || ($embstyle eq 'emb')
+ || ($embstyle eq 'wrp')) {
+ $thisfn='/adm/wrapper'.$thisfn;
+ } elsif ($embstyle eq 'ssi') {
+ #do nothing with these
+ } elsif ($thisfn!~/\.(sequence|page)$/) {
+ $thisfn='/adm/coursedocs/showdoc'.$thisfn;
+ }
+ }
+ }
return $thisfn;
}