[LON-CAPA-cvs] cvs: loncom /publisher londiff.pm

raeburn raeburn at source.lon-capa.org
Sat Oct 29 15:11:47 EDT 2011


raeburn		Sat Oct 29 19:11:47 2011 EDT

  Modified files:              
    /loncom/publisher	londiff.pm 
  Log:
  - Bug 1320 - replace \~($LONCAPA::username_re) in regexps with /priv  
  - use lonDocRoot perlvar in place of static string: '/home/httpd/html'
  - eliminate // when constructing filenames.  
  
  
Index: loncom/publisher/londiff.pm
diff -u loncom/publisher/londiff.pm:1.29 loncom/publisher/londiff.pm:1.30
--- loncom/publisher/londiff.pm:1.29	Sun Oct 23 23:46:07 2011
+++ loncom/publisher/londiff.pm	Sat Oct 29 19:11:46 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to show differences between file versions
 #
-# $Id: londiff.pm,v 1.29 2011/10/23 23:46:07 www Exp $
+# $Id: londiff.pm,v 1.30 2011/10/29 19:11:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -84,7 +84,7 @@
 
     if ($env{'form.filename'}=~/^\/res\//) {
 	($cudom,$cuname,$env{'form.filename'})=
-	    ($env{'form.filename'}=~m{^/res/($LONCAPA::domain_re)/($LONCAPA::username_re)/(.*)$});
+	    ($env{'form.filename'}=~m{^/res/($LONCAPA::domain_re)/($LONCAPA::username_re)(/.*)$});
     } else {
 	unless (($cuname,$cudom)=
 		&Apache::loncacc::constructaccess($env{'form.filename'},
@@ -99,7 +99,7 @@
   
     my $efn=$env{'form.filename'};
 
-    $efn=~s{/\~($LONCAPA::username_re)}{}g;
+    $efn=~s{^/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{};
 
     my @f1=();
     my @f2=();
@@ -127,12 +127,11 @@
 	|| $efn =~ /\.meta$/) {
 	$r->print('<p><span class="LC_diff_removed">');
 	if ($env{'form.versionone'} eq 'priv') {
-	    my $fn='/home/httpd/html/priv/'.$cudom.'/'.$cuname.'/'.$efn;
+	    my $fn=$r->dir_config('lonDocRoot')."/priv/$cudom/$cuname".$efn;
 	    @f1=&get_split_file($fn,'local');
 	    $r->print('<b>'.&mt('Construction Space Version').'</b>');
 	} else {
-	    my $fn=
-		'/home/httpd/html/res/'.$cudom.'/'.$cuname.'/';
+	    my $fn=$r->dir_config('lonDocRoot')."/res/$cudom/$cuname";
 	    if ($env{'form.versionone'}) {
 		my ($main,$suffix,$is_meta)=
 		    &Apache::lonretrieve::get_file_info($efn);
@@ -152,12 +151,12 @@
 
 	if ($env{'form.filetwo'}) {
 	    my $efn2=$env{'form.filetwo'};
-	    $efn2=~s{/\~($LONCAPA::username_re)}{}g;
-	    my $fn='/home/httpd/html/priv/'.$cudom.'/'.$cuname.'/'.$efn2;
+	    $efn2=~s{^/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{};
+	    my $fn=$r->dir_config('lonDocRoot')."/priv/$cudom/$cuname".$efn2;
 	    @f2=&get_split_file($fn,'local');
 	    $r->print('<tt>'.$efn2.'</tt>');
 	} elsif ($env{'form.versiontwo'} eq 'priv') {
-	    my $fn='/home/httpd/html/priv/'.$cudom.'/'.$cuname.'/'.$efn;
+	    my $fn=$r->dir_config('lonDocRoot')."/priv/$cudom/$cuname".$efn;
 	    @f2=&get_split_file($fn,'local');
 	    $r->print('<b>'.&mt('Construction Space Version').'</b>');
 	} else {




More information about the LON-CAPA-cvs mailing list