--- loncom/interface/portfolio.pm 2004/08/24 20:57:12 1.30 +++ loncom/interface/portfolio.pm 2004/08/25 17:30:49 1.32 @@ -194,7 +194,7 @@ sub display_directory { &Apache::lonhtmlcommon::select_recent('portfolio','currentpath', 'this.form.submit();')); $r->print(""); - if ($is_empty){ + if ($is_empty) { $displayOut = '
'. ''. ''. @@ -203,7 +203,8 @@ sub display_directory { '
'; $r->print($displayOut); - }else{ + return; + } $r->print(''. ''); my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio/$current_path/"; @@ -251,7 +252,6 @@ sub display_directory { # $r->print('>
Actions NameSizeLast Modified
'); # $r->print(&display_actions($current_path, $currentFile, $isEmpty)); $r->print('
'); - } } sub open_form { @@ -321,16 +321,24 @@ sub delete_dir { sub delete_dir_confirmed { my ($r)=@_; my $directory_name = $ENV{'form.currentpath'}; - $r->print('
'.$directory_name.'
'); $directory_name =~ m/\/$/; $directory_name = $`; my $result=&Apache::lonnet::removeuserfile($ENV{'user.name'}, $ENV{'user.domain'},'portfolio'. $directory_name); + if ($result ne 'ok') { $r->print(' An error occured (dir) ('.$result. -# ') while trying to delete '.&display_file().'
'); ') while trying to delete '.$directory_name.'
'); + } else { + my @dirs = split m!/!, $directory_name; + +# $directory_name =~ m/^(\/*\/)(\/*.)$/; + $directory_name='/'; + for (my $i=1; $i < (@dirs - 1); $i ++){ + $directory_name .= $dirs[$i].'/'; + } + $ENV{'form.currentpath'} = $directory_name; } $r->print(&done()); } @@ -421,9 +429,9 @@ sub handler { } elsif ($ENV{'form.action'} eq 'delete') { &delete($r); } elsif ($ENV{'form.action'} eq 'deletedir' && $ENV{'form.confirmed'}) { - &delete_dir_confirmed($r); + &delete_dir_confirmed($r); } elsif ($ENV{'form.action'} eq 'deletedir'){ - &delete_dir($r); + &delete_dir($r); } elsif ($ENV{'form.action'} eq 'rename' && $ENV{'form.confirmed'}) { &rename_confirmed($r); } elsif ($ENV{'form.action'} eq 'rename') { @@ -445,10 +453,9 @@ sub handler { # need to know if directory is empty so it can be removed if desired my $is_empty=(@dir_list == 2); - &display_directory($r,$current_path,$is_empty,\@dir_list); - $r->print("\n\n"); - $r->rflush(); - return OK; + &display_directory($r,$current_path,$is_empty,\@dir_list); + $r->print("\n\n"); + return OK; } } 1;