[LON-CAPA-cvs] cvs: loncom(version_2_3_X) /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 Jan 2007 21:36:46 -0000


albertel		Fri Jan 12 16:36:46 2007 EDT

  Modified files:              (Branch: version_2_3_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - backport 1.818
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.816.2.2 loncom/lonnet/perl/lonnet.pm:1.816.2.3
--- loncom/lonnet/perl/lonnet.pm:1.816.2.2	Tue Jan  2 23:19:31 2007
+++ loncom/lonnet/perl/lonnet.pm	Fri Jan 12 16:36:42 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.816.2.2 2007/01/03 04:19:31 albertel Exp $
+# $Id: lonnet.pm,v 1.816.2.3 2007/01/12 21:36:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4098,6 +4098,18 @@
     return get_query_reply($queryid);
 }
 
+# -------------------------- Update MySQL table for portfolio file
+
+sub update_portfolio_table {
+    my ($uname,$udom,$file_name,$query,$group) = @_;
+    my $homeserver = &homeserver($uname,$udom);
+    my $queryid=
+        &reply("querysend:".$query.':'.&escape($uname.':'.$udom).':'.
+              &escape($file_name).':'.&escape($group),$homeserver);
+    my $reply = &get_query_reply($queryid);
+    return $reply;
+}
+
 # ------- Request retrieval of institutional classlists for course(s)
 
 sub fetch_enrollment_query {
@@ -5266,6 +5278,15 @@
         #  remove lock
         my @del_lock = ($file_name."\0".'locked_access_records');
         my $dellockoutcome = &del('file_permissions',\@del_lock,$domain,$user);
+        my ($file,$group);
+        if (&is_course($domain,$user)) {
+            ($group,$file) = split(/\//,$file_name,2);
+        } else {
+            $file = $file_name;
+        }
+        my $sqlresult =
+            &update_portfolio_table($user,$domain,$file,'portfolio_access',
+                                    $group);
     } else {
         $outcome = "error: could not obtain lockfile\n";  
     }