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
- added fieldsets around form controls with multiple elements
- rfe: Town Hall: Menu title in search results
- rfe: Process Macros in HTTP Proxy's URL
- rfe: TimeZone for the User Profiles displays incorrectly after installation

View file

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

View file

@ -59,7 +59,10 @@ sub definition {
push(@{$definition}, {
checked=>{
defaultValue=> 0
},
},
label => {
defaultValue => undef,
},
});
return $class->SUPER::definition($session, $definition);
}
@ -99,12 +102,16 @@ Renders and input tag of type radio.
=cut
sub toHtml {
my$self = shift;
my $self = shift;
my $value = $self->getOriginalValue();
$value = defined $value ? $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($value))) : '';
my $checkedText = $self->get("checked") ? ' checked="checked"' : '';
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 {
my $self = shift;
my $output;
my $output = '<fieldset style="border:none;margin:0;padding:0">';
my $alignment = $self->alignmentSeparator;
my $i=0;
my $options = $self->getOptions;
@ -160,8 +160,9 @@ sub toHtml {
checked=>$checked,
id=>$self->get('name').$i
})->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;
}

View file

@ -150,25 +150,28 @@ sub toHtml {
my $i18n = WebGUI::International->new($self->session);
my ($checkYes, $checkNo);
if ($self->getOriginalValue) {
$checkYes = 1;
$checkYes = 1;
} else {
$checkNo = 1;
$checkNo = 1;
}
my $output = WebGUI::Form::Radio->new($self->session,
checked=>$checkYes,
name=>$self->get("name"),
value=>1,
extras=>$self->get("extras")
)->toHtml;
$output .= $i18n->get(138);
$output .= '&nbsp;&nbsp;&nbsp;';
$output .= WebGUI::Form::Radio->new($self->session,
checked=>$checkNo,
name=>$self->get("name"),
value=>0,
extras=>$self->get("extras")
)->toHtml;
$output .= $i18n->get(139);
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
. '&nbsp;&nbsp;&nbsp;'
. 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;
}