annotate Lib/IMPL/Web/View/Metadata/FormProvider.pm @ 365:7c621bb95e53

working on the metadata model
author sergey
date Mon, 02 Dec 2013 02:13:12 +0400
parents 82b6c967bcf1
children 935629bf80df
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
364
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
1 package IMPL::Web::View::Metadata::FormProvider;
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
2 use strict;
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
3
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
4 use IMPL::declare {
365
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
5 require => {
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
6 Meta => 'IMPL::Web::View::Metadata::FormMeta'
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
7 },
364
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
8 base => [
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
9 'IMPL::Object' => undef
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
10 ]
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
11 };
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
12
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
13 sub GetFormMetadata {
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
14 my ($this,$model, $form) = @_;
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
15 }
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
16
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
17 sub PopulateChildren {
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
18 my ($this,$meta) = @_;
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
19
365
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
20 map Meta->new($this,), $meta->schema->content->childNodes;
364
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
21 }
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
22
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
23 sub GetChild {
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
24
365
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
25 }
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
26
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
27 sub _IsErrorRelates {
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
28 my ($node,$source,$err) = @_;
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
29
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
30 # this is an own error
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
31 return 1 if ($node && $err->node && $err->node == $node) || (not($node) && $err->schema == $source );
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
32
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
33 # this error relates to the child control
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
34
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
35 return 0 unless $node;
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
36
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
37 for (my $n = $err->parent; $n ; $n = $n->parentNode) {
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
38 return 1 if $n == $node;
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
39 }
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
40
7c621bb95e53 working on the metadata model
sergey
parents: 364
diff changeset
41 return 0;
364
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
42 }
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
43
82b6c967bcf1 sync, working on metadata
cin
parents:
diff changeset
44 1;