Changed the agent name by its alias

This commit is contained in:
Alejandro Gallardo Escobar 2017-02-21 14:04:43 +01:00
parent e7df5ebacb
commit 0daaa9651e
4 changed files with 18 additions and 14 deletions

View File

@ -437,6 +437,7 @@ function readFields() {
values['left'] = $("input[name=left]").val();
values['top'] = $("input[name=top]").val();
values['agent'] = $("input[name=agent]").val();
values['id_agent'] = $("input[name=id_agent]").val();
values['module'] = $("select[name=module]").val();
values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val();
@ -997,6 +998,9 @@ function loadFieldsFromDB(item) {
$("input[name=agent]").val(val);
//Reload no-sincrone the select of modules
}
if (key == 'id_agent') {
$("input[name=id_agent]").val(val);
}
if (key == 'modules_html') {
$("select[name=module]").empty().html(val);
$("select[name=module]").val(moduleId);

View File

@ -87,16 +87,7 @@ echo "<div id='background_grid'
//Print the layout datas from the DB.
foreach ($layoutDatas as $layoutData) {
//change agent name by alias
if(!empty($layoutData['label'])){
$alias = db_get_value ("alias","tagente","id_agente",$layoutData['id_agent']);
$aux = explode('-',$layoutData['label']);
$layoutData['label'] = '<p>'. $alias .' -' . $aux[1];
}
$layoutData['status_calculated'] =
visual_map_get_status_element($layoutData);
$layoutData['status_calculated'] = visual_map_get_status_element($layoutData);
// Pending delete and disable modules must be ignored
$delete_pending_module = db_get_value ("delete_pending",

View File

@ -477,6 +477,9 @@ switch ($action) {
$values['id_agent'] = $id_agent;
}
}
else if (!empty($id_agent)) {
$values['id_agent'] = $id_agent;
}
else if ($agent !== null) {
$id_agent = agents_get_agent_id($agent);
$values['id_agent'] = $id_agent;
@ -663,12 +666,12 @@ switch ($action) {
if (!empty($connection['server_name'])) {
$elementFields['agent_name'] =
io_safe_output(agents_get_name($elementFields['id_agent']))
io_safe_output(agents_get_alias($elementFields['id_agent']))
. " (" . io_safe_output($connection['server_name']) . ")";
}
else {
$elementFields['agent_name'] =
io_safe_output(agents_get_name($elementFields['id_agent']));
io_safe_output(agents_get_alias($elementFields['id_agent']));
}
//Make the html of select box of modules about id_agent.
@ -783,10 +786,15 @@ switch ($action) {
$values['id_agent'] = $id_agent;
}
else {
if ($agent != '')
if (!empty($id_agent)) {
$values['id_agent'] = $id_agent;
}
else if (!empty($agent)) {
$values['id_agent'] = agents_get_agent_id($agent);
else
}
else {
$values['id_agent'] = 0;
}
}
$values['id_agente_modulo'] = $id_module;
$values['id_layout_linked'] = $map_linked;

View File

@ -282,6 +282,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$params['javascript_is_function_select'] = true;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
if (defined('METACONSOLE')) {
$params['javascript_ajax_page'] = '../../ajax.php';
$params['disabled_javascript_on_blur_function'] = true;