--- 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 ('

'.&mt('Done').'

'); } @@ -287,7 +287,7 @@ sub delete_confirmed { $ENV{'form.selectfile'}); if ($result ne 'ok') { $r->print(' An errror occured ('.$result. - ')while trying to delete '.&display_file().'
'); + ') while trying to delete '.&display_file().'
'); } $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(' An errror occured ('.$result. - ')while trying to upload '.&display_file().'
'); + ') while trying to upload '.&display_file().'
'); + } + $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(' An errror occured ('.$result. + ') while trying to create a new directory '.&display_file().'
'); } $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'}) {