[LON-CAPA-cvs] cvs: modules /gerd/harvesting lonrecommender.pm

www www at source.lon-capa.org
Tue Jul 17 10:13:31 EDT 2012


www		Tue Jul 17 14:13:31 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonrecommender.pm 
  Log:
  Titles in directory listings
  
  
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.16 modules/gerd/harvesting/lonrecommender.pm:1.17
--- modules/gerd/harvesting/lonrecommender.pm:1.16	Tue Jul 17 12:41:46 2012
+++ modules/gerd/harvesting/lonrecommender.pm	Tue Jul 17 14:13:31 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonrecommender.pm,v 1.16 2012/07/17 12:41:46 www Exp $
+# $Id: lonrecommender.pm,v 1.17 2012/07/17 14:13:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@
 use Apache::groupsort();
 use LONCAPA::map();
 use GDBM_File;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
 
 # PROTOTYPE ROUTINES --- These are the routines needed to run the prototype
 # Accessing the data files in $datapath
@@ -549,9 +549,11 @@
          @list=@tmplist;
       }
    }
+# @list now has the files from the directory or sequence
    $r->print(&submit_link(&mt('Domain Level'),'dir:/res')."<br />\n");
    $r->print('<h2>'.$uri.'</h2>');
    $r->print('<table border="1" bgcolor="#DDFFDD">');
+# Now go through the list
    foreach my $line (@list) {
       my @components=split(/\&/,$line);
       my $fn=$components[0];
@@ -559,8 +561,11 @@
       if ($fn=~/\.\d+\.\w+$/) { next; }
       if ($fn=~/^\.+$/) { next; }
       my $type=$components[-1];
+      my $title='';
       if ($type eq 'domain') {
          $fn=~s/^\/home\/httpd\/html//;
+         $fn=~/^\/res\/($match_domain)\//;
+         $title=&Apache::lonnet::domain($1,'description');
       } elsif ($uri!~/\.(page|sequence)$/) {
          $fn=$uri.'/'.$fn;
          $fn=~s/\/+/\//gs;
@@ -569,6 +574,12 @@
             unless ((&Apache::lonnet::allowed('bre',$fn)) || 
                     (&Apache::lonnet::allowed('bro',$fn))) { next; }
          }
+         if ($type eq 'user') {
+            $fn=~/^\/res\/($match_domain)\/($match_username)$/;
+            $title=&Apache::loncommon::plainname($2,$1);
+         } else {
+            $title=&Apache::lonnet::gettitle($fn);
+         }
       }
       my $dirflag=0;
       my $addflag=1;
@@ -592,6 +603,12 @@
          $r->print(' ');
       }
       $r->print('</td><td>');
+      if ($title) {
+         $r->print($title);
+      } else {
+         $r->print(' ');
+      }
+      $r->print('</td><td>');
       $r->print(&showurl($fn,$dirflag));
       $r->print("</td></tr>\n");
    }




More information about the LON-CAPA-cvs mailing list