2012-06-11 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_visual_map.php: cleaned source code style.
	
	* include/ajax/visual_console_builder.ajax.php,
	godmode/reporting/visual_console_builder.editor.js: fixed the set
	status to items when change somethings that module or method to get
	status that agent to module status item.
	
	MERGED FROM 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6479 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-06-11 12:26:20 +00:00
parent 0c3d6c3305
commit ae17ff04ec
4 changed files with 82 additions and 49 deletions

View File

@ -1,3 +1,14 @@
2012-06-11 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map.php: cleaned source code style.
* include/ajax/visual_console_builder.ajax.php,
godmode/reporting/visual_console_builder.editor.js: fixed the set
status to items when change somethings that module or method to get
status that agent to module status item.
MERGED FROM 4.0.2
2012-06-11 Vanessa Gil <vanessa.gil@artica.es>
* godmode/users/configure_user.php

View File

@ -188,46 +188,6 @@ function updateAction() {
$("#" + idItem).css('color', values['label_color']);
switch ($('#hidden-status_' + idItem).val()) {
case '1':
//Critical (BAD)
suffix = "_bad.png";
break;
case '4':
//Critical (ALERT)
suffix = "_bad.png";
break;
case '0':
//Normal (OK)
suffix = "_ok.png";
break;
case '2':
//Warning
suffix = "_warning.png";
break;
case '3':
//Unknown
default:
suffix = ".png";
// Default is Grey (Other)
}
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/console/icons/" + values['image'] + suffix);
params.push("page=include/ajax/skins.ajax");
params.push("only_src=1");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
async: false,
timeout: 10000,
success: function (data) {
$("#image_" + idItem).attr('src', data);
}
});
if ((values['width'] != 0) && (values['height'] != 0)) {
$("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', values['height']);
@ -1170,6 +1130,64 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'module_graph':
$("#image_" + idElement).attr("src", getModuleGraph(idElement));
case 'static_graph':
if (event != 'dragstop') {
var element_status= null;
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "get_element_status", value: "1"});
parameter.push ({name: "id_element", value: idElement});
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
data: parameter,
async: false,
timeout: 10000,
success: function (data) {
$('#hidden-status_' + idElement).val(data);
}
});
switch ($('#hidden-status_' + idElement).val()) {
case '1':
//Critical (BAD)
suffix = "_bad.png";
break;
case '4':
//Critical (ALERT)
suffix = "_bad.png";
break;
case '0':
//Normal (OK)
suffix = "_ok.png";
break;
case '2':
//Warning
suffix = "_warning.png";
break;
case '3':
//Unknown
default:
suffix = ".png";
// Default is Grey (Other)
}
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/console/icons/" + values['image'] + suffix);
params.push("page=include/ajax/skins.ajax");
params.push("only_src=1");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
async: false,
timeout: 10000,
success: function (data) {
$("#image_" + idElement).attr('src', data);
}
});
}
case 'percentile_item':
case 'simple_value':
case 'label':

View File

@ -481,18 +481,20 @@ switch ($action) {
}
/* visual map element status check */
if ($get_element_status){
$res = visual_map_get_status_element($id_element);
echo $res;
if ($get_element_status) {
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
$res = visual_map_get_status_element($layoutData);
echo $res;
return;
}
if ($get_image_path_status){
$img_src = get_parameter("img_src");
$only_src = get_parameter("only_src", 0);
$result = array();
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src);
@ -500,7 +502,7 @@ if ($get_image_path_status){
$result['warning'] = html_print_image($img_src . '_warning.png', true, '', $only_src);
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
$result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
echo json_encode($result);
}

View File

@ -626,11 +626,13 @@ function visual_map_get_status_element($layoutData) {
if ($layoutData['id_layout_linked'] != 0) {
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
}
else if ($layoutData["type"] == 0) { //Single object
else if ($layoutData["type"] == 0) {
//Single object
//Status for a simple module
if ($layoutData['id_agente_modulo'] != 0) {
$status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']);
//Status for a whole agent, if agente_modulo was == 0
}
else if ($layoutData['id_agent'] != 0) {