version 1.261, 2005/10/17 21:33:52
|
version 1.264, 2005/11/11 20:37:47
|
Line 2753 ENDMAINFORMHEAD
|
Line 2753 ENDMAINFORMHEAD
|
sub output_row { |
sub output_row { |
my ($r, $field_name, $field_text) = @_; |
my ($r, $field_name, $field_text) = @_; |
my $output; |
my $output; |
my $options=$env{'course.'.$env{'request.course.id'}.'.'.$field_name.'.options'}; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.'.$field_name.'.values'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
my $checked; |
|
unless (defined($options)) { |
unless (defined($options)) { |
$options = 'active,stuadd'; |
$options = 'active,stuadd'; |
$values = ''; |
$values = ''; |
} |
} |
$output.='<strong>'.$field_text.':</strong>'; |
$output.='<strong>'.$field_text.':</strong>'; |
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" /><br />'; |
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /><br />'; |
if ($options =~ m/active/) { |
|
$checked = ' checked="checked" '; |
my @options= ( ['active', 'Show to student'], |
} else { |
['onlyone','Student may select only one choice'], |
$checked = ' '; |
['stuadd', 'Student may type choices']); |
} |
foreach my $opt (@options) { |
$output.=' <input type="checkbox" name="'.$field_name.'_active" value="yes"'.$checked.' />'; |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
$output.='Show to student <br />'; |
$output.=(' 'x5).'<label><input type="checkbox" name="'. |
if ($options =~ m/onlyone/) { |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
$checked = ' checked="checked" '; |
&mt($opt->[1]).'</label> <br />'; |
} else { |
|
$checked = ' '; |
|
} |
|
$output.=' <input type="checkbox" name="'.$field_name.'_onlyone" value="yes"'.$checked.' />'; |
|
$output.='Student may select only one choice <br />'; |
|
if ($options =~ m/stuadd/) { |
|
$checked = ' checked="checked" '; |
|
} else { |
|
$checked = ' '; |
|
} |
} |
$output.=' <input type="checkbox" name="'.$field_name.'_stuadd" value="yes"'.$checked.' />'; |
|
$output.='Student may type choices <br />'; |
|
return ($output); |
return ($output); |
} |
} |
|
|
Line 2822 sub setrestrictmeta {
|
Line 2810 sub setrestrictmeta {
|
} |
} |
my $name = $save_field; |
my $name = $save_field; |
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{$meta_field.'.options'=>$options, |
{'metadata.'.$meta_field.'.options'=>$options, |
$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
},$dom,$crs); |
},$dom,$crs); |
} |
} |
} |
} |