--- loncom/interface/portfolio.pm 2004/12/06 18:13:10 1.63
+++ loncom/interface/portfolio.pm 2005/02/11 06:18:52 1.74
@@ -83,12 +83,7 @@ sub display_directory {
my ($r,$current_path,$is_empty,$dir_list)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
my $display_out;
- my %locked_files=&Apache::lonnet::dump('file_permissions',
- $ENV{'user.domain'},$ENV{'user.name'});
- my $locked_file;
- foreach my $key (keys %locked_files) {
- $locked_file .= $locked_files{$key}.':';
- }
+ my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash ($ENV{'user.domain'},$ENV{'user.name'});
if ($is_empty && ($current_path ne '/')) {
$display_out = '
');
+ $r->print('
+
+
+
+ ');
}
sub display_file_select {
my ($r,$current_path,$is_empty,$dir_list)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
my $display_out;
my $checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
- foreach my $key (keys %$checked_files) {
- &Apache::lonnet::logthis("a key is $key $$checked_files{$key} is the value");
- }
if ($is_empty && ($current_path ne '/')) {
$display_out = '
');
@@ -219,12 +209,15 @@ sub display_file_select {
sub open_form {
my ($r)=@_;
+ my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
$r->print('
');
$r->print('');
$r->print('');
- $r->print('');
+ foreach (@files) {
+ $r->print('');
+ }
$r->print('');
}
@@ -244,9 +237,19 @@ sub close_form {
sub display_file {
my ($path,$filename)=@_;
+ my $display_file_text;
if (!defined($path)) { $path=$ENV{'form.currentpath'}; }
- if (!defined($filename)) { $filename=$ENV{'form.selectfile'}; }
- return ''.$path.$filename.'';
+ if (!defined($filename)) {
+ $filename=$ENV{'form.selectfile'};
+ $display_file_text = ''.$path.$filename.'';
+ } elsif (ref($filename) eq "ARRAY") {
+ foreach (@$filename) {
+ $display_file_text .= ''.$path.$_.' ';
+ }
+ } elsif (ref($filename) eq "SCALAR") {
+ $display_file_text = ''.$path.$filename.'';
+ }
+ return $display_file_text;
}
sub done {
@@ -261,25 +264,36 @@ sub delete {
my ($r)=@_;
my @check;
my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
+ my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
+
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. ");
$r->print(&done());
} else {
- &open_form($r);
- $r->print('