annotate Lib/IMPL/Web/TT/Control.pm @ 79:2d1c3f713280

ORM concept in development
author wizard
date Mon, 05 Apr 2010 00:20:34 +0400
parents a5cb84374d40
children 0e72ad99eef7
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
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
3 use base qw(IMPL::DOM::Node);
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
4
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
5 use IMPL::Class::Property;
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
6
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
7 our %CTOR = (
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
8 'IMPL::DOM::Node' => sub {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
9 #TODO: Pass arguments
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
10 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
11 );
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
12
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
13 BEGIN {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
14 public property template => prop_all;
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
15 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
16
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
17 sub Render {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
18 my ($this) = @_;
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
19
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
20 if ($this->document) {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
21 if ($this->template) {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
22 return $this->document->context->include($this->template,{ this => $this });
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
23 } elsif ($this->document->presenter) {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
24 return $this->document->presenter->print($this);
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
25 } else {
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
26 return $this->toString();
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
27 }
a5cb84374d40 TT::Control in work
wizard
parents:
diff changeset
28 }
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 1;