[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm lonretrieve.pm testbankimport.pm

www www at source.lon-capa.org
Sat Oct 22 21:27:34 EDT 2011


www		Sun Oct 23 01:27:34 2011 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm lonretrieve.pm testbankimport.pm 
  Log:
  ... bug 1320 ...
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.108 loncom/publisher/loncfile.pm:1.109
--- loncom/publisher/loncfile.pm:1.108	Sat Oct 22 23:09:44 2011
+++ loncom/publisher/loncfile.pm	Sun Oct 23 01:27:34 2011
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.108 2011/10/22 23:09:44 www Exp $
+# $Id: loncfile.pm,v 1.109 2011/10/23 01:27:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -272,8 +272,7 @@
     $creating ||= 'file';
 
     my $published=$construct;
-    $published=~
-	s{^/home/$user/public_html/}{/home/httpd/html/res/$domain/$user/};
+    $published=~s{^/home/httpd/html/priv/}{/home/httpd/html/res/};
     my ($type,$result);
     if ( -d $construct ) {
 	return ('error','<p><span class="LC_error">'.&mt('Error: destination for operation is an existing directory.').'</span></p>');
@@ -347,7 +346,7 @@
 }
 
 sub cleanDest {
-    my ($request,$dest,$subdir,$fn,$uname)=@_;
+    my ($request,$dest,$subdir,$fn,$uname,$udom)=@_;
     #remove bad characters
     my $foundbad=0;
     my $error='';
@@ -362,7 +361,7 @@
     }
     if ($dest=~m|/|) {
 	my ($newpath)=($dest=~m|(.*)/|);
-	($newpath,$error)=&relativeDest($fn,$newpath,$uname);
+	($newpath,$error)=&relativeDest($fn,$newpath,$uname,$udom);
 	if (! -d "$newpath") {
 	    $request->print('<p><span class="LC_warning">'
                            .&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested file name."
@@ -391,11 +390,11 @@
 }
 
 sub relativeDest {
-    my ($fn,$newfilename,$uname)=@_;
+    my ($fn,$newfilename,$uname,$udom)=@_;
     my $error = '';
     if ($newfilename=~/^\//) {
 # absolute, simply add path
-	$newfilename='/home/'.$uname.'/public_html/';
+	$newfilename='/home/httpd/html/res/'.$udom.'/'.$uname.'/';
     } else {
 	my $dir=$fn;
 	$dir=~s/\/[^\/]+$//;
@@ -952,9 +951,9 @@
     my $doingdir=0;
     if ($env{'form.action'} eq 'newdir') { $doingdir=1; }
     my ($newfilename,$error) = 
-        &cleanDest($r,$env{'form.newfilename'},$doingdir,$fn,$uname);
+        &cleanDest($r,$env{'form.newfilename'},$doingdir,$fn,$uname,$udom);
     unless ($error) {
-        ($newfilename,$error)=&relativeDest($fn,$newfilename,$uname);
+        ($newfilename,$error)=&relativeDest($fn,$newfilename,$uname,$udom);
     }
     if ($error) {
         my $dirlist;
Index: loncom/publisher/lonretrieve.pm
diff -u loncom/publisher/lonretrieve.pm:1.42 loncom/publisher/lonretrieve.pm:1.43
--- loncom/publisher/lonretrieve.pm:1.42	Tue Dec 14 16:26:04 2010
+++ loncom/publisher/lonretrieve.pm	Sun Oct 23 01:27:34 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to retrieve an old version of a file
 #
-# $Id: lonretrieve.pm,v 1.42 2010/12/14 16:26:04 www Exp $
+# $Id: lonretrieve.pm,v 1.43 2011/10/23 01:27:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -233,7 +233,7 @@
 	my ($main,$suffix,$is_meta) = &get_file_info($fn);
 
         my $logfile;
-        my $ctarget='/home/'.$uname.'/public_html'.$fn;
+        my $ctarget=$r->dir_config('lonDocRoot').'/priv/'.$udom.'/'.$uname.$fn;
         my $vfn=$fn;
         if ($version ne 'new') {
 	    $vfn=~s/\.(\Q$suffix\E)$/\.$version\.$1/;
Index: loncom/publisher/testbankimport.pm
diff -u loncom/publisher/testbankimport.pm:1.30 loncom/publisher/testbankimport.pm:1.31
--- loncom/publisher/testbankimport.pm:1.30	Sat Mar  5 22:25:09 2011
+++ loncom/publisher/testbankimport.pm	Sun Oct 23 01:27:34 2011
@@ -1,5 +1,5 @@
 # Handler for parsing text upload problem descriptions into .problems
-# $Id: testbankimport.pm,v 1.30 2011/03/05 22:25:09 raeburn Exp $
+# $Id: testbankimport.pm,v 1.31 2011/10/23 01:27:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1853,9 +1853,8 @@
     $r->send_http_header;
 
     my ($filename,$pathname) = &File::Basename::fileparse($fn);
-    my $webpath = '/priv/'.$uname.$pathname;
-    my $urlpath = '/~'.$uname.$pathname;
-    my $dirpath = '/home/'.$uname.'/public_html'.$pathname;
+    my $webpath = '/priv/'.$udom.'/'.$uname.$pathname;
+    my $dirpath = $r->dir_config('lonDocRoot').$webpath;
     my ($res,$subdir,$badfile,$textref,$header,$css,$js,%loadentries, at pages,%names);
 
     if ($env{'form.phase'} eq 'three') {
@@ -1877,7 +1876,7 @@
             }
         }
         ($res,$badfile,$textref,$header,$css,$js) = 
-            &parse_datafile($r,$uname,$filename,$pathname,$dirpath,$urlpath,
+            &parse_datafile($r,$uname,$filename,$pathname,$dirpath,$webpath,
                             $page_name,$subdir,$env{'form.timestamp'});
         if ($page_name eq 'Welcome') {
              &jscript_zero($webpath,\$javascript);
@@ -1939,7 +1938,7 @@
             &display_zero ($r,$uname,$fn,$current_page,$webpath) if $page_name eq 'Welcome';
             &display_one ($r,$uname,$fn,$current_page,$textref,$header) if $page_name eq 'Blocks';
             &display_two ($r,$uname,$fn,$current_page,$textref,$header,$qcount) if $page_name eq 'Format';
-            &display_three ($r,$uname,$fn,$current_page,$textref,$res,$header,$urlpath,$qcount) if $page_name eq 'Target';
+            &display_three ($r,$uname,$fn,$current_page,$textref,$res,$header,$webpath,$qcount) if $page_name eq 'Target';
             &final_display ($r,$uname,$fn,$current_page,$textref,$res,$header,$css,$js,$webpath,$dirpath,$subdir) if $page_name eq 'Confirmation';
         }
     } elsif ($env{'form.phase'} eq 'two') {




More information about the LON-CAPA-cvs mailing list