--- loncom/interface/portfolio.pm 2004/08/24 06:16:55 1.24 +++ loncom/interface/portfolio.pm 2004/08/24 06:51:11 1.26 @@ -197,7 +197,12 @@ sub display_directory { $r->print(''. ''); my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio/$current_path/"; - foreach my $line (@$dir_list) { + foreach my $line (sort + { + my ($afile)=split('&',$a,2); + my ($bfile)=split('&',$b,2); + return (lc($afile) cmp lc($bfile)); + } (@$dir_list)) { #$strip holds directory/file name #$dom my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); @@ -268,7 +273,7 @@ sub display_file { } sub done { - return ('

'.&mt('Done').'

'); } @@ -287,7 +292,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 +311,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 ( '/' etc) + # 2) file exists in place of dir (errormessage needs improvement) + 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 +372,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'}) {
Actions NameSizeLast Modified