--- loncom/imspackages/imsimportdocs.pm	2004/03/16 19:51:40	1.4
+++ loncom/imspackages/imsimportdocs.pm	2004/04/08 09:19:39	1.6
@@ -505,7 +505,6 @@ sub display_three {
     my $timenow = time;
 
     my $destdir = $Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$cdom.'/'.$crs.'/'.$timenow;
-    my $dirname = $cdom.'/'.$crs.'/'.$timenow;
     my $seqstem = "/uploaded/$cdom/$crs/$timenow";
     my $db_handling = '';
     my $user_handling = '';
@@ -539,6 +538,20 @@ sub display_three {
    
     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);
 
@@ -553,7 +566,7 @@ sub display_three {
         my @topurls = ();
         my @topnames = ();
 
-        &Apache::imsprocessor::process_resinfo($cms,$tempdir,$destdir,\%items,\%resources,\@boards,\@announcements,\@quizzes,\@surveys,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$dirname,$seqstem,\@resrcfiles);
+        &Apache::imsprocessor::process_resinfo($cms,'DOCS',$tempdir,$destdir,\%items,\%resources,\@boards,\@announcements,\@quizzes,\@surveys,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$seqstem,$seqstem,\@resrcfiles);
 
         &Apache::imsprocessor::build_structure($cms,'DOCS',$destdir,\%items,\%resinfo,\%resources,\%hrefs,$udom,$uname,'',$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames);