added fieldsets around form controls with multiple elements

This commit is contained in:
Graham Knop 2008-09-16 16:27:15 +00:00
parent d41625dc40
commit 98bfd9ac1d
5 changed files with 36 additions and 24 deletions

View file

@ -1,4 +1,5 @@
7.6.0 7.6.0
- added fieldsets around form controls with multiple elements
- rfe: Town Hall: Menu title in search results - rfe: Town Hall: Menu title in search results
- rfe: Process Macros in HTTP Proxy's URL - rfe: Process Macros in HTTP Proxy's URL
- rfe: TimeZone for the User Profiles displays incorrectly after installation - rfe: TimeZone for the User Profiles displays incorrectly after installation

View file

@ -137,7 +137,7 @@ Renders a series of checkboxes.
sub toHtml { sub toHtml {
my $self = shift; my $self = shift;
my $output; my $output = '<fieldset style="border:none;margin:0;padding:0">';
my $alignment = $self->alignmentSeparator; my $alignment = $self->alignmentSeparator;
# Add the select all button # Add the select all button
@ -164,7 +164,7 @@ sub toHtml {
. $alignment . $alignment
; ;
} }
$output .= "</fieldset>";
return $output; return $output;
} }

View file

@ -59,7 +59,10 @@ sub definition {
push(@{$definition}, { push(@{$definition}, {
checked=>{ checked=>{
defaultValue=> 0 defaultValue=> 0
}, },
label => {
defaultValue => undef,
},
}); });
return $class->SUPER::definition($session, $definition); return $class->SUPER::definition($session, $definition);
} }
@ -99,12 +102,16 @@ Renders and input tag of type radio.
=cut =cut
sub toHtml { sub toHtml {
my$self = shift; my $self = shift;
my $value = $self->getOriginalValue(); my $value = $self->getOriginalValue();
$value = defined $value ? $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($value))) : ''; $value = defined $value ? $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($value))) : '';
my $checkedText = $self->get("checked") ? ' checked="checked"' : ''; my $checkedText = $self->get("checked") ? ' checked="checked"' : '';
my $idText = $self->get('id') ? ' id="'.$self->get('id').'" ' : ''; my $idText = $self->get('id') ? ' id="'.$self->get('id').'" ' : '';
return '<input type="radio" name="'.$self->get("name").'" value="'.$value.'"'.$idText.$checkedText.' '.($self->get("extras")||'').' />'; my $control = '<input type="radio" name="'.$self->get("name").'" value="'.$value.'"'.$idText.$checkedText.' '.($self->get("extras")||'').' />';
if ($self->get('label')) {
return "<label>" . $control . $self->get('label') . "</label>";
}
return $control;
} }

View file

@ -143,7 +143,7 @@ Renders a series of radio buttons.
sub toHtml { sub toHtml {
my $self = shift; my $self = shift;
my $output; my $output = '<fieldset style="border:none;margin:0;padding:0">';
my $alignment = $self->alignmentSeparator; my $alignment = $self->alignmentSeparator;
my $i=0; my $i=0;
my $options = $self->getOptions; my $options = $self->getOptions;
@ -160,8 +160,9 @@ sub toHtml {
checked=>$checked, checked=>$checked,
id=>$self->get('name').$i id=>$self->get('name').$i
})->toHtml; })->toHtml;
$output .= '<label for="'.$self->get('name').$i.'">'.$options->{$key}."</label>" . $alignment; $output .= '<label for="'.$self->get('name').$i.'">'.$options->{$key}."</label>" . $alignment;
} }
$output .= "</fieldset>";
return $output; return $output;
} }

View file

@ -150,25 +150,28 @@ sub toHtml {
my $i18n = WebGUI::International->new($self->session); my $i18n = WebGUI::International->new($self->session);
my ($checkYes, $checkNo); my ($checkYes, $checkNo);
if ($self->getOriginalValue) { if ($self->getOriginalValue) {
$checkYes = 1; $checkYes = 1;
} else { } else {
$checkNo = 1; $checkNo = 1;
} }
my $output = WebGUI::Form::Radio->new($self->session, my $output = '<fieldset style="border:none;margin:0;padding:0">'
checked=>$checkYes, . WebGUI::Form::Radio->new($self->session,
name=>$self->get("name"), checked => $checkYes,
value=>1, name => $self->get("name"),
extras=>$self->get("extras") value => 1,
)->toHtml; extras => $self->get("extras"),
$output .= $i18n->get(138); label => $i18n->get(138),
$output .= '&nbsp;&nbsp;&nbsp;'; )->toHtml
$output .= WebGUI::Form::Radio->new($self->session, . '&nbsp;&nbsp;&nbsp;'
checked=>$checkNo, . WebGUI::Form::Radio->new($self->session,
name=>$self->get("name"), checked => $checkNo,
value=>0, name => $self->get("name"),
extras=>$self->get("extras") value => 0,
)->toHtml; extras => $self->get("extras"),
$output .= $i18n->get(139); label => $i18n->get(139),
)->toHtml
. '</fieldset>'
;
return $output; return $output;
} }