version 1.5, 2000/10/02 22:23:39
|
version 1.8, 2000/11/28 19:15:48
|
Line 5 package Apache::inputtags;
|
Line 5 package Apache::inputtags;
|
use strict; |
use strict; |
|
|
sub BEGIN { |
sub BEGIN { |
&Apache::lonxml::register('Apache::inputtags',('textline','answergroup')); |
&Apache::lonxml::register('Apache::inputtags',('textarea','textline','answergroup','datasubmission')); |
} |
} |
|
|
|
|
sub initialize_inputtags { |
sub initialize_inputtags { |
$Apache::inputtags::curvalue=0; |
$Apache::inputtags::curvalue=0; |
|
@Apache::inputtags::input=(); |
|
@Apache::inputtags::response=(); |
|
@Apache::inputtags::answergroup=(); |
|
$Apache::inputtags::part=''; |
|
%Apache::inputtags::params=(); |
|
} |
|
|
|
sub start_textarea { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
my $result = ""; |
|
$Apache::inputtags::curvalue++; |
|
if ($target eq 'web') { |
|
$result= '<textarea name="HWVAL'.$Apache::inputtags::curvalue.'" value="">'; |
|
} |
|
return $result; |
|
} |
|
|
|
sub end_textarea { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
return "</textarea>"; |
} |
} |
|
|
sub start_textline { |
sub start_textline { |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my $result = ""; |
my $result = ""; |
$Apache::inputtags::curvalue++; |
$Apache::inputtags::curvalue++; |
|
my $args =''; |
|
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
|
my $size = &Apache::run::run("{$args;".'return $size}',$safeeval); |
|
if ($size eq '') { $size=20; } |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result= '<input name="'.$ENV{'form.request.prefix'}.'HWVAL'.$Apache::inputtags::curvalue.'" value="">'; |
$result= '<input type="text" name="HWVAL'.$Apache::inputtags::curvalue.'" value="" size="'.$size.'">'; |
} |
} |
return $result; |
return $result; |
} |
} |
|
|
sub end_textline { |
sub end_textline { |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
return ""; |
} |
} |
|
|
sub start_answergroup { |
sub start_answergroup { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
my $args =''; |
|
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
|
my $id = &Apache::run::run("{$args;".'return $id}',$safeeval); |
|
push (@Apache::inputtags::answergroup,$id); |
|
if ($target == 'web') { |
|
|
|
} |
|
return ''; |
} |
} |
|
|
sub end_answergroup { |
sub end_answergroup { |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
my $args =''; |
|
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
|
my $id = &Apache::run::run("{$args;".'return $id}',$safeeval); |
|
push (@Apache::inputtags::answergroup,$id); |
|
my $result=''; |
|
my $button='<input type="submit" name="submit" value="Submit All Answers">'; |
|
my $showbutton='1'; |
|
my $usedtry='1'; |
|
my $response=''; |
|
if ( $target == 'web' ) { |
|
if ( defined $ENV{'form.submit'}) { |
|
} |
|
if ($showbutton > 0) { $result.=$button } |
|
} |
|
pop @Apache::inputtags::answergroup; |
|
return $result; |
|
} |
|
|
|
|
|
sub start_datasubmission { |
|
} |
|
|
|
sub end_datasubmission { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
if ( $target == 'web' ) { |
if ( $target == 'web' ) { |
return '<input type="submit" name="'.$ENV{'form.request.prefix'}.'submit" value="Submit All Answers">'; |
return '<input type="submit" name="submit" value="Submit All Data">'; |
} |
} |
} |
} |
|
|