[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 08 Jun 2005 19:36:56 -0000
raeburn Wed Jun 8 15:36:56 2005 EDT
Modified files:
/loncom/interface londocs.pm
Log:
Include more hierarchy in userfiles to prevent unintended deletion when more than one folder contains a file with the same name and the same resource id.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.179 loncom/interface/londocs.pm:1.180
--- loncom/interface/londocs.pm:1.179 Wed Jun 8 14:49:38 2005
+++ loncom/interface/londocs.pm Wed Jun 8 15:36:54 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.179 2005/06/08 18:49:38 www Exp $
+# $Id: londocs.pm,v 1.180 2005/06/08 19:36:54 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1036,10 +1036,17 @@
if (($env{'form.uploaddoc.filename'}) &&
($env{'form.cmd'}=~/^upload_(\w+)/)) {
if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
+ my $destination = 'docs/';
+ if ($folder eq 'default') {
+ $destination .= 'default/';
+ } elsif ($folder =~ /^default_(\d+)$/) {
+ $destination .= $1.'/';
+ }
# this is for a course, not a user, so set coursedoc flag
# probably the only place in the system where this should be "1"
my $newidx=$#Apache::lonratedt::resources+1;
- my $url=&Apache::lonnet::userfileupload('uploaddoc',1,'docs/'.$newidx);
+ $destination .= $newidx;
+ my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination);
my $ext='false';
if ($url=~/^http\:\/\//) { $ext='true'; }
$url=~s/\:/\:/g;