--- loncom/interface/portfolio.pm	2004/08/24 06:16:55	1.24
+++ loncom/interface/portfolio.pm	2004/08/24 06:43:21	1.25
@@ -268,7 +268,7 @@ sub display_file {
 }
 
 sub done {
-    return ('<h3><a href="/adm/portfolio?currentpath="'.
+    return ('<h3><a href="/adm/portfolio?currentpath='.
 	    $ENV{'form.currentpath'}.'">'.&mt('Done').'</a></h3>');
 }
 
@@ -287,7 +287,7 @@ sub delete_confirmed {
 					       $ENV{'form.selectfile'});
     if ($result ne 'ok') {
 	$r->print('<font color="red"> An errror occured ('.$result.
-		  ')while trying to delete '.&display_file().'</font><br />');
+		  ') while trying to delete '.&display_file().'</font><br />');
     }
     $r->print(&done());
 }
@@ -306,11 +306,26 @@ sub rename_confirmed {
 
 sub upload {
     my ($r)=@_;
+    #FIXME if the file already exists we need to do a confirmation pass 
+    #before overwriting
     my $result=&Apache::lonnet::userfileupload('uploaddoc','',
 					 'portfolio'.$ENV{'form.currentpath'});
     if ($result !~ m|^/uploaded/|) {
 	$r->print('<font color="red"> An errror occured ('.$result.
-		  ')while trying to upload '.&display_file().'</font><br />');
+		  ') while trying to upload '.&display_file().'</font><br />');
+    }
+    $r->print(&done());
+}
+
+sub createdir {
+    my ($r)=@_;
+    #FIXME 1) bad dirnames
+    #      2) file exists in place of dir
+    my $result=&Apache::lonnet::mkdiruserfile($ENV{'user.name'},
+	     $ENV{'user.domain'},'portfolio'.$ENV{'form.currentpath'}.$ENV{'form.newdir'});
+    if ($result ne 'ok') {
+	$r->print('<font color="red"> An errror occured ('.$result.
+		  ') while trying to create a new directory '.&display_file().'</font><br />');
     }
     $r->print(&done());
 }
@@ -352,6 +367,8 @@ sub handler {
 	# similarly, we need to delete or rename files before getting
 	# directory list
 	&rename($r);
+    } elsif ($ENV{'form.createdir'}) {
+	&createdir($r);
     } else {
 	my $current_path='/';
 	if ($ENV{'form.currentpath'}) {