[LON-CAPA-cvs] cvs: loncom /imspackages imsimportdocs.pm imsprocessor.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Sun, 21 Mar 2004 20:44:59 -0000


raeburn		Sun Mar 21 15:44:59 2004 EDT

  Modified files:              
    /loncom/imspackages	imsimportdocs.pm imsprocessor.pm 
  Log:
  Bug fixes. Make sure target directories exist, and timestamp is included in path to documents in .page files.
  
  
Index: loncom/imspackages/imsimportdocs.pm
diff -u loncom/imspackages/imsimportdocs.pm:1.4 loncom/imspackages/imsimportdocs.pm:1.5
--- loncom/imspackages/imsimportdocs.pm:1.4	Tue Mar 16 14:51:40 2004
+++ loncom/imspackages/imsimportdocs.pm	Sun Mar 21 15:44:58 2004
@@ -539,6 +539,20 @@
    
     my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo);
     if ($manifest_result eq 'ok') {
+        my @path = ($cdom,$crs,$timenow);
+        my $fullpath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles';
+        foreach my $item (@path) {
+            $fullpath .= '/'.$item;
+            if (!-e "$fullpath") {
+                mkdir("$fullpath",0770);
+            }
+        }
+        my @namedirs = ("resfiles","sequences","pages","problems");
+        foreach my $name (@namedirs) {
+            if (!-e "$fullpath/$name") {
+                mkdir("$fullpath/$name",0770);
+            }
+        }
         &Apache::imsprocessor::target_resources(\%resources,\%imports,\@targets);
         my $copy_result = &Apache::imsprocessor::copy_resources('DOCS',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$chome,$destdir,$timenow);
 
Index: loncom/imspackages/imsprocessor.pm
diff -u loncom/imspackages/imsprocessor.pm:1.5 loncom/imspackages/imsprocessor.pm:1.6
--- loncom/imspackages/imsprocessor.pm:1.5	Fri Mar 19 19:45:16 2004
+++ loncom/imspackages/imsprocessor.pm	Sun Mar 21 15:44:58 2004
@@ -651,7 +651,7 @@
 
     my $filestem;
     if ($context eq 'DOCS') {
-        $filestem = "/uploaded/$cdom/$crs";
+        $filestem = "/uploaded/$cdom/$crs/$timenow";
     } elsif ($context eq 'CSTR') {
         $filestem = "/res/$udom/$uname/$newdir";
     }