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>
|
||||
|
||||
* godmode/servers/plugin.php: Fixed that unexpected strings are set
|
||||
|
|
|
@ -37,7 +37,7 @@ switch ($action) {
|
|||
case 'create_connection_map':
|
||||
// Header
|
||||
ui_print_page_header (__('Create new map connection'), "", false, "gis_setup_map_connection", true);
|
||||
|
||||
|
||||
$mapConnection_name = '';
|
||||
$mapConnection_group = '';
|
||||
$mapConnection_numLevelsZoom = '19';
|
||||
|
@ -343,7 +343,7 @@ function changeSetManualPosition(stCenter, stGISDefault) {
|
|||
function changePoints(e) {
|
||||
var lonlat = map.getLonLatFromViewPortPx(e.xy);
|
||||
lonlat.transform(map.getProjectionObject(), map.displayProjection); //transform the lonlat in object proyection to "standar proyection"
|
||||
|
||||
|
||||
if (setCenter) {
|
||||
//Change the fields
|
||||
center_latitude = $('input[name=center_latitude]').val(lonlat.lat);
|
||||
|
@ -357,7 +357,7 @@ function changePoints(e) {
|
|||
centerPoint.move(lonlat.transform(map.displayProjection, map.getProjectionObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (setGISDefaultPosition) {
|
||||
//Change the fields
|
||||
center_latitude = $('input[name=default_latitude]').val(lonlat.lat);
|
||||
|
@ -378,7 +378,7 @@ function changePoints(e) {
|
|||
* fields. And make two points, center and default.
|
||||
*/
|
||||
function refreshMapView() {
|
||||
switch ($('#sel_type :selected').val()) {
|
||||
switch ($('#sel_type :selected').val()) {
|
||||
case 'Gmap':
|
||||
//TODO: Validate there is a key, and use it
|
||||
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=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg&callback=loadGoogleMap';
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
|
||||
|
||||
//TODO: paint the gif clock for waiting the request.
|
||||
break;
|
||||
default:
|
||||
refreshMapViewSecondStep();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -402,50 +402,50 @@ function refreshMapView() {
|
|||
* fields. And make two points, center and default.
|
||||
*/
|
||||
function refreshMapViewSecondStep() {
|
||||
//Clear the previous map.
|
||||
map = null;
|
||||
$("#map").html('');
|
||||
//Clear the points.
|
||||
centerPoint = null;
|
||||
GISDefaultPositionPoint = null;
|
||||
|
||||
//Change the text to button.
|
||||
$("input[name=button_refresh]").val('<?php echo __("Refresh preview map");?>');
|
||||
|
||||
//Obtain data of map of fields.
|
||||
inital_zoom = $('input[name=initial_zoom]').val();
|
||||
num_levels_zoom =$('input[name=num_levels_zoom]').val();
|
||||
center_latitude = $('input[name=center_latitude]').val();
|
||||
center_longitude = $('input[name=center_longitude]').val();
|
||||
center_altitude = $('input[name=center_altitude]').val();
|
||||
|
||||
var objBaseLayers = Array();
|
||||
objBaseLayers[0] = {};
|
||||
objBaseLayers[0]['type'] = $('select[name=sel_type] :selected').val();
|
||||
objBaseLayers[0]['name'] = $('input[name=name]').val();
|
||||
objBaseLayers[0]['url'] = $('input[name=url]').val();
|
||||
// type Gmap
|
||||
objBaseLayers[0]['gmap_type'] = $('select[name=gmap_type] option:selected').val();
|
||||
objBaseLayers[0]['gmap_key'] = $('input[name=gmap_key]').val();
|
||||
// type Static Image
|
||||
objBaseLayers[0]['bb_left'] = $('input[name=bb_left]').val();
|
||||
objBaseLayers[0]['bb_right'] = $('input[name=bb_right]').val();
|
||||
objBaseLayers[0]['bb_bottom'] = $('input[name=bb_bottom]').val();
|
||||
objBaseLayers[0]['bb_top'] = $('input[name=bb_top]').val();
|
||||
objBaseLayers[0]['image_width'] = $('input[name=image_width]').val();
|
||||
objBaseLayers[0]['image_height'] = $('input[name=image_height]').val();
|
||||
|
||||
arrayControls = null;
|
||||
arrayControls = Array('Navigation', 'PanZoom', 'MousePosition');
|
||||
|
||||
js_printMap('map', inital_zoom, center_latitude, center_longitude, objBaseLayers, arrayControls);
|
||||
|
||||
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', '');
|
||||
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);
|
||||
//Clear the previous map.
|
||||
map = null;
|
||||
$("#map").html('');
|
||||
//Clear the points.
|
||||
centerPoint = null;
|
||||
GISDefaultPositionPoint = null;
|
||||
|
||||
//Change the text to button.
|
||||
$("input[name=button_refresh]").val('<?php echo __("Refresh preview map");?>');
|
||||
|
||||
//Obtain data of map of fields.
|
||||
inital_zoom = $('input[name=initial_zoom]').val();
|
||||
num_levels_zoom =$('input[name=num_levels_zoom]').val();
|
||||
center_latitude = $('input[name=center_latitude]').val();
|
||||
center_longitude = $('input[name=center_longitude]').val();
|
||||
center_altitude = $('input[name=center_altitude]').val();
|
||||
|
||||
var objBaseLayers = Array();
|
||||
objBaseLayers[0] = {};
|
||||
objBaseLayers[0]['type'] = $('select[name=sel_type] :selected').val();
|
||||
objBaseLayers[0]['name'] = $('input[name=name]').val();
|
||||
objBaseLayers[0]['url'] = $('input[name=url]').val();
|
||||
// type Gmap
|
||||
objBaseLayers[0]['gmap_type'] = $('select[name=gmap_type] option:selected').val();
|
||||
objBaseLayers[0]['gmap_key'] = $('input[name=gmap_key]').val();
|
||||
// type Static Image
|
||||
objBaseLayers[0]['bb_left'] = $('input[name=bb_left]').val();
|
||||
objBaseLayers[0]['bb_right'] = $('input[name=bb_right]').val();
|
||||
objBaseLayers[0]['bb_bottom'] = $('input[name=bb_bottom]').val();
|
||||
objBaseLayers[0]['bb_top'] = $('input[name=bb_top]').val();
|
||||
objBaseLayers[0]['image_width'] = $('input[name=image_width]').val();
|
||||
objBaseLayers[0]['image_height'] = $('input[name=image_height]').val();
|
||||
|
||||
arrayControls = null;
|
||||
arrayControls = Array('Navigation', 'PanZoom', 'MousePosition');
|
||||
|
||||
js_printMap('map', inital_zoom, center_latitude, center_longitude, objBaseLayers, arrayControls);
|
||||
|
||||
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', '');
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
|
|
|
@ -1001,9 +1001,16 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
|
|||
}
|
||||
|
||||
if ($gmap_layer === true) {
|
||||
?>
|
||||
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
|
||||
<?php
|
||||
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>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
gis_print_map($agent_name . "_agent_map", $defaultMap['zoom_level'],
|
||||
|
|
|
@ -94,9 +94,16 @@ if ($confMap !== false) {
|
|||
}
|
||||
}
|
||||
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>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
|
||||
|
|
|
@ -72,10 +72,18 @@ if ($confMap !== false) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
|
||||
|
|
Loading…
Reference in New Issue