--- loncom/interface/portfolio.pm 2010/03/26 22:27:06 1.221
+++ 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.221 2010/03/26 22:27:06 raeburn Exp $
+# $Id: portfolio.pm,v 1.225 2010/10/23 19:28:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -287,7 +287,6 @@ sub display_directory {
my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload,
$can_modify,$can_delete,$can_setacl)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
- my $display_out;
my $select_mode;
my $checked_files;
my $port_path = &get_port_path();
@@ -304,30 +303,17 @@ sub display_directory {
my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group);
my $now = time;
if ($env{"form.mode"} eq 'selectfile') {
- &select_files($r);
- $checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'});
- $select_mode = 'true';
- }
- if ($is_empty && ($current_path ne '/') && $can_delete) {
- $display_out = '
';
-
- $r->print($display_out);
- return;
+ &select_files($r);
+ $checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'});
+ $select_mode = 'true';
}
if ($select_mode eq 'true') {
$r->print(''
+ );
+ # Delete button
+ $r->print(
+ ''
+ );
+ # Directory is empty, so nothing else to display
+ return;
+ }
+
$r->print("\n".&group_form_data()."\n");
my $href_location="/uploaded/$udom/$uname/$port_path".$current_path;
@@ -1405,7 +1429,7 @@ sub access_element {
users => 'User',
course => 'Course/Community'
);
- $r->print(''.&mt('[_1]-based conditional access: ',$typetext{$type}).': ');
+ $r->print(''.&mt('[_1]-based conditional access: ',$typetext{$type}));
if ($$acl_count{$type}) {
$r->print($$acl_count{$type}.' ');
if ($$acl_count{$type} > 1) {
@@ -1889,55 +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;
- }
- }
- }
- 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'});