From 12ba95e67fce11806d94a112b446ada0598a0d75 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 21 Jan 2010 17:08:58 +0000 Subject: [PATCH] 2010-01-18 Miguel de Dios * include/styles/menu.css, godmode/gis_maps, godmode/menu.php, godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php: add the page to manipulate the GIS maps and add the page to create (and edit not at the moment) the GIS maps. * operation/gis_maps/render_view.php: small changes in the develop of render, add events and popups. * include/functions_gis.php: add code for respond to events, add function "saveMap" to save a map. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2294 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 + .../godmode/gis_maps/configure_gis_map.php | 394 ++++++++++++++++++ pandora_console/godmode/gis_maps/index.php | 58 +++ pandora_console/godmode/menu.php | 5 + pandora_console/include/functions_gis.php | 129 +++++- pandora_console/include/styles/menu.css | 3 + .../operation/gis_maps/render_view.php | 4 + 7 files changed, 595 insertions(+), 9 deletions(-) create mode 100644 pandora_console/godmode/gis_maps/configure_gis_map.php create mode 100644 pandora_console/godmode/gis_maps/index.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 498c1d4420..ec4e8b1451 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2010-01-18 Miguel de Dios + + * include/styles/menu.css, godmode/gis_maps, godmode/menu.php, + godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php: add the + page to manipulate the GIS maps and add the page to create (and edit not at + the moment) the GIS maps. + * operation/gis_maps/render_view.php: small changes in the develop of + render, add events and popups. + * include/functions_gis.php: add code for respond to events, add function + "saveMap" to save a map. + 2010-01-18 Miguel de Dios * include/javascript/OpenLayers/*: commit lost files of OpenLayer library. diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php new file mode 100644 index 0000000000..fdcf3a742e --- /dev/null +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -0,0 +1,394 @@ + $id) { + if (strlen($id) == 0) + continue; + + $temp = array(); + $temp['group'] = $_POST['layer_group_id_' . $id]; + $temp['name'] = $_POST['layer_name_' . $id]; + $temp['visible'] = $_POST['layer_visible_' . $id]; + + $layers[$index] = $temp; + } + + saveMap($conf, $baselayers, $layers); + + return; + break; +} + +echo "

" . __('GIS Maps') . " » " . __('Builder') . "

"; + +$map_config = array(); +$map_config["name"] = ''; +$map_config["group"] = ''; +$map_config["type"] = ''; +$map_config["url"] = ''; +$map_config["num_levels_zoom"] = ''; +$map_config["initial_zoom"] = ''; + +$table->width = '90%'; +$table->data = array (); + +echo '
'; +print_input_hidden('action', 'save_new'); +echo "

" . __('Basic configuration') . "

"; + +$table->data = array(); +$table->data[0][0] = __('Name') . ":"; +$table->data[0][1] = print_input_text ('name', $map_config["name"], '', 30, 60, true); + +$table->data[1][0] = __("Group") . ":"; +$table->data[1][1] = print_select_from_sql('SELECT id_grupo, nombre FROM tgrupo', 'group', $map_config["group"], '', '', '0', true); +$table->data[2][0] = __('Num levels zoom') . ":"; +$table->data[2][1] = print_input_text ('num_levels_zoom', $map_config["num_levels_zoom"], '', 2, 10, true); +$table->data[3][0] = __('Initial zoom level') . ":"; +$table->data[3][1] = print_input_text ('initial_zoom', $map_config["initial_zoom"], '', 2, 10, true); + +print_table ($table); + +$table->width = '80%'; +echo "

" . __('Maps') . "

"; +$table->data = array(); +$table->id = "maps"; +$types["OSM"] = __('Open Street Maps'); +$table->data[0][0] = __('Type') . ":"; +$table->data[0][1] = print_select ($types, 'sel_type', $map_config["type"], '', '', __('Select your type map'), true); +$table->data[0][2] = '' . print_image ("images/add.png", true) . ''; + +print_table ($table); + +echo ""; + +echo "

" . __('Layers') . "

"; +$table->width = '50%'; +$table->data = array(); +$table->id = "layers"; +$table->data[0][0] = _('Group') . ':'; +$table->data[0][1] = print_select_from_sql('SELECT id_grupo, nombre FROM tgrupo', 'group', $map_config["group"], '', '', '0', true); +$table->data[0][2] = '' . print_image ("images/add.png", true) . ''; +print_table($table); + +echo ""; + +echo "

" . __('Center') . "

"; +echo "

" . __('Please create a map before selecting the center.') . "TODO

"; + + +echo '
'; +print_submit_button (__('Create'), 'create_button', false, 'class="sub upd"'); +echo '
'; +echo '
'; + +//Chunks of table maps for when add maps to form +//-------------------------INI OSM--------------------------------------- +$table->width = '80%'; +$table->data = array(); +$table->rowclass[0] = 'OSM'; +$table->rowclass[1] = 'OSM'; +$table->rowclass[2] = 'OSM'; +$table->rowclass[3] = 'OSM'; +$table->rowstyle[0] = 'visibility: hidden;'; +$table->rowstyle[1] = 'visibility: hidden;'; +$table->rowstyle[2] = 'visibility: hidden;'; +$table->rowstyle[3] = 'visibility: hidden;'; +$table->colspan[0][0] = 3; +$table->data[0][0] = '
'; +$table->data[1][0] = "" . __('OSM') . ""; +$table->data[1][1] = ''; +$table->data[1][2] = '' . print_image ("images/cross.png", true) . ''; +$table->data[2][0] = __('URL_OSM') . ":"; +$table->data[2][1] = print_input_text ('url_osm', $map_config["url"], '', 50, 100, true); +$table->data[2][2] = ''; +$table->data[3][0] = __('Default') . ':'; +$table->data[3][1] = print_radio_button ('default_map', '2', '', true, true); +$table->data[3][2] = ''; + +print_table($table); +unset($table->rowclass); +unset($table->rowstyle); +unset($table->colspan); +//-------------------------INI OSM--------------------------------------- + +//Chunks of table layer for when add layers to form +//-------------------------INI LAYERS--------------------------------------- +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/godmode/gis_maps/index.php b/pandora_console/godmode/gis_maps/index.php new file mode 100644 index 0000000000..2422a4fb7d --- /dev/null +++ b/pandora_console/godmode/gis_maps/index.php @@ -0,0 +1,58 @@ +" . __('GIS Maps') . " » " . __('Builder') . ""; + +$table->width = '500px'; +$table->head[0] = __('Map name'); +$table->head[1] = __('Group'); +$table->head[2] = __('View'); +$table->head[3] = __('Delete'); + +$table->align[1] = 'center'; +$table->align[2] = 'center'; +$table->align[3] = 'center'; + +$maps = get_db_all_rows_in_table ('tgis_map','map_name'); + +$table->data = array(); +foreach ($maps as $map) { + $table->data[] = array('' . $map['map_name'] . '', + print_group_icon ($map['group_id'], true), + '' . print_image ("images/eye.png", true).'', + '' . print_image ("images/cross.png", true).''); +} + +print_table($table); + +echo '
'; +echo '
'; +print_input_hidden ('action','create_map'); +print_submit_button (__('Create'), '', false, 'class="sub next"'); +echo '
'; +echo '
'; +?> \ No newline at end of file diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 0a5f3b72ae..9d6a422efa 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -121,6 +121,11 @@ if (give_acl ($config['id_user'], 0, "IW")) { $menu["gmap"]["text"] = __('Map builder'); $menu["gmap"]["sec2"] = "godmode/reporting/map_builder"; $menu["gmap"]["id"] = "god-map"; + + $menu["godgismaps"]["text"] = __('GIS Maps'); + $menu["godgismaps"]["sec2"] = "godmode/gis_maps/index"; + $menu["godgismaps"]["refr"] = 60; + $menu["godgismaps"]["id"] = "god-gismaps"; } if (give_acl ($config['id_user'], 0, "PM")) { diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index 296edec4f9..971b59a3e2 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -43,6 +43,7 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $url break; } } + echo ", new OpenLayers.Control.LayerSwitcher()"; echo "],"; ?> maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), @@ -104,13 +105,13 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $url if (manual) { point = new OpenLayers.Feature.Vector(point,{estado: "ok", id: id, lanlot: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())}, - {fillColor: "#ffffff", pointRadius: pointRadiusManual, stroke: 1, strokeColor: color, strokeWidth: strokeWidth} + {fillColor: "#ffffff", pointRadius: pointRadiusManual, stroke: 1, strokeColor: color, strokeWidth: strokeWidth, cursor: "pointer"} ); } else { point = new OpenLayers.Feature.Vector(point,{estado: "ok", id: id, lanlot: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())}, - {fillColor: color, pointRadius: pointRadiusNormal} + {fillColor: color, pointRadius: pointRadiusNormal, cursor: "pointer"} ); } @@ -139,7 +140,7 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $url ); map.addLayer(layer); - var select = new OpenLayers.Control.SelectFeature(layer); - map.addControl(select); - select.activate(); - layer.events.on({ "featureselected": function(e) { if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { @@ -215,6 +212,22 @@ function makeLayer($name, $visible = true, $dot = null) { + +