2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php, godmode/reporting/visual_console_builder.php, godmode/reporting/visual_console_builder.data.php, include/functions_visual_map_editor.php, operation/reporting/reporting_xml.php, operation/agentes/exportdata.excel.php, operation/agentes/ver_agente.php, operation/agentes/status_monitor.php, operation/agentes/alerts_status.php, operation/agentes/exportdata.csv.php: uploaded the changes of source code style previous to my next commit for to make the next commit more easy. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
88c6d89c5a
commit
03b0fc8a95
|
@ -1,3 +1,19 @@
|
|||
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/reporting/reporting_builder.php,
|
||||
godmode/reporting/map_builder.php,
|
||||
godmode/reporting/visual_console_builder.php,
|
||||
godmode/reporting/visual_console_builder.data.php,
|
||||
include/functions_visual_map_editor.php,
|
||||
operation/reporting/reporting_xml.php,
|
||||
operation/agentes/exportdata.excel.php,
|
||||
operation/agentes/ver_agente.php,
|
||||
operation/agentes/status_monitor.php,
|
||||
operation/agentes/alerts_status.php,
|
||||
operation/agentes/exportdata.csv.php: uploaded the changes of source
|
||||
code style previous to my next commit for to make the next commit
|
||||
more easy.
|
||||
|
||||
2012-12-03 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/functions_treeview.php: Fixed id decoding under the
|
||||
|
|
|
@ -61,13 +61,13 @@ if ($copy_layout) {
|
|||
|
||||
$idNewVisualConsole = $result;
|
||||
|
||||
if($result) {
|
||||
if ($result) {
|
||||
$ninsert = 1;
|
||||
|
||||
|
||||
// Return from DB the items of the source layout
|
||||
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
|
||||
|
||||
if(!empty($data_layout_src)) {
|
||||
if (!empty($data_layout_src)) {
|
||||
|
||||
//By default the id parent 0 is always 0.
|
||||
$id_relations = array(0 => 0);
|
||||
|
@ -91,7 +91,7 @@ if ($copy_layout) {
|
|||
$id_relations[$old_id] = $result;
|
||||
}
|
||||
|
||||
if($result)
|
||||
if ($result)
|
||||
$ninsert++;
|
||||
}// for each item of console
|
||||
|
||||
|
@ -127,7 +127,7 @@ if ($copy_layout) {
|
|||
else {
|
||||
echo '<h3 class="error">'.__('Not copied. Error copying data').'</h3>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$table->width = '98%';
|
||||
|
@ -138,7 +138,7 @@ $table->head[1] = __('Group');
|
|||
$table->head[2] = __('Items');
|
||||
|
||||
//Only for IW flag
|
||||
if(check_acl ($config['id_user'], 0, "IW")) {
|
||||
if (check_acl ($config['id_user'], 0, "IW")) {
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
}
|
||||
|
|
|
@ -1164,9 +1164,12 @@ switch ($action) {
|
|||
break;
|
||||
// Type case only depends of local database
|
||||
case 'type':
|
||||
$sql = "SELECT id_rc FROM treport_content WHERE %s ORDER BY type %s";
|
||||
$sql = "SELECT id_rc
|
||||
FROM treport_content
|
||||
WHERE %s ORDER BY type %s";
|
||||
|
||||
$sql = sprintf($sql, 'id_report = ' . $idReport, '%s');
|
||||
$sql = sprintf($sql,
|
||||
'id_report = ' . $idReport, '%s');
|
||||
switch ($dir) {
|
||||
case 'up':
|
||||
$sql = sprintf($sql, 'ASC');
|
||||
|
@ -1224,15 +1227,18 @@ switch ($action) {
|
|||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$resultOperationDB = db_process_sql_update('treport_content',
|
||||
array('`order`' => $oldOrder), array('`order`' => $newOrder, 'id_report' => $idReport));
|
||||
array('`order`' => $oldOrder),
|
||||
array('`order`' => $newOrder, 'id_report' => $idReport));
|
||||
break;
|
||||
case "postgresql":
|
||||
$resultOperationDB = db_process_sql_update('treport_content',
|
||||
array('"order"' => $oldOrder), array('"order"' => $newOrder, 'id_report' => $idReport));
|
||||
array('"order"' => $oldOrder),
|
||||
array('"order"' => $newOrder, 'id_report' => $idReport));
|
||||
break;
|
||||
case "oracle":
|
||||
$resultOperationDB = db_process_sql_update('treport_content',
|
||||
array('"order"' => $oldOrder), array('"order"' => $newOrder, 'id_report' => $idReport), 'AND', false);
|
||||
array('"order"' => $oldOrder),
|
||||
array('"order"' => $newOrder, 'id_report' => $idReport), 'AND', false);
|
||||
break;
|
||||
}
|
||||
if ($resultOperationDB !== false) {
|
||||
|
@ -1362,4 +1368,4 @@ switch ($activeTab) {
|
|||
reporting_enterprise_select_tab($activeTab);
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -37,7 +37,7 @@ switch ($action) {
|
|||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
|
||||
html_print_input_hidden('action', 'update');
|
||||
break;
|
||||
case 'edit':
|
||||
case 'edit':
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
|
||||
html_print_input_hidden('action', 'update');
|
||||
break;
|
||||
|
|
|
@ -42,6 +42,7 @@ switch ($activeTab) {
|
|||
$background = '';
|
||||
$visualConsoleName = '';
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
case 'save':
|
||||
$idGroup = get_parameter('id_group');
|
||||
|
@ -50,10 +51,10 @@ switch ($activeTab) {
|
|||
|
||||
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background);
|
||||
|
||||
// If the background is changed the size is reseted
|
||||
// If the background is changed the size is reseted
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
$background_now = $visualConsole['background'];
|
||||
if($background_now != $background && $background) {
|
||||
if ($background_now != $background && $background) {
|
||||
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
|
||||
$values['width'] = $sizeBackground[0];
|
||||
$values['height'] = $sizeBackground[1];
|
||||
|
@ -74,8 +75,8 @@ switch ($activeTab) {
|
|||
$statusProcessInDB = array('flag' => false, 'message' => '<h3 class="error">'.__('Could not be update.').'</h3>');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
|
||||
if($values['name'] != "" && $values['background'])
|
||||
$idVisualConsole = db_process_sql_insert('tlayout', $values);
|
||||
else
|
||||
|
@ -94,6 +95,7 @@ switch ($activeTab) {
|
|||
}
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
$visualConsoleName = $visualConsole['name'];
|
||||
|
@ -102,6 +104,7 @@ switch ($activeTab) {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'list_elements':
|
||||
switch ($action) {
|
||||
case 'update':
|
||||
|
|
|
@ -85,14 +85,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items['image_row']['items'] = array('static_graph', 'icon', 'datos');
|
||||
$form_items['image_row']['html'] = '<td>' . __('Image') . '</td>
|
||||
<td>'. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .'</td>';
|
||||
|
||||
|
||||
$form_items['enable_link_row'] = array();
|
||||
$form_items['enable_link_row']['items'] = array('static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'label', 'datos'. 'icon');
|
||||
$form_items['enable_link_row']['html'] = '<td style="">' . __('Enable link') .'</td>
|
||||
<td style="">'. html_print_checkbox('enable_link', '', 'enable_link', true) .'</td>';
|
||||
|
||||
|
||||
$form_items['preview_row'] = array();
|
||||
$form_items['preview_row']['items'] = array('static_graph', 'datos icon');
|
||||
$form_items['preview_row']['html'] = '<td colspan="2" style="text-align: right;"><div id="preview" style="text-align: right;"></div></td>';
|
||||
|
|
|
@ -417,7 +417,7 @@ $table->data = array ();
|
|||
|
||||
foreach ($alerts['alerts_combined'] as $alert) {
|
||||
array_push ($table->data, ui_format_alert_row ($alert, true, $print_agent));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
ui_pagination ($countAlertsCombined, $url, $offset_combined, 0, false, 'offset_combined');
|
||||
|
|
|
@ -101,27 +101,27 @@ if (!empty ($module)) {
|
|||
|
||||
// Show header
|
||||
echo $datastart;
|
||||
|
||||
|
||||
foreach ($module as $selected) {
|
||||
|
||||
|
||||
$output = "";
|
||||
$work_period = 120000;
|
||||
if ($work_period > $period) {
|
||||
$work_period = $period;
|
||||
}
|
||||
|
||||
|
||||
$work_end = $end - $period + $work_period;
|
||||
//Buffer to get data, anyway this will report a memory exhaustin
|
||||
|
||||
|
||||
while ($work_end <= $end) {
|
||||
|
||||
|
||||
$data = array (); // Reinitialize array for each module chunk
|
||||
if ($export_type == "avg") {
|
||||
$arr = array ();
|
||||
$arr["data"] = reporting_get_agentmodule_data_average ($selected, $work_period, $work_end);
|
||||
if ($arr["data"] === false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$arr["module_name"] = modules_get_agentmodule_name ($selected);
|
||||
$arr["agent_name"] = modules_get_agentmodule_agent_name ($selected);
|
||||
$arr["agent_id"] = modules_get_agentmodule_agent ($selected);
|
||||
|
@ -160,9 +160,9 @@ if (!empty ($module)) {
|
|||
$output = "";
|
||||
} // main foreach
|
||||
echo $dataend;
|
||||
|
||||
|
||||
exit; // Necesary for CSV export, if not give problems
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
|
|
@ -120,7 +120,7 @@ if (!empty ($module)) {
|
|||
$arr["data"] = reporting_get_agentmodule_data_average ($selected, $work_period, $work_end);
|
||||
if ($arr["data"] === false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$arr["module_name"] = modules_get_agentmodule_name ($selected);
|
||||
$arr["agent_name"] = modules_get_agentmodule_agent_name ($selected);
|
||||
$arr["agent_id"] = modules_get_agentmodule_agent ($selected);
|
||||
|
@ -147,7 +147,7 @@ if (!empty ($module)) {
|
|||
}
|
||||
|
||||
echo $output;
|
||||
|
||||
|
||||
unset($output);
|
||||
$output = "";
|
||||
unset($data);
|
||||
|
|
|
@ -203,12 +203,12 @@ if (defined('METACONSOLE')) {
|
|||
if (!empty($rows_temp)) {
|
||||
foreach ($rows_temp as $module_group_key => $modules_group_val)
|
||||
$rows_temp_processed[$modules_group_val['name']] = $modules_group_val['name'];
|
||||
|
||||
|
||||
$rows_select = array_unique(array_merge($rows_select, $rows_temp_processed));
|
||||
}
|
||||
}
|
||||
|
||||
$groups_temp = users_get_groups_for_select(false, "AR", true, true, false);
|
||||
|
||||
|
||||
$groups_temp_processed = array();
|
||||
|
||||
foreach ($groups_temp as $group_temp_key => $group_temp_val) {
|
||||
|
@ -219,7 +219,7 @@ if (defined('METACONSOLE')) {
|
|||
if (!empty($groups_temp_processed)) {
|
||||
$groups_select = array_unique(array_merge($groups_select, $groups_temp_processed));
|
||||
}
|
||||
|
||||
|
||||
if (!empty($modules_temp))
|
||||
$modules = array_merge($modules, $modules_temp);
|
||||
if (!empty($tags_temp))
|
||||
|
@ -228,11 +228,11 @@ if (defined('METACONSOLE')) {
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
unset($groups_select[__('All')]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
echo '
|
||||
echo '
|
||||
<td valign="middle">' . __('Group') . '</td>
|
||||
<td valign="middle">' .
|
||||
html_print_select_groups(false, "AR", true, "ag_group",
|
||||
|
@ -241,15 +241,15 @@ echo '
|
|||
</td>';
|
||||
}
|
||||
else {
|
||||
echo '
|
||||
<td valign="middle">' . __('Group') . '</td>
|
||||
<td valign="middle">' .
|
||||
html_print_select($groups_select, "ag_group",
|
||||
io_safe_output($ag_group), '', '', '0', true, false, false, 'w130',
|
||||
false, 'width:150px;') . '
|
||||
</td>';
|
||||
echo '
|
||||
<td valign="middle">' . __('Group') . '</td>
|
||||
<td valign="middle">' .
|
||||
html_print_select($groups_select, "ag_group",
|
||||
io_safe_output($ag_group), '', '', '0', true, false, false, 'w130',
|
||||
false, 'width:150px;') . '
|
||||
</td>';
|
||||
}
|
||||
echo '<td>' . __('Monitor status') . "</td>";
|
||||
echo '<td>' . __('Monitor status') . "</td>";
|
||||
|
||||
|
||||
|
||||
|
@ -500,14 +500,14 @@ else {
|
|||
elseif($user_groups != '') {
|
||||
// User has explicit permission on group 1 ?
|
||||
$sql .= " AND tagente.id_grupo IN (".$user_groups.")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Module group
|
||||
if (defined('METACONSOLE')) {
|
||||
if ($modulegroup != '-1')
|
||||
$sql .= sprintf (" AND tagente_modulo.id_module_group IN (SELECT id_mg
|
||||
FROM tmodule_group WHERE name = '%s')", $modulegroup);
|
||||
FROM tmodule_group WHERE name = '%s')", $modulegroup);
|
||||
}
|
||||
else if ($modulegroup > -1) {
|
||||
$sql .= sprintf (" AND tagente_modulo.id_module_group = '%d'", $modulegroup);
|
||||
|
@ -564,7 +564,7 @@ if ($tag_filter !== 0) {
|
|||
FROM ttag_module
|
||||
WHERE ttag_module.id_tag = " . $tag_filter . "
|
||||
)";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -572,7 +572,7 @@ if ($tag_filter !== 0) {
|
|||
if (!defined('METACONSOLE'))
|
||||
$count = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) " .
|
||||
$sql . ")");
|
||||
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
// Offset will be used to get the subset of modules
|
||||
$inferior_limit = $offset;
|
||||
|
@ -581,12 +581,12 @@ if (defined('METACONSOLE')) {
|
|||
$offset = 0;
|
||||
if (!isset($config["meta_num_elements"]))
|
||||
$config["meta_num_elements"] = 100;
|
||||
|
||||
|
||||
$limit_sql = $config["meta_num_elements"];
|
||||
}
|
||||
else
|
||||
$limit_sql = $config["block_size"];
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT
|
||||
|
@ -707,11 +707,11 @@ switch ($config["dbtype"]) {
|
|||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
||||
if ($count > $config["block_size"]) {
|
||||
ui_pagination ($count, false, $offset);
|
||||
}
|
||||
|
||||
|
||||
if ($result === false) {
|
||||
$result = array ();
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ else {
|
|||
if ($servers === false)
|
||||
$servers = array();
|
||||
|
||||
$result = array();
|
||||
$result = array();
|
||||
$count_modules = 0;
|
||||
foreach($servers as $server) {
|
||||
// If connection was good then retrieve all data server
|
||||
|
@ -730,14 +730,15 @@ else {
|
|||
$connection = true;
|
||||
}
|
||||
else{
|
||||
$connection = false;
|
||||
$connection = false;
|
||||
}
|
||||
|
||||
$result_server = db_get_all_rows_sql ($sql);
|
||||
|
||||
if(!empty($result_server)) {
|
||||
|
||||
if (!empty($result_server)) {
|
||||
|
||||
$pwd = $server["auth_token"]; // Create HASH login info
|
||||
// Create HASH login info
|
||||
$pwd = $server["auth_token"];
|
||||
$auth_serialized = json_decode($pwd,true);
|
||||
|
||||
if (is_array($auth_serialized)) {
|
||||
|
@ -753,7 +754,7 @@ else {
|
|||
$url_hash = "&loginhash=auto&loginhash_data=$hashdata&loginhash_user=$user";
|
||||
|
||||
foreach ($result_server as $result_element_key => $result_element_value) {
|
||||
|
||||
|
||||
$result_server[$result_element_key]['server_name'] = $server["server_name"];
|
||||
$result_server[$result_element_key]['server_url'] = $server["server_url"]."/";
|
||||
$result_server[$result_element_key]['hashdata'] = $hashdata;
|
||||
|
@ -768,12 +769,12 @@ else {
|
|||
|
||||
metaconsole_restore_db();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($count_modules > $config["block_size"]) {
|
||||
ui_pagination ($count_modules, false, $offset);
|
||||
}
|
||||
|
||||
|
||||
// Get number of elements of the pagination
|
||||
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
|
||||
}
|
||||
|
@ -1039,11 +1040,11 @@ else {
|
|||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function toggle_full_value(id) {
|
||||
value_title = $("#hidden-value_replace_module_" + id).val();
|
||||
|
||||
$("#hidden-value_replace_module_" + id).val($("#value_module_text_" + id).html());
|
||||
|
||||
$("#value_module_text_" + id).html(value_title);
|
||||
}
|
||||
function toggle_full_value(id) {
|
||||
value_title = $("#hidden-value_replace_module_" + id).val();
|
||||
|
||||
$("#hidden-value_replace_module_" + id).val($("#value_module_text_" + id).html());
|
||||
|
||||
$("#value_module_text_" + id).html(value_title);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -317,11 +317,12 @@ if (is_ajax ()) {
|
|||
else
|
||||
$search = false;
|
||||
|
||||
if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) {
|
||||
if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) {
|
||||
if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
|
||||
if (metaconsole_load_external_db($connection) == NOERR) {
|
||||
|
||||
/* Get all agents if no agent was given */
|
||||
if ($id_agent == 0)
|
||||
$id_agent = array_keys (
|
||||
|
@ -332,6 +333,7 @@ if (is_ajax ()) {
|
|||
$agent_modules = agents_get_modules ($id_agent,
|
||||
($fields != '' ? explode (',', $fields) : "*"),
|
||||
($filter != '' ? $filter : false), $indexed);
|
||||
|
||||
}
|
||||
// Restore db connection
|
||||
metaconsole_restore_db();
|
||||
|
@ -351,6 +353,7 @@ if (is_ajax ()) {
|
|||
$agent_modules[$key]['nombre'] = io_safe_output($module['nombre']);
|
||||
}
|
||||
|
||||
|
||||
//Hack to translate text "any" in PHP to javascript
|
||||
//$agent_modules['any_text'] = __('Any');
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ foreach ($contents as $content) {
|
|||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sla_data = array ();
|
||||
$sla_data["agent"] = modules_get_agentmodule_agent_name ($sla['id_agent_module']);
|
||||
|
@ -491,8 +491,8 @@ foreach ($contents as $content) {
|
|||
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
|
@ -592,7 +592,8 @@ foreach ($contents as $content) {
|
|||
$content_report = " <event_report_agent/>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
fclose($file);
|
||||
} else if ($data_count <= $limit) {
|
||||
}
|
||||
else if ($data_count <= $limit) {
|
||||
$content_report = " <event_report_agent>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
fclose($file);
|
||||
|
@ -603,7 +604,7 @@ foreach ($contents as $content) {
|
|||
WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d
|
||||
GROUP BY id_agentmodule, evento
|
||||
ORDER BY time2 DESC', $content['id_agent'], $datelimit, $date);
|
||||
|
||||
|
||||
$events = db_get_all_rows_sql ($sql);
|
||||
xml_file_event ($events, $temp_file,0, $content['id_agent']);
|
||||
|
||||
|
@ -611,8 +612,9 @@ foreach ($contents as $content) {
|
|||
$content_report = " </event_report_agent>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
$content_report = " <event_report_agent>\n";
|
||||
$result = fwrite($file, $content_report);
|
||||
fclose($file);
|
||||
|
|
Loading…
Reference in New Issue