プロジェクト

全般

プロフィール

t3495.diff

3.8.9 からの変更差分 - Yuya Watanabe, 2013-12-10 17:17

ダウンロード (5.91 KB)

差分を表示:

apps/pc_frontend/modules/googlemaps/actions/actions.class.php
17 17
  */
18 18
  public function executeIndex(sfWebRequest $request)
19 19
  {
20
    $this->mapType = 'G_NORMAL_MAP';
20
    $this->mapType = 'ROADMAP';
21 21
    switch ($request->getParameter('t'))
22 22
    {
23 23
      case 'k':
24
        $this->mapType = 'G_SATELLITE_MAP';
24
        $this->mapType = 'SATELLITE';
25 25
        break;
26 26
      case 'h':
27
        $this->mapType = 'G_HYBRID_MAP';
27
        $this->mapType = 'HYBRID';
28 28
        break;
29 29
    }
30 30
  }
apps/pc_frontend/modules/googlemaps/templates/indexSuccess.php
6 6
<?php include_metas() ?>
7 7
<title><?php echo ($op_config['sns_title']) ? $op_config['sns_title'] : $op_config['sns_name'] ?></title>
8 8
<?php echo $op_config->get('pc_html_head') ?>
9
<?php if (isset($op_config['google_AJAX_search_api_key']) && isset($op_config['google_maps_api_key'])): ?>
10
<?php use_javascript('http://www.google.co.jp/uds/api?file=uds.js&v=1.0&key='.$op_config['google_AJAX_search_api_key']) ?>
11
<?php use_javascript('http://maps.google.co.jp/maps?file=api&v=2.x&key='.$op_config['google_maps_api_key']) ?>
9
<?php if (isset($op_config['google_maps_api_key'])): ?>
10
<?php use_javascript('http://maps.google.com/maps/api/js?sensor=true&key='.$op_config['google_maps_api_key']) ?>
11
<?php include_stylesheets() ?>
12
<?php include_javascripts() ?>
12 13
<?php
13 14
$googlemaps_script = <<<EOM
14 15
// parse request parameters
......
27 28
  }
28 29
  request[n] = v;
29 30
}
30
var MapType = %s;  // It is not user-inputed values
31 31

  
32
var gls;
33
var gMap;
34
function OnLocalSearch() {
35
    if (!gls.results) return;
36
    var first = gls.results[0];
37
    var point = new GLatLng(parseFloat(first.lat), parseFloat(first.lng));
38
    var zoom = request.z;
39
    gMap.addControl(new GSmallMapControl());
40
    gMap.addControl(new GMapTypeControl());
41
    gMap.setMapType(MapType);
42
    gMap.setCenter(point, zoom);
43
    var marker = new GMarker(point);
44
    gMap.addOverlay(marker);
45
    geocoder = new GClientGeocoder();
46
}
47 32
function load() {
48
    if (GBrowserIsCompatible()) {
49
        if ((request.x == 0) && (request.y == 0)){
50
            gMap = new GMap2(document.getElementById('map'));
51
            gMap.addControl(new GSmallMapControl());
52
            gMap.addControl(new GMapTypeControl());
53
            gMap.setCenter(new GLatLng(0, 0));
54
            gls = new GlocalSearch();
55
            gls.setCenterPoint(gMap);
56
            gls.setSearchCompleteCallback(null, OnLocalSearch);
57
            var q = request.q;
58
            gls.execute(q);
59
        } else {
60
            var point = new GLatLng(request.x, request.y);
61
            var zoom = request.z;
62
            gMap = new GMap2(document.getElementById('map'));
63
            gMap.addControl(new GSmallMapControl());
64
            gMap.addControl(new GMapTypeControl());
65
            gMap.setCenter(point, zoom);
66
            gMap.setMapType(MapType);
67
            var marker = new GMarker(point);
68
            gMap.addOverlay(marker);
69
            geocoder = new GClientGeocoder();
70
        }
33
    var gMap;
34
    if ((request.x == 0) && (request.y == 0)){
35
        gMap = new google.maps.Map(document.getElementById('map'), {
36
            center: new google.maps.LatLng(0, 0)
37
        });
38
    } else {
39
        var point = new google.maps.LatLng(request.x, request.y);
40
        var zoom = request.z;
41
        gMap = new google.maps.Map(document.getElementById('map'), {
42
            center: point,
43
            zoom: zoom,
44
            mapTypeId: google.maps.MapTypeId.%s
45
        });
46
        var marker = new google.maps.Marker({
47
            position: point,
48
            map: gMap
49
        });
71 50
    }
72 51
}
52
google.maps.event.addDomListener(window, 'load', load);
73 53
EOM;
74 54
echo javascript_tag(sprintf($googlemaps_script, $mapType)); ?>
75 55
<?php endif; ?>
76
<?php include_stylesheets() ?>
77
<?php include_javascripts() ?>
78 56
</head>
79
<body onload="load()" onunload="GUnload()" id="page_googlemaps_index" class="<?php echo opToolkit::isSecurePage() ? 'secure_page' : 'insecure_page' ?>">
57
<body id="page_googlemaps_index" class="<?php echo opToolkit::isSecurePage() ? 'secure_page' : 'insecure_page' ?>">
80 58
<div id="map" style="width: 300px; height: 320px"></div>
81 59
</body>
82 60
</html>
web/cmd/maps.google.co.jp.js
1 1
function url2cmd(url, googlemapsUrl) {
2
  var maps_google_co_jp_maps = url.match(/^http:\/\/maps\.google\.co\.jp\/maps\?(.+)/);
3
  var maps_google_co_jp = url.match(/^http:\/\/maps\.google\.co\.jp\/\?(.+)/);
2
  var maps_google_co_jp_maps = url.match(/^https?:\/\/maps\.google\.co\.jp\/maps\?(.+)/);
3
  var maps_google_co_jp = url.match(/^https?:\/\/maps\.google\.co\.jp\/\?(.+)/);
4 4

  
5 5
  if (maps_google_co_jp_maps || maps_google_co_jp) {
6 6
     var id = RegExp.$1;
web/cmd/maps.google.com.js
1 1
function url2cmd(url, googlemapsUrl) {
2
  var maps_google_com_maps = url.match(/^http:\/\/maps\.google\.com\/maps\?(.+)/);
3
  var maps_google_com = url.match(/^http:\/\/maps\.google\.com\/\?(.+)/);
2
  var maps_google_com_maps = url.match(/^https?:\/\/maps\.google\.com\/maps\?(.+)/);
3
  var maps_google_com = url.match(/^https?\/\/maps\.google\.com\/\?(.+)/);
4 4

  
5 5
  if (maps_google_com_maps || maps_google_com) {
6 6
     var id = RegExp.$1;