--- loncom/interface/lonparmset.pm 2006/12/14 20:08:15 1.350.2.1 +++ loncom/interface/lonparmset.pm 2007/01/18 21:14:04 1.350.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.350.2.1 2006/12/14 20:08:15 albertel Exp $ +# $Id: lonparmset.pm,v 1.350.2.6 2007/01/18 21:14:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -272,7 +272,7 @@ sub resetrulescache { sub rulescache { my $id=shift; - if ($rulesid ne $env{'request.course.id'}) { + if ($rulesid ne $env{'request.course.id'} && !defined($rules{$id})) { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; @@ -3303,6 +3303,13 @@ sub order_meta_fields { $r->print(''); return 'ok'; } +sub continue { + my $output; + $output .= '
'); @@ -3728,7 +3734,15 @@ sub parm_change_log { } if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } } - foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { + 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))) { my @changes=keys(%{$parmlog{$id}{'logentry'}}); my $count = 0; my $time = @@ -3836,6 +3850,12 @@ 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; +} + ################################################## ################################################## @@ -3879,7 +3899,9 @@ sub handler { (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. $env{'request.course.sec'})); - if ($env{'request.course.id'} && $parm_permission) { + my $exists = &check_for_course_info(); + + if ($env{'request.course.id'} && $parm_permission && $exists) { # Start Page &Apache::loncommon::content_type($r,'text/html'); @@ -3949,8 +3971,13 @@ sub handler { } } else { # ----------------------------- Not in a course, or not allowed to modify parms - $env{'user.error.msg'}= - "/adm/parmset:opa:0:0:Cannot modify assessment parameters"; + 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"; + } return HTTP_NOT_ACCEPTABLE; } return OK;