version 1.745, 2006/06/07 18:41:57
|
version 1.746, 2006/06/07 21:15:10
|
Line 4555 sub is_locked {
|
Line 4555 sub is_locked {
|
$env{'user.domain'},$env{'user.name'}); |
$env{'user.domain'},$env{'user.name'}); |
my ($tmp)=keys(%locked); |
my ($tmp)=keys(%locked); |
if ($tmp=~/^error:/) { undef(%locked); } |
if ($tmp=~/^error:/) { undef(%locked); } |
|
|
|
|
if (ref($locked{$file_name}) eq 'ARRAY') { |
if (ref($locked{$file_name}) eq 'ARRAY') { |
$is_locked = 'false'; |
$is_locked = 'false'; |
foreach my $entry (@{$locked{$file_name}}) { |
foreach my $entry (@{$locked{$file_name}}) { |
if (ref($entry) eq 'ARRAY') { |
if (ref($entry) eq 'ARRAY') { |
if ($$entry[0] eq 'access' || $$entry[0] eq 'accesscount') { |
$is_locked = 'true'; |
next; |
last; |
} else { |
|
$is_locked = 'true'; |
|
last; |
|
} |
|
} |
} |
} |
} |
} else { |
} else { |
Line 4660 sub files_not_in_path {
|
Line 4655 sub files_not_in_path {
|
#----------------------------------------------Get portfolio file permissions |
#----------------------------------------------Get portfolio file permissions |
|
|
sub get_portfile_permissions { |
sub get_portfile_permissions { |
|
# returns a reference to a hash containing contents of file_permissions.db |
my ($domain,$user) = @_; |
my ($domain,$user) = @_; |
my %current_permissions = &dump('file_permissions',$domain,$user); |
my %current_permissions = &dump('file_permissions',$domain,$user); |
my ($tmp)=keys(%current_permissions); |
my ($tmp)=keys(%current_permissions); |
Line 4670 sub get_portfile_permissions {
|
Line 4666 sub get_portfile_permissions {
|
#---------------------------------------------Get portfolio file access controls |
#---------------------------------------------Get portfolio file access controls |
|
|
sub get_access_controls { |
sub get_access_controls { |
|
# returns a hash containing access control information retrieved from |
|
# file_permissions.db. The hash contains key=value pairs where key is |
|
# the control type, end date and start date, in the form type_end_start |
|
# and value is a string containing access control settings (in XML), |
|
# |
|
# Internally access_controls are stored in file_permissions.db in an |
|
# array of arrays and a hash, where arrays are locks set when a portfolio |
|
# file has been uploaded to an essayresponse problem in a course, and |
|
# the hash contains other data. Two keys are currently defined in the hash: |
|
# access and accesscount. The value for accesscount is a scalar - equal to |
|
# the next number to use as the first part of an access control key |
|
# when defining a new control. The value for access is an anonymous hash |
|
# where keys are access controls and values are settings. |
|
# |
my ($current_permissions,$group,$file) = @_; |
my ($current_permissions,$group,$file) = @_; |
my @access_checks = (); |
my @access_checks = (); |
my %access; |
my %access; |
Line 4687 sub get_access_controls {
|
Line 4697 sub get_access_controls {
|
} |
} |
if (ref($value) eq "ARRAY") { |
if (ref($value) eq "ARRAY") { |
foreach my $stored_what (@{$value}) { |
foreach my $stored_what (@{$value}) { |
if (ref($stored_what) eq 'ARRAY') { |
if (ref($stored_what) eq 'HASH') { |
if ($$stored_what[0] eq 'access') { |
$access{$file_name} = $$stored_what{'access'}; |
if (!defined($access{$file_name})) { |
|
%{$access{$file_name}} = (); |
|
} |
|
$access{$file_name}{$$stored_what[1]}=$$stored_what[2]; |
|
} else { |
|
next; |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 4720 sub get_marked_as_readonly {
|
Line 4723 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)) { |
if (ref($stored_what eq 'HASH')) { |
if ($$stored_what[0] eq 'access' || |
next; |
$$stored_what[0] eq 'accesscount') { |
} elsif (ref($stored_what eq 'ARRAY')) { |
next; |
$cmp2=join('',@{$stored_what}); |
} else { |
|
$cmp2=join('',@{$stored_what}); |
|
} |
|
} |
} |
if ($cmp1 eq $cmp2) { |
if ($cmp1 eq $cmp2) { |
push(@readonly_files, $file_name); |
push(@readonly_files, $file_name); |
Line 4754 sub get_marked_as_readonly_hash {
|
Line 4754 sub get_marked_as_readonly_hash {
|
if (ref($value) eq "ARRAY"){ |
if (ref($value) eq "ARRAY"){ |
foreach my $stored_what (@{$value}) { |
foreach my $stored_what (@{$value}) { |
if (ref($stored_what) eq 'ARRAY') { |
if (ref($stored_what) eq 'ARRAY') { |
if ($$stored_what[0] eq 'access' || |
if ($stored_what eq $what) { |
$$stored_what[0] eq 'accesscount') { |
$readonly_files{$file_name} = 'locked'; |
next; |
} elsif (!defined($what)) { |
|
$readonly_files{$file_name} = 'locked'; |
} |
} |
} |
} |
if ($stored_what eq $what) { |
|
$readonly_files{$file_name} = 'locked'; |
|
} elsif (!defined($what)) { |
|
$readonly_files{$file_name} = 'locked'; |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 4789 sub unmark_as_readonly {
|
Line 4785 sub unmark_as_readonly {
|
if (ref($current_locks) eq "ARRAY"){ |
if (ref($current_locks) eq "ARRAY"){ |
foreach my $locker (@{$current_locks}) { |
foreach my $locker (@{$current_locks}) { |
my $compare=$locker; |
my $compare=$locker; |
if (ref($locker) eq 'ARRAY') { |
if (!ref($locker) eq 'ARRAY') { |
if ($$locker[0] eq 'access' || |
push(@new_locks,$locker); |
$$locker[0] eq 'accesscount') { |
} else { |
push(@new_locks,$locker); |
|
next; |
|
} |
|
$compare=join('',@{$locker}); |
$compare=join('',@{$locker}); |
} |
if ($compare ne $symb_crs) { |
if ($compare ne $symb_crs) { |
push(@new_locks, $locker); |
push(@new_locks, $locker); |
} |
} |
} |
} |
} |
if (scalar(@new_locks) > 0) { |
if (scalar(@new_locks) > 0) { |