2010-02-10 14:08:33 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2010-05-24 18:17:21 +02:00
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2010-02-10 14:08:33 +01:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// Load global vars
|
2019-01-30 16:18:44 +01:00
|
|
|
if (!isset($id_agente)) {
|
|
|
|
die('Not Authorized');
|
2010-02-10 14:08:33 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_gis.php';
|
|
|
|
require_once 'include/functions_html.php';
|
|
|
|
require_once 'include/functions_agents.php';
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2011-04-13 18:11:02 +02:00
|
|
|
ui_require_javascript_file('openlayers.pandora');
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2010-03-05 12:16:20 +01:00
|
|
|
echo "<div style='margin-bottom: 10px;'></div>";
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2011-04-27 15:43:31 +02:00
|
|
|
$agentData = gis_get_data_last_position_agent($id_agente);
|
2019-01-30 16:18:44 +01:00
|
|
|
$updateGisData = db_get_value('update_gis_data', 'tagente', 'id_agente', $id_agente);
|
2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
include/functions_users.php
include/functions_html.php
include/functions_menu.php
include/functions_messages.php
include/functions_modules.php
include/functions_reporting.php
include/functions_groups.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/functions_visual_map.php
include/functions_profile.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
include/functions_reports.php
index.php
extensions/insert_data.php
extensions/agents_modules.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/module_groups.php
operation/incidents/incident_detail.php
operation/search_modules.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/estado_agente.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/group_view.php
operation/search_agents.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/integria_incidents/incident_detail.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/search_users.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
ajax.php
general/ui/agents_list.php
godmode/groups/configure_group.php
godmode/groups/group_list.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_purge.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/module_manager_editor_network.php
godmode/agentes/module_manager_editor_wmi.php
godmode/agentes/module_manager_editor_plugin.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/setup/setup_auth.php
godmode/users/user_list.php
godmode/users/configure_user.php
godmode/users/configure_profile.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Functions in
functions_profile.php, functions_agents.php, functions_users.php,
functions_massive_policies.php, functions_audit.php, functions_backup.php,
functions_collection.php, functions_skins.php, functions_enterprise.php,
functions_groups.php, functions_local_components.php, functions_metaconsole.php,
functions_policies.php, functions_reporting.php, functions_reporting_csv.php,
functions_reporting_pdf2.php, functions_services.php have their own prefixes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4333 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-10 20:51:09 +02:00
|
|
|
$agent_name = agents_get_name($id_agente);
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Avoid the agents with characters that fails the div.
|
2013-03-05 15:24:44 +01:00
|
|
|
$agent_name = md5($agent_name);
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Map with the current position
|
|
|
|
echo '<div id="'.$agent_name.'_agent_map" style="border:1px solid black; width:100%; height: 30em;"></div>';
|
2010-03-01 12:17:27 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (!gis_get_agent_map($id_agente, '500px', '100%', false)) {
|
|
|
|
ui_print_error_message(__('There is no default map. Please go to the setup for to set a default map.'));
|
|
|
|
echo "<script type='text/javascript'>
|
2014-03-31 12:25:59 +02:00
|
|
|
$(document).ready(function() {
|
2019-01-30 16:18:44 +01:00
|
|
|
$('#".$agent_name."_agent_map').hide();
|
2014-03-31 12:25:59 +02:00
|
|
|
});
|
|
|
|
</script>";
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2010-02-18 14:29:36 +01:00
|
|
|
if ($agentData === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_print_info_message(
|
|
|
|
[
|
|
|
|
'no_close' => true,
|
|
|
|
'message' => __("There is no GIS data for this agent, so it's positioned in default position of map."),
|
|
|
|
]
|
|
|
|
);
|
2010-02-18 14:29:36 +01:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
ui_print_warning_message(
|
|
|
|
[
|
|
|
|
'no_close' => true,
|
|
|
|
'message' => __("When you change the Agent position, the agent automatically activates the 'Ignore new GIS data' option"),
|
|
|
|
]
|
|
|
|
);
|
2010-02-18 14:29:36 +01:00
|
|
|
|
2015-04-01 13:24:53 +02:00
|
|
|
$table->width = '100%';
|
|
|
|
$table->class = 'databox filters';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data = [];
|
2015-04-01 13:24:53 +02:00
|
|
|
$table->cellpadding = 0;
|
|
|
|
$table->cellspacing = 0;
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->head[0] = __('Agent position');
|
2015-04-01 13:24:53 +02:00
|
|
|
$table->head_colspan[0] = 4;
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->headstyle[0] = 'text-align:center';
|
2015-04-23 17:52:16 +02:00
|
|
|
$table->style[0] = 'font-weight: bold; ';
|
|
|
|
$table->style[2] = 'font-weight: bold; ';
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2011-12-05 12:54:06 +01:00
|
|
|
$table->data[1][0] = __('Latitude: ');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[1][1] = html_print_input_text_extended(
|
|
|
|
'latitude',
|
|
|
|
$agentData['stored_latitude'],
|
|
|
|
'text-latitude',
|
|
|
|
'',
|
|
|
|
20,
|
|
|
|
20,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
[
|
|
|
|
'onchange' => 'setIgnoreGISDataEnabled()',
|
|
|
|
'onkeyup' => 'setIgnoreGISDataEnabled()',
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2015-04-01 13:24:53 +02:00
|
|
|
$table->data[1][2] = __('Longitude: ');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[1][3] = html_print_input_text_extended(
|
|
|
|
'longitude',
|
|
|
|
$agentData['stored_longitude'],
|
|
|
|
'text-longitude',
|
|
|
|
'',
|
|
|
|
20,
|
|
|
|
20,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
[
|
|
|
|
'onchange' => 'setIgnoreGISDataEnabled()',
|
|
|
|
'onkeyup' => 'setIgnoreGISDataEnabled()',
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2015-04-01 13:24:53 +02:00
|
|
|
$table->data[2][0] = __('Altitude: ');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[2][1] = html_print_input_text_extended(
|
|
|
|
'altitude',
|
|
|
|
$agentData['stored_altitude'],
|
|
|
|
'text-altitude',
|
|
|
|
'',
|
|
|
|
10,
|
|
|
|
10,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
[
|
|
|
|
'onchange' => 'setIgnoreGISDataEnabled()',
|
|
|
|
'onkeyup' => 'setIgnoreGISDataEnabled()',
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2015-04-01 13:24:53 +02:00
|
|
|
$table->data[2][2] = __('Ignore new GIS data:');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[2][3] = __('Yes').' '.html_print_radio_button_extended('update_gis_data', 0, '', $updateGisData, false, '', 'style="margin-right: 40px;"', true);
|
|
|
|
$table->data[2][3] .= __('No').' '.html_print_radio_button_extended('update_gis_data', 1, '', $updateGisData, false, '', 'style="margin-right: 40px;"', true);
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2012-04-24 Dario Rodriguez <dario.rodriguez@artica.es>
* operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
operation/menu.php,
godmode/agentes/agent_template.php,
godmode/agentes/fields_manager.php,
godmode/agentes/agent_conf_gis.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/configure_field.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/agent_manager.php,
godmode/menu.php: Fixed some problems with links and new menu structure.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6127 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-04-24 12:02:06 +02:00
|
|
|
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente;
|
2019-01-30 16:18:44 +01:00
|
|
|
echo "<form method='post' action='".$url."' onsubmit ='return validateFormFields();'>";
|
2011-04-27 15:43:31 +02:00
|
|
|
html_print_input_hidden('update_gis', 1);
|
|
|
|
html_print_table($table);
|
2010-02-10 14:08:33 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '<div class="action-buttons" style="width: '.$table->width.'; float: left;">';
|
|
|
|
html_print_submit_button(__('Update'), '', false, 'class="sub upd"');
|
2010-02-10 14:08:33 +01:00
|
|
|
echo '</div>';
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '</form>';
|
2010-02-10 14:08:33 +01:00
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2010-02-18 14:29:36 +01:00
|
|
|
function setIgnoreGISDataEnabled() {
|
2019-01-30 16:18:44 +01:00
|
|
|
$("#radiobtn0002").removeAttr("checked");
|
|
|
|
$("#radiobtn0001").attr("checked","checked");
|
2010-02-18 14:29:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function validateFormFields() {
|
2019-01-30 16:18:44 +01:00
|
|
|
longitude = $('input[name=longitude]').val();
|
|
|
|
latitude = $('input[name=latitude]').val();
|
|
|
|
altitude = $('input[name=altitude]').val();
|
|
|
|
valid = true;
|
|
|
|
|
|
|
|
$('input[name=longitude]').css('background', '#ffffff');
|
|
|
|
$('input[name=latitude]').css('background', '#ffffff');
|
|
|
|
$('input[name=altitude]').css('background', '#ffffff');
|
|
|
|
|
|
|
|
//Validate longitude
|
|
|
|
if ((jQuery.trim(longitude).length == 0) ||
|
|
|
|
isNaN(parseFloat(longitude))) {
|
|
|
|
$('input[name=longitude]').css('background', '#cc0000');
|
|
|
|
|
|
|
|
valid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Validate latitude
|
|
|
|
if ((jQuery.trim(latitude).length == 0) ||
|
|
|
|
isNaN(parseFloat(latitude))) {
|
|
|
|
$('input[name=latitude]').css('background', '#cc0000');
|
|
|
|
|
|
|
|
valid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Validate altitude
|
|
|
|
if ((jQuery.trim(altitude).length == 0) ||
|
|
|
|
isNaN(parseFloat(altitude))) {
|
|
|
|
$('input[name=altitude]').val(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (valid) return true;
|
|
|
|
else return false;
|
2010-02-18 14:29:36 +01:00
|
|
|
}
|
|
|
|
|
2010-02-10 14:08:33 +01:00
|
|
|
$(document).ready (
|
2019-01-30 16:18:44 +01:00
|
|
|
function () {
|
|
|
|
function changePositionAgent(e) {
|
|
|
|
var lonlat = map.getLonLatFromViewPortPx(e.xy);
|
|
|
|
var layer = map.getLayersByName("layer_for_agent_<?php echo $agent_name; ?>");
|
|
|
|
|
|
|
|
layer = layer[0];
|
|
|
|
feature = layer.features[0];
|
|
|
|
|
|
|
|
lonlat.transform(map.getProjectionObject(), map.displayProjection); //transform the lonlat in object proyection to "standar proyection"
|
|
|
|
|
|
|
|
$('input[name=latitude]').val(lonlat.lat);
|
|
|
|
$('input[name=longitude]').val(lonlat.lon);
|
|
|
|
|
|
|
|
if ($('input[name=altitude]').val().length == 0)
|
|
|
|
$('input[name=altitude]').val(0)
|
|
|
|
|
|
|
|
setIgnoreGISDataEnabled();
|
|
|
|
|
|
|
|
//return to no-standar the proyection for to move
|
|
|
|
feature.move(lonlat.transform(map.displayProjection, map.getProjectionObject()));
|
|
|
|
}
|
|
|
|
|
|
|
|
js_activateEvents(changePositionAgent);
|
|
|
|
});
|
2010-03-08 20:21:28 +01:00
|
|
|
</script>
|