--- loncom/interface/lonparmset.pm 2005/06/13 15:35:37 1.220 +++ loncom/interface/lonparmset.pm 2005/06/14 02:33:18 1.221 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.220 2005/06/13 15:35:37 www Exp $ +# $Id: lonparmset.pm,v 1.221 2005/06/14 02:33:18 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -70,6 +70,8 @@ my $parmhashid; my %parmhash; my $symbsid; my %symbs; +my $rulesid; +my %rules; # --- end local caches @@ -240,6 +242,24 @@ sub symbcache { return $symbs{$id}; } +sub resetrulescache { + $rulesid=''; +} + +sub rulescache { + my $id=shift; + if ($rulesid ne $env{'request.course.id'}) { + %rules=(); + } + unless ($rules{$id}) { + my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; + my %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); + $rulesid=$env{'request.course.id'}; + } + return $rules{$id}; +} + ################################################## ################################################## # @@ -2551,12 +2571,52 @@ $bodytag $breadcrumbs
ENDDEFHEAD - my %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); if ($env{'form.storerules'}) { - %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); + &resetrulescache(); } - - + my @ids=(); + my %typep=(); + my %keyp=(); + my %allparms=(); + my %allparts=(); + my %allmaps=(); + my %mapp=(); + my %symbp=(); + my %maptitles=(); + my %uris=(); + my %keyorder=&standardkeyorder(); + my %defkeytype=(); + + &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, + \%mapp, \%symbp,\%maptitles,\%uris, + \%keyorder,\%defkeytype); + my %lt=&Apache::lonlocal::texthash('hours' => 'Hours', + 'min' => 'Minutes', + 'sec' => 'Seconds', + 'yes' => 'Yes', + 'no' => 'No'); + $r->print("\n'); + foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { + $r->print("\n'); + + } + $r->print("
".&mt('Rule for parameter').''. + &mt('Automatically set to ...').''.&mt('if ...').'
".$allparms{$tempkey}."\n
(".$tempkey.')
'); + if (&isdateparm($defkeytype{$tempkey})) { + $r->print(<$lt{'hours'}
+$lt{'min'}
+$lt{'sec'} +ENDINPUTDATE + } elsif ($defkeytype{$tempkey} eq 'string_yesno') { + $r->print(< $lt{'yes'}
+ +ENDYESNO + } else { + $r->print(''); + } + $r->print('
"); return; }