From a4eaac459380748b642714ac84de206f2fffe1ed Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 15 Feb 2010 11:00:51 +0000 Subject: [PATCH] 2010-02-15 Miguel de Dios * include/functions_gis.php: in the function "saveMap" set the first map as default. * godmode/setup/gis_step_2.php: minor stetic change the link of refresh by button. * godmode/gis_maps/index.php: add many alerts in the change the default map and delete any map. And fix the delete map parameter. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2359 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++++ pandora_console/godmode/gis_maps/index.php | 53 ++++++++++++++------ pandora_console/godmode/setup/gis_step_2.php | 7 +-- pandora_console/include/functions_gis.php | 7 +++ 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 94de1f6178..3b2291a1dd 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2010-02-15 Miguel de Dios + + * include/functions_gis.php: in the function "saveMap" set the first map + as default. + + * godmode/setup/gis_step_2.php: minor stetic change the link of refresh by + button. + + * godmode/gis_maps/index.php: add many alerts in the change the default map + and delete any map. And fix the delete map parameter. + 2010-02-12 Miguel de Dios * include/javascript/pandora_modules.js: add support to snmp ver3 in the diff --git a/pandora_console/godmode/gis_maps/index.php b/pandora_console/godmode/gis_maps/index.php index 41c30e194f..b24bf6ee41 100644 --- a/pandora_console/godmode/gis_maps/index.php +++ b/pandora_console/godmode/gis_maps/index.php @@ -48,7 +48,7 @@ $action = get_parameter('action'); switch ($action) { case 'delete_map': - $idMap = get_parameter('id_map'); + $idMap = get_parameter('map_id'); deleteMap($idMap); break; } @@ -71,18 +71,22 @@ $maps = get_db_all_rows_in_table ('tgis_map','map_name'); $table->data = array(); +$defaultMapId = null; + if ($maps !== false) { foreach ($maps as $map) { $checked = false; - if ($map['default_map']) + if ($map['default_map']) { $checked = true; + $defaultMapId = $map['id_tgis_map']; + } $table->data[] = array('' . $map['map_name'] . '', print_group_icon ($map['group_id'], true), '' . print_image ("images/eye.png", true).'', print_radio_button_extended('default_map', $map['id_tgis_map'], '', $checked, false, "setDefault(" . $map['id_tgis_map'] . ");", '', true), - '' . print_image ("images/cross.png", true).''); + '' . print_image ("images/cross.png", true).''); } } @@ -96,18 +100,39 @@ echo ''; echo ''; ?> \ No newline at end of file diff --git a/pandora_console/godmode/setup/gis_step_2.php b/pandora_console/godmode/setup/gis_step_2.php index 10aab79466..1a6dc1c1b3 100755 --- a/pandora_console/godmode/setup/gis_step_2.php +++ b/pandora_console/godmode/setup/gis_step_2.php @@ -171,7 +171,8 @@ if ($mapConnectionData != null) { echo "
" . $optionsConnectionTypeTable . "
"; echo "

" . __('Preview and Select the center of the map and the default position of an agent without gis data') . "

"; -echo "" . __("Load the map view") . ""; +print_button('Load the map view','button_refresh', false, 'refreshMapView();', 'class="sub"'); +echo "

"; echo "
"; $table->width = '60%'; @@ -279,8 +280,8 @@ function refreshMapView() { centerPoint = null; GISDefaultPositionPoint = null; - //Change the text. - $("#link_save_refresh").html(''); + //Change the text to button. + $("input[name=button_refresh]").val(''); //Obtain data of map of fields. inital_zoom = $('input[name=initial_zoom]').val(); diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index bcf3fbeb7d..e16fbc6644 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -509,6 +509,8 @@ function deleteMap($idMap) { process_sql_delete('tgis_map_has_tgis_map_connection', array('tgis_map_id_tgis_map' => $idMap)); process_sql_delete('tgis_map', array('id_tgis_map' => $idMap)); + $numMaps = get_db_num_rows('SELECT * FROM tgis_map'); + clean_cache(); } @@ -550,6 +552,11 @@ function saveMap($map_name, $map_initial_longitude, $map_initial_latitude, ) ); + $numMaps = get_db_num_rows('SELECT * FROM tgis_map'); + + if ($numMaps == 1) + process_sql_update('tgis_map', array('default_map' => 1), array('id_tgis_map' => $idMap)); + foreach ($map_connection_list as $map_connection) { process_sql_insert('tgis_map_has_tgis_map_connection', array(