Mercurial > pub > Impl
annotate Lib/IMPL/Web/TT/Control.pm @ 138:c5bc900eefd3
IMPL::Web::Application: Fixed file uploading
Minor improvements in the IMPL::Web::TT::Form
author | wizard |
---|---|
date | Thu, 01 Jul 2010 04:25:07 +0400 |
parents | c8dfbbdd8005 |
children | fb896377389f |
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 |
117 | 23 $args{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++); |
108 | 28 $this->controlClass($args{controlClass} || 'Control'); |
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; |