version 1.560, 2004/11/03 21:12:12
|
version 1.561, 2004/11/04 23:43:07
|
Line 3787 sub mark_as_readonly {
|
Line 3787 sub mark_as_readonly {
|
my ($domain,$user,$files,$what) = @_; |
my ($domain,$user,$files,$what) = @_; |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
foreach my $file (@{$files}) { |
foreach my $file (@{$files}) { |
push (@{$current_permissions{$file}},$what); |
push(@{$current_permissions{$file}},$what); |
} |
} |
&Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user); |
&Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user); |
return; |
return; |
} |
} |
|
|
|
#--------------------------------------------------------------Get Marked as Read Only |
|
|
|
sub get_marked_as_readonly { |
|
my ($domain,$user,$what) = @_; |
|
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
|
my @readonly_files = []; |
|
while ((my $file_name, my $value) = each %current_permissions) { |
|
if (ref($value) eq "ARRAY"){ |
|
foreach my $stored_what (@{$value}) { |
|
if ($stored_what eq $what) { |
|
push(@readonly_files, $file_name); |
|
} |
|
} |
|
} |
|
} |
|
return @readonly_files; |
|
} |
|
|
# ------------------------------------------------------------ Unmark as Read Only |
# ------------------------------------------------------------ Unmark as Read Only |
|
|
sub unmark_as_readonly { |
sub unmark_as_readonly { |
my ($domain,$user,$file,$what) = @_; |
# unmarks all files locked by $what |
my $current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
# for portfolio submissions, $what contains $crsid and $symb |
|
my ($domain,$user,$what) = @_; |
&Apache::lonnet::put('file_permissions',$current_permissions,$domain,$user); |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
|
my @readonly_files = &Apache::lonnet::get_marked_as_readonly($domain,$user,$what); |
|
foreach my $file(@readonly_files){ |
|
|
|
} |
|
&Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user); |
return; |
return; |
} |
} |
|
|