version 1.74, 2005/02/11 06:18:52
|
version 1.76, 2005/02/20 20:39:30
|
Line 253 sub display_file {
|
Line 253 sub display_file {
|
} |
} |
|
|
sub done { |
sub done { |
|
my ($message)=@_; |
|
unless (defined $message) { |
|
$message='Done'; |
|
} |
return ('<h3><a href="/adm/portfolio?currentpath='. |
return ('<h3><a href="/adm/portfolio?currentpath='. |
$ENV{'form.currentpath'}. |
$ENV{'form.currentpath'}. |
'&fieldname='.$ENV{'form.fieldname'}. |
'&fieldname='.$ENV{'form.fieldname'}. |
'&mode='.$ENV{'form.mode'}. |
'&mode='.$ENV{'form.mode'}. |
'">'.&mt('Done').'</a></h3>'); |
'">'.&mt($message).'</a></h3>'); |
} |
} |
|
|
sub delete { |
sub delete { |
Line 268 sub delete {
|
Line 272 sub delete {
|
|
|
if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') { |
if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') { |
$r->print ("The file is locked and cannot be deleted.<br />"); |
$r->print ("The file is locked and cannot be deleted.<br />"); |
$r->print(&done()); |
$r->print(&done('Back')); |
} else { |
} else { |
if (scalar(@files)) { |
if (scalar(@files)) { |
&open_form($r); |
&open_form($r); |
Line 431 sub upload {
|
Line 435 sub upload {
|
$ENV{'user.domain'}, |
$ENV{'user.domain'}, |
$ENV{'user.name'},$portfolio_root); |
$ENV{'user.name'},$portfolio_root); |
my $found_file = 0; |
my $found_file = 0; |
|
my $locked_file = 0; |
foreach my $line (@dir_list) { |
foreach my $line (@dir_list) { |
my ($filename)=split(/\&/,$line,2); |
my ($file_name)=split(/\&/,$line,2); |
if ($filename eq $fname){ |
if ($file_name eq $fname){ |
$found_file = 1; |
$found_file = 1; |
|
if (&Apache::lonnet::is_locked($ENV{'form.currentpath'}.$file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') { |
|
$locked_file = 1; |
|
} |
} |
} |
} |
} |
my $current_disk_usage = &Apache::lonnet::diskusage($ENV{'user.domain'}, $ENV{'user.name'},$portfolio_root); |
my $current_disk_usage = &Apache::lonnet::diskusage($ENV{'user.domain'}, $ENV{'user.name'},$portfolio_root); |
if ((($current_disk_usage/1000) + $filesize) > $disk_quota){ |
if ((($current_disk_usage/1000) + $filesize) > $disk_quota){ |
$r->print('<font color="red">Unable to upload <strong>'.$fname.' (size = '.$filesize.' kilobytes</strong>. Disk quota will be exceeded.'. |
$r->print('<font color="red">Unable to upload <strong>'.$fname.' (size = '.$filesize.' kilobytes</strong>. Disk quota will be exceeded.'. |
'<br />Disk quota is '.$disk_quota.' kilobytes. Your current disk usage is '.$current_disk_usage.' kilobytes.'); |
'<br />Disk quota is '.$disk_quota.' kilobytes. Your current disk usage is '.$current_disk_usage.' kilobytes.'); |
|
$r->print(&done('Back')); |
} |
} |
elsif ($found_file){ |
elsif ($found_file){ |
$r->print('<font color="red">Unable to upload <strong>'.$fname.'</strong>, a file by that name was found in <strong>'.$ENV{'form.currentpath'}.'</strong></font>'. |
if ($locked_file){ |
'<br />To upload, rename or delete existing '.$fname.' in '.$ENV{'form.currentpath'}); |
$r->print('<font color="red">Unable to upload <strong>'.$fname.'</strong>, a <strong>locked</strong> file by that name was found in <strong>portfolio'.$ENV{'form.currentpath'}.'</strong></font>'. |
|
'<br />You will be able to rename or delete existing '.$fname.' after a grade has been assigned.'); |
|
$r->print(&done('Back')); |
|
} else { |
|
$r->print('<font color="red">Unable to upload <strong>'.$fname.'</strong>, a file by that name was found in <strong>portfolio'.$ENV{'form.currentpath'}.'</strong></font>'. |
|
'<br />To upload, rename or delete existing '.$fname.' in portfolio'.$ENV{'form.currentpath'}); |
|
$r->print(&done('Back')); |
|
} |
} else { |
} else { |
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('Back')); |
|
} else { |
|
$r->print(&done()); |
} |
} |
} |
} |
$r->print(&done()); |
|
} |
} |
|
|
sub createdir { |
sub createdir { |
Line 509 sub handler {
|
Line 527 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
# Give the LON-CAPA page header |
# Give the LON-CAPA page header |
$r->print('<html><head><title>'. |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print($html.'<head><title>'. |
&mt('Portfolio Manager'). |
&mt('Portfolio Manager'). |
"</title></head>\n"); |
"</title></head>\n"); |
if ($ENV{"form.mode"} eq 'selectfile'){ |
if ($ENV{"form.mode"} eq 'selectfile'){ |