version 1.255, 2005/09/30 00:27:20
|
version 1.259, 2005/10/14 04:25:56
|
Line 2703 ENDMAINFORMHEAD
|
Line 2703 ENDMAINFORMHEAD
|
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Set Portfolio Metadata', |
{ text => 'Set Portfolio Metadata', |
action => 'setinstmeta', |
action => 'setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
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'}.'.metadata.'.$field_name.'.options'}; |
my $options=$env{'course.'.$env{'request.course.id'}.'.'.$field_name.'.options'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.'.$field_name.'.values'}; |
my $checked; |
my $checked; |
unless (defined($options)) { |
unless (defined($options)) { |
$options = 'active,stuadd'; |
$options = 'active,stuadd'; |
$values = 'Type a list of values separated by commas.'; |
$values = 'Type a list of values separated by commas.'; |
} |
} |
$output.='<tr><td><strong>'.$field_text.'</strong></td>'; |
if ($options =~ m/active/) { |
|
$checked = ' checked="checked" '; |
|
} else { |
|
$checked = ' '; |
|
} |
|
$output.='<tr><td><center><input type="checkbox" name="'.$field_name.'_active" value="yes"'.$checked.' /></center></td>'; |
|
$output.='<td><strong>'.$field_text.'</strong></td>'; |
$output.='<td><input name="'.$field_name.'_values" type="text" value="'.$values.'" /></td>'; |
$output.='<td><input name="'.$field_name.'_values" type="text" value="'.$values.'" /></td>'; |
if ($options =~ m/onlyone/) { |
if ($options =~ m/onlyone/) { |
$checked = ' CHECKED '; |
$checked = ' checked="checked" '; |
} else { |
} else { |
$checked = ' '; |
$checked = ' '; |
} |
} |
$output.='<td><center><input type="checkbox" name="'.$field_name.'_onlyone"" value="yes"'.$checked.' /></center></td>'; |
$output.='<td><center><input type="checkbox" name="'.$field_name.'_onlyone" value="yes"'.$checked.' /></center></td>'; |
if ($options =~ m/stuadd/) { |
if ($options =~ m/stuadd/) { |
$checked = ' CHECKED '; |
$checked = ' checked="checked" '; |
} else { |
} else { |
$checked = ' '; |
$checked = ' '; |
} |
} |
Line 2778 sub output_row {
|
Line 2784 sub output_row {
|
$output.='</tr>'; |
$output.='</tr>'; |
return ($output); |
return ($output); |
} |
} |
sub setinstmeta { |
|
|
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
my $next_meta; |
my $next_meta; |
my $output; |
my $output; |
Line 2793 sub setinstmeta {
|
Line 2800 sub setinstmeta {
|
'Set Portfolio Metadata')); |
'Set Portfolio Metadata')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.metadata.'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $save_field = ''; |
my $save_field = ''; |
if ($env{'form.instmeta'}) { |
if ($env{'form.restrictmeta'}) { |
foreach my $field (sort(keys(%env))) { |
foreach my $field (sort(keys(%env))) { |
if ($field=~m/^form.(.+)_(.+)$/) { |
if ($field=~m/^form.(.+)_(.+)$/) { |
my $options; |
my $options; |
Line 2812 sub setinstmeta {
|
Line 2819 sub setinstmeta {
|
if ($env{'form.'.$meta_field.'_active'}) { |
if ($env{'form.'.$meta_field.'_active'}) { |
$options.='active,'; |
$options.='active,'; |
} |
} |
my $name = 'metadata.'.$save_field; |
my $name = $save_field; |
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options, |
{$meta_field.'.options'=>$options, |
'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
},$dom,$crs); |
},$dom,$crs); |
} |
} |
} |
} |
Line 2823 sub setinstmeta {
|
Line 2830 sub setinstmeta {
|
|
|
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
my %metadata_fields = &Apache::lonmeta::fieldnames(); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
|
|
foreach my $field (sort(keys (%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
|
$output.= &output_row($r, $field, $metadata_fields{$field}); |
if ($field =~ m/metadata/) { |
|
$output.= &output_row($r, $field, $metadata_fields{$field}); |
|
} |
|
} |
} |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
<form method="post" action="/adm/parmset?action=setinstmeta" name="form"> |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
|
|
<p> |
<p> |
<table border=2> |
<table border=2> |
<tr><th>Metadata Item</th><th>Values</th><th>Only One Choice</th><th>Student Can Add Choices</th></tr> |
<tr><th>Active</th><th>Metadata Item</th><th>Values</th><th>Only One Choice</th><th>Student Can Add Choices</th></tr> |
$output |
$output |
</table> |
</table> |
<input type="submit" name="instmeta" value="Update Portfolio Metadata"> |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
</form> |
</form> |
|
|
ENDenv |
ENDenv |
Line 3021 Main handler. Calls &assessparms and &c
|
Line 3025 Main handler. Calls &assessparms and &c
|
################################################## |
################################################## |
# use Data::Dumper; |
# use Data::Dumper; |
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 3081 sub handler {
|
Line 3086 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
&overview($r); |
&overview($r); |
} elsif ($env{'form.action'} eq 'setinstmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setinstmeta', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
text=>"Portfolio Metadata"}); |
text=>"Restrict Metadata"}); |
&setinstmeta($r); |
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |