comparison Lib/IMPL/Web/TT/Control.pm @ 117:0475eb382085

Controls support (RC1)
author wizard
date Thu, 03 Jun 2010 02:41:44 +0400
parents ddf0f037d460
children a7efb3117295
comparison
equal deleted inserted replaced
116:1722ca51537c 117:0475eb382085
17 sub CTOR { 17 sub CTOR {
18 my ($this,%args) = @_; 18 my ($this,%args) = @_;
19 19
20 if ($this->document) { 20 if ($this->document) {
21 # load a template 21 # load a template
22 #$args{template} = $this->document->context->template($args{template}) if ($args{template}); 22 $args{template} = $this->document->context->template($args{template}) if ($args{template} and not ref $args{template});
23 } 23 }
24 $this->template($args{template}) if $args{template}; 24 $this->template($args{template}) if $args{template};
25 25
26 $this->id($this->nodeName . '-' . $nextId++); 26 $this->id($this->nodeName . '-' . $nextId++);
27 $this->controlClass($args{controlClass} || 'Control'); 27 $this->controlClass($args{controlClass} || 'Control');
30 sub Render { 30 sub Render {
31 my ($this) = @_; 31 my ($this) = @_;
32 32
33 if ($this->document) { 33 if ($this->document) {
34 if ($this->template) { 34 if ($this->template) {
35 return $this->document->context->include($this->template,{ this => $this }); 35 return $this->document->context->include($this->template,{ this => $this }) ;
36 } elsif ($this->document->presenter) { 36 } elsif ($this->document->presenter) {
37 return $this->document->presenter->print($this); 37 return $this->document->presenter->print($this);
38 } else { 38 } else {
39 return $this->toString(); 39 return $this->toString().": ".$this->controlClass() . ": ".$this->path;
40 } 40 }
41 } 41 }
42 } 42 }
43 43
44 1; 44 1;