--- loncom/interface/lonmeta.pm 2005/12/19 21:49:12 1.146 +++ loncom/interface/lonmeta.pm 2005/12/29 19:42:44 1.149 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.146 2005/12/19 21:49:12 albertel Exp $ +# $Id: lonmeta.pm,v 1.149 2005/12/29 19:42:44 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -248,8 +248,13 @@ sub fieldnames { 'notes' => 'Notes', 'abstract' => 'Abstract', 'lowestgradelevel' => 'Lowest Grade Level', - 'highestgradelevel' => 'Highest Grade Level', - 'courserestricted' => 'Course Restricting Metadata'); + 'highestgradelevel' => 'Highest Grade Level'); + + if (! defined($file_type) || $file_type ne 'portfolio') { + %fields = + (%fields, + 'courserestricted' => 'Course Restricting Metadata'); + } if (! defined($file_type) || $file_type ne 'portfolio') { %fields = @@ -295,11 +300,13 @@ sub portfolio_linked_path { my $result = &Apache::portfolio::make_anchor('portfolio','/'); 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 .= "/$filename"; return $result; } @@ -314,7 +321,7 @@ sub portfolio_display_uri { $meta_uri .= '.meta'; } - my ($path) = ($res_uri =~ m|(.*)/[^/]*$|); + my ($path) = ($res_uri =~ m|^portfolio(.*/)[^/]*$|); if ($as_links) { $res_uri = &portfolio_linked_path($res_uri); @@ -1069,8 +1076,9 @@ sub present_editable_metadata { $disuri=~s/^\/\~/\/priv\//; $disuri=~s/\.meta$//; my $meta_uri = $disuri; + my $path; if ($disuri =~ m|/portfolio/|) { - ($disuri, $meta_uri) = &portfolio_display_uri($disuri,1); + ($disuri, $meta_uri, $path) = &portfolio_display_uri($disuri,1); } my $target=$uri; $target=~s/^\/\~/\/res\/$env{'request.role.domain'}\//; @@ -1161,12 +1169,14 @@ ENDEDIT $Apache::lonpublisher::metadatafields{'copyright'}= 'default'; } - if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') { - $r->print(&mt('Associated with course [_1]',''.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}. - '').'
'); - } else { - $r->print("This resource is not associated with a course.
"); - } + if ($file_type eq 'portfolio') { + if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') { + $r->print(&mt('Associated with course [_1]',''.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}. + '').'
'); + } else { + $r->print("This resource is not associated with a course.
"); + } + } foreach my $field_name (@fields) { if (defined($env{'form.new_'.$field_name})) { @@ -1256,8 +1266,15 @@ ENDEDIT $r->print($output.'
'); - + + if ($file_type eq 'portfolio') { + $r->print(' +

'. + ''. + ''); + } } + $r->print('
'); return;