version 1.178, 2010/01/26 11:34:47
|
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'}); |
} |
} |
|
|
Line 3661 sub render {
|
Line 3679 sub render {
|
} |
} |
my $previous = HTML::Entities::encode(&mt("Back"), '<>&"'); |
my $previous = HTML::Entities::encode(&mt("Back"), '<>&"'); |
my $next = HTML::Entities::encode(&mt("Next"), '<>&"'); |
my $next = HTML::Entities::encode(&mt("Next"), '<>&"'); |
my $target = " target='loncapaclient'"; |
|
if ($env{'environment.remote'} eq 'off') { $target=''; } |
|
$result .= "<p>\n" . |
$result .= "<p>\n" . |
"<form action='".$actionURL."' method='post' $target>\n" . |
"<form action='".$actionURL."' method='post' >\n" . |
"<input type='button' onclick='history.go(-1)' value='$previous' />" . |
"<input type='button' onclick='history.go(-1)' value='$previous' />" . |
"<input type='hidden' name='orgurl' value='$targetURL' />" . |
"<input type='hidden' name='orgurl' value='$targetURL' />" . |
"<input type='hidden' name='selectrole' value='1' />\n" . |
"<input type='hidden' name='selectrole' value='1' />\n" . |