Mercurial > pub > Impl
annotate Lib/IMPL/Web/TT/Control.pm @ 217:bfce101e0a5a
Слияние
author | cin |
---|---|
date | Mon, 20 Aug 2012 10:27:20 +0400 |
parents | 4d0e1962161c |
children |
rev | line source |
---|---|
78 | 1 package IMPL::Web::TT::Control; |
2 | |
166 | 3 use parent qw(IMPL::Web::TT::Collection); |
78 | 4 |
171 | 5 |
78 | 6 use IMPL::Class::Property; |
122 | 7 use IMPL::DOM::Property qw(_dom); |
78 | 8 |
107 | 9 __PACKAGE__->PassThroughArgs; |
78 | 10 |
11 BEGIN { | |
194 | 12 public property controlClass => prop_all; |
13 public property template => prop_all; | |
14 public property id => prop_all; | |
107 | 15 } |
16 | |
17 my $nextId = 1; | |
18 | |
19 sub CTOR { | |
194 | 20 my ($this,%args) = @_; |
21 | |
22 if ($this->document) { | |
23 # load a template | |
24 $this->template( $this->document->context->template($args{template})) if ($args{template} and not ref $args{template}); | |
25 } | |
26 #$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
|
27 |
194 | 28 $this->id($this->nodeName . '-' . $nextId++); |
29 $this->controlClass('Control') unless $this->controlClass; | |
78 | 30 } |
31 | |
32 sub Render { | |
194 | 33 my ($this) = @_; |
34 | |
35 if ($this->document) { | |
36 if ($this->template) { | |
37 return $this->document->context->include($this->template,{ this => $this }) ; | |
38 } elsif ($this->document->presenter) { | |
39 return $this->document->presenter->print($this); | |
40 } else { | |
41 return $this->toString().": ".$this->controlClass() . ": ".$this->path; | |
42 } | |
43 } | |
78 | 44 } |
180 | 45 1; |