# HG changeset patch # User sergey # Date 1349971905 -14400 # Node ID 2530d1bb96380894381e3142e171fa5193ca39b5 # Parent 3cebcf6fdb9b57db7e4ce8909869cd19f61e6db4 sync diff -r 3cebcf6fdb9b -r 2530d1bb9638 Lib/IMPL/Web/View/TTControl.pm --- a/Lib/IMPL/Web/View/TTControl.pm Thu Oct 11 04:53:08 2012 +0400 +++ b/Lib/IMPL/Web/View/TTControl.pm Thu Oct 11 20:11:45 2012 +0400 @@ -1,15 +1,28 @@ package IMPL::Web::View::TTControl; use strict; -use IMPL::DOM::Property qw(_dom); -use IMPL::lang qw(:declare ); - -use Template::Context(); use Scalar::Util qw(weaken); -use parent qw( - IMPL::DOM::Node -); +use IMPL::Const qw(:prop); +use IMPL::declare { + require => { + TTContext => 'Template::Context', + Exception => 'IMPL::Exception', + ArgumentException => '-IMPL::InvalidArgumentException' + }, + base => [ + 'IMPL::DOM::Node' => sub { + nodeName => $_[0], + %{ $_[3] || {} } + } + ], + props => [ + id => PROP_RO, + context => PROP_RO, + template => PROP_RO + ] +}; + { my $nextId = 1; @@ -18,15 +31,6 @@ } } - -BEGIN { - public _dom property id => PROP_ALL; - - public property context => PROP_GET | PROP_OWNERSET; - public property template => PROP_ALL; -} - - sub CTOR { my ($this,$name,$template,$context,$refProps) = @_; @@ -37,20 +41,12 @@ $this->id($name . "-" . _GetNextId()) unless $this->id; - weaken($this); # prevent cyclic references produces by the code below + weaken($this); # prevent cyclic references produced by the code below $context->stash->set('append', sub { $this->appendChild(@_); undef; } ); $context->stash->set('select', sub { $this->selectNodes(@_); } ); - } -our %CTOR = ( - 'IMPL::DOM::Node' => sub { - nodeName => $_[0], - %{ $_[3] || {} } - } -); - sub InitInstance { my ($this,$args) = @_; @@ -61,7 +57,7 @@ } } -sub renderBlock { +sub GetRenderBlock { $_[0]->template->blocks->{RENDER} || $_[0]->template; } @@ -70,7 +66,7 @@ $args = {} unless ref $args eq 'HASH'; - if(my $body = $this->renderBlock ) { + if(my $body = $this->GetRenderBlock ) { return $this->context->include( $body, { %$args, this => $this, template => $this->template, document => $this->document } ); } else { return ""; diff -r 3cebcf6fdb9b -r 2530d1bb9638 Lib/IMPL/Web/View/TTDocument.pm --- a/Lib/IMPL/Web/View/TTDocument.pm Thu Oct 11 04:53:08 2012 +0400 +++ b/Lib/IMPL/Web/View/TTDocument.pm Thu Oct 11 20:11:45 2012 +0400 @@ -120,7 +120,7 @@ $this->loader->layout($this->layout), { %{$args || {}}, - content => sub { $output ||= $this->RenderContent($args); }, + content => sub { $this->RenderContent($args); }, this => $this, template => $this->template }