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

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 10 Nov 2004 05:57:53 -0000


banghart		Wed Nov 10 00:57:53 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Answering rhetorical question (i.e., rewriting to use new
  	Apache::lonnet::is_locked subroutine).
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.55 loncom/interface/portfolio.pm:1.56
--- loncom/interface/portfolio.pm:1.55	Tue Nov  9 16:51:14 2004
+++ loncom/interface/portfolio.pm	Wed Nov 10 00:57:53 2004
@@ -251,10 +251,7 @@
     my ($r)=@_;
     my @check;
     my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
-    push @check, $file_name;
-    my %locked = &Apache::lonnet::get('file_permissions',\@check,
-                                        $ENV{'user.domain'},$ENV{'user.name'});
-    if (ref($locked{$file_name}) eq 'ARRAY') {
+    if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') {
         $r->print ("The file is locked and cannot be deleted.<br />");
         $r->print(&done());
     } else {
@@ -314,12 +311,8 @@
 
 sub rename {
     my ($r)=@_;
-    my @check;
     my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
-    push @check, $file_name;
-    my %locked = &Apache::lonnet::get('file_permissions',\@check,
-                                        $ENV{'user.domain'},$ENV{'user.name'});
-    if (ref($locked{$file_name}) eq 'ARRAY') {
+    if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'}) eq 'true') {
         $r->print ("The file is locked and cannot be renamed.<br />");
         $r->print(&done());
     } else {