comparison Lib/IMPL/Web/QueryHandler/PageFormat.pm @ 127:0dce0470a3d8

In the IMPL::Web::ControllerUnit added the ability to notify a form about a wrong data from a transaction added a relativeUrl function for a usage from a templates IMPL::Web::TT::Form now fully functional
author wizard
date Fri, 11 Jun 2010 20:21:07 +0400
parents 92c850d0bdb9
children e4f15cbc3f1a
comparison
equal deleted inserted replaced
126:c8dfbbdd8005 127:0dce0470a3d8
37 $pathInfo =~ s/($rx)//; 37 $pathInfo =~ s/($rx)//;
38 $prefixRoot = $1 if $1; 38 $prefixRoot = $1 if $1;
39 } 39 }
40 local $ENV{PATH_INFO} = $pathInfo || $this->defaultTarget; 40 local $ENV{PATH_INFO} = $pathInfo || $this->defaultTarget;
41 41
42 my @path = split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("PATH_INFO is empty and no defaultTarget specified" ); 42 my @path = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("PATH_INFO is empty and no defaultTarget specified" );
43
44 my @pathContainer = @path;
45 pop @pathContainer;
43 46
44 $doc->LoadFile ( File::Spec->catfile($this->templatesBase,@path), $this->templatesCharset, $this->templatesBase ); 47 $doc->LoadFile ( File::Spec->catfile($this->templatesBase,@path), $this->templatesCharset, $this->templatesBase );
45 $doc->AddVar( result => $nextHandler->() ); 48 $doc->AddVar( result => $nextHandler->() );
46 $doc->AddVar( absoluteUrl => sub { "$prefixRoot/$_[0]" } ); 49 $doc->AddVar( absoluteUrl => sub { "$prefixRoot/$_[0]" } );
50 $doc->AddVar( relativeUrl => sub { join '/', $prefixRoot, @pathContainer,$_[0] } );
47 { 51 {
48 local $@; 52 local $@;
49 $doc->AddVar( user => IMPL::Security::Context->current->principal ); 53 $doc->AddVar( user => IMPL::Security::Context->current->principal );
50 $doc->AddVar( session => IMPL::Security::Context->current ); 54 $doc->AddVar( session => IMPL::Security::Context->current );
51 warn $@ if $@; 55 warn $@ if $@;