r39285 - in /trunk/libhtml-formfu-perl: ./ debian/ lib/HTML/ lib/HTML/FormFu/ lib/HTML/FormFu/Element/ lib/HTML/FormFu/Model/ t/bugs/ t/elements/ t/filters/ t/form/ t/i18n/
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Fri Jul 3 23:39:07 UTC 2009
Author: ansgar-guest
Date: Fri Jul 3 23:39:02 2009
New Revision: 39285
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=39285
Log:
New upstream release
Added:
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/Label.pm
- copied unchanged from r39284, branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Label.pm
trunk/libhtml-formfu-perl/t/bugs/datetime_hour_lt_10.t
- copied unchanged from r39284, branches/upstream/libhtml-formfu-perl/current/t/bugs/datetime_hour_lt_10.t
trunk/libhtml-formfu-perl/t/elements/label.t
- copied unchanged from r39284, branches/upstream/libhtml-formfu-perl/current/t/elements/label.t
trunk/libhtml-formfu-perl/t/i18n/add_localize_object_from_class.t
- copied unchanged from r39284, branches/upstream/libhtml-formfu-perl/current/t/i18n/add_localize_object_from_class.t
trunk/libhtml-formfu-perl/t/i18n/add_localize_object_from_class.yml
- copied unchanged from r39284, branches/upstream/libhtml-formfu-perl/current/t/i18n/add_localize_object_from_class.yml
Modified:
trunk/libhtml-formfu-perl/Changes
trunk/libhtml-formfu-perl/MANIFEST
trunk/libhtml-formfu-perl/META.yml
trunk/libhtml-formfu-perl/debian/changelog
trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/Date.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/DateTime.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Localize.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Util.pm
trunk/libhtml-formfu-perl/t/filters/compoundjoin.t
trunk/libhtml-formfu-perl/t/filters/compoundjoin.yml
trunk/libhtml-formfu-perl/t/form/get_all_elements.t
Modified: trunk/libhtml-formfu-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/Changes?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/Changes (original)
+++ trunk/libhtml-formfu-perl/Changes Fri Jul 3 23:39:02 2009
@@ -1,3 +1,21 @@
+0.05001 2009-07-03
+
+ - get_field(s), get_element(s), get_all_elements() now support a Regex
+ object for any conditional argument.
+
+ - Model::Hashref now searches for Multi and Repeatable elements using the
+ regexes qr/Multi/ and qr/Repeatable/ to all for custom/derived classes.
+
+ - New $form->add_localize_object_from_class() method.
+
+ - New Element::Label.
+
+ - Bugfix: DateTime element, hour/minute select menus didn't display correct
+ value when hour/minute value was less than 10, and $form->process()
+ wasn't called after $form->model->default_values().
+
+ - Silence "undef value in string eq" warnings.
+
0.05000 2009-05-26
- Nested repeatable blocks now create field names such as
Modified: trunk/libhtml-formfu-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/MANIFEST?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/MANIFEST (original)
+++ trunk/libhtml-formfu-perl/MANIFEST Fri Jul 3 23:39:02 2009
@@ -144,6 +144,7 @@
lib/HTML/FormFu/Element/Hidden.pm
lib/HTML/FormFu/Element/Hr.pm
lib/HTML/FormFu/Element/Image.pm
+lib/HTML/FormFu/Element/Label.pm
lib/HTML/FormFu/Element/Multi.pm
lib/HTML/FormFu/Element/Number.pm
lib/HTML/FormFu/Element/Password.pm
@@ -256,6 +257,7 @@
t/block_insert_before.t
t/bugs/constructor_arg_overwrites_default.t
t/bugs/date_element_empty_input.t
+t/bugs/datetime_hour_lt_10.t
t/bugs/element_class.t
t/bugs/element_parent.t
t/bugs/error_msg.t
@@ -403,6 +405,7 @@
t/elements/hidden.t
t/elements/hr.t
t/elements/image.t
+t/elements/label.t
t/elements/label.yml
t/elements/multi.t
t/elements/multi_errors.t
@@ -567,6 +570,8 @@
t/form/submitted_and_valid.t
t/form/valid.t
t/i18n/add_localize_object.t
+t/i18n/add_localize_object_from_class.t
+t/i18n/add_localize_object_from_class.yml
t/inflators/array.t
t/inflators/callback.t
t/inflators/compounddatetime.t
Modified: trunk/libhtml-formfu-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/META.yml?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/META.yml (original)
+++ trunk/libhtml-formfu-perl/META.yml Fri Jul 3 23:39:02 2009
@@ -58,4 +58,4 @@
perl: 5.8.1
resources:
license: http://dev.perl.org/licenses/
-version: 0.05000
+version: 0.05001
Modified: trunk/libhtml-formfu-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/changelog?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/debian/changelog (original)
+++ trunk/libhtml-formfu-perl/debian/changelog Fri Jul 3 23:39:02 2009
@@ -1,8 +1,12 @@
-libhtml-formfu-perl (0.05000-2) UNRELEASED; urgency=low
+libhtml-formfu-perl (0.05001-1) UNRELEASED; urgency=low
+ [ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- -- Nathan Handler <nhandler at ubuntu.com> Sat, 06 Jun 2009 01:34:25 +0000
+ [ Ansgar Burchardt ]
+ * New upstream release
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sat, 04 Jul 2009 01:34:08 +0200
libhtml-formfu-perl (0.05000-1) unstable; urgency=low
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm Fri Jul 3 23:39:02 2009
@@ -112,7 +112,7 @@
*plugins = \&plugin;
*add_plugins = \&add_plugin;
-our $VERSION = '0.05000';
+our $VERSION = '0.05001';
$VERSION = eval $VERSION;
Class::C3::initialize();
@@ -2775,6 +2775,12 @@
type => 'Radio',
});
+Accepts also an Regexp to search for results.
+
+ $form->get_elements({
+ name => qr/oo/,
+ });
+
=head2 get_field
Arguments: [%options]
@@ -2804,6 +2810,12 @@
type => 'Radio',
});
+Accepts also an Regexp to search for results.
+
+ $form->get_elements({
+ name => qr/oo/,
+ });
+
=head2 get_element
Arguments: [%options]
@@ -2834,6 +2846,12 @@
$form->get_all_elements({
type => 'Text',
+ });
+
+Accepts also an Regexp to search for results.
+
+ $form->get_elements({
+ name => qr/oo/,
});
See L</get_elements> for a non-recursive version.
@@ -2856,6 +2874,12 @@
type => 'Text',
});
+Accepts also an Regexp to search for results.
+
+ $form->get_elements({
+ name => qr/oo/,
+ });
+
See L</get_all_elements> for a non-recursive version.
=head2 get_deflators
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element.pm Fri Jul 3 23:39:02 2009
@@ -542,6 +542,8 @@
=item L<HTML::FormFu::Element::Hr>
+=item L<HTML::FormFu::Element::Label>
+
=item L<HTML::FormFu::Element::Multi>
=item L<HTML::FormFu::Element::Repeatable>
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/Date.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/Date.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/Date.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/Date.pm Fri Jul 3 23:39:02 2009
@@ -17,6 +17,9 @@
__PACKAGE__->mk_accessors( qw(
_known_fields
+ printf_day
+ printf_month
+ printf_year
) );
__PACKAGE__->mk_item_accessors( qw(
@@ -60,6 +63,10 @@
$self->_known_fields( [qw/ day month year /] );
+ $self->printf_day ('%d');
+ $self->printf_month('%d');
+ $self->printf_year ('%d');
+
$self->field_order( [qw/ day month year /] );
$self->day( {
@@ -99,8 +106,13 @@
for my $i ( 0 .. $#order ) {
my $field = $order[$i];
- $self->_elements->[$i]
- ->default( $value ? $self->$field->{default} : undef );
+ my $printf_method = "printf_$field";
+
+ my $default = $value
+ ? sprintf( $self->$printf_method, $self->$field->{default} )
+ : undef;
+
+ $self->_elements->[$i]->default($default);
}
}
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/DateTime.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/DateTime.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/DateTime.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Element/DateTime.pm Fri Jul 3 23:39:02 2009
@@ -6,6 +6,8 @@
use Scalar::Util qw( blessed );
__PACKAGE__->mk_attrs(qw/ hour minute /);
+
+__PACKAGE__->mk_accessors(qw/ printf_hour printf_minute /);
sub new {
my $self = shift->next::method(@_);
@@ -30,6 +32,9 @@
type => '_MultiSelect',
prefix => [],
} );
+
+ $self->printf_hour ('%02d');
+ $self->printf_minute('%02d');
return $self;
}
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Localize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Localize.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Localize.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Localize.pm Fri Jul 3 23:39:02 2009
@@ -12,6 +12,7 @@
our @EXPORT = qw(
localize
add_localize_object
+ add_localize_object_from_class
get_localize_object_from_class
get_localize_object_dies_on_missing_key
add_default_localize_object
@@ -85,6 +86,16 @@
}
return $self;
+}
+
+sub add_localize_object_from_class {
+ my ( $self, @class ) = @_;
+
+ return $self->add_localize_object(
+ map {
+ $self->get_localize_object_from_class( $_ )
+ } @class
+ );
}
sub get_localize_object_from_class {
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm Fri Jul 3 23:39:02 2009
@@ -248,7 +248,7 @@
my $element = shift;
unless ( $self->_multi ) {
my %multis = ();
- my $multis = $self->form->get_all_elements( { type => "Multi" } );
+ my $multis = $self->form->get_all_elements( { type => qr/Multi/ } );
foreach my $multi ( @{ $multis || [] } ) {
my @multis;
map { push( @multis, $_->name ) } @{ $multi->get_elements };
@@ -265,7 +265,7 @@
my $element = shift;
unless ( $self->_repeatable ) {
my %rep = ();
- my $rep = $self->form->get_all_elements( { type => "Repeatable" } );
+ my $rep = $self->form->get_all_elements( { type => qr/Repeatable/ } );
# TODO - Mario Minati 19.05.2009
# use $_->delimiter to split the keys
foreach my $rep_element (@{ $rep || [] }) {
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Util.pm?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Util.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Util.pm Fri Jul 3 23:39:02 2009
@@ -125,11 +125,11 @@
for my $name ( keys %$args ) {
my $value;
-
+ next unless defined $args->{$name};
@$elements = grep {
$_->can($name)
&& defined( $value = $_->$name )
- && $value eq $args->{$name}
+ && (ref($args->{$name}) eq 'Regexp' ? $value =~ $args->{$name} : $value eq $args->{$name})
} @$elements;
}
Modified: trunk/libhtml-formfu-perl/t/filters/compoundjoin.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/t/filters/compoundjoin.t?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/t/filters/compoundjoin.t (original)
+++ trunk/libhtml-formfu-perl/t/filters/compoundjoin.t Fri Jul 3 23:39:02 2009
@@ -5,22 +5,22 @@
use HTML::FormFu;
-my $form = HTML::FormFu->new;
+my $form = HTML::FormFu->new(
+ { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } );
$form->load_config_file('t/filters/compoundjoin.yml');
-$form->process({
- 'address.number' => '10',
- 'address.street' => 'Downing Street',
-});
+$form->process;
+
+$form->process(
+ {
+ 'rep_1.address.number' => '10',
+ 'rep_1.address.street' => 'Downing Street',
+ }
+);
ok( $form->submitted_and_valid );
-is( $form->param_value('address'), '10 Downing Street' );
+is( $form->param_value('rep_1.address'), '10 Downing Street' );
-is_deeply(
- $form->params,
- {
- address => '10 Downing Street',
- },
-);
+is_deeply( $form->params, { rep_1 => { address => '10 Downing Street' }, }, );
Modified: trunk/libhtml-formfu-perl/t/filters/compoundjoin.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/t/filters/compoundjoin.yml?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/t/filters/compoundjoin.yml (original)
+++ trunk/libhtml-formfu-perl/t/filters/compoundjoin.yml Fri Jul 3 23:39:02 2009
@@ -1,12 +1,16 @@
---
elements:
- - type: Multi
- name: address
+ - type: Repeatable
+ nested_name: rep
+
+ elements:
+ - type: Multi
+ name: address
- elements:
- - name: number
- - name: street
+ elements:
+ - name: number
+ - name: street
- filters:
- type: CompoundJoin
+ filters:
+ type: CompoundJoin
Modified: trunk/libhtml-formfu-perl/t/form/get_all_elements.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/t/form/get_all_elements.t?rev=39285&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/t/form/get_all_elements.t (original)
+++ trunk/libhtml-formfu-perl/t/form/get_all_elements.t Fri Jul 3 23:39:02 2009
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More tests => 28;
use HTML::FormFu;
@@ -86,3 +86,12 @@
ok( $elems->[0] == $e2 );
}
+
+{
+ my $elems = $form->get_all_elements( { name => qr/oo/ } );
+
+ is( @$elems, 2 );
+
+ ok( $elems->[0] == $e1 );
+ ok( $elems->[1] == $e2 );
+}
More information about the Pkg-perl-cvs-commits
mailing list