Changeset 182
- Timestamp:
- 03/08/06 13:45:08 (3 years ago)
- Files:
-
- Mapper/trunk/Mapper.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Mapper/trunk/Mapper.pl
r180 r182 13 13 use MT; 14 14 use MT::Template::Context; 15 use MT::ConfigMgr; 15 16 use base 'MT::Plugin'; 16 17 use vars qw($VERSION); … … 43 44 $config->{unique} = $ctx->stash('entry')->id 44 45 if defined $ctx->stash('entry'); 46 my $cfg = MT::ConfigMgr->instance; 47 $config->{language} ||= $cfg->DefaultLanguage; 48 $config->{charset} ||= $cfg->PublishCharset; 49 45 50 my $mapper_class = __PACKAGE__ . '::' . ($args->{method} || 'Google'); 46 51 my $mapper = $mapper_class->new($config); … … 70 75 use strict; 71 76 use MT::Util qw(encode_url); 72 use MT::ConfigMgr;73 77 use LWP::Simple; 74 78 use HTML::Template; … … 78 82 my($config) = @_; 79 83 $config->{count} = 0; 80 my $cfg = MT::ConfigMgr->instance;81 $config->{language} ||= $cfg->DefaultLanguage;82 $config->{charset} ||= $cfg->PublishCharset;83 84 $config->{unique} ||= int(rand(65536)); 84 85 bless $config, $class; … … 119 120 //<![CDATA[ 120 121 function attachOnLoad(func) { 121 var old = window ['onload'];122 window ['onload']= (typeof old != 'function') ?122 var old = window.onload; 123 window.onload = (typeof old != 'function') ? 123 124 func : function(evt) { old(evt); return func(evt); }; 124 125 } … … 134 135 135 136 var map = new GMap(document.getElementById(mapid)); 136 map.setMapType( maptype);137 map.setMapType((typeof maptype == 'string') ? eval(maptype) : maptype); 137 138 map.addControl(new GSmallMapControl()); 138 139 map.addControl(new GMapTypeControl()); … … 165 166 //<![CDATA[ 166 167 attachOnLoad(function() { 167 generateGMap('<TMPL_VAR NAME="mapid">','<TMPL_VAR NAME="address">',<TMPL_VAR NAME="latitude">,<TMPL_VAR NAME="longitude">, <TMPL_VAR NAME="maptype">,<TMPL_VAR NAME="zoom">);168 generateGMap('<TMPL_VAR NAME="mapid">','<TMPL_VAR NAME="address">',<TMPL_VAR NAME="latitude">,<TMPL_VAR NAME="longitude">,'<TMPL_VAR NAME="maptype">',<TMPL_VAR NAME="zoom">); 168 169 }); 169 170 //]]> … … 174 175 my $this = shift; 175 176 my($lat, $lon, $address) = @_; 176 $address =~ s/:.*$//;177 ($address) = split(/:/, $address); 177 178 my $tmpl = HTML::Template->new(scalarref => \$body_tmpl); 178 179 $tmpl->param(
