[LON-CAPA-cvs] cvs: rat / lonratedt.pm lonratsrv.pm lonwrapper.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 20 Dec 2006 22:42:50 -0000


albertel		Wed Dec 20 17:42:50 2006 EDT

  Modified files:              
    /rat	lonratsrv.pm lonratedt.pm lonwrapper.pm 
  Log:
  - bunch of \w replacements
  
  
Index: rat/lonratsrv.pm
diff -u rat/lonratsrv.pm:1.38 rat/lonratsrv.pm:1.39
--- rat/lonratsrv.pm:1.38	Thu Nov  2 16:26:54 2006
+++ rat/lonratsrv.pm	Wed Dec 20 17:42:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Server for RAT Maps
 #
-# $Id: lonratsrv.pm,v 1.38 2006/11/02 21:26:54 albertel Exp $
+# $Id: lonratsrv.pm,v 1.39 2006/12/20 22:42:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -30,6 +30,7 @@
 
 use strict;
 use Apache::Constants qw(:common);
+use LONCAPA();
 use LONCAPA::map();
 
 
@@ -43,18 +44,18 @@
   return OK if $r->header_only;
 
   my $url=$r->uri;
-  $url=~/\/(\w+)\/ratserver$/;
+  $url=~m{/(\w+)/ratserver$};
   my $mode=$1;
 
-  $url=~s/\/loadonly\/ratserver$/\/save\/ratserver/;
+  $url=~s{/loadonly/ratserver$}{/save/ratserver};
   
   my $fn=$r->filename;
   my $lonDocRoot=$r->dir_config('lonDocRoot');
   if ( $fn =~ /\Q$lonDocRoot\E/ ) {
       #internal authentication, needs fixup.
       $fn = $url;
-      $fn=~s|^/~(\w+)|/home/$1/public_html|;
-      $fn=~s|/[^/]*/ratserver$||;
+      $fn=~s{^/~($LONCAPA::username_re)}{/home/$1/public_html};
+      $fn=~s{/[^/]*/ratserver$}{};
   }
   my $errtext='';
   my $infotext='';
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.85 rat/lonratedt.pm:1.86
--- rat/lonratedt.pm:1.85	Thu Nov  2 16:27:58 2006
+++ rat/lonratedt.pm	Wed Dec 20 17:42:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.85 2006/11/02 21:27:58 albertel Exp $
+# $Id: lonratedt.pm,v 1.86 2006/12/20 22:42:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -763,7 +763,7 @@
 # ----------------------------------------------------------------- No such dir
 sub nodir {
    my ($r,$dir)=@_;
-   $dir=~s{^/home/\w+/public_html}{};
+   $dir=~s{^/home/$LONCAPA::username_re/public_html}{};
    $r->print(&Apache::loncommon::start_page(undef,undef,
 					    {'only_body' => 1,
 					     'bgcolor'   => '#FFFFFF',}).
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.25 rat/lonwrapper.pm:1.26
--- rat/lonwrapper.pm:1.25	Thu Nov 30 18:35:38 2006
+++ rat/lonwrapper.pm	Wed Dec 20 17:42:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.25 2006/11/30 23:35:38 banghart Exp $
+# $Id: lonwrapper.pm,v 1.26 2006/12/20 22:42:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -122,7 +122,7 @@
     $orgurl.=(($orgurl=~/\?/)?'&':'?').'wrapperdisplay=menu';
     $url=~s/^\/adm\/wrapper//;
     my $is_ext = $url =~ m|^/ext/|;
-    $url=~s/^\/ext\//http\:\/\//;
+    $url=~s{^/ext/}{http://};
     $url=~s|http://https://|https://|;
     $url=~s|:|:|g;
 #