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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 08 Oct 2008 21:14:14 -0000


raeburn		Wed Oct  8 17:14:14 2008 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Fix breakage caused by change in lonmeta.pm rev 1.196.
  - Trim $group from front of $file_name before sending query.
  - Addition of course group portfolio files to the portfolio_metadata MySQL database table is now immediate. 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.969 loncom/lonnet/perl/lonnet.pm:1.970
--- loncom/lonnet/perl/lonnet.pm:1.969	Mon Sep 29 18:49:05 2008
+++ loncom/lonnet/perl/lonnet.pm	Wed Oct  8 17:14:11 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.969 2008/09/29 22:49:05 raeburn Exp $
+# $Id: lonnet.pm,v 1.970 2008/10/08 21:14:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4896,6 +4896,9 @@
 
 sub update_portfolio_table {
     my ($uname,$udom,$file_name,$query,$group,$action) = @_;
+    if ($group ne '') {
+        $file_name =~s /^\Q$group\E//;
+    }
     my $homeserver = &homeserver($uname,$udom);
     my $queryid=
         &reply("querysend:".$query.':'.&escape($uname.':'.$udom.':'.$group).
@@ -6149,20 +6152,18 @@
                 }
             }
         }
+        my ($group);
+        if (&is_course($domain,$user)) {
+            ($group,my $file) = split(/\//,$file_name,2);
+        }
         $deloutcome = &del('file_permissions',\@deletions,$domain,$user);
         $new_values{$file_name."\0".'accesscontrol'} = \%new_control;
         $outcome = &put('file_permissions',\%new_values,$domain,$user);
         #  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',
+            &update_portfolio_table($user,$domain,$file_name,'portfolio_access',
                                     $group);
     } else {
         $outcome = "error: could not obtain lockfile\n";