comparison Lib/IMPL/Web/QueryHandler/PageFormat.pm @ 171:59e5fcb59d86

Исправления, изменена концепция веб-форм
author sourcer
date Mon, 06 Jun 2011 03:30:36 +0400
parents 4267a2ac3d46
children d1676be8afcc
comparison
equal deleted inserted replaced
170:b88b7fe60aa3 171:59e5fcb59d86
6 6
7 use JSON; 7 use JSON;
8 use IMPL::Class::Property; 8 use IMPL::Class::Property;
9 use IMPL::Web::TT::Document; 9 use IMPL::Web::TT::Document;
10 use Template::Plugin::URL; 10 use Template::Plugin::URL;
11 use IMPL::Security::Context; 11 use IMPL::Security::Context();
12 use File::Spec; 12 use File::Spec();
13 use HTML::TreeBuilder; 13 use HTML::TreeBuilder();
14 use URI; 14 use URI();
15 use Error qw(:try); 15 use Error qw(:try);
16 use Encode();
16 17
17 $Template::Plugin::URL::JOINT = '&'; 18 $Template::Plugin::URL::JOINT = '&';
18 19
19 BEGIN { 20 BEGIN {
20 public property templatesCharset => prop_all; 21 public property templatesCharset => prop_all;
42 43
43 try { 44 try {
44 45
45 $this->templatesBase($ENV{DOCUMENT_ROOT}) unless $this->templatesBase; 46 $this->templatesBase($ENV{DOCUMENT_ROOT}) unless $this->templatesBase;
46 47
47 my ($requestUri) = split /\?/, $ENV{REQUEST_URI}; 48 my ($requestUri) = split( /\?/, $ENV{REQUEST_URI} );
48 49
49 my $pathInfo; 50 my $pathInfo;
50 my @root = (''); 51 my @root = ('');
51 my @base; 52 my @base;
52 53
123 my ($this,$params) = @_; 124 my ($this,$params) = @_;
124 125
125 my $clone = $this->clone; 126 my $clone = $this->clone;
126 if (ref $params eq 'HASH' ) { 127 if (ref $params eq 'HASH' ) {
127 my %newParams = ($clone->query_form , %$params); 128 my %newParams = ($clone->query_form , %$params);
128 $clone->query_form(map { $_, $newParams{$_} } sort keys %newParams ); 129 $clone->query_form(map { $_, ( Encode::is_utf8( $newParams{$_} ) ? Encode::encode('utf-8', $newParams{$_}) : $newParams{$_} ) } sort keys %newParams );
129 } 130 }
130 return $clone; 131 return $clone;
131 } 132 }
132 133
133 1; 134 1;