--- loncom/lonnet/perl/lonnet.pm	2004/11/02 23:22:47	1.558
+++ loncom/lonnet/perl/lonnet.pm	2004/11/04 23:43:07	1.561
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.558 2004/11/02 23:22:47 albertel Exp $
+# $Id: lonnet.pm,v 1.561 2004/11/04 23:43:07 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3781,6 +3781,50 @@ sub diskusage {
     return $listing;
 }
 
+# ------------------------------------------------------------- Mark as Read Only
+
+sub mark_as_readonly {
+    my ($domain,$user,$files,$what) = @_;
+    my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user);
+    foreach my $file (@{$files}) {
+        push(@{$current_permissions{$file}},$what);
+    }
+    &Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user);
+    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
+
+sub unmark_as_readonly {
+    # unmarks all files locked by $what 
+    # for portfolio submissions, $what contains $crsid and $symb
+    my ($domain,$user,$what) = @_;
+    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;
+}
 
 # ------------------------------------------------------------ Directory lister