[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm
raeburn
raeburn@source.lon-capa.org
Sat, 23 Oct 2010 19:28:12 -0000
raeburn Sat Oct 23 19:28:12 2010 EDT
Modified files:
/loncom/interface portfolio.pm
Log:
- Remove unused subroutine (check_for_upload moved to loncommon.pm in rev 1.195).
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.224 loncom/interface/portfolio.pm:1.225
--- loncom/interface/portfolio.pm:1.224 Sun Jun 20 03:13:46 2010
+++ loncom/interface/portfolio.pm Sat Oct 23 19:28:12 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.224 2010/06/20 03:13:46 raeburn Exp $
+# $Id: portfolio.pm,v 1.225 2010/10/23 19:28:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1913,56 +1913,6 @@
);
}
-
-sub check_for_upload {
- my ($path,$fname,$group,$element) = @_;
- my $disk_quota = &get_quota($group);
- my $filesize = (length($env{'form.'.$element})) / 1000; #express in k (1024?)
- my $portfolio_root = &get_portfolio_root();
- my $port_path = &get_port_path();
- my ($uname,$udom) = &get_name_dom($group);
- # Fixme --- Move the checking for existing file to LOND error return
- my @dir_list=&get_dir_list($portfolio_root,$path,$group);
- my $found_file = 0;
- my $locked_file = 0;
- foreach my $line (@dir_list) {
- my ($file_name)=split(/\&/,$line,2);
- if ($file_name eq $fname){
- $file_name = $path.$file_name;
- $file_name = &prepend_group($file_name);
- $found_file = 1;
- if (&Apache::lonnet::is_locked($file_name,$udom,$uname) eq 'true') {
- $locked_file = 1;
- }
- last;
- }
- }
- my $getpropath = 1;
- my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,$portfolio_root,$getpropath);
-
- if (($current_disk_usage + $filesize) > $disk_quota){
- my $msg = '<span class="LC_error">'.
- &mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded.','<span class="LC_filename">'.$fname.'</span>',$filesize).'</span>'.
- '<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.',$disk_quota,$current_disk_usage);
- return ('will_exceed_quota',$msg);
- } elsif ($found_file) {
- if ($locked_file) {
- my $msg = '<span class="LC_error">';
- $msg .= &mt('Unable to upload [_1]. A locked file by that name was found in [_2].','<span class="LC_filename">'.$fname.'</span>','<span class="LC_filename">'.$port_path.$env{'form.currentpath'}.'</span>');
- $msg .= '</span><br />';
- $msg .= &mt('You will be able to rename or delete existing [_1] after a grade has been assigned.','<span class="LC_filename">'.$fname.'</span>');
- return ('file_locked',$msg);
- } else {
- my $msg = '<span class="LC_error">';
- $msg .= &mt('Unable to upload [_1]. A file by that name was found in [_2].','<span class="LC_filename">'.$fname.'</span>',$port_path.$env{'form.currentpath'});
- $msg .= '</span>';
- $msg .= '<br />';
- $msg .= &mt('To upload, rename or delete existing [_1] in [_2].','<span class="LC_filename">'.$fname.'</span>', $port_path.$env{'form.currentpath'});
- return ('file_exists',$msg);
- }
- }
-}
-
sub upload {
my ($r,$url,$group)=@_;
my $fname=&Apache::lonnet::clean_filename($env{'form.uploaddoc.filename'});