[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Tue, 22 Nov 2005 19:43:53 -0000
banghart Tue Nov 22 14:43:53 2005 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
remove $_, rename some variables, remove useless code
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.131 loncom/interface/lonmeta.pm:1.132
--- loncom/interface/lonmeta.pm:1.131 Sat Nov 19 17:47:07 2005
+++ loncom/interface/lonmeta.pm Tue Nov 22 14:43:53 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.131 2005/11/19 22:47:07 albertel Exp $
+# $Id: lonmeta.pm,v 1.132 2005/11/22 19:43:53 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -490,26 +490,26 @@
my %meta_options;
my @cur_values_inst;
my $cur_values_stu;
- my $values = $env{$course_key.'.metadata.'.$_.'.values'};
- if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) {
+ my $values = $env{$course_key.'.metadata.'.$type.'.values'};
+ if ($env{$course_key.'.metadata.'.$type.'.options'} =~ m/stuadd/) {
$stu_add = 'true';
}
- if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) {
+ if ($env{$course_key.'.metadata.'.$type.'.options'} =~ m/onlyone/) {
$only_one = 'true';
}
# need to take instructor values out of list where instructor and student
# values may be mixed.
if ($values && $stu_add) {
- foreach (split(/,/,$values)) {
- $_ =~ s/^\s+//;
- $meta_options{$_} = $_;
+ foreach my $item (split(/,/,$values)) {
+ $item =~ s/^\s+//;
+ $meta_options{$item} = $type;
}
- foreach (split(/,/,$value)) {
- $_ =~ s/^\s+//;
- if ($meta_options{$_}) {
- push(@cur_values_inst,$_);
+ foreach my $item (split(/,/,$value)) {
+ $item =~ s/^\s+//;
+ if ($meta_options{$item}) {
+ push(@cur_values_inst,$item);
} else {
- $cur_values_stu .= $_.',';
+ $cur_values_stu .= $item.',';
}
}
} else {
@@ -1099,44 +1099,38 @@
if ($metacourse ne 'none') {
$r->print('Document metadata restricted by :<strong> '.$env{$metacourse.".description"}."</strong><br />");
}
-
- foreach (@fields) {
- if (defined($env{'form.new_'.$_})) {
- $Apache::lonpublisher::metadatafields{$_}=
- join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_));
+ foreach my $field_name(@fields) {
+
+ if (defined($env{'form.new_'.$field_name})) {
+ $Apache::lonpublisher::metadatafields{$field_name}=
+ join(',',&Apache::loncommon::get_env_multiple('form.new_'.$field_name));
}
- my $field_name = $_;
if ($metacourse ne 'none') {
# handle restrictions here
- if ($env{$metacourse.'.metadata.'.$_.'.options'} =~ m/active/){
- $output.=('<p>'.$lt{$_}.': '.
- &prettyinput($_,
- $Apache::lonpublisher::metadatafields{$_},
- 'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');
- } elsif ($_ eq 'courserestricted') {
+ if ($env{$metacourse.'.metadata.'.$field_name.'.options'} =~ m/active/){
+ $output.=('<p>'.$lt{$field_name}.': '.
+ &prettyinput($field_name,
+ $Apache::lonpublisher::metadatafields{$field_name},
+ 'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');
+ } elsif ($field_name eq 'courserestricted') {
$output.=(
&prettyinput($field_name,
- $Apache::lonpublisher::metadatafields{$_},
+ $Apache::lonpublisher::metadatafields{$field_name},
'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse));
}
} else {
- if ($_ ne 'courserestricted') {
- $output.=('<p>'.$lt{$_}.': '.
- &prettyinput($_,
- $Apache::lonpublisher::metadatafields{$_},
- 'new_'.$_,'defaultmeta').'</p>');
+ if ($field_name ne 'courserestricted') {
+ $output.=('<p>'.$lt{$field_name}.': '.
+ &prettyinput($field_name,
+ $Apache::lonpublisher::metadatafields{$field_name},
+ 'new_'.$field_name,'defaultmeta').'</p>');
} else {
$output.=&prettyinput($field_name,
- $Apache::lonpublisher::metadatafields{$_},
+ $Apache::lonpublisher::metadatafields{$field_name},
'new_'.$field_name,'defaultmeta');
}
}
}
- $output.=('<p>'.$lt{$_}.': '.
- &prettyinput($_,
- $Apache::lonpublisher::metadatafields{$_},
- 'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');
-
if ($env{'form.store'}) {
my $mfh;
my $formname='store';