2014-01-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php: added function "https_is_running". * include/functions_gis.php, operation/gis_maps/render_view.php, operation/gis_maps/public_console.php, godmode/setup/gis_step_2.php: fixed the urls for google maps when it is running in https mode. Fixes: #2403 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9303 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
613df874b7
commit
be56740004
|
@ -1,3 +1,13 @@
|
||||||
|
2014-01-09 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions.php: added function "https_is_running".
|
||||||
|
|
||||||
|
* include/functions_gis.php, operation/gis_maps/render_view.php,
|
||||||
|
operation/gis_maps/public_console.php, godmode/setup/gis_step_2.php:
|
||||||
|
fixed the urls for google maps when it is running in https mode.
|
||||||
|
|
||||||
|
Fixes: #2403
|
||||||
|
|
||||||
2014-01-09 Junichi Satoh <junichi@rworks.jp>
|
2014-01-09 Junichi Satoh <junichi@rworks.jp>
|
||||||
|
|
||||||
* godmode/servers/plugin.php: Fixed that unexpected strings are set
|
* godmode/servers/plugin.php: Fixed that unexpected strings are set
|
||||||
|
|
|
@ -37,7 +37,7 @@ switch ($action) {
|
||||||
case 'create_connection_map':
|
case 'create_connection_map':
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header (__('Create new map connection'), "", false, "gis_setup_map_connection", true);
|
ui_print_page_header (__('Create new map connection'), "", false, "gis_setup_map_connection", true);
|
||||||
|
|
||||||
$mapConnection_name = '';
|
$mapConnection_name = '';
|
||||||
$mapConnection_group = '';
|
$mapConnection_group = '';
|
||||||
$mapConnection_numLevelsZoom = '19';
|
$mapConnection_numLevelsZoom = '19';
|
||||||
|
@ -343,7 +343,7 @@ function changeSetManualPosition(stCenter, stGISDefault) {
|
||||||
function changePoints(e) {
|
function changePoints(e) {
|
||||||
var lonlat = map.getLonLatFromViewPortPx(e.xy);
|
var lonlat = map.getLonLatFromViewPortPx(e.xy);
|
||||||
lonlat.transform(map.getProjectionObject(), map.displayProjection); //transform the lonlat in object proyection to "standar proyection"
|
lonlat.transform(map.getProjectionObject(), map.displayProjection); //transform the lonlat in object proyection to "standar proyection"
|
||||||
|
|
||||||
if (setCenter) {
|
if (setCenter) {
|
||||||
//Change the fields
|
//Change the fields
|
||||||
center_latitude = $('input[name=center_latitude]').val(lonlat.lat);
|
center_latitude = $('input[name=center_latitude]').val(lonlat.lat);
|
||||||
|
@ -357,7 +357,7 @@ function changePoints(e) {
|
||||||
centerPoint.move(lonlat.transform(map.displayProjection, map.getProjectionObject()));
|
centerPoint.move(lonlat.transform(map.displayProjection, map.getProjectionObject()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setGISDefaultPosition) {
|
if (setGISDefaultPosition) {
|
||||||
//Change the fields
|
//Change the fields
|
||||||
center_latitude = $('input[name=default_latitude]').val(lonlat.lat);
|
center_latitude = $('input[name=default_latitude]').val(lonlat.lat);
|
||||||
|
@ -378,7 +378,7 @@ function changePoints(e) {
|
||||||
* fields. And make two points, center and default.
|
* fields. And make two points, center and default.
|
||||||
*/
|
*/
|
||||||
function refreshMapView() {
|
function refreshMapView() {
|
||||||
switch ($('#sel_type :selected').val()) {
|
switch ($('#sel_type :selected').val()) {
|
||||||
case 'Gmap':
|
case 'Gmap':
|
||||||
//TODO: Validate there is a key, and use it
|
//TODO: Validate there is a key, and use it
|
||||||
gmap_key = $('input[name=gmap_key]').val();
|
gmap_key = $('input[name=gmap_key]').val();
|
||||||
|
@ -387,13 +387,13 @@ function refreshMapView() {
|
||||||
script.src = 'http://www.google.com/jsapi?key='+gmap_key+'&callback=loadGoogleMap';
|
script.src = 'http://www.google.com/jsapi?key='+gmap_key+'&callback=loadGoogleMap';
|
||||||
//script.src = 'http://www.google.com/jsapi?key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg&callback=loadGoogleMap';
|
//script.src = 'http://www.google.com/jsapi?key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg&callback=loadGoogleMap';
|
||||||
document.getElementsByTagName("head")[0].appendChild(script);
|
document.getElementsByTagName("head")[0].appendChild(script);
|
||||||
|
|
||||||
//TODO: paint the gif clock for waiting the request.
|
//TODO: paint the gif clock for waiting the request.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
refreshMapViewSecondStep();
|
refreshMapViewSecondStep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,50 +402,50 @@ function refreshMapView() {
|
||||||
* fields. And make two points, center and default.
|
* fields. And make two points, center and default.
|
||||||
*/
|
*/
|
||||||
function refreshMapViewSecondStep() {
|
function refreshMapViewSecondStep() {
|
||||||
//Clear the previous map.
|
//Clear the previous map.
|
||||||
map = null;
|
map = null;
|
||||||
$("#map").html('');
|
$("#map").html('');
|
||||||
//Clear the points.
|
//Clear the points.
|
||||||
centerPoint = null;
|
centerPoint = null;
|
||||||
GISDefaultPositionPoint = null;
|
GISDefaultPositionPoint = null;
|
||||||
|
|
||||||
//Change the text to button.
|
//Change the text to button.
|
||||||
$("input[name=button_refresh]").val('<?php echo __("Refresh preview map");?>');
|
$("input[name=button_refresh]").val('<?php echo __("Refresh preview map");?>');
|
||||||
|
|
||||||
//Obtain data of map of fields.
|
//Obtain data of map of fields.
|
||||||
inital_zoom = $('input[name=initial_zoom]').val();
|
inital_zoom = $('input[name=initial_zoom]').val();
|
||||||
num_levels_zoom =$('input[name=num_levels_zoom]').val();
|
num_levels_zoom =$('input[name=num_levels_zoom]').val();
|
||||||
center_latitude = $('input[name=center_latitude]').val();
|
center_latitude = $('input[name=center_latitude]').val();
|
||||||
center_longitude = $('input[name=center_longitude]').val();
|
center_longitude = $('input[name=center_longitude]').val();
|
||||||
center_altitude = $('input[name=center_altitude]').val();
|
center_altitude = $('input[name=center_altitude]').val();
|
||||||
|
|
||||||
var objBaseLayers = Array();
|
var objBaseLayers = Array();
|
||||||
objBaseLayers[0] = {};
|
objBaseLayers[0] = {};
|
||||||
objBaseLayers[0]['type'] = $('select[name=sel_type] :selected').val();
|
objBaseLayers[0]['type'] = $('select[name=sel_type] :selected').val();
|
||||||
objBaseLayers[0]['name'] = $('input[name=name]').val();
|
objBaseLayers[0]['name'] = $('input[name=name]').val();
|
||||||
objBaseLayers[0]['url'] = $('input[name=url]').val();
|
objBaseLayers[0]['url'] = $('input[name=url]').val();
|
||||||
// type Gmap
|
// type Gmap
|
||||||
objBaseLayers[0]['gmap_type'] = $('select[name=gmap_type] option:selected').val();
|
objBaseLayers[0]['gmap_type'] = $('select[name=gmap_type] option:selected').val();
|
||||||
objBaseLayers[0]['gmap_key'] = $('input[name=gmap_key]').val();
|
objBaseLayers[0]['gmap_key'] = $('input[name=gmap_key]').val();
|
||||||
// type Static Image
|
// type Static Image
|
||||||
objBaseLayers[0]['bb_left'] = $('input[name=bb_left]').val();
|
objBaseLayers[0]['bb_left'] = $('input[name=bb_left]').val();
|
||||||
objBaseLayers[0]['bb_right'] = $('input[name=bb_right]').val();
|
objBaseLayers[0]['bb_right'] = $('input[name=bb_right]').val();
|
||||||
objBaseLayers[0]['bb_bottom'] = $('input[name=bb_bottom]').val();
|
objBaseLayers[0]['bb_bottom'] = $('input[name=bb_bottom]').val();
|
||||||
objBaseLayers[0]['bb_top'] = $('input[name=bb_top]').val();
|
objBaseLayers[0]['bb_top'] = $('input[name=bb_top]').val();
|
||||||
objBaseLayers[0]['image_width'] = $('input[name=image_width]').val();
|
objBaseLayers[0]['image_width'] = $('input[name=image_width]').val();
|
||||||
objBaseLayers[0]['image_height'] = $('input[name=image_height]').val();
|
objBaseLayers[0]['image_height'] = $('input[name=image_height]').val();
|
||||||
|
|
||||||
arrayControls = null;
|
arrayControls = null;
|
||||||
arrayControls = Array('Navigation', 'PanZoom', 'MousePosition');
|
arrayControls = Array('Navigation', 'PanZoom', 'MousePosition');
|
||||||
|
|
||||||
js_printMap('map', inital_zoom, center_latitude, center_longitude, objBaseLayers, arrayControls);
|
js_printMap('map', inital_zoom, center_latitude, center_longitude, objBaseLayers, arrayControls);
|
||||||
|
|
||||||
layer = js_makeLayer('temp_layer', true, null);
|
layer = js_makeLayer('temp_layer', true, null);
|
||||||
|
|
||||||
centerPoint = js_addPointExtent('temp_layer', '<?php echo __('Center'); ?>', $('input[name=center_longitude]').val(), $('input[name=center_latitude]').val(), 'images/gis_map/icons/circle.pink.png', 11, 11, 'center', '');
|
centerPoint = js_addPointExtent('temp_layer', '<?php echo __('Center'); ?>', $('input[name=center_longitude]').val(), $('input[name=center_latitude]').val(), 'images/gis_map/icons/circle.pink.png', 11, 11, 'center', '');
|
||||||
GISDefaultPositionPoint = js_addPointExtent('temp_layer', '<?php echo __('Default'); ?>', $('input[name=default_longitude]').val(), $('input[name=default_latitude]').val(), 'images/gis_map/icons/cross.pink.png', 11, 11, 'default', '');
|
GISDefaultPositionPoint = js_addPointExtent('temp_layer', '<?php echo __('Default'); ?>', $('input[name=default_longitude]').val(), $('input[name=default_latitude]').val(), 'images/gis_map/icons/cross.pink.png', 11, 11, 'default', '');
|
||||||
|
|
||||||
js_activateEvents(changePoints);
|
js_activateEvents(changePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateGmapsParamtres () {
|
function validateGmapsParamtres () {
|
||||||
|
|
|
@ -68,6 +68,17 @@ require_once('functions_io.php');
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
function https_is_running() {
|
||||||
|
if (isset ($_SERVER['HTTPS'])
|
||||||
|
&& ($_SERVER['HTTPS'] === true
|
||||||
|
|| $_SERVER['HTTPS'] == 'on')) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans an object or an array and casts all values as integers
|
* Cleans an object or an array and casts all values as integers
|
||||||
*
|
*
|
||||||
|
|
|
@ -1001,9 +1001,16 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gmap_layer === true) {
|
if ($gmap_layer === true) {
|
||||||
?>
|
if (https_is_running()) {
|
||||||
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
?>
|
||||||
<?php
|
<script type="text/javascript" src="https://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gis_print_map($agent_name . "_agent_map", $defaultMap['zoom_level'],
|
gis_print_map($agent_name . "_agent_map", $defaultMap['zoom_level'],
|
||||||
|
|
|
@ -94,9 +94,16 @@ if ($confMap !== false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($gmap_layer === true) {
|
if ($gmap_layer === true) {
|
||||||
|
if (https_is_running()) {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" src="https://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
|
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
|
||||||
|
|
|
@ -72,10 +72,18 @@ if ($confMap !== false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gmap_layer === true) {
|
if ($gmap_layer === true) {
|
||||||
|
if (https_is_running()) {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" src="https://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
|
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
|
||||||
|
|
Loading…
Reference in New Issue