[LON-CAPA-cvs] cvs: modules /gerd/harvesting lonrecommender.pm
www
www at source.lon-capa.org
Mon Jul 16 18:30:52 EDT 2012
www Mon Jul 16 22:30:52 2012 EDT
Modified files:
/modules/gerd/harvesting lonrecommender.pm
Log:
Start on directory listing
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.12 modules/gerd/harvesting/lonrecommender.pm:1.13
--- modules/gerd/harvesting/lonrecommender.pm:1.12 Mon Jul 16 18:07:24 2012
+++ modules/gerd/harvesting/lonrecommender.pm Mon Jul 16 22:30:52 2012
@@ -5,7 +5,7 @@
#
# MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
#
-# $Id: lonrecommender.pm,v 1.12 2012/07/16 18:07:24 www Exp $
+# $Id: lonrecommender.pm,v 1.13 2012/07/16 22:30:52 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -522,6 +522,40 @@
}
# =================================================================================
+# Get a directory listing. This is the only thing that is loaded "fresh",
+# since the other information has been compiled earlier
+#
+
+sub show_dir_list {
+ my ($r,$taxocats,$uri)=@_;
+ my @list=();
+ if ($uri=~/\.(page|sequence)\/$/) {
+# is a page or a sequence
+ $uri=~s/\/$//;
+ $uri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1];
+ $uri=~s/\/+/\//g;
+ foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$uri))) {
+ my @ratpart=split(/\:/,$_);
+ push(@list,&LONCAPA::map::qtescape($ratpart[1]));
+ }
+ } else {
+# is really a directory
+ my @tmplist = &Apache::lonnet::dirlist($uri);
+# deal with backward compatibility, so this runs on both 2.10 and CVS HEAD
+ if (ref($tmplist[0]) eq 'ARRAY') {
+ @list=@{$tmplist[0]};
+ } else {
+ @list=@tmplist;
+ }
+ }
+ $r->print(&submit_link('Top Level','dir:/res'));
+ foreach my $line (@list) {
+ $r->print($line."<br />");
+ }
+}
+
+
+# =================================================================================
sub handle_request {
my ($r,$c)=@_;
@@ -603,7 +637,8 @@
&display_list($r,1,\%taxonomy_categories, at selectedurls);
} elsif ($cmd eq 'search') {
} elsif ($cmd=~/^taxo\:/) {
- } elsif ($cmd=~/^dir\:/) {
+ } elsif ($cmd=~/^dir\:(.*)$/) {
+ &show_dir_list($r,\%taxonomy_categories,$1);
} elsif ($cmd=~/^indiv\:/) {
}
More information about the LON-CAPA-cvs
mailing list