--- loncom/lonnet/perl/lonnet.pm 2003/09/11 07:57:03 1.411 +++ loncom/lonnet/perl/lonnet.pm 2003/09/16 17:54:50 1.413 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.411 2003/09/11 07:57:03 albertel Exp $ +# $Id: lonnet.pm,v 1.413 2003/09/16 17:54:50 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -246,9 +246,13 @@ sub critical { return $answer; } +# # -------------- Remove all key from the env that start witha lowercase letter -# (Which is alweways a lon-capa value) +# (Which is always a lon-capa value) + sub cleanenv { +# unless (defined(&Apache::exists_config_define("MODPERL2"))) { return; } +# unless (&Apache::exists_config_define("MODPERL2")) { return; } foreach my $key (keys(%ENV)) { if ($key =~ /^[a-z]/) { delete($ENV{$key}); @@ -2602,7 +2606,10 @@ sub is_on_map { if ($match) { return (1,$1); } else { - return (0,0); + my ($name,$ext)=($filename=~/^(.+)\.(\w+)$/); + $ENV{'acc.res.'.$ENV{'request.course.id'}.'.'.$pathname}=~ + /\&(\Q$name\E\.\d+\.$ext)\:([\d\|]+)\&/; + return (0,$2,$pathname.'/'.$1); } } @@ -3875,7 +3882,18 @@ sub symbclean { # ---------------------------------------------- Split symb to find map and url sub decode_symb { - return split(/\_\_\_/,shift); + my ($map,$resid,$url)=split(/\_\_\_/,shift); + return (&fixversion($map),$resid,&fixversion($url)); +} + +sub fixversion { + my $fn=shift; + if ($fn=~/^(adm|uploaded|public)/) { return $fn; } + my ($match,$cond,$versioned)=&is_on_map($fn); + unless ($match) { + $fn=$versioned; + } + return $fn; } # ------------------------------------------------------ Return symb list entry