version 1.24, 2004/08/24 06:16:55
|
version 1.25, 2004/08/24 06:43:21
|
Line 268 sub display_file {
|
Line 268 sub display_file {
|
} |
} |
|
|
sub done { |
sub done { |
return ('<h3><a href="/adm/portfolio?currentpath="'. |
return ('<h3><a href="/adm/portfolio?currentpath='. |
$ENV{'form.currentpath'}.'">'.&mt('Done').'</a></h3>'); |
$ENV{'form.currentpath'}.'">'.&mt('Done').'</a></h3>'); |
} |
} |
|
|
Line 287 sub delete_confirmed {
|
Line 287 sub delete_confirmed {
|
$ENV{'form.selectfile'}); |
$ENV{'form.selectfile'}); |
if ($result ne 'ok') { |
if ($result ne 'ok') { |
$r->print('<font color="red"> An errror occured ('.$result. |
$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()); |
$r->print(&done()); |
} |
} |
Line 306 sub rename_confirmed {
|
Line 306 sub rename_confirmed {
|
|
|
sub upload { |
sub upload { |
my ($r)=@_; |
my ($r)=@_; |
|
#FIXME if the file already exists we need to do a confirmation pass |
|
#before overwriting |
my $result=&Apache::lonnet::userfileupload('uploaddoc','', |
my $result=&Apache::lonnet::userfileupload('uploaddoc','', |
'portfolio'.$ENV{'form.currentpath'}); |
'portfolio'.$ENV{'form.currentpath'}); |
if ($result !~ m|^/uploaded/|) { |
if ($result !~ m|^/uploaded/|) { |
$r->print('<font color="red"> An errror occured ('.$result. |
$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()); |
$r->print(&done()); |
} |
} |
Line 352 sub handler {
|
Line 367 sub handler {
|
# similarly, we need to delete or rename files before getting |
# similarly, we need to delete or rename files before getting |
# directory list |
# directory list |
&rename($r); |
&rename($r); |
|
} elsif ($ENV{'form.createdir'}) { |
|
&createdir($r); |
} else { |
} else { |
my $current_path='/'; |
my $current_path='/'; |
if ($ENV{'form.currentpath'}) { |
if ($ENV{'form.currentpath'}) { |