[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 07 Aug 2006 19:51:55 -0000
albertel Mon Aug 7 15:51:55 2006 EDT
Modified files:
/loncom/interface lonaboutme.pm
Log:
- use the title in the listing if one exists
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.49 loncom/interface/lonaboutme.pm:1.50
--- loncom/interface/lonaboutme.pm:1.49 Fri Aug 4 16:41:32 2006
+++ loncom/interface/lonaboutme.pm Mon Aug 7 15:51:54 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# "About Me" Personal Information
#
-# $Id: lonaboutme.pm,v 1.49 2006/08/04 20:41:32 albertel Exp $
+# $Id: lonaboutme.pm,v 1.50 2006/08/07 19:51:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -485,7 +485,6 @@
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">';
@@ -496,21 +495,35 @@
$output .= &parse_directory($r,$depth,$currhash->{$item},
$path.'/'.$item);
} else {
- my $showname;
- if ($currhash->{$item} =~ m|/([^/]+)$|) {
- $showname = $1;
- } else {
- $showname = $currhash->{$item};
- }
- $showname=&HTML::Entities::encode($showname,'<>&"');
+
+
+ my $file_name;
+ if ($currhash->{$item} =~ m|/([^/]+)$|) {
+ $file_name = $1;
+ } else {
+ $file_name = $currhash->{$item};
+ }
+ my $have_meta = exists($dirlist{$file_name.'.meta'});
my $url = '/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.
$currhash->{$item};
+
+ my $showname;
+ if ($have_meta) {
+ $showname = &Apache::lonnet::metadata($url,'title');
+ }
+ if ($showname eq '') {
+ $showname = $file_name;
+ } else {
+ $showname = $file_name.' ('.$showname.')';
+ }
+
+ $showname=&HTML::Entities::encode($showname,'<>&"');
$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'})) {
+ if ($have_meta) {
$output.= '<a href="'.$url.'.meta"><img alt="'.&mt('Catalog Information').'" src="'.
&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').
'" class="LC_icon" /></a>';