--- loncom/interface/londocs.pm 2005/06/08 18:49:38 1.179 +++ loncom/interface/londocs.pm 2005/06/08 21:38:44 1.182 @@ -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.182 2005/06/08 21:38:44 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1036,10 +1036,19 @@ sub editor { 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); + + my $newidx=&Apache::lonratedt::getresidx(); + $destination .= $newidx; + my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination); + my $ext='false'; if ($url=~/^http\:\/\//) { $ext='true'; } $url=~s/\:/\:/g; @@ -1144,8 +1153,8 @@ sub editor { # Loading a complete map if (($env{'form.importmap'}) && ($env{'form.loadmap'})) { foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { - my $idx=$#Apache::lonratedt::resources; - $idx++; + my ($title,$url,$ext,$type)=split(/\:/,$_); + my $idx=&Apache::lonratedt::getresidx($url); $Apache::lonratedt::resources[$idx]=$_; $Apache::lonratedt::order [$#Apache::lonratedt::order+1]=$idx; @@ -1858,7 +1867,7 @@ sub changewarning { } $r->print( ''. -'
ENDBLOCK - $r->print(''); } $r->print(''."\n". ''); @@ -2507,7 +2517,7 @@ ENDSUPFORM } } if ($allowed) { - $r->print('