Changeset 182

Show
Ignore:
Timestamp:
03/08/06 13:45:08 (3 years ago)
Author:
ogawa
Message:

Fix for correctly running on IE7 and other browsers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Mapper/trunk/Mapper.pl

    r180 r182  
    1313use MT; 
    1414use MT::Template::Context; 
     15use MT::ConfigMgr; 
    1516use base 'MT::Plugin'; 
    1617use vars qw($VERSION); 
     
    4344    $config->{unique} = $ctx->stash('entry')->id 
    4445        if defined $ctx->stash('entry'); 
     46    my $cfg = MT::ConfigMgr->instance; 
     47    $config->{language} ||= $cfg->DefaultLanguage; 
     48    $config->{charset} ||= $cfg->PublishCharset; 
     49 
    4550    my $mapper_class = __PACKAGE__ . '::' . ($args->{method} || 'Google'); 
    4651    my $mapper = $mapper_class->new($config); 
     
    7075use strict; 
    7176use MT::Util qw(encode_url); 
    72 use MT::ConfigMgr; 
    7377use LWP::Simple; 
    7478use HTML::Template; 
     
    7882    my($config) = @_; 
    7983    $config->{count} = 0; 
    80     my $cfg = MT::ConfigMgr->instance; 
    81     $config->{language} ||= $cfg->DefaultLanguage; 
    82     $config->{charset} ||= $cfg->PublishCharset; 
    8384    $config->{unique} ||= int(rand(65536)); 
    8485    bless $config, $class; 
     
    119120//<![CDATA[ 
    120121function attachOnLoad(func) { 
    121     var old = window['onload']
    122     window['onload'] = (typeof old != 'function') ? 
     122    var old = window.onload
     123    window.onload = (typeof old != 'function') ? 
    123124        func : function(evt) { old(evt); return func(evt); }; 
    124125} 
     
    134135 
    135136        var map = new GMap(document.getElementById(mapid)); 
    136         map.setMapType(maptype); 
     137        map.setMapType((typeof maptype == 'string') ? eval(maptype) : maptype); 
    137138        map.addControl(new GSmallMapControl()); 
    138139        map.addControl(new GMapTypeControl()); 
     
    165166//<![CDATA[ 
    166167attachOnLoad(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">); 
    168169}); 
    169170//]]> 
     
    174175    my $this = shift; 
    175176    my($lat, $lon, $address) = @_; 
    176     $address =~ s/:.*$//
     177    ($address) = split(/:/, $address)
    177178    my $tmpl = HTML::Template->new(scalarref => \$body_tmpl); 
    178179    $tmpl->param(