Enhancement(機能追加・改善) #1755 » t3495.diff
apps/pc_frontend/modules/googlemaps/actions/actions.class.php | ||
---|---|---|
*/
|
||
public function executeIndex(sfWebRequest $request)
|
||
{
|
||
$this->mapType = 'G_NORMAL_MAP';
|
||
$this->mapType = 'ROADMAP';
|
||
switch ($request->getParameter('t'))
|
||
{
|
||
case 'k':
|
||
$this->mapType = 'G_SATELLITE_MAP';
|
||
$this->mapType = 'SATELLITE';
|
||
break;
|
||
case 'h':
|
||
$this->mapType = 'G_HYBRID_MAP';
|
||
$this->mapType = 'HYBRID';
|
||
break;
|
||
}
|
||
}
|
apps/pc_frontend/modules/googlemaps/templates/indexSuccess.php | ||
---|---|---|
<?php include_metas() ?>
|
||
<title><?php echo ($op_config['sns_title']) ? $op_config['sns_title'] : $op_config['sns_name'] ?></title>
|
||
<?php echo $op_config->get('pc_html_head') ?>
|
||
<?php if (isset($op_config['google_AJAX_search_api_key']) && isset($op_config['google_maps_api_key'])): ?>
|
||
<?php use_javascript('http://www.google.co.jp/uds/api?file=uds.js&v=1.0&key='.$op_config['google_AJAX_search_api_key']) ?>
|
||
<?php use_javascript('http://maps.google.co.jp/maps?file=api&v=2.x&key='.$op_config['google_maps_api_key']) ?>
|
||
<?php if (isset($op_config['google_maps_api_key'])): ?>
|
||
<?php use_javascript('http://maps.google.com/maps/api/js?sensor=true&key='.$op_config['google_maps_api_key']) ?>
|
||
<?php include_stylesheets() ?>
|
||
<?php include_javascripts() ?>
|
||
<?php
|
||
$googlemaps_script = <<<EOM
|
||
// parse request parameters
|
||
... | ... | |
}
|
||
request[n] = v;
|
||
}
|
||
var MapType = %s; // It is not user-inputed values
|
||
var gls;
|
||
var gMap;
|
||
function OnLocalSearch() {
|
||
if (!gls.results) return;
|
||
var first = gls.results[0];
|
||
var point = new GLatLng(parseFloat(first.lat), parseFloat(first.lng));
|
||
var zoom = request.z;
|
||
gMap.addControl(new GSmallMapControl());
|
||
gMap.addControl(new GMapTypeControl());
|
||
gMap.setMapType(MapType);
|
||
gMap.setCenter(point, zoom);
|
||
var marker = new GMarker(point);
|
||
gMap.addOverlay(marker);
|
||
geocoder = new GClientGeocoder();
|
||
}
|
||
function load() {
|
||
if (GBrowserIsCompatible()) {
|
||
if ((request.x == 0) && (request.y == 0)){
|
||
gMap = new GMap2(document.getElementById('map'));
|
||
gMap.addControl(new GSmallMapControl());
|
||
gMap.addControl(new GMapTypeControl());
|
||
gMap.setCenter(new GLatLng(0, 0));
|
||
gls = new GlocalSearch();
|
||
gls.setCenterPoint(gMap);
|
||
gls.setSearchCompleteCallback(null, OnLocalSearch);
|
||
var q = request.q;
|
||
gls.execute(q);
|
||
} else {
|
||
var point = new GLatLng(request.x, request.y);
|
||
var zoom = request.z;
|
||
gMap = new GMap2(document.getElementById('map'));
|
||
gMap.addControl(new GSmallMapControl());
|
||
gMap.addControl(new GMapTypeControl());
|
||
gMap.setCenter(point, zoom);
|
||
gMap.setMapType(MapType);
|
||
var marker = new GMarker(point);
|
||
gMap.addOverlay(marker);
|
||
geocoder = new GClientGeocoder();
|
||
}
|
||
var gMap;
|
||
if ((request.x == 0) && (request.y == 0)){
|
||
gMap = new google.maps.Map(document.getElementById('map'), {
|
||
center: new google.maps.LatLng(0, 0)
|
||
});
|
||
} else {
|
||
var point = new google.maps.LatLng(request.x, request.y);
|
||
var zoom = request.z;
|
||
gMap = new google.maps.Map(document.getElementById('map'), {
|
||
center: point,
|
||
zoom: zoom,
|
||
mapTypeId: google.maps.MapTypeId.%s
|
||
});
|
||
var marker = new google.maps.Marker({
|
||
position: point,
|
||
map: gMap
|
||
});
|
||
}
|
||
}
|
||
google.maps.event.addDomListener(window, 'load', load);
|
||
EOM;
|
||
echo javascript_tag(sprintf($googlemaps_script, $mapType)); ?>
|
||
<?php endif; ?>
|
||
<?php include_stylesheets() ?>
|
||
<?php include_javascripts() ?>
|
||
</head>
|
||
<body onload="load()" onunload="GUnload()" id="page_googlemaps_index" class="<?php echo opToolkit::isSecurePage() ? 'secure_page' : 'insecure_page' ?>">
|
||
<body id="page_googlemaps_index" class="<?php echo opToolkit::isSecurePage() ? 'secure_page' : 'insecure_page' ?>">
|
||
<div id="map" style="width: 300px; height: 320px"></div>
|
||
</body>
|
||
</html>
|
web/cmd/maps.google.co.jp.js | ||
---|---|---|
function url2cmd(url, googlemapsUrl) {
|
||
var maps_google_co_jp_maps = url.match(/^http:\/\/maps\.google\.co\.jp\/maps\?(.+)/);
|
||
var maps_google_co_jp = url.match(/^http:\/\/maps\.google\.co\.jp\/\?(.+)/);
|
||
var maps_google_co_jp_maps = url.match(/^https?:\/\/maps\.google\.co\.jp\/maps\?(.+)/);
|
||
var maps_google_co_jp = url.match(/^https?:\/\/maps\.google\.co\.jp\/\?(.+)/);
|
||
if (maps_google_co_jp_maps || maps_google_co_jp) {
|
||
var id = RegExp.$1;
|
web/cmd/maps.google.com.js | ||
---|---|---|
function url2cmd(url, googlemapsUrl) {
|
||
var maps_google_com_maps = url.match(/^http:\/\/maps\.google\.com\/maps\?(.+)/);
|
||
var maps_google_com = url.match(/^http:\/\/maps\.google\.com\/\?(.+)/);
|
||
var maps_google_com_maps = url.match(/^https?:\/\/maps\.google\.com\/maps\?(.+)/);
|
||
var maps_google_com = url.match(/^https?\/\/maps\.google\.com\/\?(.+)/);
|
||
if (maps_google_com_maps || maps_google_com) {
|
||
var id = RegExp.$1;
|