[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 20 May 2006 06:34:51 -0000
albertel Sat May 20 02:34:51 2006 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
- metadata editor understands group portfolio files
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.154 loncom/interface/lonmeta.pm:1.155
--- loncom/interface/lonmeta.pm:1.154 Wed Apr 26 10:53:52 2006
+++ loncom/interface/lonmeta.pm Sat May 20 02:34:50 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.154 2006/04/26 14:53:52 albertel Exp $
+# $Id: lonmeta.pm,v 1.155 2006/05/20 06:34:50 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -296,15 +296,23 @@
}
sub portfolio_linked_path {
- my ($path) = @_;
- my $result = &Apache::portfolio::make_anchor('portfolio','/');
+ my ($path,$group,$port_path) = @_;
+
+ my $start = 'portfolio';
+ if ($group) {
+ $start = "groups/$group/".$start;
+ }
+ my $result = &Apache::portfolio::make_anchor($port_path,$start,'/',
+ undef,undef,undef,$group);
+
my $fullpath = '/';
my (undef,@tree) = split('/',$path);
my $filename = pop(@tree);
foreach my $dir (@tree) {
$fullpath .= $dir.'/';
$result .= '/';
- $result .= &Apache::portfolio::make_anchor($dir,$fullpath);
+ $result .= &Apache::portfolio::make_anchor($port_path,$dir,$fullpath,
+ undef,undef,undef,$group);
}
$result .= "/$filename";
return $result;
@@ -312,9 +320,17 @@
sub portfolio_display_uri {
my ($uri,$as_links)=@_;
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my ($port_path,$group);
+ if ($uri =~ m{^/editupload/\Q$cdom\E/\Q$cnum\E/groups/}) {
+ $group = (split('/',$uri))[5];
+ $port_path = '/adm/coursegrp_portfolio';
+ } else {
+ $port_path = '/adm/portfolio';
+ }
$uri =~ s|.*/(portfolio/.*)$|$1|;
my ($res_uri,$meta_uri) = ($uri,$uri);
-
if ($uri =~ /\.meta$/) {
$res_uri =~ s/\.meta//;
} else {
@@ -322,10 +338,9 @@
}
my ($path) = ($res_uri =~ m|^portfolio(.*/)[^/]*$|);
-
if ($as_links) {
- $res_uri = &portfolio_linked_path($res_uri);
- $meta_uri = &portfolio_linked_path($meta_uri);
+ $res_uri = &portfolio_linked_path($res_uri,$group,$port_path);
+ $meta_uri = &portfolio_linked_path($meta_uri,$group,$port_path);
}
return ($res_uri,$meta_uri,$path);
}
@@ -1073,7 +1088,7 @@
# Header
my $disuri=$uri;
my $fn=&Apache::lonnet::filelocation('',$uri);
- $disuri=~s/^\/\~/\/priv\//;
+ $disuri=~s{^/\~}{/priv/};
$disuri=~s/\.meta$//;
my $meta_uri = $disuri;
my $path;
@@ -1081,7 +1096,7 @@
($disuri, $meta_uri, $path) = &portfolio_display_uri($disuri,1);
}
my $target=$uri;
- $target=~s/^\/\~/\/res\/$env{'request.role.domain'}\//;
+ $target=~s{^/\~}{/res/$env{'request.role.domain'}/};
$target=~s/\.meta$//;
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target);
if ($bombs) {