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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 19 Oct 2006 21:23:25 -0000


raeburn		Thu Oct 19 17:23:25 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  &mt() an additional error message.  Loop through keys of hash.  Stop concatenating keys when creating new access control record for a renamed file.      
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.165 loncom/interface/portfolio.pm:1.166
--- loncom/interface/portfolio.pm:1.165	Thu Oct 19 16:36:12 2006
+++ loncom/interface/portfolio.pm	Thu Oct 19 17:23:22 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.165 2006/10/19 20:36:12 albertel Exp $
+# $Id: portfolio.pm,v 1.166 2006/10/19 21:23:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -550,9 +550,10 @@
 					       $env{'form.currentpath'}.
 					       $delete_file);
         if ($result ne 'ok') {
-	    $r->print('<span class="LC_error"> An error occured ('.$result.
-    		      ') while trying to delete '.
-                      &display_file(undef, $delete_file).'</span><br />');
+	    $r->print('<span class="LC_error">'.
+                     &mt('An error occured ([_1]) while trying to delete 
+                         [_2].',$result,&display_file(undef, $delete_file)).
+                      '</span><br /><br />');
         } else {
             $r->print(&mt('File: [_1] deleted.',
                           &display_file(undef,$delete_file)));
@@ -563,7 +564,7 @@
                                                          $group,$file_name);
             if (keys(%access_controls) > 0) {
                 my %changes; 
-                foreach my $key (%{$access_controls{$file_name}}) {
+                foreach my $key (keys(%{$access_controls{$file_name}})) {
                     $changes{'delete'}{$key} = 1;
                 }
                 if (keys(%changes) > 0) {
@@ -573,15 +574,15 @@
                     if ($outcome ne 'ok') {
                            $r->print('<br />'.&mt("An error occured ([_1]) while ".
                                "trying to delete access controls for the file.",$outcome).
-                               '</span><br />');
+                               '</span><br /><br />');
                     } else {
                         if ($deloutcome eq 'ok') {
-                            $r->print('<br />'.&mt('Access controls also deleted for the file.'));
+                            $r->print('<br />'.&mt('Access controls also deleted for the file.').'<br /><br />');
                         } else {
                             $r->print('<span class="LC_error">'.'<br />'.
                                &mt("An error occured ([_1]) while ".
                                    "trying to delete access controls for the file.",$deloutcome).
-                                   '</span><br />');
+                                   '</span><br /><br />');
                         }
                     }
                 }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.796 loncom/lonnet/perl/lonnet.pm:1.797
--- loncom/lonnet/perl/lonnet.pm:1.796	Tue Oct 17 22:39:12 2006
+++ loncom/lonnet/perl/lonnet.pm	Thu Oct 19 17:23:23 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.796 2006/10/18 02:39:12 raeburn Exp $
+# $Id: lonnet.pm,v 1.797 2006/10/19 21:23:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5026,8 +5026,13 @@
             for (my $i=0; $i<$numnew; $i++) {
                 my $newkey = $newitems[$i];
                 my $newid = &Apache::loncommon::get_cgi_id();
-                $newkey =~ s/^(\d+)/$newid/;
-                $translation{$1} = $newid;
+                if ($newkey =~ /^\d+:/) { 
+                    $newkey =~ s/^(\d+)/$newid/;
+                    $translation{$1} = $newid;
+                } elsif ($newkey =~ /^\d+_\d+_\d+:/) {
+                    $newkey =~ s/^(\d+_\d+_\d+)/$newid/;
+                    $translation{$1} = $newid;
+                }
                 $new_values{$file_name."\0".$newkey} = 
                                           $$changes{'activate'}{$newitems[$i]};
                 $new_control{$newkey} = $now;