[LON-CAPA-cvs] cvs: rat / lonuserstate.pm loncom/auth lonacc.pm loncom/homework structuretags.pm loncom/interface lonmenu.pm loncom/lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 01 Nov 2003 16:37:22 -0000


This is a MIME encoded message

--www1067704642
Content-Type: text/plain

www		Sat Nov  1 11:37:22 2003 EDT

  Modified files:              
    /loncom/auth	lonacc.pm 
    /loncom/homework	structuretags.pm 
    /loncom/interface	lonmenu.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /rat	lonuserstate.pm 
  Log:
  Do not explicitly request most recent versions of files.
  
  Two subroutines will need caching:
  
  * lonnet::fixversion
  & lonnet::getversion
  
  
--www1067704642
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20031101113722.txt"

Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.48 loncom/auth/lonacc.pm:1.49
--- loncom/auth/lonacc.pm:1.48	Sat Sep 20 13:44:22 2003
+++ loncom/auth/lonacc.pm	Sat Nov  1 11:37:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.48 2003/09/20 17:44:22 www Exp $
+# $Id: lonacc.pm,v 1.49 2003/11/01 16:37:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,7 +76,7 @@
 	       $ENV{'request.state'} = 'unknown';
             }
             $ENV{'request.filename'} = $r->filename;
-
+            $ENV{'request.noversionuri'} = &Apache::lonnet::deversion($requrl);
 # -------------------------------------------------------- Load POST parameters
 
 	    &Apache::loncommon::get_posted_cgi($r);
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.219 loncom/homework/structuretags.pm:1.220
--- loncom/homework/structuretags.pm:1.219	Thu Oct 30 15:52:54 2003
+++ loncom/homework/structuretags.pm	Sat Nov  1 11:37:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.219 2003/10/30 20:52:54 albertel Exp $
+# $Id: structuretags.pm,v 1.220 2003/11/01 16:37:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1159,7 +1159,7 @@
     my $result='';
     if (($target eq 'web') &&
         (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
-        my $url=$ENV{'REQUEST_URI'};
+        my $url=$ENV{'request.noversionuri'};
         $url=~s/\?.*$//;
 	$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'.
                 '<a href="'.$url.'/smpedit">'.&mt('Simple Problem Editor').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.96 loncom/interface/lonmenu.pm:1.97
--- loncom/interface/lonmenu.pm:1.96	Fri Oct 24 17:04:21 2003
+++ loncom/interface/lonmenu.pm	Sat Nov  1 11:37:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.96 2003/10/24 21:04:21 albertel Exp $
+# $Id: lonmenu.pm,v 1.97 2003/11/01 16:37:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -72,7 +72,7 @@
     my $registration=shift;
     my $navmaps='';
     my $reloadlink='';
-    my $escurl=&Apache::lonnet::escape($ENV{'REQUEST_URI'});
+    my $escurl=&Apache::lonnet::escape($ENV{'request.noversionuri'});
     my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'});
     if ($ENV{'browser.interface'} eq 'textual') {
 # Textual display only
@@ -81,9 +81,9 @@
 	    $navmaps=(<<ENDNAV);
 <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a>
 ENDNAV
-            if (($ENV{'REQUEST_URI'}=~/^\/adm\//) &&
-         ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) &&
-         ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
+            if (($ENV{'request.noversionuri'}=~/^\/adm\//) &&
+         ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
+         ($ENV{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
                 my $escreload=&Apache::lonnet::escape('return:');
                 $reloadlink=(<<ENDRELOAD);
 <a href="/adm/flip?postdata=$escreload" target="_top"><font color="$font">$lt{'ret'}</font></a>
@@ -114,7 +114,7 @@
             $function='admin';
         }
         if (($ENV{'request.role'}=~/^(au|ca)/) ||
-            ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {
+            ($ENV{'request.noversionuri'}=~/^(\/priv|\~)/)) {
             $function='author';
         }
         my $domain=&Apache::loncommon::determinedomain();
@@ -131,9 +131,9 @@
 <td bgcolor="$tabbg">
 <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top"><font color="$font">$lt{'nav'}</font></a></td>
 ENDNAVREM
-            if (($ENV{'REQUEST_URI'}=~/^\/adm\//) &&
-                ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) &&
-         ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
+            if (($ENV{'request.noversionuri'}=~/^\/adm\//) &&
+                ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
+         ($ENV{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
                 my $escreload=&Apache::lonnet::escape('return:');
                 $reloadlink=(<<ENDRELOAD);
 <td bgcolor="$tabbg">
@@ -181,7 +181,7 @@
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
-    if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; }
+    if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
     my $force_title='';
     if ($ENV{'request.state'} eq 'construct') {
 	$force_title=&Apache::lonxml::display_title();
@@ -196,7 +196,7 @@
         ($ENV{'environment.remote'} eq 'off') ||
         ((($ENV{'request.publicaccess'}) || 
          (!&Apache::lonnet::is_on_map(
-	   &Apache::lonnet::unescape($ENV{'REQUEST_URI'})))) &&
+	   &Apache::lonnet::unescape($ENV{'request.noversionuri'})))) &&
         (!$forcereg))) {
  	return $result.
           '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title;
@@ -217,7 +217,7 @@
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
-    if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; }
+    if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
 
     $Apache::lonxml::registered=1;
 
@@ -261,7 +261,7 @@
     my $tableend=($noremote?'</table>':'');
 # =============================================================================
 # ============================ This is for URLs that actually can be registered
-    if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
+    if (($ENV{'request.noversionuri'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
 # -- This applies to homework problems for users with grading privileges
         my $hwkadd='';
         if 
@@ -357,7 +357,7 @@
 s&9&1&sbkm.gif&set&bookmark&set_bookmark()&Set a bookmark for this resource&2
 s&9&3&anot.gif&anno-&tations&annotate()&Make notes and annotations about this resource&2
 ENDMENUITEMS
-        unless ($ENV{'REQUEST_URI'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
+        unless ($ENV{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
 	    $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.gif&catalog&info&catalog_info()&Show catalog information
 s&8&1&eval.gif&evaluate&this&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
@@ -397,7 +397,7 @@
 ENDREGTEXT
 # Registered, graphical output
         } else {
-	    my $requri=(split(/\?/,$ENV{'REQUEST_URI'}))[0];
+	    my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0];
 	    $requri=&Apache::lonnet::unescape($requri);
 	    $result = (<<ENDREGTHIS);
      
@@ -485,12 +485,12 @@
 }
 
 sub loadevents() {
-    if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; }
+    if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
     return 'LONCAPAreg();';
 }
 
 sub unloadevents() {
-    if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; }
+    if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
     return 'LONCAPAstale();';
 }
 
@@ -826,7 +826,7 @@
 sub utilityfunctions {
     unless (($ENV{'browser.interface'} eq 'textual')  ||
         ($ENV{'environment.remote'} eq 'off')) { return ''; }
-    my $currenturl=$ENV{'REQUEST_URI'};
+    my $currenturl=$ENV{'request.noversionuri'};
     my $currentsymb=$ENV{'request.symb'};
 return (<<ENDUTILITY)
 
@@ -906,7 +906,7 @@
 	$function='admin';
     }
     if (($ENV{'request.role'}=~/^(au|ca)/) ||
-	($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {
+	($ENV{'request.noversionuri'}=~/^(\/priv|\~)/)) {
 	$function='author';
     }
     my $domain=&Apache::loncommon::determinedomain();
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.438 loncom/lonnet/perl/lonnet.pm:1.439
--- loncom/lonnet/perl/lonnet.pm:1.438	Fri Oct 31 17:20:37 2003
+++ loncom/lonnet/perl/lonnet.pm	Sat Nov  1 11:37:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.438 2003/10/31 22:20:37 www Exp $
+# $Id: lonnet.pm,v 1.439 2003/11/01 16:37:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2449,7 +2449,7 @@
 
 sub allowed {
     my ($priv,$uri)=@_;
-
+    $uri=&deversion($uri);
     my $orguri=$uri;
     $uri=&declutter($uri);
 
@@ -4013,14 +4013,16 @@
 
 sub symbverify {
     my ($symb,$thisfn)=@_;
-    $thisfn=&symbclean(&declutter($thisfn));
+    $thisfn=&declutter($thisfn);
 # direct jump to resource in page or to a sequence - will construct own symbs
     if ($thisfn=~/\.(page|sequence)$/) { return 1; }
 # check URL part
     my ($map,$resid,$url)=&decode_symb($symb);
+
     unless ($url eq $thisfn) { return 0; }
 
     $symb=&symbclean($symb);
+    $thisfn=&deversion($thisfn);
 
     my %bighash;
     my $okay=0;
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.65 rat/lonuserstate.pm:1.66
--- rat/lonuserstate.pm:1.65	Wed Oct 29 16:50:41 2003
+++ rat/lonuserstate.pm	Sat Nov  1 11:37:22 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.65 2003/10/29 21:50:41 www Exp $
+# $Id: lonuserstate.pm,v 1.66 2003/11/01 16:37:22 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,6 +74,11 @@
     if ($hash{'version_'.$uri}) {
 	my $version=$hash{'version_'.$uri};
 	if ($version eq 'mostrecent') { return $uri; }
+	if ($version eq &Apache::lonnet::getversion(
+			&Apache::lonnet::filelocation('',$uri))) 
+	             { return $uri; }
+	&Apache::lonnet::logthis($uri.' '.$version.' '. &Apache::lonnet::getversion(
+				  &Apache::lonnet::filelocation('',$uri)));
 	$uri=~s/\.(\w+)$/\.$version\.$1/;
     }
     return $uri;

--www1067704642--