changeset 296:86ff93b34f2a

sync
author cin
date Tue, 05 Mar 2013 01:46:32 +0400
parents 9b25e1f50144
children 52aae1b85084
files Lib/IMPL/Web/View/TTControl.pm Lib/IMPL/Web/View/TTFactory.pm
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTControl.pm	Fri Mar 01 03:15:30 2013 +0400
+++ b/Lib/IMPL/Web/View/TTControl.pm	Tue Mar 05 01:46:32 2013 +0400
@@ -6,6 +6,7 @@
 use Scalar::Util qw(blessed);
 use IMPL::declare {
 	require => {
+	    TemplateDocument => 'Template::Document',
         TTContext => 'Template::Context',
         Exception => 'IMPL::Exception',
         ArgumentException => '-IMPL::InvalidArgumentException',
@@ -113,11 +114,20 @@
 }
 
 sub RenderBlock {
-    my ($this,$block, $args) = @_;
+    my ($this, $block, $args) = @_;
     
     $args = {} unless ref $args eq 'HASH';
     
-    return $this->context->include( $block, { %$args, this => $this, template => $this->template } );
+    return $block ? $this->context->include( $block, { %$args, this => $this, template => $this->template } ) : undef;
+}
+
+sub ExportBlock {
+    my ($this,$block) = @_;
+    
+    return TemplateDocument->new({
+        BLOCK => $this->template->blocks->{$block},
+        DEFBLOCKS => $this->template->blocks
+    });
 }
 
 sub AUTOLOAD {
--- a/Lib/IMPL/Web/View/TTFactory.pm	Fri Mar 01 03:15:30 2013 +0400
+++ b/Lib/IMPL/Web/View/TTFactory.pm	Tue Mar 05 01:46:32 2013 +0400
@@ -84,6 +84,8 @@
         if (my $init = $this->template->blocks->{INIT}) {
             $this->context->process($init);
         }
+        
+        $this->context->visit($this->template->blocks);
     }
     
     my $instance = $this->SUPER::CreateObject(@_);