--- loncom/interface/lonparmset.pm 2007/01/18 21:02:20 1.350.2.5 +++ loncom/interface/lonparmset.pm 2006/12/14 20:04:11 1.352 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.350.2.5 2007/01/18 21:02:20 albertel Exp $ +# $Id: lonparmset.pm,v 1.352 2006/12/14 20:04:11 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -272,8 +272,10 @@ sub resetrulescache { sub rulescache { my $id=shift; - if ($rulesid ne $env{'request.course.id'} - && !defined($rules{$id})) { + if ($rulesid ne $env{'request.course.id'}) { + %rules=(); + } + unless (defined($rules{$id})) { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); @@ -3189,7 +3191,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 +3199,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); } @@ -3310,7 +3332,7 @@ sub addmetafield { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; if (exists($env{'form.undelete'})) { - my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield'); + my @meta_fields = &Apache::loncommon::get_env_multiple('form.undelete'); foreach my $meta_field(@meta_fields) { my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; $options =~ s/deleted//; @@ -3339,7 +3361,7 @@ sub addmetafield { $r->print('You may undelete previously deleted fields.
Check those you wish to undelete and click Undelete.
'); $r->print('
'); foreach my $key(keys(%$fields)) { - $r->print(''.$$fields{$key}.'
print(''.$$fields{$key}.'
print(''); $r->print('
'); @@ -3373,7 +3395,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 +3407,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 +3430,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 +3449,7 @@ sub setrestrictmeta { $r->print(< $output - -
-
- -
-
-
- + $buttons
ENDenv $r->print(&Apache::loncommon::end_page()); @@ -3728,15 +3755,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 +3863,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 +3906,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 +3976,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;