[system] / trunk / pg / macros / parserRadioButtons.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/parserRadioButtons.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5373 Revision 5392
1loadMacros('MathObjects.pl','contextString.pl'); 1loadMacros('MathObjects.pl','contextString.pl');
2 2
3sub _parserRadioButtons_init {}; # don't reload this file 3sub _parserRadioButtons_init {parserRadioButtons::Init()}; # don't reload this file
4 4
5=head1 DESCRIPTION 5=head1 DESCRIPTION
6 6
7 #################################################################### 7 ####################################################################
8 # 8 #
66 # MultiPart calls to get answer rules). 66 # MultiPart calls to get answer rules).
67 # 67 #
68 68
69=cut 69=cut
70 70
71sub RadioButtons {parserRadioButtons->new(@_)} 71##################################################
72
73# 72#
74# The package that implements RadioButtons 73# The package that implements RadioButtons
75# 74#
76package parserRadioButtons; 75package parserRadioButtons;
77our @ISA = qw(Value::String); 76our @ISA = qw(Value::String);
78 77
79my $jsPrinted = 0; # true when the JavaScript has been printed 78my $jsPrinted = 0; # true when the JavaScript has been printed
80 79
80#
81# Set up the main:: namespace
82#
83sub Init {
84 $jsPrinted = 0;
85 main::PG_restricted_eval('sub RadioButtons {parserRadioButtons->new(@_)}');
86}
81 87
82# 88#
83# Create a new RadioButtons object 89# Create a new RadioButtons object
84# 90#
85sub new { 91sub new {
104 unless defined($value) && $value ne ""; 110 unless defined($value) && $value ne "";
105 my $context = Parser::Context->getCopy("String"); 111 my $context = Parser::Context->getCopy("String");
106 my %choiceHash = $self->choiceHash(1); 112 my %choiceHash = $self->choiceHash(1);
107 $context->strings->add(map {$_=>{}} (keys %choiceHash)); 113 $context->strings->add(map {$_=>{}} (keys %choiceHash));
108 $value = $self->correctChoice($value); 114 $value = $self->correctChoice($value);
109 $self = bless $context->Package("String")->new($context,$value)->with( 115 $self = bless $context->Package("String")->new($context,$value)->with(choices => $choices, %options), $class;
110 isValue => 1, choices => $choices, %options), $class;
111 $self->JavaScript if $self->{uncheckable}; 116 $self->JavaScript if $self->{uncheckable};
112 return $self; 117 return $self;
113} 118}
114 119
115# 120#

Legend:
Removed from v.5373  
changed lines
  Added in v.5392

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9