[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm portfolio.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 04 Aug 2006 20:41:34 -0000
albertel Fri Aug 4 16:41:34 2006 EDT
Modified files:
/loncom/interface portfolio.pm lonaboutme.pm
Log:
- make the cat button only appear if a.meta file exists
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.143 loncom/interface/portfolio.pm:1.144
--- loncom/interface/portfolio.pm:1.143 Wed Aug 2 12:56:30 2006
+++ loncom/interface/portfolio.pm Fri Aug 4 16:41:32 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.143 2006/08/02 16:56:30 banghart Exp $
+# $Id: portfolio.pm,v 1.144 2006/08/04 20:41:32 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1476,7 +1476,6 @@
}
}
$fname=&Apache::lonnet::clean_filename($fname);
-
my $portfolio_root=&get_portfolio_root();
my ($uname,$udom) = &get_name_dom();
my $port_path = &get_port_path();
@@ -1596,7 +1595,10 @@
}
sub get_portfolio_root {
- my ($uname,$udom) = &get_name_dom();
+ my ($udom,$uname) = @_;
+ if (!defined($uname) || !defined($udom)) {
+ ($uname,$udom) = &get_name_dom();
+ }
my $path;
if (defined($env{'form.group'})) {
$path = '/userfiles/groups/'.$env{'form.group'}.'/portfolio';
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.48 loncom/interface/lonaboutme.pm:1.49
--- loncom/interface/lonaboutme.pm:1.48 Fri Aug 4 15:42:55 2006
+++ loncom/interface/lonaboutme.pm Fri Aug 4 16:41:32 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# "About Me" Personal Information
#
-# $Id: lonaboutme.pm,v 1.48 2006/08/04 19:42:55 albertel Exp $
+# $Id: lonaboutme.pm,v 1.49 2006/08/04 20:41:32 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -447,7 +447,7 @@
my $output;
if (keys(%allfileshash) > 0) {
$output = &portfolio_table_start();
- $output .= &parse_directory($r,0,\%allfileshash);
+ $output .= &parse_directory($r,0,\%allfileshash,'');
$output .= '</table>';
} else {
my $access_text;
@@ -476,10 +476,16 @@
}
sub parse_directory {
- my ($r,$depth,$currhash) = @_;
+ my ($r,$depth,$currhash,$path) = @_;
my ($cdom,$cnum,$name) = &aboutme_info($r);
$depth++;
my $output;
+
+ my $portfolio_root = &Apache::portfolio::get_portfolio_root($cdom,$cnum);
+ my %dirlist = map {
+ ((split('&',$_,2))[0],1)
+ } &Apache::lonnet::dirlist($path,$cdom,$cnum,$portfolio_root);
+ &Apache::lonnet::logthis("$path -- $portfolio_root");
foreach my $item (sort(keys(%{$currhash}))) {
$output .= &portfolio_row_start();
$output .= '<td style="padding-left: '.($depth*25).'px">';
@@ -487,7 +493,8 @@
my $title=&HTML::Entities::encode($item,'<>&"');
$output .= '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/navmap.folder.open.gif").'" alt="'.&mt('Folder').' '.$title.'" class="LC_icon" /> '.$title;
$output .= '</td><td></td></tr>';
- $output .= &parse_directory($r,$depth,$currhash->{$item});
+ $output .= &parse_directory($r,$depth,$currhash->{$item},
+ $path.'/'.$item);
} else {
my $showname;
if ($currhash->{$item} =~ m|/([^/]+)$|) {
@@ -498,11 +505,16 @@
$showname=&HTML::Entities::encode($showname,'<>&"');
my $url = '/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.
$currhash->{$item};
- $output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" /> <a href="'.$url.'">'.$showname.'</a>';
- $output.='</td><td><a href="'.$url.'.meta"><img align="right" alt="'.&mt('Catalog Information').'" src="'.
+ $output .= '<a href="'.$url.'">'.
+ '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" />'.
+ ' '.$showname.'</a>';
+ $output.='</td><td>';
+ &Apache::lonnet::logthis("sh $showname");
+ if (exists($dirlist{$showname.'.meta'})) {
+ $output.= '<a href="'.$url.'.meta"><img alt="'.&mt('Catalog Information').'" src="'.
&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').
- '" /></a>';
-
+ '" class="LC_icon" /></a>';
+ }
$output .= '</td></tr>';
}
}