version 1.758, 2006/06/26 18:56:03
|
version 1.759, 2006/06/30 00:26:49
|
Line 4582 sub is_locked {
|
Line 4582 sub is_locked {
|
} |
} |
} |
} |
|
|
|
sub declutter_portfile { |
|
my ($file) = @_; |
|
&logthis("got $file"); |
|
$file =~ s-^(/portfolio/|portfolio/)-/-; |
|
&logthis("ret $file"); |
|
return $file; |
|
} |
|
|
# ------------------------------------------------------------- Mark as Read Only |
# ------------------------------------------------------------- Mark as Read Only |
|
|
sub mark_as_readonly { |
sub mark_as_readonly { |
Line 4590 sub mark_as_readonly {
|
Line 4598 sub mark_as_readonly {
|
my ($tmp)=keys(%current_permissions); |
my ($tmp)=keys(%current_permissions); |
if ($tmp=~/^error:/) { undef(%current_permissions); } |
if ($tmp=~/^error:/) { undef(%current_permissions); } |
foreach my $file (@{$files}) { |
foreach my $file (@{$files}) { |
|
$file = &declutter_portfile($file); |
push(@{$current_permissions{$file}},$what); |
push(@{$current_permissions{$file}},$what); |
} |
} |
&put('file_permissions',\%current_permissions,$domain,$user); |
&put('file_permissions',\%current_permissions,$domain,$user); |
Line 4811 sub get_marked_as_readonly {
|
Line 4820 sub get_marked_as_readonly {
|
if (ref($value) eq "ARRAY"){ |
if (ref($value) eq "ARRAY"){ |
foreach my $stored_what (@{$value}) { |
foreach my $stored_what (@{$value}) { |
my $cmp2=$stored_what; |
my $cmp2=$stored_what; |
if (ref($stored_what eq 'ARRAY')) { |
if (ref($stored_what) eq 'ARRAY') { |
$cmp2=join('',@{$stored_what}); |
$cmp2=join('',@{$stored_what}); |
} |
} |
if ($cmp1 eq $cmp2) { |
if ($cmp1 eq $cmp2) { |
Line 4863 sub unmark_as_readonly {
|
Line 4872 sub unmark_as_readonly {
|
# unmarks $file_name (if $file_name is defined), or all files locked by $what |
# unmarks $file_name (if $file_name is defined), or all files locked by $what |
# for portfolio submissions, $what contains [$symb,$crsid] |
# for portfolio submissions, $what contains [$symb,$crsid] |
my ($domain,$user,$what,$file_name,$group) = @_; |
my ($domain,$user,$what,$file_name,$group) = @_; |
|
$file_name = &declutter_portfile($file_name); |
my $symb_crs = $what; |
my $symb_crs = $what; |
if (ref($what)) { $symb_crs=join('',@$what); } |
if (ref($what)) { $symb_crs=join('',@$what); } |
my %current_permissions = &dump('file_permissions',$domain,$user,$group); |
my %current_permissions = &dump('file_permissions',$domain,$user,$group); |
Line 4870 sub unmark_as_readonly {
|
Line 4880 sub unmark_as_readonly {
|
if ($tmp=~/^error:/) { undef(%current_permissions); } |
if ($tmp=~/^error:/) { undef(%current_permissions); } |
my @readonly_files = &get_marked_as_readonly($domain,$user,$what,$group); |
my @readonly_files = &get_marked_as_readonly($domain,$user,$what,$group); |
foreach my $file (@readonly_files) { |
foreach my $file (@readonly_files) { |
if (defined($file_name) && ($file_name ne $file)) { next; } |
my $clean_file = &declutter_portfile($file); |
|
if (defined($file_name) && ($file_name ne $clean_file)) { next; } |
my $current_locks = $current_permissions{$file}; |
my $current_locks = $current_permissions{$file}; |
my @new_locks; |
my @new_locks; |
my @del_keys; |
my @del_keys; |