# HG changeset patch # User cin # Date 1364762508 -14400 # Node ID 673581380e794dcd926a9c4226959dfcf40557e1 # Parent aeeb57a12046785719b4426d608611acfe858534 Added templates provider functionality to controls minor fixes diff -r aeeb57a12046 -r 673581380e79 Lib/IMPL/Web/Application/ResourceContract.pm --- a/Lib/IMPL/Web/Application/ResourceContract.pm Mon Mar 25 02:04:18 2013 +0400 +++ b/Lib/IMPL/Web/Application/ResourceContract.pm Mon Apr 01 00:41:48 2013 +0400 @@ -1,5 +1,7 @@ package IMPL::Web::Application::ResourceContract; use strict; + +use IMPL::lang; use IMPL::Const qw(:prop); use IMPL::declare { require => { @@ -40,7 +42,12 @@ my %nameMap; foreach my $res (@$resources) { + if (ref $res->{contract} eq 'HASH') { + $res->{contract} = __PACKAGE__->new(%{$res->{contract}}); + } + next unless $res->{contract}; + if ( my $name = $res->{name} ) { $nameMap{$name} = $res; } diff -r aeeb57a12046 -r 673581380e79 Lib/IMPL/Web/NotAllowedException.pm --- a/Lib/IMPL/Web/NotAllowedException.pm Mon Mar 25 02:04:18 2013 +0400 +++ b/Lib/IMPL/Web/NotAllowedException.pm Mon Apr 01 00:41:48 2013 +0400 @@ -4,13 +4,14 @@ use IMPL::Const qw(:prop); use IMPL::declare { base => [ - 'IMPL::Web::Exception' => sub { - my %args = @_; - $args{Message}; - } + 'IMPL::Web::Exception' => '@_' ] }; +use IMPL::Resources::Strings { + message => "The requested method isn't allowed" +}; + sub CTOR { my $this = shift; my %args = @_; diff -r aeeb57a12046 -r 673581380e79 Lib/IMPL/Web/View/TTControl.pm --- a/Lib/IMPL/Web/View/TTControl.pm Mon Mar 25 02:04:18 2013 +0400 +++ b/Lib/IMPL/Web/View/TTControl.pm Mon Apr 01 00:41:48 2013 +0400 @@ -89,6 +89,24 @@ ); } +sub GetTemplate { + my ($this,$name) = @_; + + return eval { $this->context->template($name) }; +} + +sub Include { + my ($this,$template, $args) = @_; + + my $tpl = $this->GetTemplate($template) + or die OperationException->new("The specified template isn't found", $template); + + return $this->context->include( + $tpl, + $args + ); +} + sub AUTOLOAD { our $AUTOLOAD;