--- loncom/publisher/lonupload.pm 2011/10/26 22:38:49 1.55
+++ loncom/publisher/lonupload.pm 2011/11/14 00:20:31 1.59
@@ -1,8 +1,7 @@
-
# The LearningOnline Network with CAPA
# Handler to upload files into construction space
#
-# $Id: lonupload.pm,v 1.55 2011/10/26 22:38:49 www Exp $
+# $Id: lonupload.pm,v 1.59 2011/11/14 00:20:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -163,7 +162,7 @@ sub upfile_store {
}
sub phaseone {
- my ($r,$fn,$uname,$udom,$mode)=@_;
+ my ($r,$fn,$mode)=@_;
my $action = '/adm/upload';
if ($mode eq 'testbank') {
$action = '/adm/testbank';
@@ -240,7 +239,7 @@ sub phaseone {
}
sub phasetwo {
- my ($r,$fn,$uname,$udom,$mode)=@_;
+ my ($r,$fn,$mode)=@_;
my $output;
my $action = '/adm/upload';
@@ -252,7 +251,7 @@ sub phasetwo {
}
$fn=~s/\/+/\//g;
if ($fn) {
- my $target='/home/httpd/html/'.$fn;
+ my $target= $r->dir_config('lonDocRoot').'/'.$fn;
&Debug($r, "target -> ".$target);
# target is the full filesystem path of the destination file.
my $base = &File::Basename::basename($fn);
@@ -404,9 +403,10 @@ sub phasethree {
} elsif ($mode eq 'imsimport') {
$action = '/adm/imsimport';
}
- my $dir_root = '/home/httpd/html/priv/'.$udom.'/'.$uname;
- my $url_root = '/priv/'.$udom.'/'.$uname;
+ my $url_root = "/priv/$udom/$uname";
+ my $dir_root = $r->dir_config('lonDocRoot').$url_root;
my $path = &File::Basename::dirname($fn);
+ $path =~ s{^\Q$url_root\E}{};
my $filename = &HTML::Entities::encode($env{'form.filename'},'<>&"');
my $state = &embedded_form_elems('modify_orightml',$filename,$mode).
'';
@@ -415,7 +415,7 @@ sub phasethree {
$dir_root,$url_root,undef,
undef,undef,$state,$action);
if ($mode ne 'imsimport' && $mode ne 'testbank') {
- $result .= '