--- loncom/interface/londocs.pm 2005/06/08 18:49:38 1.179 +++ loncom/interface/londocs.pm 2005/06/10 16:56:08 1.186 @@ -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.186 2005/06/10 16:56:08 www 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; @@ -1068,7 +1077,9 @@ sub editor { if ($cmd eq 'del') { my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); if ($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) { - &Apache::lonnet::removeuploadedurl($url); + unless ($url=~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library)$/) { + &Apache::lonnet::removeuploadedurl($url); + } } &Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { @@ -1144,8 +1155,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; @@ -1856,15 +1867,15 @@ sub changewarning { if (!defined($message)) { $message='Changes will become active for your current session after [_1], or the next time you log in.'; } - $r->print( -''. -'
'. + $r->print("\n\n". +''."\n". +''. '

'. &mt($message,' '). -$help{'Caching'}.'

'); +$help{'Caching'}.''."\n\n"); } # ================================================================ Main Handler @@ -2109,7 +2120,7 @@ function removeres(folderpath,index,oldt } function cutres(folderpath,index,oldtitle,container,pagesymb) { - if (confirm('WARNING: Cutting a resource makes associated grades and scores inaccessible,\\neven if it is pasted in again elsewhere!\\nCut "'+oldtitle+'"?')) { + if (confirm('WARNING: Cutting a resource makes associated grades and scores inaccessible!\\nGrades remain inaccessible if resource is pasted into another folder.\\nCut "'+oldtitle+'"?')) { this.document.forms.renameform.cmd.value='cut_'+index; this.document.forms.renameform.markcopy.value=index; if (container == 'sequence') { @@ -2151,13 +2162,14 @@ ENDNEWSCRIPT 'upls' => 'Upload a new supplemental course document', 'impp' => 'Import a document', 'pubd' => 'Published documents', - 'copm' => 'All documents out of a published map', + 'copm' => 'All documents out of a published map into this folder', 'spec' => 'Special documents', 'upld' => 'Upload Document', 'srch' => 'Search', 'impo' => 'Import', 'selm' => 'Select Map', 'load' => 'Load Map', + 'reco' => 'Recover Deleted Resources', 'newf' => 'New Folder', 'newp' => 'New Composite Page', 'extr' => 'External Resource', @@ -2248,7 +2260,11 @@ ENDCOURSEVERIFY '.sequence'; my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. '.page'; - + my $container='sequence'; + if ($env{'form.pagepath'}) { + $container='page'; + } + my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; $r->print(< $lt{'uplm'} @@ -2257,7 +2273,7 @@ ENDCOURSEVERIFY $lt{'file'}:
-
+
$lt{'title'}:
@@ -2281,14 +2297,18 @@ $help{'Importing_LON-CAPA_Resource'}


-$lt{'copm'} -
+$lt{'copm'}
+
$help{'Load_Map'}

+
+
+ +
ENDFORM unless ($env{'form.pagepath'}) { $r->print(< + ENDFORM } if ($env{'form.pagepath'}) { @@ -2417,8 +2438,8 @@ $uploadtag onClick="javascript:makeexamupload();" /> $help{'Score_Upload_Form'} + ENDBLOCK - $r->print(''); } $r->print(''."\n". ''); @@ -2507,7 +2528,7 @@ ENDSUPFORM } } if ($allowed) { - $r->print('
'); + $r->print('
'); } $r->print(''); } else {