From d81a28b235ec2fea884ed83d5f2a154f4357ad99 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 6 Jun 2010 22:29:52 -0700 Subject: [PATCH] Fix some broken Form fields. Fixes bug #11611 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Form/FieldType.pm | 4 ++- lib/WebGUI/Form/ThingFieldsList.pm | 25 +++++++++++++++++++ lib/WebGUI/Form/Username.pm | 13 ++++++++++ .../i18n/English/Form_ThingsFieldList.pm | 11 ++++++++ lib/WebGUI/i18n/English/Form_Username.pm | 5 ++++ 6 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 lib/WebGUI/i18n/English/Form_ThingsFieldList.pm diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 5626a6d3f..ac758575f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -4,6 +4,7 @@ - fixed #11613: Thingy: If next action after add is to add more things, previous data remains - added API method commitAsUser allowing developers to commit version tags as other users - fixed: The template form plugin would return an empty string when getValueAsHtml was called. ( Martin Kamerbeek / Oqapi ) + - fixed #11611: Thingy: The add field pop up box has multiple "Text" field types 7.9.6 - new checkbox in the asset manager for clearing the package flag on import diff --git a/lib/WebGUI/Form/FieldType.pm b/lib/WebGUI/Form/FieldType.pm index d0bff2b5a..ba553ab52 100644 --- a/lib/WebGUI/Form/FieldType.pm +++ b/lib/WebGUI/Form/FieldType.pm @@ -125,7 +125,9 @@ sub getTypes { } my %fields = (); foreach my $type (@types) { - $fields{$type} = WebGUI::Pluggable::instanciate('WebGUI::Form::'.ucfirst($type), 'getName', [$self->session]); + my $name = WebGUI::Pluggable::instanciate('WebGUI::Form::'.ucfirst($type), 'getName', [$self->session]); + $self->session->log->warn("type: $type; name: $name"); + $fields{$type} = $name; } return \%fields; } diff --git a/lib/WebGUI/Form/ThingFieldsList.pm b/lib/WebGUI/Form/ThingFieldsList.pm index 10f8f99ab..72591335b 100644 --- a/lib/WebGUI/Form/ThingFieldsList.pm +++ b/lib/WebGUI/Form/ThingFieldsList.pm @@ -36,6 +36,31 @@ The following methods are specifically available from this class. Check the supe =cut +#------------------------------------------------------------------- + +=head2 getName ( session ) + +Returns the human readable name of this control. + +=cut + +sub getName { + my ($self, $session) = @_; + return WebGUI::International->new($session, 'WebGUI')->get('user'); +} + +#------------------------------------------------------------------- + +=head2 isDynamicCompatible ( ) + +Since this Form field requires a thingId to work it is not dynamic compatible. + +=cut + +sub isDynamicCompatible { + return 0; +} + #---------------------------------------------------------------------------- =head2 www_getThingFields ($session) diff --git a/lib/WebGUI/Form/Username.pm b/lib/WebGUI/Form/Username.pm index c1d6509f4..af0a73dff 100644 --- a/lib/WebGUI/Form/Username.pm +++ b/lib/WebGUI/Form/Username.pm @@ -58,6 +58,19 @@ Defaults to the setting textBoxSize or 30 if that's not set. Specifies how big o #------------------------------------------------------------------- +=head2 getName ( session ) + +Returns the human readable name of this control. + +=cut + +sub getName { + my ($self, $session) = @_; + return WebGUI::International->new($session, 'Form_Username')->get('username'); +} + +#------------------------------------------------------------------- + =head2 getValue ( [ value ] ) Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead. Strip newlines/carriage returns from the value. diff --git a/lib/WebGUI/i18n/English/Form_ThingsFieldList.pm b/lib/WebGUI/i18n/English/Form_ThingsFieldList.pm new file mode 100644 index 000000000..dc1f6c4cf --- /dev/null +++ b/lib/WebGUI/i18n/English/Form_ThingsFieldList.pm @@ -0,0 +1,11 @@ +package WebGUI::i18n::English::Form_ThingsFieldList; +use strict; + +our $I18N = { + 'Thingy Fields List' => { + message => q|Thingy Fields List|, + lastUpdated => 1217216725, + }, +}; + +1; diff --git a/lib/WebGUI/i18n/English/Form_Username.pm b/lib/WebGUI/i18n/English/Form_Username.pm index ba5fdf373..e8ca2b608 100644 --- a/lib/WebGUI/i18n/English/Form_Username.pm +++ b/lib/WebGUI/i18n/English/Form_Username.pm @@ -6,6 +6,11 @@ our $I18N = { message => q|Sorry, that account name is already in use by another member of this site.|, lastUpdated => 1217216725 }, + 'username' => { + message => q|Username|, + lastUpdated => 1217216725, + context => q|Name of the form plugin|, + }, }; 1;