--- loncom/lonnet/perl/lonnet.pm 2006/01/10 16:06:07 1.692 +++ loncom/lonnet/perl/lonnet.pm 2006/01/11 20:27:43 1.698 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.692 2006/01/10 16:06:07 albertel Exp $ +# $Id: lonnet.pm,v 1.698 2006/01/11 20:27:43 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3412,7 +3412,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\|]+)\&/); @@ -4823,11 +4824,21 @@ sub EXT { return $env{'course.'.$courseid.'.'.$spacequalifierrest}; } elsif ($realm eq 'resource') { - my $section; - my @groups = (); if (defined($courseid) && $courseid eq $env{'request.course.id'}) { if (!$symbparm) { $symbparm=&symbread(); } } + + if ($space eq 'title') { + if (!$symbparm) { $symbparm = $env{'request.filename'}; } + return &gettitle($symbparm); + } + + if ($space eq 'map') { + my ($map) = &decode_symb($symbparm); + return &symbread($map); + } + + my ($section, $group, @groups); my ($courselevelm,$courselevel); if ($symbparm && defined($courseid) && $courseid eq $env{'request.course.id'}) { @@ -4954,6 +4965,11 @@ sub EXT { if ($space eq 'time') { return time; } + } elsif ($realm eq 'server') { +# ----------------------------------------------------------------- system.time + if ($space eq 'name') { + return $ENV{'SERVER_NAME'}; + } } return ''; } @@ -5344,6 +5360,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; } @@ -5398,6 +5415,7 @@ sub symbclean { # remove wrapper $symb=~s/(\_\_\_\d+\_\_\_)adm\/wrapper\/(res\/)*/$1/; + $symb=~s/(\_\_\_\d+\_\_\_)adm\/coursedocs\/showdoc\/(res\/)*/$1/; return $symb; } @@ -6130,6 +6148,8 @@ sub declutter { if ($thisfn=~m|^/enc/|) { $thisfn=&Apache::lonenc::unencrypted($thisfn); } $thisfn=~s/^\Q$perlvar{'lonDocRoot'}\E//; $thisfn=~s/^\///; + $thisfn=~s|^adm/wrapper/||; + $thisfn=~s|^adm/coursedocs/showdoc/||; $thisfn=~s/^res\///; $thisfn=~s/\?.+$//; return $thisfn; @@ -6142,6 +6162,30 @@ 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 'ssi' + || ($embstyle eq 'hdn') + || ($embstyle eq 'rat') + || ($embstyle eq 'prv') + || ($embstyle eq 'ign')) { + #do nothing with these + } elsif (($embstyle eq 'img') + || ($embstyle eq 'emb') + || ($embstyle eq 'wrp')) { + $thisfn='/adm/wrapper'.$thisfn; + } elsif ($embstyle eq 'unk' + && $thisfn!~/\.(sequence|page)$/) { + $thisfn='/adm/coursedocs/showdoc'.$thisfn; + } else { + &logthis("Got a blank emb style"); + } + } + } return $thisfn; }