[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Mon, 20 Nov 2006 19:39:23 -0000
banghart Mon Nov 20 14:39:23 2006 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
Allow changing metadata course association.
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.187 loncom/interface/lonmeta.pm:1.188
--- loncom/interface/lonmeta.pm:1.187 Mon Nov 20 13:54:55 2006
+++ loncom/interface/lonmeta.pm Mon Nov 20 14:39:22 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.187 2006/11/20 18:54:55 banghart Exp $
+# $Id: lonmeta.pm,v 1.188 2006/11/20 19:39:22 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -724,7 +724,7 @@
sub handler {
my $r=shift;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['currentpath']);
+ ['currentpath','changecourse']);
my $uri=$r->uri;
#
# Set document type
@@ -752,7 +752,8 @@
my $result=&Apache::lonnet::getfile($fn);
&Apache::lonpublisher::metaeval($result);
&Apache::lonnet::logthis("restricted is: ".$Apache::lonpublisher::metadatafields{'courserestricted'});
- if (!$Apache::lonpublisher::metadatafields{'courserestricted'}) {
+ if ((!$Apache::lonpublisher::metadatafields{'courserestricted'}) ||
+ ($env{'form.changecourse'} eq 'true')) {
&pre_select_course($r,$uri);
} else {
&present_editable_metadata($r,$uri,'portfolio');
@@ -1252,10 +1253,13 @@
}
if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') {
- $r->print(&mt('Associated with course [_1]','<strong>'.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}.
- '</strong>').'<br />');
+ $r->print(&mt('Associated with course [_1]',
+ '<strong><a href="'.$uri.'?changecourse=true">'.
+ $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.
+ ".description"}.
+ '</a></strong>').'<br />');
} else {
- $r->print("This resource is not associated with a course.<br />");
+ $r->print('<a href="'.$uri.'?changecourse=true">This resource is not associated with a course.</a><br />');
}
}
if (@added_order) {