--- loncom/interface/portfolio.pm 2010/06/20 03:13:46 1.224 +++ loncom/interface/portfolio.pm 2010/10/23 19:28:12 1.225 @@ -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 @@ ENDSMP ); } - -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 = ''. - &mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded.',''.$fname.'',$filesize).''. - '
'.&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 = ''; - $msg .= &mt('Unable to upload [_1]. A locked file by that name was found in [_2].',''.$fname.'',''.$port_path.$env{'form.currentpath'}.''); - $msg .= '
'; - $msg .= &mt('You will be able to rename or delete existing [_1] after a grade has been assigned.',''.$fname.''); - return ('file_locked',$msg); - } else { - my $msg = ''; - $msg .= &mt('Unable to upload [_1]. A file by that name was found in [_2].',''.$fname.'',$port_path.$env{'form.currentpath'}); - $msg .= ''; - $msg .= '
'; - $msg .= &mt('To upload, rename or delete existing [_1] in [_2].',''.$fname.'', $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'});