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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 25 Sep 2003 20:39:32 -0000


albertel		Thu Sep 25 16:39:32 2003 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm 
  Log:
  - better search for metadata when directory in CSTR
  - understand ~ CSTR space directories
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.46 loncom/interface/lonhelper.pm:1.47
--- loncom/interface/lonhelper.pm:1.46	Tue Sep 16 16:00:57 2003
+++ loncom/interface/lonhelper.pm	Thu Sep 25 16:39:32 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.46 2003/09/16 20:00:57 bowersj2 Exp $
+# $Id: lonhelper.pm,v 1.47 2003/09/25 20:39:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2308,9 +2308,17 @@
     my @fileList;
 
     # If the subdirectory is in local CSTR space
-    if ($subdir =~ m|/home/([^/]+)/public_html|) {
+    my $metadir;
+    if ($subdir =~ m|/home/([^/]+)/public_html/(.*)|) {
         my $user = $1;
         my $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
+	$metadir='/res/'.$domain.'/'.$user.'/'.$2;
+        @fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, '');
+    } elsif ($subdir =~ m|^~([^/]+)/(.*)$|) {
+	$subdir='/home/'.$1.'/public_html/'.$2;
+        my $user = $1;
+        my $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
+	$metadir='/res/'.$domain.'/'.$user.'/'.$2;
         @fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, '');
     } else {
         # local library server resource space
@@ -2349,7 +2357,7 @@
 	    }
 
             # Get the title
-            my $title = Apache::lonpubdir::getTitleString($fileName);
+            my $title = Apache::lonpubdir::getTitleString(($metadir?$metadir:$subdir) .'/'. $file);
 
             # Netscape 4 is stupid and there's nowhere to put the
             # information on the input tag that the file is Published,
@@ -2387,7 +2395,7 @@
     $result .= "</table>\n";
 
     if (!$choices) {
-        $result .= '<font color="#FF0000">There are no files available to select in this directory. Please go back and select another option.</font><br /><br />';
+        $result .= '<font color="#FF0000">There are no files available to select in this directory ('.$subdir.'). Please go back and select another option.</font><br /><br />';
     }
 
     $result .= $buttons;