version 1.125, 2005/11/11 21:25:50
|
version 1.128, 2005/11/18 23:47:33
|
Line 483 sub prettyinput {
|
Line 483 sub prettyinput {
|
if (! defined($size)) { |
if (! defined($size)) { |
$size = 80; |
$size = 80; |
} |
} |
|
my $output; |
if (defined($course_key)) { |
if (defined($course_key)) { |
my $stu_add; |
my $stu_add; |
my $only_one; |
my $only_one; |
|
my %meta_options; |
|
my @cur_values_inst; |
|
my $cur_values_stu; |
my $values = $env{$course_key.'.metadata.'.$_.'.values'}; |
my $values = $env{$course_key.'.metadata.'.$_.'.values'}; |
if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) { |
if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) { |
$stu_add = 'true'; |
$stu_add = 'true'; |
Line 493 sub prettyinput {
|
Line 497 sub prettyinput {
|
if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) { |
if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) { |
$only_one = 'true'; |
$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 (split(/,/,$value)) { |
|
$_ =~ s/^\s+//; |
|
if ($meta_options{$_}) { |
|
push(@cur_values_inst,$_); |
|
} else { |
|
$cur_values_stu .= $_.','; |
|
} |
|
} |
|
} |
if ($type eq 'author') { |
if ($type eq 'author') { |
return |
return |
'<input type="text" name="'.$fieldname.'" size="'.$size.'" '. |
'<input type="text" name="'.$fieldname.'" size="'.$size.'" '. |
Line 511 sub prettyinput {
|
Line 531 sub prettyinput {
|
if ($type eq 'subject') { |
if ($type eq 'subject') { |
} |
} |
if ($type eq 'keywords') { |
if ($type eq 'keywords') { |
my %hash; |
|
my $def; |
|
my @cur_values; |
|
foreach (split(/,/,$value)) { |
|
$_ =~ s/^\s+//; |
|
push(@cur_values,$_); |
|
} |
|
foreach (split(/,/,$values)) { |
|
$_ =~ s/^\s+//; |
|
$hash{$_} = $_; |
|
} |
|
if ($only_one) { |
if ($only_one) { |
return(&Apache::loncommon::select_form($def,'new_keywords',%hash)); |
$output .= (&Apache::loncommon::select_form($value,'new_keywords',%meta_options)); |
} else { |
} else { |
return (&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values,undef,\%hash)); |
$output .= (&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values_inst,undef,\%meta_options)); |
} |
} |
|
if ($stu_add) { |
|
$output .= '<input type="text" name="'.$fieldname.'" size="'.$size.'" '. |
|
'value="'.$cur_values_stu.'" />'. |
|
&relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname, |
|
$relatedvalue); |
|
} |
|
return ($output); |
} |
} |
if ($type eq 'notes') { |
if ($type eq 'notes') { |
} |
} |
Line 1102 ENDEDIT
|
Line 1118 ENDEDIT
|
$Apache::lonpublisher::metadatafields{$_}= |
$Apache::lonpublisher::metadatafields{$_}= |
join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_)); |
join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_)); |
} |
} |
|
my $field_name = $_; |
if ($metacourse ne 'none') { |
if ($metacourse ne 'none') { |
# handle restrictions here |
# handle restrictions here |
if (($env{$metacourse.'.metadata.'.$_.'.options'} =~ m/active/)|| |
if ($env{$metacourse.'.metadata.'.$_.'.options'} =~ m/active/){ |
($_ eq 'courserestricted')) { |
|
$output.=('<p>'.$lt{$_}.': '. |
$output.=('<p>'.$lt{$_}.': '. |
&prettyinput($_, |
&prettyinput($_, |
$Apache::lonpublisher::metadatafields{$_}, |
$Apache::lonpublisher::metadatafields{$_}, |
'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>'); |
'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>'); |
} |
} elsif ($_ eq 'courserestricted') { |
|
$output.=( |
|
&prettyinput($field_name, |
|
$Apache::lonpublisher::metadatafields{$_}, |
|
'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse)); |
|
} |
} else { |
} else { |
$output.=('<p>'.$lt{$_}.': '. |
if ($_ ne 'courserestricted') { |
|
$output.=('<p>'.$lt{$_}.': '. |
&prettyinput($_, |
&prettyinput($_, |
$Apache::lonpublisher::metadatafields{$_}, |
$Apache::lonpublisher::metadatafields{$_}, |
'new_'.$_,'defaultmeta').'</p>'); |
'new_'.$_,'defaultmeta').'</p>'); |
|
} else { |
|
$output.=&prettyinput($field_name, |
|
$Apache::lonpublisher::metadatafields{$_}, |
|
'new_'.$field_name,'defaultmeta'); |
|
} |
} |
} |
} |
} |
|
$output.=('<p>'.$lt{$_}.': '. |
|
&prettyinput($_, |
|
$Apache::lonpublisher::metadatafields{$_}, |
|
'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>'); |
|
|
if ($env{'form.store'}) { |
if ($env{'form.store'}) { |
my $mfh; |
my $mfh; |
my $formname='store'; |
my $formname='store'; |