$stateTitle
@@ -682,6 +684,7 @@ sub addElement {
push @{$self->{ELEMENTS}}, $element;
}
+use Data::Dumper;
sub render {
my $self = shift;
my @results = ();
@@ -689,6 +692,7 @@ sub render {
for my $element (@{$self->{ELEMENTS}}) {
push @results, $element->render();
}
+
return join("\n", @results);
}
@@ -701,23 +705,8 @@ package Apache::lonhelper::element;
=head2 Element Base Class
-The Apache::lonhelper::element base class provides support methods for
-the elements to use, such as a multiple value processer.
-
-B:
-
-=over 4
-
-=item * process_multiple_choices(formName, varName): Process the form
-element named "formName" and place the selected items into the helper
-variable named varName. This is for things like checkboxes or
-multiple-selection listboxes where the user can select more then
-one entry. The selected entries are delimited by triple pipes in
-the helper variables, like this:
-
- CHOICE_1|||CHOICE_2|||CHOICE_3
-
-=back
+The Apache::lonhelper::element base class provides support for elements
+and defines some generally useful tags for use in elements.
B
@@ -831,28 +820,6 @@ sub overrideForm {
return 0;
}
-sub process_multiple_choices {
- my $self = shift;
- my $formname = shift;
- my $var = shift;
-
- # Must extract values from data directly, as there
- # may be more then one.
- my @values;
- for my $formparam (split (/&/, $ENV{QUERY_STRING})) {
- my ($name, $value) = split(/=/, $formparam);
- if ($name ne $formname) {
- next;
- }
- $value =~ tr/+/ /;
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
- push @values, $value;
- }
- $helper->{VARS}->{$var} = join('|||', @values);
-
- return;
-}
-
1;
package Apache::lonhelper::message;
@@ -1205,9 +1172,8 @@ sub postprocess {
return 0;
}
- if ($self->{'multichoice'}) {
- $self->process_multiple_choices($self->{'variable'}.'.forminput',
- $self->{'variable'});
+ if (ref($chosenValue)) {
+ $helper->{VARS}->{$self->{'variable'}} = join('|||', @$chosenValue);
}
if (defined($self->{NEXTSTATE})) {
@@ -1693,11 +1659,6 @@ BUTTONS
sub postprocess {
my $self = shift;
- if ($self->{'multichoice'}) {
- $self->process_multiple_choices($self->{'variable'}.'.forminput',
- $self->{'variable'});
- }
-
if ($self->{'multichoice'} && !$helper->{VARS}->{$self->{'variable'}}) {
$self->{ERROR_MSG} = 'You must choose at least one resource to continue.';
return 0;
@@ -1855,10 +1816,6 @@ sub postprocess {
return 0;
}
- if ($self->{'multichoice'}) {
- $self->process_multiple_choices($self->{'variable'}.'.forminput',
- $self->{'variable'});
- }
if (defined($self->{NEXTSTATE})) {
$helper->changeState($self->{NEXTSTATE});
}
@@ -2143,10 +2100,6 @@ sub postprocess {
return 0;
}
- if ($self->{'multichoice'}) {
- $self->process_multiple_choices($self->{'variable'}.'.forminput',
- $self->{'variable'});
- }
if (defined($self->{NEXTSTATE})) {
$helper->changeState($self->{NEXTSTATE});
}
|