annotate Lib/IMPL/DOM/Transform/PostToDOM.pm @ 112:0ed8e2541b1c

Form processing mechanism
author wizard
date Tue, 18 May 2010 17:59:31 +0400
parents 83e356614c1e
children 7b14e0122b79
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
1 package IMPL::DOM::Transform::PostToDOM;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
4
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
5 use IMPL::DOM::Navigator::Builder;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
6 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
7
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
8 use base qw(IMPL::Transform);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
10 BEGIN {
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
11 public property documentClass => prop_get | owner_set;
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
12 public property documentSchema => prop_get | owner_set;
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
13 private property _navi => prop_all;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
14 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
15
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
16 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
17 'IMPL::Transform' => sub {
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
18 HASH => \&TransfromPostData
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
19 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
20 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
21
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
22 sub CTOR {
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
23 my ($this,$docClass,$docSchema) = @_;
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
24 $docClass ||= 'IMPL::DOM::Document';
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
25
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
26 $this->_navi(
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
27 IMPL::DOM::Navigator::Builder->new(
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
28 $docClass,
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
29 $docSchema
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
30 )
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
31 );
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
32 }
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
33
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
34 sub TransformPostData {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
35 my ($this,$data) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
36
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
37 my $navi = $this->_navi;
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
38
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
39 my %
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
40
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
41 while (my ($key,$value) = each %$data) {
79
2d1c3f713280 ORM concept in development
wizard
parents: 49
diff changeset
42 # TODO: review
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
43 $navi->save;
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
44 my $node = $navi->Navigate(split /\//, $key);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
45 $node->nodeValue($value);
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
46 $navi->resore;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
47 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
48
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
49 return $navi->Document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
50 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
51
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
52 sub
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
53
112
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
54 sub TransformErrors {
0ed8e2541b1c Form processing mechanism
wizard
parents: 106
diff changeset
55 return $_[0]->_navi->BuildErrors;
106
83e356614c1e DOM Builder now is a navigator like SimpleBuilder
wizard
parents: 79
diff changeset
56 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
57
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
58 1;