2012-03-12 Miguel de Dios <miguel.dedios@artica.es>

* include/ajax/agent.php: added the query "get_agents_group" for getting the
	list of agents from a group pass as ajax parameter.
	
	* godmode/reporting/visual_console_builder.editor.php: fixed lost title for
	simple graph toolbox.
	
	* godmode/reporting/visual_console_builder.wizard.php,
	godmode/reporting/visual_console_builder.php,
	include/functions_visual_map.php: added into the wizzard a field group to
	filter agents, and the feature to choose the item to create with the massive
	wizzard.

	* include/functions_graph.php, include/functions_ui.php,
	operation/reporting/reporting_viewer.php: cleaned source code style. 

	* include/javascript/pandora.js: into the function
	"agent_changed_by_multiple_agents" fixed the none text and any text, and
	the width of module form field.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5737 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-03-12 16:23:50 +00:00
parent 5ad6901d4a
commit 00e89cc78e
10 changed files with 399 additions and 115 deletions

View File

@ -1,3 +1,24 @@
2012-03-12 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/agent.php: added the query "get_agents_group" for getting the
list of agents from a group pass as ajax parameter.
* godmode/reporting/visual_console_builder.editor.php: fixed lost title for
simple graph toolbox.
* godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
include/functions_visual_map.php: added into the wizzard a field group to
filter agents, and the feature to choose the item to create with the massive
wizzard.
* include/functions_graph.php, include/functions_ui.php,
operation/reporting/reporting_viewer.php: cleaned source code style.
* include/javascript/pandora.js: into the function
"agent_changed_by_multiple_agents" fixed the none text and any text, and
the width of module form field.
2012-03-12 Vanessa Gil <vanessa.gil@artica.es> 2012-03-12 Vanessa Gil <vanessa.gil@artica.es>
* index.php: Fixed problem to display "sec2" in menu. * index.php: Fixed problem to display "sec2" in menu.

View File

@ -106,6 +106,9 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
<span id="title_panel_span_percentile_item" <span id="title_panel_span_percentile_item"
class="title_panel_span" class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Percentile Item');?></span> style="display: none; font-weight: bolder;"><?php echo __('Percentile Item');?></span>
<span id="title_panel_span_module_graph"
class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Module Graph');?></span>
<span id="title_panel_span_simple_value" <span id="title_panel_span_simple_value"
class="title_panel_span" class="title_panel_span"
style="display: none; font-weight: bolder;"><?php echo __('Simple value');?></span> style="display: none; font-weight: bolder;"><?php echo __('Simple value');?></span>

View File

@ -25,6 +25,7 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
} }
require_once ('include/functions_visual_map.php'); require_once ('include/functions_visual_map.php');
require_once('godmode/reporting/visual_console_builder.constans.php');
require_once($config['homedir'] . "/include/functions_agents.php"); require_once($config['homedir'] . "/include/functions_agents.php");
$action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new'); $action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new');
@ -165,10 +166,17 @@ switch ($activeTab) {
$id_agents = get_parameter ('id_agents', array ()); $id_agents = get_parameter ('id_agents', array ());
$name_modules = get_parameter ('module', array ()); $name_modules = get_parameter ('module', array ());
$type = (int)get_parameter('type', STATIC_GRAPH);
$image = get_parameter ('image'); $image = get_parameter ('image');
$range = (int) get_parameter ("range", 50); $range = (int) get_parameter ("range", 50);
$width = (int) get_parameter ("width", 0); $width = (int) get_parameter ("width", 0);
$height = (int) get_parameter ("height", 0); $height = (int) get_parameter ("height", 0);
$period = (int) get_parameter ("period", 0);
$process_value = (int) get_parameter ("process_value", 0);
$percentileitem_width = (int) get_parameter ("percentileitem_width", 0);
$max_value = (int) get_parameter ("max_value", 0);
$type_percentile = get_parameter ("type_percentile", 'percentile');
$value_show = get_parameter ("value_show", 'percent');
$message = ''; $message = '';
@ -176,26 +184,38 @@ switch ($activeTab) {
$statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true)); $statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true));
} }
else { else {
if ($name_modules[0] == '0') //Any module
$message .= visual_map_process_wizard_add ($id_agents, $image, $idVisualConsole, $range, $width, $height); if ($name_modules[0] == '0') {
else{ $id_modules = array();
foreach ($id_agents as $id_agent) {
$id_modulo = agents_get_modules($id_agent, array('id_agente_modulo'));
if (empty($id_modulo)) $id_modulo = array();
foreach ($id_modulo as $id) {
$id_modules[] = $id['id_agente_modulo'];
}
}
$message .= visual_map_process_wizard_add_modules($id_modules,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $type);
}
else {
$id_modules = array(); $id_modules = array();
$cont_dest = 1;
$cont_mod = 1;
foreach($name_modules as $mod){ foreach($name_modules as $mod){
$cont_ag = 1;
foreach($id_agents as $ag){ foreach($id_agents as $ag){
$sql = "SELECT id_agente_modulo $sql = "SELECT id_agente_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE delete_pending = 0 AND id_agente = ".$ag." AND nombre = '".$mod."'"; WHERE delete_pending = 0 AND id_agente = ".$ag." AND nombre = '".$mod."'";
$result = db_get_row_sql ($sql); $result = db_get_row_sql ($sql);
$id_modules[$cont_dest] = $result['id_agente_modulo']; $id_modules[] = $result['id_agente_modulo'];
$cont_ag = $cont_ag + 1;
$cont_dest = $cont_dest + 1;
} }
$cont_mod = $cont_mod + 1;
} }
$message .= visual_map_process_wizard_add_modules ($id_modules, $image, $idVisualConsole, $range, $width, $height); $message .= visual_map_process_wizard_add_modules($id_modules,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $type);
} }
$statusProcessInDB = array('flag' => true, 'message' => $message); $statusProcessInDB = array('flag' => true, 'message' => $message);
} }

View File

@ -50,24 +50,91 @@ foreach ($all_images as $image_file) {
$images_list[$image_file] = $image_file; $images_list[$image_file] = $image_file;
} }
$table->data[0][0] = __('Image'); $type_list = array(
$table->data[0][1] = html_print_select ($images_list, 'image', '', '', '', '', true); STATIC_GRAPH => __('Static Graph'),
PERCENTILE_BAR => __('Percentile Item'),
MODULE_GRAPH => __('Module graph'),
SIMPLE_VALUE => __('Simple value')
);
$table->data[1][0] = __('Image range (px)'); /* Layout_data editor form */
$table->data[1][1] = html_print_input_text ('range', 50, '', 5, 5, true); $intervals = array ();
$intervals[3600] = "1 ".__('hour');
$intervals[7200] = "2 ".__('hours');
$intervals[10800] = "3 ".__('hours');
$intervals[21600] = "6 ".__('hours');
$intervals[43200] = "12 ".__('hours');
$intervals[86400] = __('Last day');
$intervals[172800] = "2 ". __('days');
$intervals[604800] = __('Last week');
$intervals[1209600] = "14 ".__('days');
$intervals[2592000] = __('Last month');
$intervals[5184000] = "2 ".__('months');
$intervals[15552000] = "6 ".__('months');
$table->data[2][0] = __('Image size (px)'); $table->rowstyle["all_0"] = 'display: none;';
$table->data[2][1] = __('Width').': '.html_print_input_text ('width', 0, '', 5, 5, true); $table->data["all_0"][0] = __('Type');
$table->data[2][1] .= '<br />'.__('Height').': '.html_print_input_text ('height', 0, '', 5, 5, true); $table->data["all_0"][1] = html_print_select ($type_list, 'type', '', 'hidden_rows()', '', '', true);
$table->data[3][0] = __('Agents'); $table->rowstyle["staticgraph"] = 'display: none;';
$table->data[3][1] = html_print_select (agents_get_group_agents ($visualConsole['id_group'], false, "none", false, true), $table->data["staticgraph"][0] = __('Image');
$table->data["staticgraph"][1] = html_print_select ($images_list, 'image', '', '', '', '', true);
$table->rowstyle["all_1"] = 'display: none;';
$table->data["all_1"][0] = __('Range between elements (px)');
$table->data["all_1"][1] = html_print_input_text ('range', 50, '', 5, 5, true);
$table->rowstyle["staticgraph_modulegraph"] = 'display: none;';
$table->data["staticgraph_modulegraph"][0] = __('Size (px)');
$table->data["staticgraph_modulegraph"][1] = __('Width').': '.html_print_input_text ('width', 0, '', 5, 5, true);
$table->data["staticgraph_modulegraph"][1] .= '<br />'.__('Height').': '.html_print_input_text ('height', 0, '', 5, 5, true);
$table->rowstyle["modulegraph"] = 'display: none;';
$table->data["modulegraph"][0] = __('Period');
$table->data["modulegraph"][1] = html_print_select ($intervals, 'period', '', '', '--', 0, true);
$table->rowstyle["simplevalue"] = 'display: none;';
$table->data["simplevalue"][0] = __('Process');
$table->data["simplevalue"][1] = html_print_select (
array (SIMPLE_VALUE_MIN => __('Min value'),
SIMPLE_VALUE_MAX => __('Max value'),
SIMPLE_VALUE_AVG => __('Avg value')), 'process_value', '', '', '', '', true);
$table->rowstyle["percentileitem_1"] = 'display: none;';
$table->data["percentileitem_1"][0] = __('Width (px)');
$table->data["percentileitem_1"][1] = html_print_input_text ('percentileitem_width', 0, '', 5, 5, true);
$table->rowstyle["percentileitem_2"] = 'display: none;';
$table->data["percentileitem_2"][0] = __('Max value');
$table->data["percentileitem_2"][1] = html_print_input_text ('max_value', 0, '', 5, 5, true);
$table->rowstyle["percentileitem_3"] = 'display: none;';
$table->data["percentileitem_3"][0] = __('Type');
$table->data["percentileitem_3"][1] = html_print_radio_button_extended('type_percentile', 'percentile', ('Percentile'), 'percentile', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('type_percentile', 'bubble', ('Bubble'), 'percentile', false, '', 'style="float: left;"', true);
$table->rowstyle["percentileitem_4"] = 'display: none;';
$table->data["percentileitem_4"][0] = __('Value to show');
$table->data["percentileitem_4"][1] = html_print_radio_button_extended('value_show', 'percent', ('Percent'), 'value', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', 'style="float: left;"', true);
$table->rowstyle["all_2"] = 'display: none;';
$table->data["all_2"][0] = __('Groups');
$table->data["all_2"][1] = html_print_select_groups($config['id_user'], "AR", true,
'groups', '', '', '', 0, true);
$table->rowstyle["all_3"] = 'display: none;';
$table->data["all_3"][0] = __('Agents');
$table->data["all_3"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true),
'id_agents[]', 0, false, '', '', true, true); 'id_agents[]', 0, false, '', '', true, true);
$table->data[4][0] = __('Modules');
$table->data[4][1] = html_print_select (array (), 'module[]', 0, false, '', '', true, true);
echo '<form method="post" action="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '" onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false;">'; $table->rowstyle["all_4"] = 'display: none;';
$table->data["all_4"][0] = __('Modules');
$table->data["all_4"][1] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true);
echo '<form method="post"
action="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '"
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';
html_print_table ($table); html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -80,10 +147,100 @@ echo '</form>';
//Trick for it have a traduct text for javascript. //Trick for it have a traduct text for javascript.
echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>'; echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>';
echo '<span id="none_text" style="display: none;">' . __('None') . '</span>'; echo '<span id="none_text" style="display: none;">' . __('None') . '</span>';
echo '<span id="loading_text" style="display: none;">' . __('Loading...') . '</span>';
?> ?>
<script language="javascript" type="text/javascript"> <script type="text/javascript">
var show_only_enabled_modules = true; var show_only_enabled_modules = true;
$(document).ready (function () { $(document).ready (function () {
hidden_rows();
$("#groups").change (function () {
$('#id_agents').attr('disabled', true);
$('#id_agents').empty ();
$('#id_agents').append ($('<option></option>').html($("#loading_text").html()));
$('#id_agents').css ("width", "auto");
$('#id_agents').css ("max-width", "");
var data_params = {"page": "include/ajax/agent",
"get_agents_group": 1,
"id_group": $("#groups").val(),
"mode": "json"};
jQuery.ajax ({
data: data_params,
async: false,
type: 'POST',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
$('#id_agents').empty ();
if (isEmptyObject(data)) {
var noneText = $("#none_text").html(); //Trick for catch the translate text.
$('#id_agents').append ($('<option></option>').html (noneText).attr ("None", "").attr('value', -1).attr('selected', true));
}
else {
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
$('#id_agents').append ($('<option></option>').html (s).attr("value", i));
});
}
$('#id_agents').css ("width", "auto");
$('#id_agents').css ("max-width", "");
$('#id_agents').removeAttr('disabled');
return;
}
});
return;
});
$("#id_agents").change (agent_changed_by_multiple_agents); $("#id_agents").change (agent_changed_by_multiple_agents);
}); });
function check_fields() {
console.log(999);
switch ($("#type").val()) {
case "<?php echo PERCENTILE_BAR;?>":
case "<?php echo MODULE_GRAPH;?>":
case "<?php echo SIMPLE_VALUE;?>":
if (($("#module").val() == "-1") || ($("#module").val() == null)) {
alert("<?php echo __("Please select any module or modules.");?>");
return false;
}
else {
return true;
}
break;
default:
return true;
break;
}
}
function hidden_rows() {
$("tr", "#wizard_table").hide(); //Hide all in the form table
//Show the id ".*-all_.*"
$("tr", "#wizard_table").filter(function () {return /^wizard_table\-all.*/.test(this.id); }).show();
switch ($("#type").val()) {
case "<?php echo STATIC_GRAPH;?>":
$("tr", "#wizard_table").filter(function () {return /^.*staticgraph.*/.test(this.id); }).show();
break;
case "<?php echo PERCENTILE_BAR;?>":
$("tr", "#wizard_table").filter(function () {return /^.*percentileitem.*/.test(this.id); }).show();
break;
case "<?php echo MODULE_GRAPH;?>":
$("tr", "#wizard_table").filter(function () {return /^.*modulegraph.*/.test(this.id); }).show();
break;
case "<?php echo SIMPLE_VALUE;?>":
$("tr", "#wizard_table").filter(function () {return /^.*simplevalue.*/.test(this.id); }).show();
break;
}
}
</script> </script>

View File

@ -27,6 +27,25 @@ enterprise_include_once ('include/functions_metaconsole.php');
// * id_group // * id_group
$search_agents = (bool) get_parameter ('search_agents'); $search_agents = (bool) get_parameter ('search_agents');
$search_agents_2 = (bool) get_parameter ('search_agents_2'); $search_agents_2 = (bool) get_parameter ('search_agents_2');
$get_agents_group = (bool) get_parameter('get_agents_group', false);
if ($get_agents_group) {
$id_group = (int)get_parameter('id_group', -1);
$mode = (string)get_parameter('mode', 'json');
$return = array();
if ($id_group != -1) {
$return = agents_get_group_agents($id_group);
}
switch ($mode) {
case 'json':
echo json_encode($return);
break;
}
return;
}
if ($search_agents && ($config['metaconsole'] == 0)) { if ($search_agents && ($config['metaconsole'] == 0)) {

View File

@ -486,12 +486,13 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
} }
// Added support for projection graphs (normal_module + 1(prediction data)) // Added support for projection graphs (normal_module + 1(prediction data))
if ($projection !== false){ if ($projection !== false) {
$module_number = count ($module_list) + 1; $module_number = count ($module_list) + 1;
}else{ }
else {
$module_number = count ($module_list); $module_number = count ($module_list);
} }
// interval - This is the number of "rows" we are divided the time to fill data. // interval - This is the number of "rows" we are divided the time to fill data.
// more interval, more resolution, and slower. // more interval, more resolution, and slower.
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs // periodo - Gap of time, in seconds. This is now to (now-periodo) secs
@ -500,7 +501,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
for ($i = 0; $i < $module_number; $i++) { for ($i = 0; $i < $module_number; $i++) {
if (! isset ($weight_list[$i])) { if (! isset ($weight_list[$i])) {
$weight_list[$i] = 1; $weight_list[$i] = 1;
} else if ($weight_list[$i] == 0) { }
else if ($weight_list[$i] == 0) {
$weight_list[$i] = 1; $weight_list[$i] = 1;
} }
} }
@ -530,7 +532,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
// Calculate data for each module // Calculate data for each module
for ($i = 0; $i < $module_number; $i++) { for ($i = 0; $i < $module_number; $i++) {
// If its a projection graph, first module will be data and second will be the projection // If its a projection graph, first module will be data and second will be the projection
if ($projection != false and $i != 0){ if ($projection != false and $i != 0) {
$agent_module_id = $module_list[0]; $agent_module_id = $module_list[0];
$agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_name = modules_get_agentmodule_agent_name ($agent_module_id);
$agent_id = agents_get_agent_id ($agent_name); $agent_id = agents_get_agent_id ($agent_name);
@ -539,7 +541,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$id_module_type = modules_get_agentmodule_type ($agent_module_id); $id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type); $module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type); $uncompressed_module = is_module_uncompressed ($module_type);
}else{ }
else {
$agent_module_id = $module_list[$i]; $agent_module_id = $module_list[$i];
$agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_name = modules_get_agentmodule_agent_name ($agent_module_id);
$agent_id = agents_get_agent_id ($agent_name); $agent_id = agents_get_agent_id ($agent_name);
@ -718,11 +721,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$avg += $temp_graph_values[$timestamp_short]; $avg += $temp_graph_values[$timestamp_short];
// Added to support projection graphs // Added to support projection graphs
if ($projection != false and $i != 0){ if ($projection != false and $i != 0) {
$projection_data = array(); $projection_data = array();
$projection_data = array_merge($before_projection, $projection); $projection_data = array_merge($before_projection, $projection);
$graph_values[$i] = $projection_data; $graph_values[$i] = $projection_data;
}else{ }
else {
$graph_values[$i] = $temp_graph_values; $graph_values[$i] = $temp_graph_values;
} }
} }

View File

@ -50,7 +50,7 @@ function ui_print_truncate_text($text, $numChars = 25, $showTextInAToopTip = tru
echo $text; echo $text;
} }
} }
$text = io_safe_output($text); $text = io_safe_output($text);
if ((strlen($text)) > ($numChars)) { if ((strlen($text)) > ($numChars)) {
$half_length = intval(($numChars - 3) / 2); // '/2' because [...] is in the middle of the word. $half_length = intval(($numChars - 3) / 2); // '/2' because [...] is in the middle of the word.
@ -68,7 +68,7 @@ function ui_print_truncate_text($text, $numChars = 25, $showTextInAToopTip = tru
$truncateText = '<span title="'.$text.'">'.$truncateText.'</span>'; $truncateText = '<span title="'.$text.'">'.$truncateText.'</span>';
} }
} }
if ($showTextInAToopTip) { if ($showTextInAToopTip) {
if ($style !== false){ if ($style !== false){
$truncateText = $truncateText . '<a href="#" class="tip">&nbsp;<span style="' . $style . '">' . $text . '</span></a>'; $truncateText = $truncateText . '<a href="#" class="tip">&nbsp;<span style="' . $style . '">' . $text . '</span></a>';
} }
@ -666,21 +666,21 @@ function ui_print_string_substr ($string, $cutoff = 16, $return = false, $fontsi
if (empty ($string)) { if (empty ($string)) {
return ""; return "";
} }
$string2 = io_safe_output ($string); $string2 = io_safe_output ($string);
if (mb_strlen($string2, "UTF-8") > $cutoff){ if (mb_strlen($string2, "UTF-8") > $cutoff){
$string3 = "..."; $string3 = "...";
} else { } else {
$string3 = ""; $string3 = "";
} }
$font_size_mod = ""; $font_size_mod = "";
if ($fontsize > 0){ if ($fontsize > 0){
$font_size_mod = "style='font-size: ".$fontsize."px'"; $font_size_mod = "style='font-size: ".$fontsize."px'";
} }
$string = '<span '.$font_size_mod.' title="'.io_safe_input($string2).'">'.mb_substr ($string2, 0, $cutoff, "UTF-8").$string3.'</span>'; $string = '<span '.$font_size_mod.' title="'.io_safe_input($string2).'">'.mb_substr ($string2, 0, $cutoff, "UTF-8").$string3.'</span>';
if ($return === false) { if ($return === false) {
echo $string; echo $string;
} }

View File

@ -323,7 +323,9 @@ function visual_map_print_item($layoutData) {
* *
* @return string Return the message status to insert DB. * @return string Return the message status to insert DB.
*/ */
function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0, $height = 0) { function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range,
$width = 0, $height = 0, $period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $type) {
if (empty ($id_agents)) { if (empty ($id_agents)) {
print_error_message (__('No agents selected')); print_error_message (__('No agents selected'));
return false; return false;
@ -340,17 +342,39 @@ function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range,
$pos_y = $pos_y + $range; $pos_y = $pos_y + $range;
} }
db_process_sql_insert ('tlayout_data', $value_height = $height;
array ('id_layout' => $id_layout, $value_image = $image;
'pos_x' => $pos_x, $value_type = $type;
'pos_y' => $pos_y, switch ($type) {
'label' => agents_get_name ($id_agent), case PERCENTILE_BAR:
'image' => $image, case PERCENTILE_BUBBLE:
'id_agent' => $id_agent, $value_height = $max_value;
'width' => $width, $value_image = $value_show;
'height' => $height, if ($type_percentile == 'percentile') {
'label_color' => '#000000') $value_type = PERCENTILE_BAR;
); }
else {
$value_type = PERCENTILE_BUBBLE;
}
break;
case SIMPLE_VALUE:
$value_type = $process_value;
break;
}
$values = array ('type' => $value_type,
'id_layout' => $id_layout,
'pos_x' => $pos_x,
'pos_y' => $pos_y,
'label' => agents_get_name ($id_agent),
'image' => $value_image,
'id_agent' => $id_agent,
'width' => $width,
'period' => $period,
'height' => $value_height,
'label_color' => '#000000');
db_process_sql_insert ('tlayout_data', $values);
$pos_x = $pos_x + $range; $pos_x = $pos_x + $range;
} }
@ -372,7 +396,9 @@ function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range,
* *
* @return string Return the message status to insert DB. * @return string Return the message status to insert DB.
*/ */
function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $width = 0, $height = 0) { function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
$range, $width = 0, $height = 0, $period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $type) {
if (empty ($id_modules)) { if (empty ($id_modules)) {
$return = ui_print_error_message (__('No modules selected'), '', true); $return = ui_print_error_message (__('No modules selected'), '', true);
return $return; return $return;
@ -392,18 +418,47 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
$id_agent = modules_get_agentmodule_agent ($id_module); $id_agent = modules_get_agentmodule_agent ($id_module);
db_process_sql_insert ('tlayout_data',
array ('id_layout' => $id_layout, $value_height = $height;
'pos_x' => $pos_x, $value_image = $image;
'pos_y' => $pos_y, $value_type = $type;
'label' => modules_get_agentmodule_name ($id_module), $value_width = $width;
'image' => $image, switch ($type) {
'id_agent' => $id_agent, case PERCENTILE_BAR:
'id_agente_modulo' => $id_module, case PERCENTILE_BUBBLE:
'width' => $width, $value_height = $max_value;
'height' => $height, $value_width = $percentileitem_width;
'label_color' => '#000000') $value_image = $value_show;
); if ($type_percentile == 'percentile') {
$value_type = PERCENTILE_BAR;
}
else {
$value_type = PERCENTILE_BUBBLE;
}
break;
case SIMPLE_VALUE:
$value_type = $process_value;
break;
}
$label = ui_print_truncate_text(agents_get_name ($id_agent), 8, false, true, false, '…', false);
$label .= " - " . ui_print_truncate_text(modules_get_agentmodule_name($id_module), 8, false, true, false, '…', false);
$label = io_safe_input($label);
$values = array ('type' => $value_type,
'id_layout' => $id_layout,
'pos_x' => $pos_x,
'pos_y' => $pos_y,
'label' => $label,
'image' => $value_image,
'id_agent' => $id_agent,
'id_agente_modulo' => $id_module,
'width' => $value_width,
'period' => $period,
'height' => $value_height,
'label_color' => '#000000');
db_process_sql_insert ('tlayout_data', $values);
$pos_x = $pos_x + $range; $pos_x = $pos_x + $range;
} }

View File

@ -160,55 +160,59 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
$('#module').empty (); $('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0)); $('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php', jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente", {"page": "operation/agentes/ver_agente",
"get_agent_modules_json_for_multiple_agents": 1, "get_agent_modules_json_for_multiple_agents": 1,
"id_agent[]": idAgents, "id_agent[]": idAgents,
"all": find_modules, "all": find_modules,
"custom_condition": custom_condition "custom_condition": custom_condition
}, },
function (data) { function (data) {
$('#module').empty (); $('#module').empty ();
if (isEmptyObject(data)) {
var noneText = $("#none_text").html(); //Trick for catch the translate text.
if (noneText == null) {
noneText = 'None';
}
$('#module').append ($('<option></option>').html (noneText).attr ("None", "").attr('selected', true));
return;
}
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (isEmptyObject(data)) { if (anyText == null) {
var noneText = $("#none_text").html(); //Trick for catch the translate text. anyText = 'Any';
if (anyText == null) {
anyText = 'None';
}
$('#module').append ($('<option></option>').html (anyText).attr ("None", "").attr('selected', true));
return;
} }
if (typeof($(document).data('text_for_module')) != 'undefined') { $('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true)); }
} }
else { jQuery.each (data, function (i, val) {
if (typeof(data['any_text']) != 'undefined') { s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true)); $('#module').append ($('<option></option>').html (s).attr ("value", val));
} $('#module').fadeIn ('normal');
else { });
var anyText = $("#any_text").html(); //Trick for catch the translate text. if (selected != undefined)
$('#module').attr ('value', selected);
if (anyText == null) { $('#module').css ("width", "auto");
anyText = 'Any'; $('#module').css ("max-width", "");
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true)); $('#module').removeAttr('disabled');
} },
} "json"
jQuery.each (data, function (i, val) { );
s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (s).attr ("value", val));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json"
);
} }
/** /**

View File

@ -229,13 +229,14 @@ $(document).ready (function () {
/* Show/hide begin date reports controls */ /* Show/hide begin date reports controls */
$("#checkbox-enable_init_date").click(function() { $("#checkbox-enable_init_date").click(function() {
flag = $("#checkbox-enable_init_date").is(':checked'); flag = $("#checkbox-enable_init_date").is(':checked');
if (flag == true){ if (flag == true) {
$("#table1-1-0").css("display", ""); $("#table1-1-0").css("display", "");
$("#table1-1-1").css("display", ""); $("#table1-1-1").css("display", "");
$("#table1-1-2").css("display", "none"); $("#table1-1-2").css("display", "none");
$("#table1-1-3").css("display", ""); $("#table1-1-3").css("display", "");
$("#table1-1-6").css("display", "none"); $("#table1-1-6").css("display", "none");
}else{ }
else {
$("#table1-1-0").css("display", "none"); $("#table1-1-0").css("display", "none");
$("#table1-1-1").css("display", "none"); $("#table1-1-1").css("display", "none");
$("#table1-1-2").css("display", ""); $("#table1-1-2").css("display", "");