[LON-CAPA-cvs] cvs: modules /gerd/harvesting lonrecommender.pm
www
www at source.lon-capa.org
Mon Jul 16 20:11:43 EDT 2012
www Tue Jul 17 00:11:43 2012 EDT
Modified files:
/modules/gerd/harvesting lonrecommender.pm
Log:
Continued work on directory listings
Index: modules/gerd/harvesting/lonrecommender.pm
diff -u modules/gerd/harvesting/lonrecommender.pm:1.13 modules/gerd/harvesting/lonrecommender.pm:1.14
--- modules/gerd/harvesting/lonrecommender.pm:1.13 Mon Jul 16 22:30:52 2012
+++ modules/gerd/harvesting/lonrecommender.pm Tue Jul 17 00:11:42 2012
@@ -5,7 +5,7 @@
#
# MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
#
-# $Id: lonrecommender.pm,v 1.13 2012/07/16 22:30:52 www Exp $
+# $Id: lonrecommender.pm,v 1.14 2012/07/17 00:11:42 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -462,7 +462,7 @@
#
sub showurl {
- my ($url)=@_;
+ my ($url,$dirflag)=@_;
$url=~s/^\/?res\///;
my @parts=split(/\//,$url);
my $output='';
@@ -471,7 +471,11 @@
$thusfar.='/'.$parts[$i];
$output.=' / '.&submit_link($parts[$i],'dir:/res'.$thusfar);
}
- $output.=' / '.&submit_link($parts[-1],'indiv:/res/'.$url);
+ if (($dirflag) || ($url=~/\.(page|sequence)$/)) {
+ $output.=' / '.&submit_link($parts[-1],'dir:/res/'.$url);
+ } else {
+ $output.=' / '.&submit_link($parts[-1],'indiv:/res/'.$url);
+ }
return $output;
}
@@ -529,11 +533,8 @@
sub show_dir_list {
my ($r,$taxocats,$uri)=@_;
my @list=();
- if ($uri=~/\.(page|sequence)\/$/) {
+ 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]));
@@ -548,10 +549,39 @@
@list=@tmplist;
}
}
- $r->print(&submit_link('Top Level','dir:/res'));
+ $r->print(&submit_link(&mt('Domain Level'),'dir:/res')."<br />\n");
+ $r->print('<h2>'.$uri.'</h2>');
+ $r->print('<table border="1" bgcolor="#DDFFDD">');
foreach my $line (@list) {
- $r->print($line."<br />");
+ my @components=split(/\&/,$line);
+ my $fn=$components[0];
+ if ($fn=~/\.(meta|bak|save)$/) { next; }
+ if ($fn=~/\.\d+\.\w+$/) { next; }
+ if ($fn=~/^\.+$/) { next; }
+ my $type=$components[-1];
+ if ($type eq 'domain') {
+ $fn=~s/^\/home\/httpd\/html//;
+ } elsif ($uri!~/\.(page|sequence)$/) {
+ $fn=$uri.'/'.$fn;
+ $fn=~s/\/+/\//gs;
+ }
+ my $dirflag=0;
+ my $addflag=1;
+ if (($type eq 'domain') || ($type eq 'user')) {
+ $addflag=0;
+ $dirflag=1;
+ }
+ $r->print("<tr><td>");
+ if ($addflag) {
+ $r->print(&submit_link(&mt('Add'),'add:'.$fn));
+ } else {
+ $r->print(' ');
+ }
+ $r->print('</td><td>');
+ $r->print(&showurl($fn,$dirflag));
+ $r->print("</td></tr>\n");
}
+ $r->print("</table>\n");
}
More information about the LON-CAPA-cvs
mailing list