[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
www
lon-capa-cvs@mail.lon-capa.org
Tue, 16 Sep 2003 17:54:51 -0000
www Tue Sep 16 13:54:51 2003 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
decode_symb should now hopefully return versioned resource URLs
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.412 loncom/lonnet/perl/lonnet.pm:1.413
--- loncom/lonnet/perl/lonnet.pm:1.412 Mon Sep 15 14:43:54 2003
+++ loncom/lonnet/perl/lonnet.pm Tue Sep 16 13:54:50 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.412 2003/09/15 18:43:54 www Exp $
+# $Id: lonnet.pm,v 1.413 2003/09/16 17:54:50 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2606,7 +2606,10 @@
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);
}
}
@@ -3879,7 +3882,18 @@
# ---------------------------------------------- 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