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:
mdtrooper 2014-01-09 13:33:16 +00:00
parent bc146a5a75
commit c6d791dd93
6 changed files with 96 additions and 53 deletions

View File

@ -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

View File

@ -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();
@ -393,7 +393,7 @@ function refreshMapView() {
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;
//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");?>');
//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();
//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();
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');
arrayControls = null;
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', '');
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', '');
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);
js_activateEvents(changePoints);
}
function validateGmapsParamtres () {

View File

@ -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
*

View File

@ -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'],

View File

@ -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');

View File

@ -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');