annotate Lib/IMPL/Web/TT/Document.pm @ 99:6dd659f6f66c

Minor changes, DOM schema is in development (in the aspect of a forms)
author wizard
date Wed, 05 May 2010 17:33:55 +0400
parents 964587c5183c
children 0e72ad99eef7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
1 package IMPL::Web::TT::Document;
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
75
wizard
parents: 49
diff changeset
5 use base qw(IMPL::DOM::Document IMPL::Object::Disposable);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
6 use Template::Context;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
7 use Template::Provider;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
8 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
9 use File::Spec;
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
10 use Scalar::Util qw(blessed);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
11
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
12 BEGIN {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
13 private property _provider => prop_all;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
14 private property _context => prop_all;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
15 public property template => prop_get | owner_set;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
16 public property presenter => prop_all, { validate => \&_validatePresenter };
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
17 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
18
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
19 our %CTOR = (
75
wizard
parents: 49
diff changeset
20 'IMPL::DOM::Document' => sub { nodeName => 'document' }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
21 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
22
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
23 sub provider {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
24 my ($this,%args) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
25
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
26 if (my $provider = $this->_provider) {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
27 return $provider;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
28 } else {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
29 return $this->_provider(new Template::Provider(
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
30 \%args
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
31 ));
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
32 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
33 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
34
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
35 sub context {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
36 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
37
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
38 if (my $ctx = $this->_context) {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
39 return $ctx;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
40 } else {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
41 return $this->_context (
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
42 new Template::Context(
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
43 VARIABLES => {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
44 document => $this,
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
45 this => $this,
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
46 render => sub {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
47 $this->_process(@_);
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
48 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
49 },
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
50 TRIM => 1,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
51 RECURSION => 1,
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
52 LOAD_TEMPLATES => [$this->provider]
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
53 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
54 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
55 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
56 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
57
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
58 sub _validatePresenter {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
59 my ($this,$value) = @_;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
60
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
61 die new IMPL::InvalidArgumentException("A view object is required") unless blessed($value) and $value->isa('Template::View');
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
62 }
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
63
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
64 sub LoadFile {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
65 my ($this,$filePath,$encoding) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
66
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
67 die new IMPL::InvalidArgumentException("A filePath parameter is required") unless $filePath;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
68
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
69 $encoding ||= 'utf8';
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
70
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
71 $this->_context(undef);
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
72 $this->_provider(undef);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
73
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
74 my ($vol,$dir,$fileName) = File::Spec->splitpath($filePath);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
75
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
76 my $inc = File::Spec->catpath($vol,$dir,'');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
77
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
78 $this->provider(
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
79 ENCODING => $encoding,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
80 INTERPOLATE => 1,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
81 PRE_CHOMP => 1,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
82 POST_CHOMP => 1,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
83 INCLUDE_PATH => $inc
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
84 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
85
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
86 $this->template($this->context->template($fileName));
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
87 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
88
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 77
diff changeset
89 sub AddVar {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 77
diff changeset
90 my ($this,$name,$value) = @_;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 77
diff changeset
91
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 77
diff changeset
92 $this->context->stash->set($name,$value);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 77
diff changeset
93 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 77
diff changeset
94
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
95 sub title {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
96 $_[0]->template->title;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
97 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
98
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
99 sub Render {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
100 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
101
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
102 return $this->template->process($this->context);
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
103 }
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
104
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
105 # Формирует представление для произвольных объектов
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
106 sub _process {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
107 my ($this,@items) = @_;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
108
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
109 my @result;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
110
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
111 foreach my $item (@items) {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
112 if (blessed($item) and $item->isa('IMPL::Web::TT::Control')) {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
113 push @result, $item->Render();
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
114 } elsif(blessed($item)) {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
115 if ($this->presenter) {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
116 push @result, $this->presenter->print($item);
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
117 } else {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
118 push @result, $this->toString;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
119 }
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
120 } else {
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
121 push @result, $item;
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
122 }
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
123 }
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
124
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
125 return join '',@items;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
126 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
127
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
128 sub Dispose {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
129 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
130
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
131 $this->template(undef);
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
132 $this->_context(undef);
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
133 $this->_provider(undef);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
134
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
135 $this->SUPER::Dispose();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
136 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
137
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
138 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
139 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
140 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
141
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
142 =head1 NAME
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
143
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
144 C<IMPL::Web::TT::Document> - Документ, позволяющий строить представление по шаблону
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
145
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
146 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
147
75
wizard
parents: 49
diff changeset
148 =begin code
wizard
parents: 49
diff changeset
149
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
150 // create new document
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
151 my $doc = new IMPL::Web::TT::Document;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
152
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
153 // load template
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
154 $doc->loadFile('Templates/index.tt');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
155
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
156 // render file
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
157 print $doc->Render();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
158
75
wizard
parents: 49
diff changeset
159 =end code
wizard
parents: 49
diff changeset
160
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
161 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
162
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
163 C<use base qw(IMPL::DOM::Document)>
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
164
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
165 Документ, основанный на шаблоне Template::Toolkit. Позволяет загрузить шаблон,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
166 и сформировать окончательный документ. Является наследником C<IMPL::DOM::Node>,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
167 т.о. может быть использован для реализации DOM модели.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
168
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
169 Внутри шаблона переменная C<document> ссылается на объект документа. По этой
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
170 причине образуется циклическая ссылка между объектами шаблона и документом, что
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
171 требует вызова метода C<Dispose> для освобождения документа.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
172
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
173 =head1 METHODS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
174
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
175 =over
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
176
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
177 =item C<CTOR()>
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
178
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
179 Создает новый экземпляр документа, свойство C<nodeName> устанавливается в 'C<document>'
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
180
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
181 =item C<$doc->LoadFile($fileName,$encoding)>
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
182
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
183 Загружает шаблон из файла C<$fileName>, используя кодировку C<$encoding>. Если
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
184 кодировка не указана, использует utf-8.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
185
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
186 =item C<$doc->Render()>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
187
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
188 Возвращает данные построенные на основе загруженного шаблона.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
189
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
190 =item C<$doc->Dispose()>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
191
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
192 Освобождает ресурсы и помечает объект как освобожденный.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
193
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
194 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
195
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
196 =head1 DOM
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
197
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
198 =begin code html
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
199
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
200 [% table = document.Create('env','table') %]
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
201
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
202 [% FOEACH item in document.result %]
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
203 [% table.rows.Add( item.get('name','value') ) %]
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
204 [% END %]
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
205
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
206 [% form = document.Create('login','form') %]
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
207
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
208
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
209 [% form.template = 'LOGIN_FORM'%]
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
210
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
211 [% FOREACH item IN document.childNodes %]
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
212 [%render(item)%]
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
213 [% END %]
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
214
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
215 [% BLOCK LOGIN_FORM %]
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
216 <form method="POST" action='/login.pl'>
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
217 user: [% render(this.item('name')) %] password: [% render(this.item('password')) %] <input type="submit"/>
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
218 </form>
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
219 [% END %]
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
220
77
9d24db321029 Refactoring Web::TT
wizard
parents: 76
diff changeset
221 =end code html
76
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
222
b1652a158b2b Web::DOM
wizard
parents: 75
diff changeset
223
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
224 =cut