annotate Lib/IMPL/Web/View/TTLoader.pm @ 340:c090d9102a38

web application security refactoring
author cin
date Fri, 21 Jun 2013 02:43:56 +0400
parents 86336d451b82
children 9bdccdf1f50b
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::TTLoader;
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 Template::Constants qw(:status);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
5
336
cin
parents: 311
diff changeset
6 use File::Spec();
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
7 use IMPL::Const qw(:prop);
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
8 use IMPL::declare {
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
9 require => {
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
10 Provider => 'Template::Provider',
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
11 Context => 'Template::Context',
309
cin
parents: 308
diff changeset
12 TTRegistry => 'IMPL::Web::View::TTRegistry',
308
sergey
parents: 289
diff changeset
13 TTFactory => 'IMPL::Web::View::TTFactory',
309
cin
parents: 308
diff changeset
14 TTDocument => '-IMPL::Web::View::TTDocument',
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
15 Exception => 'IMPL::Exception',
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
16 ArgumentException => '-IMPL::InvalidArgumentException',
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
17 KeyNotFoundException => '-IMPL::KeyNotFoundException'
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
18 },
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
19 base => [
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
20 'IMPL::Object' => undef,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
21 'IMPL::Object::Serializable' => undef
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
22 ],
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
23 props => [
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
24 options => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
25 provider => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
26 context => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
27 ext => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
28 layoutBase => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
29 isInitialized => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
30 initializer => PROP_RO,
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
31 _globals => PROP_RW
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
32 ]
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
33 };
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
34
196
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
35 sub save {
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
36 my ($this,$context) = @_;
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
37
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
38 $context->AddVar($_, $this->$_()) for qw(options provider context ext layoutBase);
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
39 }
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
40
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
41 sub restore {
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
42 my ($class,$data,$surrogate) = @_;
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
43
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
44 my %params = @$data;
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
45
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
46 my $refOpts = delete $params{options};
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
47
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
48 if ($surrogate){
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
49 $surrogate->callCTOR($refOpts,%params);
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
50 } else {
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
51 $surrogate = $class->new($refOpts,%params);
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
52 }
206
c8fe3f84feba +IMPL::Web::Handlers::ViewSelector
sergey
parents: 205
diff changeset
53 return $surrogate;
196
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
54 }
a705e848dcc7 added IMPL::Config::Reference
cin
parents: 195
diff changeset
55
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
56 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
57 my ($this,$refOpts,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
58
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
59 $refOpts ||= {};
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
60
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
61 $this->ext($args{ext}) if $args{ext};
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
62 $this->initializer($args{initializer}) if $args{initializer};
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
63 $this->_globals(ref $args{globals} eq 'HASH' ? $args{globals} : {});
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
64
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
65 $this->options($refOpts);
195
7a920771fd8e IMPL::Web::View changed document layout handling, docs, examples
cin
parents: 194
diff changeset
66 $this->layoutBase($args{layoutBase}) if $args{layoutBase};
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
67
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
68 # to aviod cyclic references we need to do a copy of $refOpts
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
69 $refOpts->{LOAD_TEMPLATES} = $this->provider(Provider->new( { %$refOpts } ));
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
70
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
71 $this->context(Context->new($refOpts));
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
72 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
73
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
74 sub document {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
75 my ($this,$name,$vars) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
76
309
cin
parents: 308
diff changeset
77 $vars ||= {};
308
sergey
parents: 289
diff changeset
78
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
79 my $tt = $this->template($name);
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
80
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
81 $this->_init();
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
82
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
83 my $opts = { %{ $this->options } };
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
84
287
2d253e6e4a88 *TTView refactoring
cin
parents: 285
diff changeset
85 $this->context->localise();
289
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
86 my $ctx = _clone_context($this->context);
287
2d253e6e4a88 *TTView refactoring
cin
parents: 285
diff changeset
87 $this->context->delocalise();
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
88
311
cin
parents: 310
diff changeset
89 $ctx->stash->update($vars);
cin
parents: 310
diff changeset
90
309
cin
parents: 308
diff changeset
91 my $registry = TTRegistry->new($this, $ctx);
cin
parents: 308
diff changeset
92
cin
parents: 308
diff changeset
93 my $factory = TTFactory->new($tt->class || TTDocument, $tt, $ctx, $name, $registry);
308
sergey
parents: 289
diff changeset
94
309
cin
parents: 308
diff changeset
95 $vars->{registry} = $registry;
310
0a9d51cf6dfd *TTView: refactoring, document supports custom classes, layouts are become controls
sergey
parents: 309
diff changeset
96 $vars->{layoutBase} = $this->layoutBase;
309
cin
parents: 308
diff changeset
97
311
cin
parents: 310
diff changeset
98 return $factory->new( $vars );
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
99 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
100
308
sergey
parents: 289
diff changeset
101
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
102 sub template {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
103 my ($this,$name) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
104
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
105 $name =~ s/^\s+|\s+$//g;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
106
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
107 die ArgumentException->new("A valid template name is required") unless length $name;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
108
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
109 $name = $this->_appendExt($name);
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
110
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
111 my ($tt,$error) = $this->provider->fetch($name);
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
112
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
113 if (defined $error and $error == STATUS_DECLINED) {
285
546957c50a36 *IMPL::Web::Handler::TTView Reworked template selection mechanism
cin
parents: 265
diff changeset
114 die KeyNotFoundException->new($name);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
115 } elsif (defined $error and $error == STATUS_ERROR) {
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
116 die Exception->new("Failed to load a template", $name, $tt);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
117 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
118
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
119 return $tt;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
120 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
121
336
cin
parents: 311
diff changeset
122 sub ResolveFileName {
cin
parents: 311
diff changeset
123 my ($this,$fname) = @_;
cin
parents: 311
diff changeset
124
cin
parents: 311
diff changeset
125 $fname = $this->_appendExt($fname);
cin
parents: 311
diff changeset
126
cin
parents: 311
diff changeset
127 my @files = grep -f , map File::Spec->catfile($_,$fname), @{$this->provider->paths()};
cin
parents: 311
diff changeset
128 return shift @files;
cin
parents: 311
diff changeset
129 }
cin
parents: 311
diff changeset
130
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
131 sub _appendExt {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
132 my ($this,$name) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
133
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
134 return $name unless $this->ext;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
135
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
136 if (length $this->ext and substr( $name, -length($this->ext) ) eq $this->ext) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
137 return $name;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
138 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
139 return $name . $this->ext;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
140 }
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
141 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
142
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
143 sub _init {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
144 my ($this) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
145
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
146 if (!$this->isInitialized) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
147 my $initializer = $this->initializer || sub {};
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
148
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
149 eval {
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
150 $this->context->process($initializer,$this->_globals);
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
151 };
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
152 if (my $e = $@) {
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
153 die Exception->new("Failed to process an initializer", $this->initializer, $e);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
154 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
155
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
156 $this->isInitialized(1);
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
157 }
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
158 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
159
289
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
160 sub _clone_context {
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
161 my $args = { %{shift || {}} };
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
162 delete $args->{CONFIG};
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
163
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
164 return Template::Context->new($args);
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
165 }
85572f512abc *TTView refactoring
cin
parents: 287
diff changeset
166
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
167 1;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
168
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
169 __END__
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
170
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
171 =pod
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
172
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
173 =head1 NAME
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
174
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
175 C<IMPL::Web::View::TTLoader> - предоставляет глобальный контекст для загрузки шаблонов
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
176
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
177 =head1 SYNOPSIS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
178
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
179 =begin code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
180
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
181 use IMPL::Web::View::TTLoader();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
182
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
183 my $loader = new IMPL::Web::View::TTLoader(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
184 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
185 INCLUDE_PATH => [
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
186 '/my/app/tt',
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
187 '/my/app/tt/lib'
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
188 ]
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
189 },
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
190 ext => '.tt',
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
191 initializer => 'shared/global'
4d0e1962161c Replaced tabs with spaces
cin
parents: 185
diff changeset
192
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
193 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
194
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
195 my $doc = $loader->document('index');
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
196
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
197 my $html = $doc->Render();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
198
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
199 =end code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
200
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
201 =head1 DESCRIPTION
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
202
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
203 Провайдер для загрузки шаблонов и документов. Имеет собственное пространство
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
204 имен, контекст выполнения шаблонов. Контект загрузчика инициализируется
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
205 шаблоном, в котором определяются глобальные переменные, которые будут доступны
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
206 в документах, однако их изменения будут локализованы.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
207
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
208 Инициализация контекста провайдера происходит при первой загрузке любого
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
209 документа.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
210
182
sergey
parents: 181
diff changeset
211 =head1 MEMBERS
sergey
parents: 181
diff changeset
212
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
213 =head2 C<CTOR($options,%args)>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
214
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
215 =over
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
216
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
217 =item * C<$options>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
218
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
219 Параметры контекста загрузчика, контексты документов и элементов управления
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
220 также унаследуют эти свойства. Напрямую передаются в конструктор
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
221 C<Template::Context>.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
222
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
223 =item * C<%args>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
224
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
225 Именованные параметы загрузчика.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
226
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
227 =over
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
228
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
229 =item * C<ext>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
230
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
231 Расширение, которое будет добавляться к именам шаблонов и документов (если оно
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
232 не будет указано явно).
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
233
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
234 =item * C<initializer>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
235
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
236 Имя шаблона, который будет использован для инициализации контекста.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
237
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
238 =item * C<globals>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
239
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
240 Глобальные переменнын, которые будут переданы в контекст.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
241
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
242 =item * C<layoutBase>
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
243
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
244 Путь к шаблонам для оформления документов. Каждый документ может задавать свой
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
245 C<layout> указанный в его C<META> блоке или конструкторе.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
246 См. C<IMPL::View::TTDocument>.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
247
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
248 =back
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
249
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
250 =back
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
251
182
sergey
parents: 181
diff changeset
252 =head2 C<document($docName)>
sergey
parents: 181
diff changeset
253
265
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
254 Загружает документ с именем C<$docName>. При необходимости к нему будет
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
255 добавлено расширение, указанное в свойстве C<ext>. Это единственно полезный
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
256 метод провайдера.
6b6d4b2275a1 improved documentation
cin
parents: 232
diff changeset
257
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
258 =cut
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
259