From 6a9a63c4b06e568fff9bf3485005814796d3bb5d Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 15 Jan 2006 05:18:11 +0000 Subject: [PATCH] bug fixes from running t/FormGetName.t --- lib/WebGUI/Form/Asset.pm | 6 +++--- lib/WebGUI/Form/Button.pm | 2 +- lib/WebGUI/Form/CheckList.pm | 8 ++++---- lib/WebGUI/Form/Checkbox.pm | 2 +- lib/WebGUI/Form/Combo.pm | 2 +- lib/WebGUI/Form/ContentType.pm | 2 +- lib/WebGUI/Form/Control.pm | 23 +++++++++++++++++++++++ lib/WebGUI/Form/DatabaseLink.pm | 2 +- lib/WebGUI/Form/Date.pm | 4 ++-- lib/WebGUI/Form/DateTime.pm | 6 +++--- lib/WebGUI/Form/FieldType.pm | 4 ++-- lib/WebGUI/Form/Group.pm | 4 ++-- lib/WebGUI/Form/HTMLArea.pm | 4 ++-- lib/WebGUI/Form/Hidden.pm | 2 +- lib/WebGUI/Form/Interval.pm | 4 ++-- lib/WebGUI/Form/List.pm | 12 ++++++------ lib/WebGUI/Form/Password.pm | 2 +- lib/WebGUI/Form/Radio.pm | 2 +- lib/WebGUI/Form/RadioList.pm | 8 ++++---- lib/WebGUI/Form/SelectBox.pm | 4 ++-- lib/WebGUI/Form/SelectList.pm | 2 +- lib/WebGUI/Form/Submit.pm | 2 +- lib/WebGUI/Form/Template.pm | 4 ++-- lib/WebGUI/Form/Text.pm | 2 +- lib/WebGUI/Form/Textarea.pm | 2 +- lib/WebGUI/Form/TimeField.pm | 2 +- 26 files changed, 70 insertions(+), 47 deletions(-) diff --git a/lib/WebGUI/Form/Asset.pm b/lib/WebGUI/Form/Asset.pm index 789a67f9f..982e8049d 100644 --- a/lib/WebGUI/Form/Asset.pm +++ b/lib/WebGUI/Form/Asset.pm @@ -100,17 +100,17 @@ sub toHtml { name=>$self->get("name"), extras=>$self->get("extras"), value=>$asset->getId, - id=>$self->{id} + id=>$self->get("id"), )->toHtml .WebGUI::Form::Text->new( name=>$self->get("name")."_display", extras=>' readonly="1" ', value=>$asset->get("title"), - id=>$self->{id}."_display" + id=>$self->get('id')."_display" )->toHtml .WebGUI::Form::Button->new( value=>"...", - extras=>'onclick="window.open(\''.$asset->getUrl("op=formAssetTree;classLimiter=".$self->get("class").";formId=".$self->{id}).'\',\'assetPicker\',\'toolbar=no, location=no, status=no, directories=no, width=400, height=400\');"' + extras=>'onclick="window.open(\''.$asset->getUrl("op=formAssetTree;classLimiter=".$self->get("class").";formId=".$self->get('id')).'\',\'assetPicker\',\'toolbar=no, location=no, status=no, directories=no, width=400, height=400\');"' )->toHtml; } diff --git a/lib/WebGUI/Form/Button.pm b/lib/WebGUI/Form/Button.pm index 5e426f55d..36901963a 100644 --- a/lib/WebGUI/Form/Button.pm +++ b/lib/WebGUI/Form/Button.pm @@ -81,7 +81,7 @@ sub toHtml { my $value = $self->fixQuotes($self->get("value")); my $html = 'get("name").'" ' if ($self->get("name")); - $html .= 'id="'.$self->{id}.'" ' unless ($self->{id} eq "_formId"); + $html .= 'id="'.$self->get('id').'" ' unless ($self->get('id') eq "_formId"); $html .= 'value="'.$value.'" '.$self->get("extras").' />'; return $html; } diff --git a/lib/WebGUI/Form/CheckList.pm b/lib/WebGUI/Form/CheckList.pm index 04463cc5b..488f0d566 100644 --- a/lib/WebGUI/Form/CheckList.pm +++ b/lib/WebGUI/Form/CheckList.pm @@ -92,18 +92,18 @@ sub toHtml { %options = $self->orderedHash(); foreach my $key (keys %options) { my $checked = 0; - foreach my $item (@{ $self->{value} }) { + foreach my $item (@{ $self->get('value') }) { if ($item eq $key) { $checked = 1; } } $output .= WebGUI::Form::Checkbox->new({ - name=>$self->{name}, + name=>$self->get('name'), value=>$key, - extras=>$self->{extras}, + extras=>$self->get('extras'), checked=>$checked })->toHtml; - $output .= ${$self->{options}}{$key} . $alignment; + $output .= ${$self->get('options')}{$key} . $alignment; } return $output; } diff --git a/lib/WebGUI/Form/Checkbox.pm b/lib/WebGUI/Form/Checkbox.pm index d69b3303c..867bd3306 100644 --- a/lib/WebGUI/Form/Checkbox.pm +++ b/lib/WebGUI/Form/Checkbox.pm @@ -124,7 +124,7 @@ sub toHtml { my $self = shift; my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->get("value")))); my $checkedText = ' checked="checked"' if ($self->get("checked")); - my $idText = ' id="'.$self->{id}.'" ' if ($self->{id}); + my $idText = ' id="'.$self->get('id').'" ' if ($self->get('id')); return 'get("extras").' />'; } diff --git a/lib/WebGUI/Form/Combo.pm b/lib/WebGUI/Form/Combo.pm index e81bd76d7..8c14cc559 100644 --- a/lib/WebGUI/Form/Combo.pm +++ b/lib/WebGUI/Form/Combo.pm @@ -103,7 +103,7 @@ sub toHtml { .WebGUI::Form::Text->new( size=>$self->session->setting->get("textBoxSize")-5, name=>$self->get("name")."_new", - id=>$self->{id}."_new" + id=>$self->get('id')."_new" )->toHtml; } diff --git a/lib/WebGUI/Form/ContentType.pm b/lib/WebGUI/Form/ContentType.pm index 016d161e2..a2ea5f84b 100644 --- a/lib/WebGUI/Form/ContentType.pm +++ b/lib/WebGUI/Form/ContentType.pm @@ -94,7 +94,7 @@ sub toHtml { my $self = shift; my %types; my $i18n = WebGUI::International->new($self->session); - foreach my $type (@{$self->get("types}")) { + foreach my $type (@{ $self->get('types') }) { if ($type eq "text") { $types{text} = $i18n->get(1010); } elsif ($type eq "mixed") { diff --git a/lib/WebGUI/Form/Control.pm b/lib/WebGUI/Form/Control.pm index 27e0bcb88..7a891b3cf 100644 --- a/lib/WebGUI/Form/Control.pm +++ b/lib/WebGUI/Form/Control.pm @@ -522,6 +522,29 @@ sub session { } +#------------------------------------------------------------------- + +=head2 set ( key, var ) + +Set a property of this form object. + +=head3 key + +The name of the property to set. + +=head3 var + +The value to set the property to. + +=cut + +sub set { + my $self = shift; + my $key = shift; + my $value = shift; + $self->{_params}{$key} = $value; +} + #------------------------------------------------------------------- =head2 toHtml ( ) diff --git a/lib/WebGUI/Form/DatabaseLink.pm b/lib/WebGUI/Form/DatabaseLink.pm index c31ad7512..d3cdf10a8 100644 --- a/lib/WebGUI/Form/DatabaseLink.pm +++ b/lib/WebGUI/Form/DatabaseLink.pm @@ -94,7 +94,7 @@ sub definition { defaultValue=>$i18n->get('1075 description') }, }); - return $class->SUPER::definition($definition); + return $class->SUPER::definition($session, $definition); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/Date.pm b/lib/WebGUI/Form/Date.pm index 156bb9ea2..d884b3b3e 100644 --- a/lib/WebGUI/Form/Date.pm +++ b/lib/WebGUI/Form/Date.pm @@ -80,7 +80,7 @@ sub definition { defaultValue=>$i18n->get("479") }, defaultValue=>{ - defaultValue=$session->datetime->time() + defaultValue=>$session->datetime->time() }, maxlength=>{ defaultValue=> 10 @@ -150,7 +150,7 @@ sub toHtml { $self->session->style->setLink($self->session->config->get("extrasURL").'/calendar/calendar-win2k-1.css', { rel=>"stylesheet", type=>"text/css", media=>"all" }); return $self->SUPER::toHtml. '