annotate Lib/IMPL/Web/TT/Control.pm @ 139:5a9f64890c31

Fixed module loading by the UriController
author wizard
date Thu, 01 Jul 2010 17:32:29 +0400
parents c8dfbbdd8005
children fb896377389f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
1 package IMPL::Web::TT::Control;
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
2
108
c6fb6964de4c Removed absolute modules
wizard
parents: 107
diff changeset
3 use base qw(IMPL::Web::TT::Collection);
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
4
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
5 use IMPL::Class::Property;
122
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 117
diff changeset
6 use IMPL::DOM::Property qw(_dom);
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
7
107
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
8 __PACKAGE__->PassThroughArgs;
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
9
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
10 BEGIN {
108
c6fb6964de4c Removed absolute modules
wizard
parents: 107
diff changeset
11 public property controlClass => prop_all;
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
12 public property template => prop_all;
107
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
13 public property id => prop_all;
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
14 }
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
15
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
16 my $nextId = 1;
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
17
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
18 sub CTOR {
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
19 my ($this,%args) = @_;
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
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
0475eb382085 Controls support (RC1)
wizard
parents: 109
diff changeset
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
c8dfbbdd8005 Several bug fixes
wizard
parents: 122
diff changeset
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
0e72ad99eef7 Updated Web::TT
wizard
parents: 78
diff changeset
27 $this->id($this->nodeName . '-' . $nextId++);
108
c6fb6964de4c Removed absolute modules
wizard
parents: 107
diff changeset
28 $this->controlClass($args{controlClass} || 'Control');
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
29 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
30
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
31 sub Render {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
32 my ($this) = @_;
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
33
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
34 if ($this->document) {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
35 if ($this->template) {
117
0475eb382085 Controls support (RC1)
wizard
parents: 109
diff changeset
36 return $this->document->context->include($this->template,{ this => $this }) ;
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
37 } elsif ($this->document->presenter) {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
38 return $this->document->presenter->print($this);
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
39 } else {
117
0475eb382085 Controls support (RC1)
wizard
parents: 109
diff changeset
40 return $this->toString().": ".$this->controlClass() . ": ".$this->path;
78
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
41 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
42 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
43 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
44
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
45 1;