--- loncom/lonnet/perl/lonnet.pm 2006/01/05 19:39:52 1.683.2.5 +++ loncom/lonnet/perl/lonnet.pm 2006/01/11 07:33:45 1.683.2.7 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.683.2.5 2006/01/05 19:39:52 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 # @@ -271,7 +271,7 @@ sub transfer_profile_to_env { my %Remove; for ($envi=0;$envi<=$#profile;$envi++) { chomp($profile[$envi]); - my ($envname,$envvalue)=split(/=/,$profile[$envi]); + my ($envname,$envvalue)=split(/=/,$profile[$envi],2); $env{$envname} = $envvalue; if (my ($key,$time) = ($envname =~ /^(cgi\.(\d+)_\d+\.)/)) { if ($time < time-300) { @@ -323,7 +323,7 @@ sub appenv { for (my $i=0; $i<=$#oldenv; $i++) { chomp($oldenv[$i]); if ($oldenv[$i] ne '') { - my ($name,$value)=split(/=/,$oldenv[$i]); + my ($name,$value)=split(/=/,$oldenv[$i],2); unless (defined($newenv{$name})) { $newenv{$name}=$value; } @@ -382,7 +382,7 @@ sub delenv { } foreach (@oldenv) { if ($_=~/^$delthis/) { - my ($key,undef) = split('=',$_); + my ($key,undef) = split('=',$_,2); delete($env{$key}); } else { print $fh $_; @@ -3405,7 +3405,8 @@ sub is_on_map { 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 @@ sub metadata { # 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 @@ sub symbverify { 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 @@ sub symbclean { # remove wrapper $symb=~s/(\_\_\_\d+\_\_\_)adm\/wrapper\/(res\/)*/$1/; + $symb=~s/(\_\_\_\d+\_\_\_)adm\/coursedocs\/showdoc\/(res\/)*/$1/; return $symb; } @@ -6081,6 +6085,8 @@ sub declutter { $thisfn=~s/^\///; $thisfn=~s/^res\///; $thisfn=~s/\?.+$//; + $thisfn=~s|^adm/wrapper/||; + $thisfn=~s|^adm/coursedocs/showdoc/||; return $thisfn; } @@ -6091,6 +6097,23 @@ sub clutter { 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; }