2010-02-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/configurar_agente.php, godmode/agentes/agent_manager.php: add in the agent config form the fields Icon agent select and Ignore new GIS data. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2328 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e79bc4095c
commit
7ec5bbfb6a
|
@ -1,3 +1,9 @@
|
|||
2010-02-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/agentes/configurar_agente.php, godmode/agentes/agent_manager.php:
|
||||
add in the agent config form the fields Icon agent select and Ignore new
|
||||
GIS data.
|
||||
|
||||
2010-02-01 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
Changes ported from 3.0 branch.
|
||||
|
|
|
@ -43,6 +43,7 @@ if (is_ajax ()) {
|
|||
enterprise_include ('godmode/agentes/agent_manager.php');
|
||||
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_gis.php');
|
||||
|
||||
$new_agent = (bool) get_parameter ('new_agent');
|
||||
|
||||
|
@ -207,6 +208,26 @@ if (!$new_agent) {
|
|||
}
|
||||
else
|
||||
$table->data[11][1] = '<em>'.__('Not available').'</em>';
|
||||
|
||||
$listIcons = getArrayListIcons();
|
||||
|
||||
$arraySelectIcon = array();
|
||||
foreach ($listIcons as $index => $value) $arraySelectIcon[$index] = $index;
|
||||
|
||||
$path = 'images/gis_map/icons/'; //TODO set better method the path
|
||||
|
||||
$table->data[12][0] = __('Icon agent');
|
||||
$table->data[12][1] = print_select($arraySelectIcon, "icon_path", $icon_path, "changeIcons();", __('None'), '', true) .
|
||||
' ' . __('Default') . ': <img id="icon_default" src="' . $path . $icon_path . '.png" />' .
|
||||
' ' . __('Ok') . ': <img id="icon_ok" src="' . $path . $icon_path . '_ok.png" />' .
|
||||
' ' . __('Bad') . ': <img id="icon_bad" src="' . $path . $icon_path . '_bad.png" />' .
|
||||
' ' . __('Warning') . ': <img id="icon_warning" src="' . $path . $icon_path . '_warning.png" />';
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$table->data[13][0] = __('Ignore new GIS data:');
|
||||
$table->data[13][1] = __('Disabled').' '.print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[13][1] .= __('Active').' '.print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||
}
|
||||
|
||||
print_table ($table);
|
||||
|
||||
|
@ -228,6 +249,32 @@ require_jquery_file ('autocomplete');
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
//Use this function for change 3 icons when change the selectbox
|
||||
function changeIcons() {
|
||||
icon = $("#icon_path :selected").val();
|
||||
|
||||
$("#icon_default").attr("src", "images/spinner.png");
|
||||
$("#icon_ok").attr("src", "images/spinner.png");
|
||||
$("#icon_bad").attr("src", "images/spinner.png");
|
||||
$("#icon_warning").attr("src", "images/spinner.png");
|
||||
|
||||
if (icon.length == 0) {
|
||||
$("#icon_default").attr("src", "");
|
||||
$("#icon_ok").attr("src", "");
|
||||
$("#icon_bad").attr("src", "");
|
||||
$("#icon_warning").attr("src", "");
|
||||
}
|
||||
else {
|
||||
$("#icon_default").attr("src", "<?php echo $path; ?>" + icon + ".png");
|
||||
$("#icon_ok").attr("src", "<?php echo $path; ?>" + icon + "_ok.png");
|
||||
$("#icon_bad").attr("src", "<?php echo $path; ?>" + icon + "_bad.png");
|
||||
$("#icon_warning").attr("src", "<?php echo $path; ?>" + icon + "_warning.png");
|
||||
}
|
||||
|
||||
//$("#icon_default").attr("src", "<?php echo $path; ?>" + icon +
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
$("select#id_os").pandoraSelectOS ();
|
||||
$("#text-id_parent").autocomplete ("ajax.php",
|
||||
|
|
|
@ -104,6 +104,8 @@ $grupo = 0;
|
|||
$id_os = 9; // Windows
|
||||
$custom_id = "";
|
||||
$cascade_protection = 0;
|
||||
$icon_path = '';
|
||||
$update_gis_data = 0;
|
||||
|
||||
$create_agent = (bool) get_parameter ('create_agent');
|
||||
|
||||
|
@ -122,6 +124,8 @@ if ($create_agent) {
|
|||
$disabled = (int) get_parameter_post ("disabled");
|
||||
$custom_id = (string) get_parameter_post ("custom_id",'');
|
||||
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
|
||||
$icon_path = (string) get_parameter_post ("icon_path",'');
|
||||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
|
||||
// Check if agent exists (BUG WC-50518-2)
|
||||
if ($nombre_agente == "") {
|
||||
|
@ -139,7 +143,9 @@ if ($create_agent) {
|
|||
'id_os' => $id_os, 'disabled' => $disabled,
|
||||
'cascade_protection' => $cascade_protection,
|
||||
'server_name' => $server_name,
|
||||
'id_parent' => $id_parent, 'custom_id' => $custom_id));
|
||||
'id_parent' => $id_parent, 'custom_id' => $custom_id,
|
||||
'icon_path' => $icon_path,
|
||||
'update_gis_data' => $update_gis_data));
|
||||
enterprise_hook ('update_agent', array ($id_agente));
|
||||
if ($id_agente !== false) {
|
||||
// Create address for this agent in taddress
|
||||
|
@ -306,6 +312,8 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
$id_parent = (int) get_agent_id ($id_parent);
|
||||
$custom_id = (string) get_parameter_post ("custom_id", "");
|
||||
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
|
||||
$icon_path = (string) get_parameter_post ("icon_path",'');
|
||||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
|
||||
//Verify if there is another agent with the same name but different ID
|
||||
if ($nombre_agente == "") {
|
||||
|
@ -336,7 +344,9 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
'comentarios' => $comentarios,
|
||||
'cascade_protection' => $cascade_protection,
|
||||
'server_name' => $server_name,
|
||||
'custom_id' => $custom_id),
|
||||
'custom_id' => $custom_id,
|
||||
'icon_path' => $icon_path,
|
||||
'update_gis_data' => $update_gis_data),
|
||||
array ('id_agente' => $id_agente));
|
||||
|
||||
if ($result === false) {
|
||||
|
@ -382,7 +392,8 @@ if ($id_agente) {
|
|||
$id_parent = $agent["id_parent"];
|
||||
$custom_id = $agent["custom_id"];
|
||||
$cascade_protection = $agent["cascade_protection"];
|
||||
|
||||
$icon_path = $agent["icon_path"];
|
||||
$update_gis_data = $agent["update_gis_data"];
|
||||
}
|
||||
|
||||
$update_module = (bool) get_parameter ('update_module');
|
||||
|
|
Loading…
Reference in New Issue