version 1.239, 2005/07/19 16:42:02
|
version 1.245, 2005/08/30 00:40:12
|
Line 1950 sub crsenv {
|
Line 1950 sub crsenv {
|
'disablesigfigs' |
'disablesigfigs' |
); |
); |
foreach my $parameter (sort(keys(%values))) { |
foreach my $parameter (sort(keys(%values))) { |
unless ($parameter =~ m/^internal\./) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
if (! $descriptions{$parameter}) { |
if (! $descriptions{$parameter}) { |
$descriptions{$parameter}=$parameter; |
$descriptions{$parameter}=$parameter; |
push(@Display_Order,$parameter); |
push(@Display_Order,$parameter); |
Line 2677 ENDMAINFORMHEAD
|
Line 2677 ENDMAINFORMHEAD
|
action => 'crsenv', |
action => 'crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
|
{ text => 'Set Instructor Defined Metadata', |
|
action => 'setinstmeta', |
|
permission => $parm_permission, |
|
}, |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission, |
Line 2720 ENDMAINFORMHEAD
|
Line 2724 ENDMAINFORMHEAD
|
$r->print($menu_html); |
$r->print($menu_html); |
return; |
return; |
} |
} |
|
### Set instructor defined metadata |
|
sub setinstmeta { |
|
my ($r)=@_; |
|
my $next_meta; |
|
my $output; |
|
my $item_num; |
|
if ($env{'form.serial'}) { |
|
$next_meta = $env{'form.serial'}; |
|
} else { |
|
$next_meta = 1; |
|
} |
|
$r->print(&Apache::lonxml::xmlbegin()); |
|
$r->print('<head> |
|
<title>LON-CAPA Set Instructor Metadata</title> |
|
</head>'); |
|
$r->print(&Apache::loncommon::bodytag('Set Instructor Metadata')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Set Instructor Metadata')); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $key_base = $env{'course.'.$env{'request.course.id'}.'.metadata.'}; |
|
if ($env{'form.state'}eq 'add') { |
|
$r->print('<strong>Compose a new metadata item:</strong><br />'); |
|
$r->print('<form method="post" action="/adm/parmset">'); |
|
$r->print ('Title of item: '.&Apache::lonhtmlcommon::textbox("title",undef,undef,undef).'<br />'); |
|
$r->print ('List if items (comma separated): '.&Apache::lonhtmlcommon::textbox("values",undef,undef,undef).'<br />'); |
|
$r->print ('Select one: <input type="radio" name="type" value="one"><br />'); |
|
$r->print ('Select many: <input type="radio" name="type" value="many"><br />'); |
|
$r->print('<input type="hidden" name="serial" value="'.$next_meta.'" />'); |
|
$r->print('<input type="hidden" name="action" value="setinstmeta" />'); |
|
$r->print('<input type="hidden" name="state" value="save" />'); |
|
$r->print('<input type="submit" value="Save Metadata">'); |
|
$r->print('</form>'); |
|
} elsif ($env{'form.state'}eq 'save') { |
|
$r->print('Here we save the metadata'); |
|
$key_base.=$env{'form.serial'}.'.'; |
|
$r->print('The title: '.$env{'form.title'}.'<br>'); |
|
$r->print('The values: '.$env{'form.values'}.'<br>'); |
|
$r->print('The type: '.$env{'form.type'}.'<br>'); |
|
$r->print('The number: '.$env{'form.serial'}.'<br>'); |
|
my $name = 'metadata.'.$env{'form.serial'}.'.title'; |
|
my $value = $env{'form.title'}; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
$r->print('the put result was: '.$put_result.'<br />'); |
|
$name = 'metadata.'.$env{'form.serial'}.'.type'; |
|
$value = $env{'form.type'}; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
$name = 'metadata.'.$env{'form.serial'}.'.values'; |
|
$value = $env{'form.values'}; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
|
} else { |
|
|
|
foreach my $key (sort keys %env) { |
|
if ($key=~m/^course\.$env{'request.course.id'}\.metadata\.\d+\.title$/) { |
|
$key=~m/^course\.$env{'request.course.id'}\.metadata\.(\d+)\.title/; |
|
$item_num = $1; |
|
if ($1 ge $next_meta) { |
|
$next_meta = $1 + 1; |
|
} |
|
$output.='<tr><td>'.$env{$key}.'</td>'; |
|
$output.='<td>Select one: <input type="radio" name="type'.$item_num.'" value="one" /><br />'; |
|
$output.='Select many: <input type="radio" name="type'.$item_num.'" value="many" /></td>'; |
|
$output.='<td><input name="values'.$item_num.'" type="text" value="'.$env{$key.'.values'}.'" /></td></tr>'; |
|
} |
|
} |
|
$output.='<tr><td><i>Create new instructor metadata item</i><br />'; |
|
$output.='<input type="text" name="newitem" /></td>'; |
|
$output.='<td>Select one: <input type="radio" name="typenew" value="one" /><br />'; |
|
$output.='Select many: <input type="radio" name="typenew" value="many" /></td>'; |
|
$output.='<td><input name="valuesnew" type="text" value="" /></td></tr>'; |
|
$output.='<td><input type="hidden" name="serial" value="'.$next_meta.'" /></td></tr>'; |
|
$r->print(<<ENDenv); |
|
<form method="post" action="/adm/parmset?action=setinstmeta" name="form"> |
|
|
|
<p> |
|
<table border=2> |
|
<tr><th>Title</th><th>Options</th><th>Choices</th></tr> |
|
$output |
|
</table> |
|
<input type="submit" name="instmeta" value="Update Instructor Metadata"> |
|
</form> |
|
|
|
ENDenv |
|
|
|
} |
|
$r->print('</body> |
|
</html>'); |
|
return 'ok'; |
|
} |
################################################## |
################################################## |
|
|
sub defaultsetter { |
sub defaultsetter { |
Line 2907 sub handler {
|
Line 3002 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
'udom','uname','symb']); |
'udom','uname','symb','serial']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 2954 sub handler {
|
Line 3049 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) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setinstmeta', |
|
text=>"Instructor Metadata"}); |
|
&setinstmeta($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"}); |