version 1.254, 2005/09/29 21:10:32
|
version 1.259, 2005/10/14 04:25:56
|
Line 2702 ENDMAINFORMHEAD
|
Line 2702 ENDMAINFORMHEAD
|
action => 'crsenv', |
action => 'crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Set Instructor Defined 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 2749 ENDMAINFORMHEAD
|
Line 2749 ENDMAINFORMHEAD
|
$r->print($menu_html); |
$r->print($menu_html); |
return; |
return; |
} |
} |
### Set instructor defined metadata |
### Set portfolio metadata |
sub output_row { |
sub output_row { |
my ($r, $field_name) = @_; |
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_name.'</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 2786 sub setinstmeta {
|
Line 2793 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 Instructor Metadata</title> |
<title>LON-CAPA Set Portfolio Metadata</title> |
</head>'); |
</head>'); |
$r->print(&Apache::loncommon::bodytag('Set Instructor Metadata')); |
$r->print(&Apache::loncommon::bodytag('Set Portfolio Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
'Set Instructor 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'}); |
$output.= &output_row($r, "Title"); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
$output.= &output_row($r, "Subject"); |
|
$output.= &output_row($r, "Keywords"); |
foreach my $field (sort(keys(%metadata_fields))) { |
|
$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 Instructor Metadata"> |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
</form> |
</form> |
|
|
ENDenv |
ENDenv |
Line 3016 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 3076 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=>"Instructor 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"}); |