version 1.559, 2004/11/03 00:11:42
|
version 1.561, 2004/11/04 23:43:07
|
Line 3786 sub diskusage {
|
Line 3786 sub diskusage {
|
sub mark_as_readonly { |
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}) { |
$current_permissions{$file}.=':'.$what.':'; |
push(@{$current_permissions{$file}},$what); |
} |
} |
&Apache::lonnet::put('file_permissions',{ 'locked_files' => %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::get('file_permissions',$file,$domain,$user); |
# for portfolio submissions, $what contains $crsid and $symb |
$current_permissions =~ s/:$file://; |
my ($domain,$user,$what) = @_; |
&Apache::lonnet::put('file_permissions',{ $file => $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; |
} |
} |
|
|