Diff for /loncom/interface/lonparmset.pm between versions 1.223 and 1.224

version 1.223, 2005/06/16 22:21:19 version 1.224, 2005/06/17 18:11:42
Line 251  sub rulescache { Line 251  sub rulescache {
     if ($rulesid ne $env{'request.course.id'}) {      if ($rulesid ne $env{'request.course.id'}) {
  %rules=();   %rules=();
     }      }
     unless ($rules{$id}) {      unless (defined($rules{$id})) {
  my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};   my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
  my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};   my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
  my %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);   %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);
  $rulesid=$env{'request.course.id'};   $rulesid=$env{'request.course.id'};
     }      }
     return $rules{$id};      return $rules{$id};
Line 2571  $bodytag Line 2571  $bodytag
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">  <form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">
 ENDDEFHEAD  ENDDEFHEAD
     if ($env{'form.storerules'}) {  
 # storage here  
  &resetrulescache();  
     }  
     my @ids=();      my @ids=();
     my %typep=();      my %typep=();
     my %keyp=();      my %keyp=();
Line 2591  ENDDEFHEAD Line 2587  ENDDEFHEAD
     &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps,       &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, 
  \%mapp, \%symbp,\%maptitles,\%uris,   \%mapp, \%symbp,\%maptitles,\%uris,
  \%keyorder,\%defkeytype);   \%keyorder,\%defkeytype);
       if ($env{'form.storerules'}) {
    my %newrules=();
    my @delrules=();
    foreach (keys %env) {
               if ($_=~/^form\.(\w+)\_action$/) {
    my $tempkey=$1;
                   if ($env{$_}) {
       $newrules{$tempkey.'_action'}=$env{$_};
       if (&isdateparm($defkeytype{$tempkey})) {
    $newrules{$tempkey.'_hours'}=$env{'form.'.$tempkey.'_hours'};
    $newrules{$tempkey.'_min'}=$env{'form.'.$tempkey.'_min'};
    $newrules{$tempkey.'_sec'}=$env{'form.'.$tempkey.'_sec'};
       } else {
    $newrules{$tempkey.'_value'}=$env{'form.'.$tempkey.'_value'};
       }
    } else {
       push @delrules,$tempkey.'_action';
       push @delrules,$tempkey.'_hours';
       push @delrules,$tempkey.'_min';
       push @delrules,$tempkey.'_sec';
       push @delrules,$tempkey.'_value';
    }
       }
    }
    &Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs);
    &Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs);
    &resetrulescache();
       }
     my %lt=&Apache::lonlocal::texthash('hours' => 'Hours',      my %lt=&Apache::lonlocal::texthash('hours' => 'Hours',
        'min' => 'Minutes',         'min' => 'Minutes',
        'sec' => 'Seconds',         'sec' => 'Seconds',
Line 2616  ENDDEFHEAD Line 2640  ENDDEFHEAD
     foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) {      foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) {
  unless ($tempkey) { next; }   unless ($tempkey) { next; }
  $r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>');   $r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>');
   
  my $action=&rulescache($tempkey.'_action');   my $action=&rulescache($tempkey.'_action');
  $r->print('<select name="'.$tempkey.'_action">');   $r->print('<select name="'.$tempkey.'_action">');
  if (&isdateparm($defkeytype{$tempkey})) {   if (&isdateparm($defkeytype{$tempkey})) {
Line 2655  ENDINPUTDATE Line 2678  ENDINPUTDATE
             if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; }              if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; }
   
     $r->print(<<ENDYESNO);      $r->print(<<ENDYESNO);
 <label><input type="radio" name="$tempkey" value="yes" $yeschecked /> $lt{'yes'}</label><br />  <label><input type="radio" name="$tempkey\_value" value="yes" $yeschecked /> $lt{'yes'}</label><br />
 <label><input type="radio" name="$tempkey" value="no" $nochecked /> $lt{'no'}</label>  <label><input type="radio" name="$tempkey\_value" value="no" $nochecked /> $lt{'no'}</label>
 ENDYESNO  ENDYESNO
         } else {          } else {
     $r->print('<input type="text" size="20" name="'.$tempkey.'" value="'.&rulescache($tempkey.'_value').'" />');      $r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />');
  }   }
         $r->print('</td></tr>');          $r->print('</td></tr>');
     }      }
     $r->print("</table></form></body></html>");      $r->print("</table>\n<input type='submit' name='storerules' value='".
         &mt('Store Rules')."' /></form>\n</body>\n</html>");
     return;      return;
 }  }
   

Removed from v.1.223  
changed lines
  Added in v.1.224


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>