[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Mon, 11 Dec 2006 23:57:21 -0000
banghart Mon Dec 11 18:57:21 2006 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
Improve display of setting restricted metadata. Not finished,
saving work in progress.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.350 loncom/interface/lonparmset.pm:1.351
--- loncom/interface/lonparmset.pm:1.350 Mon Dec 4 21:55:53 2006
+++ loncom/interface/lonparmset.pm Mon Dec 11 18:57:17 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.350 2006/12/05 02:55:53 albertel Exp $
+# $Id: lonparmset.pm,v 1.351 2006/12/11 23:57:17 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3188,7 +3188,6 @@
### Set portfolio metadata
sub output_row {
my ($r, $field_name, $field_text, $added_flag) = @_;
- my $row_class;
my $output;
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'};
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'};
@@ -3197,26 +3196,47 @@
$values = '';
}
if (!($options =~ /deleted/)) {
- $output = &Apache::loncommon::start_data_table_row();
- $output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>';
- # $output .= '<td><strong>'.$field_text.':</strong></td>';
- $output .= '<td><span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>';
- $output .= &Apache::loncommon::end_data_table_row();
my @options= ( ['active', 'Show to student'],
- ['onlyone','Student may select only one choice'],
- ['stuadd', 'Student may type choices']);
+ ['stuadd', 'Provide text area for students to type catalog information'],
+ ['choices','Provide choices for students to select from']);
+# ['onlyone','Student may select only one choice']);
if ($added_flag) {
push @options,['deleted', 'Delete Metadata Field'];
}
+ $output = &Apache::loncommon::start_data_table_row();
+ $output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>';
+ $output .= &Apache::loncommon::end_data_table_row();
foreach my $opt (@options) {
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ;
$output .= &Apache::loncommon::continue_data_table_row();
- $output .= '<td colspan="2">'.(' ' x 5).'<span class="LC_metadata"><label><input type="checkbox" name="'.
- $field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'.
- &mt($opt->[1]).'</label></span> </td>';
+ $output .= '<td>'.(' ' x 5).'<span class="LC_metadata"><label>
+ <input type="checkbox" name="'.
+ $field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'.
+ &mt($opt->[1]).'</label></span> </td>';
$output .= &Apache::loncommon::end_data_table_row();
}
-
+ $output .= &Apache::loncommon::continue_data_table_row();
+ $output .= '<td>'.(' ' x 10).'<span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>';
+ $output .= &Apache::loncommon::end_data_table_row();
+ my $multiple_checked;
+ my $single_checked;
+ if ($options =~ m/onlyone/) {
+ $multiple_checked = "";
+ $single_checked = " CHECKED ";
+ } else {
+ $multiple_checked = " CHECKED ";
+ $single_checked = "";
+ }
+ $output .= &Apache::loncommon::continue_data_table_row();
+ $output .= '<td>'.(' ' x 10).'<span class="LC_metadata">
+ <input type="radio" name="'.$field_name.'_onlyone" value="multiple" '.$multiple_checked .'/>
+ Student may select multiple choices from list</span></td>';
+ $output .= &Apache::loncommon::end_data_table_row();
+ $output .= &Apache::loncommon::continue_data_table_row();
+ $output .= '<td>'.(' ' x 10).'<span class="LC_metadata">
+ <input type="radio" name="'.$field_name.'_onlyone" value="single" '.$single_checked.'/>
+ Student may select only one choice from list</span></td>';
+ $output .= &Apache::loncommon::end_data_table_row();
}
return ($output);
}
@@ -3372,7 +3392,10 @@
if ($env{'form.'.$meta_field.'_stuadd'}) {
$options.='stuadd,';
}
- if ($env{'form.'.$meta_field.'_onlyone'}) {
+ if ($env{'form.'.$meta_field.'_choices'}) {
+ $options.='choices,';
+ }
+ if ($env{'form.'.$meta_field.'_onlyone'} eq 'single') {
$options.='onlyone,';
}
if ($env{'form.'.$meta_field.'_active'}) {
@@ -3381,7 +3404,6 @@
if ($env{'form.'.$meta_field.'_deleted'}) {
$options.='deleted,';
}
-
my $name = $save_field;
$put_result = &Apache::lonnet::put('environment',
{'metadata.'.$meta_field.'.options'=>$options,
@@ -3405,6 +3427,16 @@
$output.= &output_row($r, $field, $metadata_fields{$field});
}
}
+ my $buttons = (<<ENDButtons);
+ <input type="submit" name="restrictmeta" value="Save" />
+ </form><br />
+ <form method="post" action="/adm/parmset?action=addmetadata" name="form1">
+ <input type="submit" name="restrictmeta" value="Add a Metadata Field" />
+ </form>
+ <br />
+ <form method="post" action="/adm/parmset?action=ordermetadata" name="form2">
+ <input type="submit" name="restrictmeta" value="Order Metadata Fields" />
+ENDButtons
my $added_flag = 1;
foreach my $field (sort(keys(%$added_metadata_fields))) {
$row_alt = $row_alt ? 0 : 1;
@@ -3414,14 +3446,7 @@
$r->print(<<ENDenv);
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form">
$output
- <input type="submit" name="restrictmeta" value="Update Metadata Restrictions" />
- </form><br />
- <form method="post" action="/adm/parmset?action=addmetadata" name="form1">
- <input type="submit" name="restrictmeta" value="Add a Metadata Field" />
- </form>
- <br />
- <form method="post" action="/adm/parmset?action=ordermetadata" name="form2">
- <input type="submit" name="restrictmeta" value="Order Metadata Fields" />
+ $buttons
</form>
ENDenv
$r->print(&Apache::loncommon::end_page());