[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Thu, 16 Dec 2004 20:34:33 -0000
banghart Thu Dec 16 15:34:33 2004 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
sub get_marked_as_readonly_hash
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.576 loncom/lonnet/perl/lonnet.pm:1.577
--- loncom/lonnet/perl/lonnet.pm:1.576 Wed Dec 15 14:42:42 2004
+++ loncom/lonnet/perl/lonnet.pm Thu Dec 16 15:34:33 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.576 2004/12/15 19:42:42 albertel Exp $
+# $Id: lonnet.pm,v 1.577 2004/12/16 20:34:33 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1406,13 +1406,13 @@
}
# Save the file
{
- #&Apache::lonnet::logthis("Saving to $filepath $file");
open(FH,'>'.$filepath.'/'.$file);
print FH $ENV{'form.'.$formname};
close(FH);
}
# Notify homeserver to grep it
#
+ &Apache::lonnet::logthis("fetching ".$path.$file);
my $fetchresult= &reply('fetchuserfile:'.$path.$file,$docuhome);
if ($fetchresult eq 'ok') {
#
@@ -3907,7 +3907,25 @@
}
return @readonly_files;
}
+#-----------------------------------------------------------Get Marked as Read Only Hash
+sub get_marked_as_readonly_hash {
+ my ($domain,$user,$what) = @_;
+ my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user);
+ my %readonly_files;
+ while (my ($file_name,$value) = each(%current_permissions)) {
+ if (ref($value) eq "ARRAY"){
+ foreach my $stored_what (@{$value}) {
+ if ($stored_what eq $what) {
+ $readonly_files{$file_name} = 'locked';
+ } elsif (!defined($what)) {
+ $readonly_files{$file_name} = 'locked';
+ }
+ }
+ }
+ }
+ return %readonly_files;
+}
# ------------------------------------------------------------ Unmark as Read Only
sub unmark_as_readonly {