Diff for /loncom/interface/lonhelper.pm between versions 1.179 and 1.180

version 1.179, 2010/03/10 21:25:50 version 1.180, 2010/05/24 09:21:18
Line 3289  package Apache::lonhelper::string; Line 3289  package Apache::lonhelper::string;
 string elements provide a string entry field for the user. string elements  string elements provide a string entry field for the user. string elements
 take the usual 'variable' and 'nextstate' parameters. string elements  take the usual 'variable' and 'nextstate' parameters. string elements
 also pass through 'maxlength' and 'size' attributes to the input tag.  also pass through 'maxlength' and 'size' attributes to the input tag.
   Since you could have multiple strings in a helper state, each with its own
   validator, all but the last string should have
   noproceed='1' so that _all_ validators are evaluated before the next
   state can be reached.
   
 string honors the defaultvalue tag, if given.  string honors the defaultvalue tag, if given.
   
Line 3308  BEGIN { Line 3312  BEGIN {
   
 sub new {  sub new {
     my $ref = Apache::lonhelper::element->new();      my $ref = Apache::lonhelper::element->new();
       $ref->{'PROCEED'} = 1;      # By default postprocess goes to next state.
     bless($ref);      bless($ref);
 }  }
   
Line 3324  sub start_string { Line 3329  sub start_string {
     $paramHash->{'nextstate'} = $token->[2]{'nextstate'};      $paramHash->{'nextstate'} = $token->[2]{'nextstate'};
     $paramHash->{'maxlength'} = $token->[2]{'maxlength'};      $paramHash->{'maxlength'} = $token->[2]{'maxlength'};
     $paramHash->{'size'} = $token->[2]{'size'};      $paramHash->{'size'} = $token->[2]{'size'};
   
     return '';      return '';
 }  }
   
 sub end_string {  sub end_string {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   
   
     if ($target ne 'helper') {      if ($target ne 'helper') {
         return '';          return '';
     }      }
     Apache::lonhelper::string->new();      my $state = Apache::lonhelper::string->new();
   
   
       if(&Apache::lonxml::get_param('noproceed', $parstack, $safeeval, undef, 1)) {
    $state->noproceed();
       }
   
      
   
     return '';      return '';
 }  }
   
   sub noproceed() {
       my $self = shift;
       $self->{PROCEED}  = 0;
   }
   
 sub render {  sub render {
     my $self = shift;      my $self = shift;
     my $result = '';      my $result = '';
Line 3381  sub postprocess { Line 3399  sub postprocess {
  }   }
     }      }
   
     if (defined($self->{'nextstate'})) {      if (defined($self->{'nextstate'}) && $self->{PROCEED}) {
         $helper->changeState($self->{'nextstate'});          $helper->changeState($self->{'nextstate'});
     }      }
   

Removed from v.1.179  
changed lines
  Added in v.1.180


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