--- loncom/lonnet/perl/lonnet.pm 2003/09/11 07:57:03 1.411 +++ loncom/lonnet/perl/lonnet.pm 2003/09/17 01:45:14 1.414 @@ -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.414 2003/09/17 01:45:14 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,6 +85,7 @@ use Apache::Constants qw(:common :http); use HTML::LCParser; use Fcntl qw(:flock); use Apache::loncoursedata; +use Apache::lonlocal; my $readit; @@ -246,9 +247,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 +2607,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); } } @@ -2732,7 +2740,7 @@ sub userlog_query { sub plaintext { my $short=shift; - return $prp{$short}; + return &mt($prp{$short}); } # ----------------------------------------------------------------- Assign Role @@ -3875,7 +3883,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