--- loncom/interface/lonmeta.pm 2005/12/29 19:42:44 1.149
+++ loncom/interface/lonmeta.pm 2006/01/04 05:43:19 1.150
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.149 2005/12/29 19:42:44 albertel Exp $
+# $Id: lonmeta.pm,v 1.150 2006/01/04 05:43:19 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -358,36 +358,31 @@ sub pre_select_course {
return;
}
sub select_course {
- my %courses;
- my $output;
- my $selected;
- foreach my $key (keys(%env)) {
- if ($key =~ m/\.metadata\./) {
- $key =~ m/^course\.(.+)(\.metadata.+$)/;
- my $course = $1;
- my $coursekey = 'course.'.$course.'.description';
- my $value = $env{$coursekey};
- $courses{$coursekey} = $value;
- }
- }
- my $meta_not_found = 1;
- if ($Apache::lonpublisher::metadatafields{'courserestricted'} eq 'none') {
- $selected = ' SELECTED ';
- } else {
- $selected = '';
- }
+ my $output=$/;
+ my $current_restriction=
+ $Apache::lonpublisher::metadatafields{'courserestricted'};
+ my $selected = ($current_restriction eq 'none' ? 'selected="selected"'
+ : '');
+
$output .= '
';
return ($output);
@@ -549,7 +544,8 @@ sub prettyinput {
$size = 80;
}
my $output;
- if (defined($course_key)) {
+ if (defined($course_key)
+ && exists($env{$course_key.'.metadata.'.$type.'.options'})) {
my $stu_add;
my $only_one;
my %meta_options;
@@ -1183,7 +1179,8 @@ ENDEDIT
$Apache::lonpublisher::metadatafields{$field_name}=
join(',',&Apache::loncommon::get_env_multiple('form.new_'.$field_name));
}
- if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') {
+ if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none'
+ && exists($env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.'.$field_name.'.options'})) {
# handle restrictions here
if (($env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.'.$field_name.'.options'} =~ m/active/) ||
($field_name eq 'courserestricted')){