Mercurial > pub > Impl
view Lib/Form/Filter/Mandatory.pm @ 122:a7efb3117295
Fixed bug in IMPL::DOM::Navigator::selectNodes
Fixed bug in IMPL::DOM::Node::selectNodes
renamed operator 'type' to 'typeof' in IMPL::Object::Abstract
A proper implementation of the IMPL::DOM::Node::nodeProperty and a related changes in the IMPL::DOM::Property module, now the last is very simple.
author | wizard |
---|---|
date | Tue, 08 Jun 2010 20:12:45 +0400 |
parents | 16ada169ca75 |
children | 76515373dac0 |
line wrap: on
line source
package Form::Filter::Mandatory; use strict; use Common; use base qw(Form::Filter); sub SUPPORTED_CONTEXT { Form::Filter::CTX_SINGLE | Form::Filter::CTX_SET } sub Invoke { my ($this,$target,$context,$schemaTarget,$parent) = @_; my @list; if ($context & Form::Filter::CTX_SET) { @list = @{$target || []}; } elsif ($context & (Form::Filter::CTX_SINGLE | Form::Filter::CTX_EXISTENT)) { @list = ($target); } foreach my $object (@list) { if (defined $object and not $object->isEmpty) { return Form::FilterResult->new( State => Form::FilterResult::STATE_SUCCESS_STAY ); } } return Form::FilterResult->new( State => Form::FilterResult::STATE_ERROR, Message => $this->FormatMessage($schemaTarget), Target => $schemaTarget, Container => $parent ); } 1;