diff 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
line wrap: on
line diff
--- a/Lib/IMPL/Web/QueryHandler/PageFormat.pm	Fri Jun 11 04:29:51 2010 +0400
+++ b/Lib/IMPL/Web/QueryHandler/PageFormat.pm	Fri Jun 11 20:21:07 2010 +0400
@@ -39,11 +39,15 @@
 		}
 		local $ENV{PATH_INFO} = $pathInfo || $this->defaultTarget;
 		
-		my @path = split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("PATH_INFO is empty and no defaultTarget specified" );
+		my @path = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("PATH_INFO is empty and no defaultTarget specified" );
+		
+		my @pathContainer = @path;
+		pop @pathContainer;
 		
 		$doc->LoadFile ( File::Spec->catfile($this->templatesBase,@path), $this->templatesCharset, $this->templatesBase );
 		$doc->AddVar( result => $nextHandler->() );
 		$doc->AddVar( absoluteUrl => sub { "$prefixRoot/$_[0]" } );
+		$doc->AddVar( relativeUrl => sub { join '/', $prefixRoot, @pathContainer,$_[0] } );
 		{
 			local $@;
 			$doc->AddVar( user => IMPL::Security::Context->current->principal );