Mercurial > pub > Impl
annotate Lib/IMPL/Web/TT/Control.pm @ 146:60fd224f3e3c
fixed cgi parameters processing
Added parameters inflating feature
Added preprocessed templates, reformatting output
author | wizard |
---|---|
date | Mon, 26 Jul 2010 03:19:06 +0400 |
parents | fb896377389f |
children | 4267a2ac3d46 |
rev | line source |
---|---|
78 | 1 package IMPL::Web::TT::Control; |
2 | |
108 | 3 use base qw(IMPL::Web::TT::Collection); |
78 | 4 |
5 use IMPL::Class::Property; | |
122 | 6 use IMPL::DOM::Property qw(_dom); |
78 | 7 |
107 | 8 __PACKAGE__->PassThroughArgs; |
78 | 9 |
10 BEGIN { | |
108 | 11 public property controlClass => prop_all; |
78 | 12 public property template => prop_all; |
107 | 13 public property id => prop_all; |
14 } | |
15 | |
16 my $nextId = 1; | |
17 | |
18 sub CTOR { | |
19 my ($this,%args) = @_; | |
20 | |
109
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
108
diff
changeset
|
21 if ($this->document) { |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
108
diff
changeset
|
22 # load a template |
140
fb896377389f
to_json and escape_string functions for the templates
wizard
parents:
126
diff
changeset
|
23 $this->template( $this->document->context->template($args{template})) if ($args{template} and not ref $args{template}); |
109
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
108
diff
changeset
|
24 } |
126 | 25 #$this->template($args{template}) if $args{template}; |
109
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
108
diff
changeset
|
26 |
107 | 27 $this->id($this->nodeName . '-' . $nextId++); |
140
fb896377389f
to_json and escape_string functions for the templates
wizard
parents:
126
diff
changeset
|
28 $this->controlClass('Control') unless $this->controlClass; |
78 | 29 } |
30 | |
31 sub Render { | |
32 my ($this) = @_; | |
33 | |
34 if ($this->document) { | |
35 if ($this->template) { | |
117 | 36 return $this->document->context->include($this->template,{ this => $this }) ; |
78 | 37 } elsif ($this->document->presenter) { |
38 return $this->document->presenter->print($this); | |
39 } else { | |
117 | 40 return $this->toString().": ".$this->controlClass() . ": ".$this->path; |
78 | 41 } |
42 } | |
43 } | |
44 | |
45 1; |