Change the YesNo form plugin to be a subclass of RadioList. Fix rendering problems with RadioList. Fixes bug #11777
This commit is contained in:
parent
7c3d572146
commit
decfa808bb
4 changed files with 40 additions and 48 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
- fixed #11781: Thingy wrong retorn value from Ajax method
|
- fixed #11781: Thingy wrong retorn value from Ajax method
|
||||||
- fixed #11780: fixFilenames regex needs an anchor in ZipArchive asset
|
- fixed #11780: fixFilenames regex needs an anchor in ZipArchive asset
|
||||||
- fixed #11782: Attachments all showing duplicated first thumbnail
|
- fixed #11782: Attachments all showing duplicated first thumbnail
|
||||||
|
- fixed #11777: Thingy search on yes no field fails
|
||||||
|
|
||||||
7.9.12
|
7.9.12
|
||||||
- webgui.org homepage gives 404 (#11778)
|
- webgui.org homepage gives 404 (#11778)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ sub alignmentSeparator {
|
||||||
return "<br />\n";
|
return "<br />\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return " \n";
|
return " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,13 +141,14 @@ sub toHtml {
|
||||||
$checked = 1;
|
$checked = 1;
|
||||||
}
|
}
|
||||||
$output .= WebGUI::Form::Radio->new($self->session, {
|
$output .= WebGUI::Form::Radio->new($self->session, {
|
||||||
name=>$self->get('name'),
|
name => $self->get('name'),
|
||||||
value=>$key,
|
value => $key,
|
||||||
extras=>$self->get('extras'),
|
extras => $self->get('extras'),
|
||||||
checked=>$checked,
|
checked => $checked,
|
||||||
id=>$self->get('name').$i
|
id => $self->get('name').$i,
|
||||||
|
label => $options->{$key},
|
||||||
})->toHtml;
|
})->toHtml;
|
||||||
$output .= '<label for="'.$self->get('name').$i.'">'.$options->{$key}."</label>" . $alignment;
|
$output .= $alignment;
|
||||||
}
|
}
|
||||||
$output .= "</fieldset>";
|
$output .= "</fieldset>";
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ package WebGUI::Form::YesNo;
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use base 'WebGUI::Form::Control';
|
use base 'WebGUI::Form::RadioList';
|
||||||
use WebGUI::Form::Radio;
|
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
@ -39,6 +38,18 @@ The following methods are specifically available from this class. Check the supe
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 areOptionsSettable ( )
|
||||||
|
|
||||||
|
Options are predefined for a Yes/No.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub areOptionsSettable {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 definition ( [ additionalTerms ] )
|
=head2 definition ( [ additionalTerms ] )
|
||||||
|
|
||||||
See the super class for additional details.
|
See the super class for additional details.
|
||||||
|
|
@ -92,6 +103,24 @@ sub getName {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 getOptions
|
||||||
|
|
||||||
|
Return the options, set to defaults for the Yes/No. These options are not overridable.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub getOptions {
|
||||||
|
my $self = shift;
|
||||||
|
my $i18n = WebGUI::International->new($self->session);
|
||||||
|
$self->set('options',{
|
||||||
|
1 => $i18n->get(138),
|
||||||
|
0 => $i18n->get(139),
|
||||||
|
});
|
||||||
|
return $self->SUPER::getOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getValue ( [ value ] )
|
=head2 getValue ( [ value ] )
|
||||||
|
|
||||||
If value is present, we will process it, otherwise the superclass will handle the request.
|
If value is present, we will process it, otherwise the superclass will handle the request.
|
||||||
|
|
@ -137,44 +166,5 @@ sub isDynamicCompatible {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 toHtml ( )
|
|
||||||
|
|
||||||
Renders a yes/no question field.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub toHtml {
|
|
||||||
my $self = shift;
|
|
||||||
my $i18n = WebGUI::International->new($self->session);
|
|
||||||
my ($checkYes, $checkNo);
|
|
||||||
if ($self->getOriginalValue) {
|
|
||||||
$checkYes = 1;
|
|
||||||
} else {
|
|
||||||
$checkNo = 1;
|
|
||||||
}
|
|
||||||
my $output = '<fieldset style="border:none;margin:0;padding:0">'
|
|
||||||
. WebGUI::Form::Radio->new($self->session,
|
|
||||||
checked => $checkYes,
|
|
||||||
name => $self->get("name"),
|
|
||||||
value => 1,
|
|
||||||
extras => $self->get("extras"),
|
|
||||||
label => $i18n->get(138),
|
|
||||||
)->toHtml
|
|
||||||
. ' '
|
|
||||||
. WebGUI::Form::Radio->new($self->session,
|
|
||||||
checked => $checkNo,
|
|
||||||
name => $self->get("name"),
|
|
||||||
value => 0,
|
|
||||||
extras => $self->get("extras"),
|
|
||||||
label => $i18n->get(139),
|
|
||||||
)->toHtml
|
|
||||||
. '</fieldset>'
|
|
||||||
;
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue