--- loncom/publisher/lonupload.pm 2011/11/02 14:40:16 1.57
+++ loncom/publisher/lonupload.pm 2013/06/04 22:20:16 1.62
@@ -1,8 +1,7 @@
-
# The LearningOnline Network with CAPA
# Handler to upload files into construction space
#
-# $Id: lonupload.pm,v 1.57 2011/11/02 14:40:16 raeburn Exp $
+# $Id: lonupload.pm,v 1.62 2013/06/04 22:20:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -126,7 +125,6 @@ use Apache::File;
use File::Copy;
use File::Basename;
use Apache::Constants qw(:common :http :methods);
-use Apache::loncacc;
use Apache::loncommon();
use Apache::lonnet;
use HTML::Entities();
@@ -163,7 +161,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 +238,7 @@ sub phaseone {
}
sub phasetwo {
- my ($r,$fn,$uname,$udom,$mode)=@_;
+ my ($r,$fn,$mode)=@_;
my $output;
my $action = '/adm/upload';
@@ -252,7 +250,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);
@@ -407,6 +405,7 @@ sub phasethree {
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 +414,7 @@ sub phasethree {
$dir_root,$url_root,undef,
undef,undef,$state,$action);
if ($mode ne 'imsimport' && $mode ne 'testbank') {
- $result .= '