--- loncom/interface/lonparmset.pm 2007/01/06 14:52:30 1.350.2.4 +++ loncom/interface/lonparmset.pm 2006/12/14 20:34:33 1.354 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.350.2.4 2007/01/06 14:52:30 albertel Exp $ +# $Id: lonparmset.pm,v 1.354 2006/12/14 20:34:33 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3189,7 +3189,6 @@ ENDMAINFORMHEAD ### 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'}; @@ -3198,26 +3197,47 @@ sub output_row { $values = ''; } if (!($options =~ /deleted/)) { - $output = &Apache::loncommon::start_data_table_row(); - $output .= ''.$field_text.':'; - # $output .= ''.$field_text.':'; - $output .= ''; - $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 .= ''.$field_text.':'; + $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 .= ''.(' ' x 5).' '; + $output .= ''.(' ' x 5).' '; $output .= &Apache::loncommon::end_data_table_row(); } - + $output .= &Apache::loncommon::continue_data_table_row(); + $output .= ''.(' ' x 10).''; + $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 .= ''.(' ' x 10).' + + Student may select multiple choices from list'; + $output .= &Apache::loncommon::end_data_table_row(); + $output .= &Apache::loncommon::continue_data_table_row(); + $output .= ''.(' ' x 10).' + + Student may select only one choice from list'; + $output .= &Apache::loncommon::end_data_table_row(); } return ($output); } @@ -3373,7 +3393,10 @@ sub setrestrictmeta { 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'}) { @@ -3382,7 +3405,6 @@ sub setrestrictmeta { if ($env{'form.'.$meta_field.'_deleted'}) { $options.='deleted,'; } - my $name = $save_field; $put_result = &Apache::lonnet::put('environment', {'metadata.'.$meta_field.'.options'=>$options, @@ -3406,6 +3428,16 @@ sub setrestrictmeta { $output.= &output_row($r, $field, $metadata_fields{$field}); } } + my $buttons = (< +
+
+ +
+
+
+ +ENDButtons my $added_flag = 1; foreach my $field (sort(keys(%$added_metadata_fields))) { $row_alt = $row_alt ? 0 : 1; @@ -3415,14 +3447,7 @@ sub setrestrictmeta { $r->print(< $output - -
-
- -
-
-
- + $buttons
ENDenv $r->print(&Apache::loncommon::end_page()); @@ -3728,15 +3753,7 @@ sub parm_change_log { } if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } } - foreach my $id (sort - { - if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { - return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} - } - my $aid = (split('00000',$a))[-1]; - my $bid = (split('00000',$b))[-1]; - return $bid<=>$aid; - } (keys(%parmlog))) { + foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { my @changes=keys(%{$parmlog{$id}{'logentry'}}); my $count = 0; my $time = @@ -3844,12 +3861,6 @@ sub parm_change_log { $r->print(&Apache::loncommon::end_page()); } -sub check_for_course_info { - my $navmap = Apache::lonnavmaps::navmap->new(); - return 1 if ($navmap); - return 0; -} - ################################################## ################################################## @@ -3893,9 +3904,7 @@ sub handler { (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. $env{'request.course.sec'})); - my $exists = &check_for_course_info(); - - if ($env{'request.course.id'} && $parm_permission && $exists) { + if ($env{'request.course.id'} && $parm_permission) { # Start Page &Apache::loncommon::content_type($r,'text/html'); @@ -3965,13 +3974,8 @@ sub handler { } } else { # ----------------------------- Not in a course, or not allowed to modify parms - if ($exists) { - $env{'user.error.msg'}= - "/adm/parmset:opa:0:0:Cannot modify assessment parameters"; - } else { - $env{'user.error.msg'}= - "/adm/parmset::0:1:Course environment gone, reinitialize the course"; - } + $env{'user.error.msg'}= + "/adm/parmset:opa:0:0:Cannot modify assessment parameters"; return HTTP_NOT_ACCEPTABLE; } return OK;