annotate Lib/IMPL/Web/View/TTDocument.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents 8e8401c0aea4
children 7a920771fd8e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
1 package IMPL::Web::View::TTDocument;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
2 use strict;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
3
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
4 use IMPL::lang qw(:declare :constants);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
5 use IMPL::DOM::Property qw(_dom);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
6 use IMPL::Web::View::TTFactory();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
7 use IMPL::Web::View::TTControl();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
8
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
9 use Scalar::Util qw(weaken);
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
10
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
11
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
12 use parent qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
13 IMPL::DOM::Document
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
14 IMPL::Web::View::TTControl
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
15 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
16
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
17 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
18 public _dom property layout => PROP_ALL;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
19 public property opts => PROP_GET | PROP_OWNERSET;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
20 public property loader => PROP_ALL;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
21 public property controls => PROP_GET | PROP_OWNERSET;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
22
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
23 # store the stash separately to make require() method to work correctly
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
24 # even when a stash of the context is modified during the processing
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
25 public property stash => PROP_GET | PROP_OWNERSET;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
26 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
27
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
28 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
29 my ($this,$template,$refOpts,$loader,$vars) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
30
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
31 $this->controls({});
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
32 $this->loader($loader) if $loader;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
33
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
34 $this->layout( $template->layout ) unless $this->layout;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
35
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
36 $this->opts($refOpts);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
37 $this->stash($this->context->stash);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
38
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
39 my $self = $this;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
40 weaken($self);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
41
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
42 $this->templateVars('require', sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
43 my $doc = $self;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
44 die new IMPL::Exception("A document is destroyed or invalid") unless $doc;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
45 $doc->require(@_);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
46 });
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
47
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
48 $this->templateVars('document', sub { $self } );
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
49 $this->InitInstance($vars);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
50 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
51
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
52 our %CTOR = (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
53 'IMPL::Web::View::TTControl' => sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
54 my ($template,$contextOpts) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
55 'document',
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
56 $_[0], # template
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
57 new Template::Context($_[1]) # context
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
58 },
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
59 'IMPL::DOM::Document' => sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
60 nodeName => 'document'
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
61 }
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
62 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
63
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
64 sub templateVars {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
65 my $this = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
66 my $name = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
67
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
68 if (@_) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
69 return $this->stash->set($name, shift);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
70 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
71 return $this->stash->get($name);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
72 }
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
73 }
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
74
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
75 sub require {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
76 my ($this, $control, $nodeProps) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
77
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
78 $nodeProps ||= {};
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
79 $nodeProps->{document} = $this;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
80
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
81 if (my $factory = $this->controls->{$control}) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
82 return $factory;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
83 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
84
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
85 my $path = $control;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
86 if ( my $template = $this->loader->template($path) ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
87 my $opts = { %{$this->opts} };
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
88
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
89 # avoid propagation of local variables
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
90 $opts->{STASH} = $this->stash->clone();
188
029c9610528c Memory leak tests in IMPL::Web::View
cin
parents: 187
diff changeset
91
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
92 my $ctx = new Template::Context($opts);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
93
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
94 $factory = new IMPL::Web::View::TTFactory(
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
95 $template->class || typeof IMPL::Web::View::TTControl,
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
96 $template,
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
97 $ctx,
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
98 $opts
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
99 );
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
100
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
101 my @parts = split(/\/+/,$control);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
102
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
103 $this->controls->{$control} = $factory;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
104
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
105 return $factory;
188
029c9610528c Memory leak tests in IMPL::Web::View
cin
parents: 187
diff changeset
106
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
107 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
108 die new IMPL::KeyNotFoundException($control);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
109 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
110 }
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
111 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
112
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
113 sub Render {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
114 my ($this,$args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
115
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
116 my $output;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
117
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
118 if ($this->layout) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
119 $output = $this->context->include(
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
120 $this->loader->template($this->layout),
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
121 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
122 content => sub { $output ||= $this->RenderContent($args); },
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
123 this => $this,
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
124 template => $this->template
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
125 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
126 );
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
127 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
128 return $this->RenderContent($args);
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
129 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
130
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
131 return $output;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
132 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
133
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
134 sub RenderContent {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
135 my $this = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
136 return $this->SUPER::Render(@_);
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
137 }
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
138
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
139
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
140 1;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
141
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
142 __END__
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
143
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
144 =pod
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
145
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
146 =head1 NAME
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
147
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
148 C<IMPL::Web::View::TTDocument> - документ для построения HTML страницы на основе шаблонов TT.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
149
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
150 =head1 SYNOPSIS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
151
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
152 =begin code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
153
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
154 use IMPL::Web::View::TTDocument();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
155
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
156 my $doc = new IMPL::Wbe::View::TTDocument($template,$ttOptions);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
157
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
158 return $doc->Render();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
159
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
160 =end code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
161
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
162 Однако, более предпочтительный способ использовать C<IMPL::Web::View::TTLoader>.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
163
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
164 =head1 DESCRIPTION
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
165
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
166 Документ для представления данных. Документы представляют собой иерархически организованные данные,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
167 элементами данного документа являются данные для отображения, такие как
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
168
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
169 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
170
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
171 =item * Объекты из БД
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
172
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
173 =item * Навигационные цепочки
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
174
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
175 =item * Меню и т.п.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
176
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
177 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
178
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
179 Скприт шаблона формирует структуру документа, затем сформированная структура форматируется в готовый документ.
192
a9faf883cdce IMPL::Web::View refactoring
cin
parents: 191
diff changeset
180 Процесс форматирования объектной модели в готовый документ может быть выполнена как вручную, так и при помощи
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
181 вспомогательного шаблона - обертки. Если у шаблона документа указан C<layout> в метаданных, то он будет
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
182 использован как шаблон для форматирования объектной модели, вывод самого шаблона будет проигнорирован. Если
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
183 обертка не задана, то результатом будет вывод самого скрипта шаблона.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
184
192
a9faf883cdce IMPL::Web::View refactoring
cin
parents: 191
diff changeset
185 Использование объектной модели документа позволяет решить задачи по созданию элементов управления
a9faf883cdce IMPL::Web::View refactoring
cin
parents: 191
diff changeset
186 контейнеров, у которых может быть сложное содежимое. Примером таких элементов могут быть формы,
a9faf883cdce IMPL::Web::View refactoring
cin
parents: 191
diff changeset
187 внутри форм элементы управления могут группироваться.
a9faf883cdce IMPL::Web::View refactoring
cin
parents: 191
diff changeset
188
193
sergey
parents: 192
diff changeset
189 =head2 Элементы управления (компоненты)
sergey
parents: 192
diff changeset
190
sergey
parents: 192
diff changeset
191 Документ состоит из узлов, часть которых наследуется от C<IMPL::Web::View::TTControl>, такие узлы называются
sergey
parents: 192
diff changeset
192 элементами управления. Каждый элемент управления имеет собственный контекст, который наследуется от контекста
sergey
parents: 192
diff changeset
193 документа.
sergey
parents: 192
diff changeset
194
sergey
parents: 192
diff changeset
195 =head2 Фабрика элементов управления
sergey
parents: 192
diff changeset
196
sergey
parents: 192
diff changeset
197 Для создания элементов управления используются фабрики. Каждый элемен управления имеет свой шаблон для
sergey
parents: 192
diff changeset
198 форматиорвания содержимого, фабрика связывает шаблон и класс элемента управления, для чего при загрузке
sergey
parents: 192
diff changeset
199 шаблона используется свойство C<type> из метаданных. Фабрика загружается в документ при том только один
sergey
parents: 192
diff changeset
200 раз, повторные загрузки фабрики возвращают уже загруженную. Для загрузки фабрики используется метод
sergey
parents: 192
diff changeset
201 C<require()>.
sergey
parents: 192
diff changeset
202
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
203
185
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
204 =head2 Порядок обработки документа
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
205
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
206 =over
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
207
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
208 =item 1 Создается документ при помощи метода C<TTLoader::document()>
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
209
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
210 =item 1 При создании документа (в конструкторе), происходит выполнение блока C<CTOR>
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
211
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
212 =item 1 При вызове метода C<TTDocument::Render()> устанавливаются переменные C<this>, C<document>
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
213 и шаблон обрабатывается при помощи метода C<process()> контекста документа.
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
214
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
215 =back
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
216
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
217 =head2 Загрузка элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
218
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
219 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
220
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
221 =item 1 C<TInput = require('my/org/input')>
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
222
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
223 =item 1 Загружает шаблон C<my/org/input.tt>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
224
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
225 =item 1 Создает фабрику элементов управления с собственным контекстом, унаследованным от контекст документа.
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
226
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
227 =item 1 Выполняет шаблон в пространстве имен фабрики
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
228
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
229 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
230
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
231 =head2 Создание элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
232
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
233 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
234
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 193
diff changeset
235 =item 1 C<< TInput.new('login') >>
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
236
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
237 =item 1 Если это первый элемент управления, то выполняетя статический конструктор в контексте фабрики
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
238
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
239 =item 1 Создается новый дочерний контекст к контексту фабрики
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
240
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
241 =item 1 Создается экземпляр элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
242
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
243 =item 1 Выполняется блок конструктора в контексте элемента управления, параметр C<this> имеет значение
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
244 нового экземпляра элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
245
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
246 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
247
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
248 =head1 MEMBERS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
249
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
250 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
251
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
252 =item C<CTOR($template, %options)>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
253
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
254 Создает экземпляр документа с указанным шаблоном и параметрами, параметры
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
255
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
256 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
257
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
258 =cut