--- loncom/interface/portfolio.pm 2004/08/25 18:48:26 1.33 +++ loncom/interface/portfolio.pm 2004/09/06 23:11:57 1.36 @@ -266,19 +266,6 @@ sub open_form { $ENV{'form.currentpath'}.'" />'); } -sub clean_filename { - my ($fname)=@_; -# Replace Windows backslashes by forward slashes - $fname=~s/\\/\//g; -# Get rid of everything but the actual filename - $fname=~s/^.*\/([^\/]+)$/$1/; -# Replace spaces by underscores - $fname=~s/\s+/\_/g; -# Replace all other weird characters by nothing - $fname=~s/[^\w\.\-]//g; - return $fname; -} - sub close_form { my ($r)=@_; $r->print('
Unable to upload '.$fname.', a file by that name was found in '.$ENV{'form.currentpath'}.''.
'
To upload, rename or delete existing '.$fname.' in '.$ENV{'form.currentpath'});
@@ -414,8 +398,8 @@ sub upload {
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().'
');
+ $r->print(' An errror occured ('.$result.
+ ') while trying to upload '.&display_file().'
');
}
}
$r->print(&done());
@@ -459,7 +443,14 @@ sub handler {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['selectfile','currentpath',
'currentfile']);
-
+ # make sure there is a portfolio directory off /userfiles
+ my @dir_list=&Apache::lonnet::dirlist('/',
+ $ENV{'user.domain'},
+ $ENV{'user.name'},$portfolio_root);
+ if ($dir_list[0] eq 'no_such_dir'){
+ &Apache::lonnet::mkdiruserfile($ENV{'user.name'},
+ $ENV{'user.domain'},'portfolio');
+ }
if ($ENV{'form.uploaddoc.filename'}) {
&upload($r);
} elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {