[LON-CAPA-cvs] cvs: loncom /publisher lonpubdir.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 28 23:33:23 EDT 2014


raeburn		Sun Jun 29 03:33:23 2014 EDT

  Modified files:              
    /loncom/publisher	lonpubdir.pm 
  Log:
  - Exclude . and .. from directory listing when determining if directory
    is empty. Correction to regexps added in rev. 1.157
  
  
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.157 loncom/publisher/lonpubdir.pm:1.158
--- loncom/publisher/lonpubdir.pm:1.157	Mon Jun 23 17:02:49 2014
+++ loncom/publisher/lonpubdir.pm	Sun Jun 29 03:33:23 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Authoring Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.157 2014/06/23 17:02:49 raeburn Exp $
+# $Id: lonpubdir.pm,v 1.158 2014/06/29 03:33:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,7 +100,7 @@
     }
     my @files;
     if (opendir(DIR,$fn)) {
-        @files = readdir(DIR);
+        @files = grep(!/^\.+$/,readdir(DIR));
         closedir(DIR);
     } else {
         $r->print('<p class="LC_error">'.&mt('Could not open directory.').'</p>');
@@ -126,8 +126,8 @@
     my $sortby = $env{'form.sortby'};
     my $sortorder = $env{'form.sortorder'};
 
-    if ((@files == 0) && ($thisdisfn =~ m{^/$match_domain/$match_username/priv})) {
-        if ($thisdisfn =~ m{^/$match_domain/$match_username/priv$}) {
+    if ((@files == 0) && ($thisdisfn =~ m{^/$match_domain/$match_username})) {
+        if ($thisdisfn =~ m{^/$match_domain/$match_username$}) {
             $r->print('<p class="LC_info">'.&mt('This Authoring Space is currently empty.').'</p>');
         } else {
             $r->print('<p class="LC_info">'.&mt('This subdirectory is currently empty.').'</p>');




More information about the LON-CAPA-cvs mailing list