version 1.249, 2005/09/02 22:36:38
|
version 1.250, 2005/09/14 17:56:25
|
Line 2752 sub setinstmeta {
|
Line 2752 sub setinstmeta {
|
my $output; |
my $output; |
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
if ($env{'form.serial'}) { |
|
$next_meta = $env{'form.serial'}; |
|
} else { |
|
$next_meta = 1; |
|
} |
|
$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 Instructor Metadata</title> |
Line 2770 sub setinstmeta {
|
Line 2765 sub setinstmeta {
|
foreach my $field (%env) { |
foreach my $field (%env) { |
# start by looking for populated fields |
# start by looking for populated fields |
if ($field=~m/type(\d+)/) { |
if ($field=~m/type(\d+)/) { |
my $item_num = $1; |
my $name; |
my $name = 'metadata.'.$item_num.'.type'; |
my $value; |
my $value = $env{'form.type'.$item_num}; |
|
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{$name=>$value},$dom,$crs); |
{$name=>$value},$dom,$crs); |
$name = 'metadata.'.$item_num.'.values'; |
|
$value = $env{'form.values'.$item_num}; |
|
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{$name=>$value},$dom,$crs); |
{$name=>$value},$dom,$crs); |
} |
} |
if ($field=~m/newfield/) { |
if ($field=~m/newfield/) { |
my $item_num = $env{'form.serial'}; |
my $name = 'metadata.'.$env{'form.titlenew'}; |
my $name = 'metadata.'.$item_num.'.type'; |
my %meta_hash = {values=>[$env{'form.valuesnew'}], |
my $value = $env{'form.typenew'}; |
allow_pick=>'many', |
$put_result = &Apache::lonnet::put('environment', |
allow_type=>'no'}; |
{$name=>$value},$dom,$crs); |
|
$name = 'metadata.'.$item_num.'.values'; |
my $value = \%meta_hash; |
$value = $env{'form.valuesnew'}; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
$name = 'metadata.'.$item_num.'.title'; |
|
$value = $env{'form.titlenew'}; |
|
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{$name=>$value},$dom,$crs); |
{$name=>$value},$dom,$crs); |
|
|
} |
} |
|
|
|
|
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
foreach my $key (sort keys %env) { |
foreach my $key (sort keys %env) { |
if ($key=~m/^course\.$env{'request.course.id'}\.metadata\.\d+\.title$/) { |
if ($key=~m/^course\.$env{'request.course.id'}\.metadata\.(.+)$/) { |
$key=~m/(^course\.$env{'request.course.id'}\.metadata\.)(\d+)\.title/; |
my $meta_data_item = $1; |
$key_base = $1; |
my $meta_hash=$env{$key}; |
$item_num = $2; |
$output.='<tr><td>'.$meta_data_item.'</td>'; |
if ($item_num ge $next_meta) { |
$output.='<td>Select one: <input type="checkbox" name="" value="one" /><br />'; |
$next_meta = $item_num + 1; |
$output.='Select many: <input type="checkbox" name="type" value="many" /></td>'; |
} |
$output.='<td><input name="values" type="text" value="$env{$key_base.$item_num.'.'" /></td></tr>'; |
$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_base.$item_num.'.values'}.'" /></td></tr>'; |
|
} |
} |
} |
} |
$output.='<tr><td><i>Create new instructor metadata item</i><br />'; |
$output.='<tr><td><i>Create new instructor metadata item</i><br />'; |
$output.='<input type="text" name="titlenew" /></td>'; |
$output.='<input type="text" name="titlenew" /></td>'; |
$output.='<td>Select one: <input type="radio" name="typenew" value="one" /><br />'; |
$output.='<td>students must pick only one: <input type="checkbox" name="pickonenew" value="one" /><br />'; |
$output.='Select many: <input type="radio" name="typenew" value="many" /></td>'; |
$output.='Allow student to type extra info: <input type="checkbox" name="typeextranew" value="extra" /></td>'; |
$output.='<td><input name="valuesnew" type="text" value="" /></td></tr>'; |
$output.='<td><input name="valuesnew" type="text" value="" /></td></tr>'; |
$output.='<input type="hidden" name="serial" value="'.$next_meta.'" />'; |
$output.='<input type="hidden" name="serial" value="'.$next_meta.'" />'; |
$output.='<input type="hidden" name="state" value="save" /></tr>'; |
$output.='<input type="hidden" name="state" value="save" /></tr>'; |