version 1.258, 2005/10/06 22:05:56
|
version 1.263, 2005/11/04 20:08:09
|
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 2758 sub output_row {
|
Line 2758 sub output_row {
|
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 = ''; |
} |
} |
|
$output.='<strong>'.$field_text.':</strong>'; |
|
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" /><br />'; |
if ($options =~ m/active/) { |
if ($options =~ m/active/) { |
$checked = ' checked="checked" '; |
$checked = ' checked="checked" '; |
} else { |
} else { |
$checked = ' '; |
$checked = ' '; |
} |
} |
$output.='<tr><td><center><input type="checkbox" name="'.$field_name.'_active" value="yes"'.$checked.' /></center></td>'; |
$output.=' <input type="checkbox" name="'.$field_name.'_active" value="yes"'.$checked.' />'; |
$output.='<td><strong>'.$field_text.'</strong></td>'; |
$output.='Show to student <br />'; |
$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="checked" '; |
} else { |
} else { |
$checked = ' '; |
$checked = ' '; |
} |
} |
$output.='<td><center><input type="checkbox" name="'.$field_name.'_onlyone" value="yes"'.$checked.' /></center></td>'; |
$output.=' <input type="checkbox" name="'.$field_name.'_onlyone" value="yes"'.$checked.' />'; |
|
$output.='Student may select only one choice <br />'; |
if ($options =~ m/stuadd/) { |
if ($options =~ m/stuadd/) { |
$checked = ' checked="checked" '; |
$checked = ' checked="checked" '; |
} else { |
} else { |
$checked = ' '; |
$checked = ' '; |
} |
} |
$output.='<td><input type="checkbox" name="'.$field_name.'_stuadd" value="yes"'.$checked.' /></td>'; |
$output.=' <input type="checkbox" name="'.$field_name.'_stuadd" value="yes"'.$checked.' />'; |
|
$output.='Student may type choices <br />'; |
$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 2792 sub setinstmeta {
|
Line 2794 sub setinstmeta {
|
my $put_result; |
my $put_result; |
$r->print(&Apache::lonxml::xmlbegin()); |
$r->print(&Apache::lonxml::xmlbegin()); |
$r->print('<head> |
$r->print('<head> |
<title>LON-CAPA Set Portfolio Metadata</title> |
<title>LON-CAPA Restrict Metadata</title> |
</head>'); |
</head>'); |
$r->print(&Apache::loncommon::bodytag('Set Portfolio Metadata')); |
$r->print(&Apache::loncommon::bodytag('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
'Set Portfolio Metadata')); |
'Restrict 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 2818 sub setinstmeta {
|
Line 2820 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, |
{'metadata.'.$meta_field.'.options'=>$options, |
'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
Line 2826 sub setinstmeta {
|
Line 2828 sub setinstmeta {
|
} |
} |
} |
} |
} |
} |
|
|
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
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}); |
$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> |
|
<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> |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
<input type="submit" name="instmeta" value="Update Portfolio Metadata"> |
|
</form> |
</form> |
|
|
ENDenv |
ENDenv |
|
|
|
|
$r->print('</body> |
$r->print('</body> |
</html>'); |
</html>'); |
return 'ok'; |
return 'ok'; |
Line 3024 Main handler. Calls &assessparms and &c
|
Line 3017 Main handler. Calls &assessparms and &c
|
################################################## |
################################################## |
# use Data::Dumper; |
# use Data::Dumper; |
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 3084 sub handler {
|
Line 3078 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"}); |