--- loncom/interface/lonmeta.pm 2005/12/19 21:17:25 1.144
+++ loncom/interface/lonmeta.pm 2005/12/19 21:49:12 1.146
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.144 2005/12/19 21:17:25 albertel Exp $
+# $Id: lonmeta.pm,v 1.146 2005/12/19 21:49:12 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -290,8 +290,21 @@ sub fieldnames {
return &Apache::lonlocal::texthash(%fields);
}
+sub portfolio_linked_path {
+ my ($path) = @_;
+ my $result = &Apache::portfolio::make_anchor('portfolio','/');
+ my $fullpath = '/';
+ my (undef,@tree) = split('/',$path);
+ foreach my $dir (@tree) {
+ $fullpath .= $dir.'/';
+ $result .= '/';
+ $result .= &Apache::portfolio::make_anchor($dir,$fullpath);
+ }
+ return $result;
+}
+
sub portfolio_display_uri {
- my ($uri)=@_;
+ my ($uri,$as_links)=@_;
$uri =~ s|.*/(portfolio/.*)$|$1|;
my ($res_uri,$meta_uri) = ($uri,$uri);
@@ -300,14 +313,21 @@ sub portfolio_display_uri {
} else {
$meta_uri .= '.meta';
}
- return ($res_uri,$meta_uri);
+
+ my ($path) = ($res_uri =~ m|(.*)/[^/]*$|);
+
+ if ($as_links) {
+ $res_uri = &portfolio_linked_path($res_uri);
+ $meta_uri = &portfolio_linked_path($meta_uri);
+ }
+ return ($res_uri,$meta_uri,$path);
}
sub pre_select_course {
my ($r,$uri) = @_;
my $output;
my $fn=&Apache::lonnet::filelocation('',$uri);
- my ($res_uri,$meta_uri) = &portfolio_display_uri($uri);
+ my ($res_uri,$meta_uri,$path) = &portfolio_display_uri($uri);
%Apache::lonpublisher::metadatafields=();
%Apache::lonpublisher::metadatakeys=();
my $result=&Apache::lonnet::getfile($fn);
@@ -322,13 +342,19 @@ sub pre_select_course {
$r->print($output.'
');
$r->print('');
+
+ $r->print('