--- loncom/interface/lonaboutme.pm 2006/08/04 19:42:55 1.48
+++ loncom/interface/lonaboutme.pm 2006/08/07 19:51:54 1.50
@@ -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.50 2006/08/07 19:51:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -447,7 +447,7 @@ sub portfolio_files {
my $output;
if (keys(%allfileshash) > 0) {
$output = &portfolio_table_start();
- $output .= &parse_directory($r,0,\%allfileshash);
+ $output .= &parse_directory($r,0,\%allfileshash,'');
$output .= '';
} else {
my $access_text;
@@ -476,10 +476,15 @@ sub portfolio_files {
}
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);
foreach my $item (sort(keys(%{$currhash}))) {
$output .= &portfolio_row_start();
$output .= '
';
@@ -487,22 +492,42 @@ sub parse_directory {
my $title=&HTML::Entities::encode($item,'<>&"');
$output .= ' '.$title;
$output .= ' | | ';
- $output .= &parse_directory($r,$depth,$currhash->{$item});
+ $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};
- $output .= '
'.$showname.'';
- $output.=' ';
+ 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 .= ''.
+ ' '.
+ ' '.$showname.'';
+ $output.=' | ';
+ &Apache::lonnet::logthis("sh $showname");
+ if ($have_meta) {
+ $output.= ' ';
+ }
$output .= ' | ';
}
}