pandorafms/pandora_console/operation/tree.php

414 lines
13 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
$pure = get_parameter('pure', 0);
$tab = get_parameter('tab', 'group');
$search_agent = get_parameter('searchAgent', '');
$status_agent = get_parameter('statusAgent', AGENT_STATUS_ALL);
$search_module = get_parameter('searchModule', '');
$status_module = get_parameter('statusModule', -1);
$group_id = (int) get_parameter('group_id');
$tag_id = (int) get_parameter('tag_id');
$strict_acl = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
// ---------------------Tabs -------------------------------------------
$enterpriseEnable = false;
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
$enterpriseEnable = true;
}
$url = 'index.php?' .
'sec=estado&' .
'sec2=operation/tree&' .
'refr=0&' .
'pure='.$pure.'&' .
'tab=%s';
$tabs = array();
if (!$strict_acl) {
$tabs['tag'] = array(
'text' => "<a href='" . sprintf($url, "tag") . "'>" .
html_print_image("images/tag.png", true,
array("title" => __('Tags'))) . "</a>",
'active' => ($tab == "tag"));
$tabs['os'] = array(
'text' => "<a href='" . sprintf($url, "os") . "'>" .
html_print_image("images/operating_system.png", true,
array("title" => __('OS'))) . "</a>",
'active' => ($tab == "os"));
$tabs['group'] = array(
'text' => "<a href='" . sprintf($url, "group") . "'>" .
html_print_image("images/group.png", true,
array("title" => __('Groups'))) . "</a>",
'active' => ($tab == "group"));
$tabs['module_group'] = array(
'text' => "<a href='" . sprintf($url, "module_group") . "'>" .
html_print_image("images/module_group.png", true,
array("title" => __('Module groups'))) . "</a>",
'active' => ($tab == "module_group"));
$tabs['module'] = array(
'text' => "<a href='" . sprintf($url, "module") . "'>" .
html_print_image("images/brick.png", true,
array("title" => __('Modules'))) . "</a>",
'active' => ($tab == "module"));
if ($enterpriseEnable) {
$tabs['policies'] = array(
'text' => "<a href='" . sprintf($url, "policies") . "'>" .
html_print_image("images/policies_mc.png", true,
array("title" => __('Policies'))) . "</a>",
'active' => ($tab == "policies"));
}
}
2015-03-06 12:28:05 +01:00
enterprise_hook('open_meta_frame');
$header_title = __('Tree view');
$header_sub_title = __('Sort the agents by %s');
switch ($tab) {
case 'tag':
$header_sub_title = sprintf($header_sub_title, __('tags'));
break;
case 'os':
$header_sub_title = sprintf($header_sub_title, __('OS'));
break;
case 'group':
$header_sub_title = sprintf($header_sub_title, __('groups'));
break;
case 'module_group':
$header_sub_title = sprintf($header_sub_title, __('module groups'));
break;
case 'module':
$header_sub_title = sprintf($header_sub_title, __('modules'));
break;
case 'policies':
if ($enterpriseEnable)
$header_sub_title = sprintf($header_sub_title, __('policies'));
break;
}
if (!defined('METACONSOLE')) {
if (!$strict_acl)
$header_title = $header_title ." - ". $header_sub_title;
ui_print_page_header($header_title, "images/extensions.png", false, "", false, $tabs);
}
// ---------------------Tabs -------------------------------------------
// --------------------- form filter -----------------------------------
$table = new StdClass();
$table->width = "100%";
2015-04-14 10:12:13 +02:00
$table->class='databox filters';
$table->data = array();
$table->rowspan = array();
2015-04-23 17:52:16 +02:00
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
// Agent filter
$agent_status_arr = array();
$agent_status_arr[AGENT_STATUS_ALL] = __('All'); //default
$agent_status_arr[AGENT_STATUS_NORMAL] = __('Normal');
$agent_status_arr[AGENT_STATUS_WARNING] = __('Warning');
$agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical');
$agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown');
$agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init');
$row = array();
$row[] = __('Agent status');
$row[] = html_print_select($agent_status_arr, "status_agent", $status_agent, '', '', 0, true);
$row[] = __('Search agent');
2015-03-12 10:27:28 +01:00
if (defined('METACONSOLE'))
$row[] = html_print_input_text("search_agent", $search_agent, '', 70, 30, true);
else
$row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true);
// Button
$row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true);
$table->rowspan[][count($row)-1] = 2;
$table->data[] = $row;
if (!defined('METACONSOLE')) {
// Module filter
$module_status_arr = array();
$module_status_arr[-1] = __('All'); //default
$module_status_arr[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$module_status_arr[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$row = array();
$row[] = __('Module status');
$row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true);
$row[] = __('Search module');
$row[] = html_print_input_text("search_module", $search_module, '', 40, 30, true);
$table->data[] = $row;
}
2015-03-06 12:28:05 +01:00
if (defined('METACONSOLE')) {
2015-03-12 10:27:28 +01:00
$table->width = "96%";
$table->cellpadding = "0";
$table->cellspacing = "0";
$table->class='databox_filters';
$table->styleTable='padding:0px;margin-bottom:0px; ';
2015-03-06 12:28:05 +01:00
}
$form_html = '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
$form_html .= html_print_table($table, true);
$form_html .= '</form>';
if (defined('METACONSOLE')) {
2015-03-12 10:27:28 +01:00
echo "<div class='view_tree'>";
ui_toggle($form_html, __('Show Options'));
echo "<br>";
2015-06-08 09:32:01 +02:00
}
else {
2015-04-21 17:26:20 +02:00
//echo "<br>";
ui_toggle($form_html, __('Tree search'));
}
html_print_input_hidden("group-id", $group_id);
html_print_input_hidden("tag-id", $tag_id);
// --------------------- form filter -----------------------------------
ui_include_time_picker();
ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/");
2013-05-20 Sergio Martin <sergio.martin@artica.es> * include/functions_html.php include/styles/pandora.css include/functions_visual_map.php include/functions_agents.php include/languages/util-bzr-update include/languages/util-generate-tarball include/languages/util-all include/languages/util-create-po include/languages/util-README include/languages/util-update-po include/languages/util-create-template include/languages/util-compile-mo include/constants.php operation/tree.php operation/visual_console/render_view.php operation/users/user_edit.php operation/events/events.build_table.php operation/events/events_list.php operation/events/events.php operation/agentes/status_monitor.php images/status_sets/faces/severity_warning_pixel.png images/status_sets/faces/agent_critical_ball.png images/status_sets/faces/severity_major_pixel.png images/status_sets/faces/module_warning_ball.png images/status_sets/faces/module_ok_ball.png images/status_sets/faces/agent_no_data_ball.png images/status_sets/faces/severity_minor_pixel.png images/status_sets/faces/agent_ok_ball.png images/status_sets/faces/severity_normal_pixel.png images/status_sets/faces/server_down_ball.png images/status_sets/faces/alert_not_fired_ball.png images/status_sets/faces/severity_informational_pixel.png images/status_sets/faces/agent_down_ball.png.png images/status_sets/faces/module_no_data_ball.png images/status_sets/faces/alert_fired_ball.png images/status_sets/faces/agent_warning_ball.png images/status_sets/faces/severity_maintenance_pixel.png images/status_sets/faces/agent_no_monitors_ball.png images/status_sets/faces/agent_down_ball.png images/status_sets/faces/severity_critical_pixel.png images/status_sets/faces/alert_disabled_ball.png images/status_sets/faces/module_critical_ball.png images/status_sets/faces/server_ok_ball.png images/status_sets/color_text/severity_informational.png images/status_sets/color_text/module_critical.png images/status_sets/color_text/server_ok.png images/status_sets/color_text/alert_not_fired.png images/status_sets/color_text/severity_warning_pixel.png images/status_sets/color_text/agent_critical_ball.png images/status_sets/color_text/severity_major_pixel.png images/status_sets/color_text/module_warning_ball.png images/status_sets/color_text/module_unknown.png images/status_sets/color_text/module_ok_ball.png images/status_sets/color_text/module_alertsfired.png images/status_sets/color_text/module_no_data.png images/status_sets/color_text/severity_maintenance.png images/status_sets/color_text/agent_no_data_ball.png images/status_sets/color_text/severity_minor_pixel.png images/status_sets/color_text/alert_fired.png images/status_sets/color_text/agent_ok_ball.png images/status_sets/color_text/severity_normal_pixel.png images/status_sets/color_text/agent_no_data.png images/status_sets/color_text/severity_critical.png images/status_sets/color_text/agent_no_monitors.png images/status_sets/color_text/agent_ok.png images/status_sets/color_text/server_down_ball.png images/status_sets/color_text/alert_not_fired_ball.png images/status_sets/color_text/severity_informational_pixel.png images/status_sets/color_text/server_down.png images/status_sets/color_text/alert_disabled.png images/status_sets/color_text/module_unknown_ball.png images/status_sets/color_text/severity_warning.png images/status_sets/color_text/severity_major.png images/status_sets/color_text/module_no_data_ball.png images/status_sets/color_text/agent_critical.png images/status_sets/color_text/module_warning.png images/status_sets/color_text/alert_fired_ball.png images/status_sets/color_text/agent_warning_ball.png images/status_sets/color_text/severity_maintenance_pixel.png images/status_sets/color_text/module_ok.png images/status_sets/color_text/agent_no_monitors_ball.png images/status_sets/color_text/severity_minor.png images/status_sets/color_text/agent_down_ball.png images/status_sets/color_text/severity_normal.png images/status_sets/color_text/agent_warning.png images/status_sets/color_text/agent_down.png images/status_sets/color_text/severity_critical_pixel.png images/status_sets/color_text/alert_disabled_ball.png images/status_sets/color_text/module_critical_ball.png images/status_sets/color_text/server_ok_ball.png images/status_sets/default/severity_informational.png images/status_sets/default/module_critical.png images/status_sets/default/server_ok.png images/status_sets/default/alert_not_fired.png images/status_sets/default/severity_warning_pixel.png images/status_sets/default/agent_critical_ball.png images/status_sets/default/severity_major_pixel.png images/status_sets/default/module_warning_ball.png images/status_sets/default/module_unknown.png images/status_sets/default/module_ok_ball.png images/status_sets/default/module_alertsfired.png images/status_sets/default/module_no_data.png images/status_sets/default/severity_maintenance.png images/status_sets/default/agent_no_data_ball.png images/status_sets/default/severity_minor_pixel.png images/status_sets/default/alert_fired.png images/status_sets/default/agent_ok_ball.png images/status_sets/default/severity_normal_pixel.png images/status_sets/default/agent_no_data.png images/status_sets/default/severity_critical.png images/status_sets/default/agent_no_monitors.png images/status_sets/default/agent_ok.png images/status_sets/default/server_down_ball.png images/status_sets/default/alert_not_fired_ball.png images/status_sets/default/severity_informational_pixel.png images/status_sets/default/server_down.png images/status_sets/default/alert_disabled.png images/status_sets/default/severity_warning.png images/status_sets/default/severity_major.png images/status_sets/default/module_no_data_ball.png images/status_sets/default/agent_critical.png images/status_sets/default/module_warning.png images/status_sets/default/alert_fired_ball.png images/status_sets/default/agent_warning_ball.png images/status_sets/default/severity_maintenance_pixel.png images/status_sets/default/module_ok.png images/status_sets/default/agent_no_monitors_ball.png images/status_sets/default/alert_disabled_square.png images/status_sets/default/severity_minor.png images/status_sets/default/agent_down_ball.png images/status_sets/default/severity_normal.png images/status_sets/default/agent_warning.png images/status_sets/default/agent_down.png images/status_sets/default/severity_critical_pixel.png images/status_sets/default/alert_disabled_ball.png images/status_sets/default/module_critical_ball.png images/status_sets/default/server_ok_ball.png godmode/groups/configure_group.php godmode/groups/group_list.php godmode/servers/plugin.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_commands.php godmode/users/user_list.php godmode/users/profile_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/reporting/visual_console_builder.php godmode/reporting/visual_console_builder.data.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/tag/tag.php godmode/category/category.php: Visual changes in icons and colors. Add visual layers for metaconsole git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8160 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-05-20 10:42:02 +02:00
ui_require_javascript_file("TreeController", "include/javascript/tree/");
html_print_image('images/spinner.gif', false,
array('class' => "loading_tree",
'style' => 'display: none;'));
echo "<div class='tree-table'>";
echo "<div class='tree-table-row'>";
echo "<div class='tree-table-cell tree-table-cell-tree'>";
echo "<div id='tree-controller-recipient'>";
echo "</div>";
echo "</div>";
echo "<div class='tree-table-cell tree-table-cell-detail'>";
echo "<div id='tree-controller-detail-recipient'>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
2015-03-06 12:28:05 +01:00
if (defined('METACONSOLE')) {
echo "</div>";
}
2013-05-20 Sergio Martin <sergio.martin@artica.es> * include/functions_html.php include/styles/pandora.css include/functions_visual_map.php include/functions_agents.php include/languages/util-bzr-update include/languages/util-generate-tarball include/languages/util-all include/languages/util-create-po include/languages/util-README include/languages/util-update-po include/languages/util-create-template include/languages/util-compile-mo include/constants.php operation/tree.php operation/visual_console/render_view.php operation/users/user_edit.php operation/events/events.build_table.php operation/events/events_list.php operation/events/events.php operation/agentes/status_monitor.php images/status_sets/faces/severity_warning_pixel.png images/status_sets/faces/agent_critical_ball.png images/status_sets/faces/severity_major_pixel.png images/status_sets/faces/module_warning_ball.png images/status_sets/faces/module_ok_ball.png images/status_sets/faces/agent_no_data_ball.png images/status_sets/faces/severity_minor_pixel.png images/status_sets/faces/agent_ok_ball.png images/status_sets/faces/severity_normal_pixel.png images/status_sets/faces/server_down_ball.png images/status_sets/faces/alert_not_fired_ball.png images/status_sets/faces/severity_informational_pixel.png images/status_sets/faces/agent_down_ball.png.png images/status_sets/faces/module_no_data_ball.png images/status_sets/faces/alert_fired_ball.png images/status_sets/faces/agent_warning_ball.png images/status_sets/faces/severity_maintenance_pixel.png images/status_sets/faces/agent_no_monitors_ball.png images/status_sets/faces/agent_down_ball.png images/status_sets/faces/severity_critical_pixel.png images/status_sets/faces/alert_disabled_ball.png images/status_sets/faces/module_critical_ball.png images/status_sets/faces/server_ok_ball.png images/status_sets/color_text/severity_informational.png images/status_sets/color_text/module_critical.png images/status_sets/color_text/server_ok.png images/status_sets/color_text/alert_not_fired.png images/status_sets/color_text/severity_warning_pixel.png images/status_sets/color_text/agent_critical_ball.png images/status_sets/color_text/severity_major_pixel.png images/status_sets/color_text/module_warning_ball.png images/status_sets/color_text/module_unknown.png images/status_sets/color_text/module_ok_ball.png images/status_sets/color_text/module_alertsfired.png images/status_sets/color_text/module_no_data.png images/status_sets/color_text/severity_maintenance.png images/status_sets/color_text/agent_no_data_ball.png images/status_sets/color_text/severity_minor_pixel.png images/status_sets/color_text/alert_fired.png images/status_sets/color_text/agent_ok_ball.png images/status_sets/color_text/severity_normal_pixel.png images/status_sets/color_text/agent_no_data.png images/status_sets/color_text/severity_critical.png images/status_sets/color_text/agent_no_monitors.png images/status_sets/color_text/agent_ok.png images/status_sets/color_text/server_down_ball.png images/status_sets/color_text/alert_not_fired_ball.png images/status_sets/color_text/severity_informational_pixel.png images/status_sets/color_text/server_down.png images/status_sets/color_text/alert_disabled.png images/status_sets/color_text/module_unknown_ball.png images/status_sets/color_text/severity_warning.png images/status_sets/color_text/severity_major.png images/status_sets/color_text/module_no_data_ball.png images/status_sets/color_text/agent_critical.png images/status_sets/color_text/module_warning.png images/status_sets/color_text/alert_fired_ball.png images/status_sets/color_text/agent_warning_ball.png images/status_sets/color_text/severity_maintenance_pixel.png images/status_sets/color_text/module_ok.png images/status_sets/color_text/agent_no_monitors_ball.png images/status_sets/color_text/severity_minor.png images/status_sets/color_text/agent_down_ball.png images/status_sets/color_text/severity_normal.png images/status_sets/color_text/agent_warning.png images/status_sets/color_text/agent_down.png images/status_sets/color_text/severity_critical_pixel.png images/status_sets/color_text/alert_disabled_ball.png images/status_sets/color_text/module_critical_ball.png images/status_sets/color_text/server_ok_ball.png images/status_sets/default/severity_informational.png images/status_sets/default/module_critical.png images/status_sets/default/server_ok.png images/status_sets/default/alert_not_fired.png images/status_sets/default/severity_warning_pixel.png images/status_sets/default/agent_critical_ball.png images/status_sets/default/severity_major_pixel.png images/status_sets/default/module_warning_ball.png images/status_sets/default/module_unknown.png images/status_sets/default/module_ok_ball.png images/status_sets/default/module_alertsfired.png images/status_sets/default/module_no_data.png images/status_sets/default/severity_maintenance.png images/status_sets/default/agent_no_data_ball.png images/status_sets/default/severity_minor_pixel.png images/status_sets/default/alert_fired.png images/status_sets/default/agent_ok_ball.png images/status_sets/default/severity_normal_pixel.png images/status_sets/default/agent_no_data.png images/status_sets/default/severity_critical.png images/status_sets/default/agent_no_monitors.png images/status_sets/default/agent_ok.png images/status_sets/default/server_down_ball.png images/status_sets/default/alert_not_fired_ball.png images/status_sets/default/severity_informational_pixel.png images/status_sets/default/server_down.png images/status_sets/default/alert_disabled.png images/status_sets/default/severity_warning.png images/status_sets/default/severity_major.png images/status_sets/default/module_no_data_ball.png images/status_sets/default/agent_critical.png images/status_sets/default/module_warning.png images/status_sets/default/alert_fired_ball.png images/status_sets/default/agent_warning_ball.png images/status_sets/default/severity_maintenance_pixel.png images/status_sets/default/module_ok.png images/status_sets/default/agent_no_monitors_ball.png images/status_sets/default/alert_disabled_square.png images/status_sets/default/severity_minor.png images/status_sets/default/agent_down_ball.png images/status_sets/default/severity_normal.png images/status_sets/default/agent_warning.png images/status_sets/default/agent_down.png images/status_sets/default/severity_critical_pixel.png images/status_sets/default/alert_disabled_ball.png images/status_sets/default/module_critical_ball.png images/status_sets/default/server_ok_ball.png godmode/groups/configure_group.php godmode/groups/group_list.php godmode/servers/plugin.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_commands.php godmode/users/user_list.php godmode/users/profile_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/reporting/visual_console_builder.php godmode/reporting/visual_console_builder.data.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/tag/tag.php godmode/category/category.php: Visual changes in icons and colors. Add visual layers for metaconsole git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8160 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-05-20 10:42:02 +02:00
enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
var treeController = TreeController.getController();
processTreeSearch();
$("form#tree_search").submit(function(e) {
e.preventDefault();
$(".tree-element-detail-content").hide();
$(".tree-controller-detail-recipient").hide();
processTreeSearch();
});
function processTreeSearch () {
// Clear the tree
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
treeController.recipient.empty();
$(".loading_tree").show();
var parameters = {};
parameters['page'] = "include/ajax/tree.ajax";
parameters['getChildren'] = 1;
parameters['filter'] = {};
parameters['type'] = "<?php echo $tab; ?>";
parameters['filter']['searchAgent'] = $("input#text-search_agent").val();
parameters['filter']['statusAgent'] = $("select#status_agent").val();
parameters['filter']['searchModule'] = $("input#text-search_module").val();
parameters['filter']['statusModule'] = $("select#status_module").val();
parameters['filter']['groupID'] = $("input#hidden-group-id").val();
parameters['filter']['tagID'] = $("input#hidden-tag-id").val();
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: parameters,
success: function(data) {
if (data.success) {
$(".loading_tree").hide();
treeController.init({
recipient: $("div#tree-controller-recipient"),
detailRecipient: $("div#tree-controller-detail-recipient"),
page: parameters['page'],
2015-04-20 15:48:06 +02:00
emptyMessage: "<?php echo __('No data found'); ?>",
tree: data.tree,
2015-03-06 12:28:05 +01:00
baseURL: "<?php echo ui_get_full_url(false, false, false, defined('METACONSOLE')); ?>",
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
filter: parameters['filter'],
counterTitles: {
total: {
agents: "<?php echo __('Total agents'); ?>",
modules: "<?php echo __('Total modules'); ?>",
none: "<?php echo __('Total'); ?>"
},
alerts: {
agents: "<?php echo __('Fired alerts'); ?>",
modules: "<?php echo __('Fired alerts'); ?>",
none: "<?php echo __('Fired alerts'); ?>"
},
critical: {
agents: "<?php echo __('Critical agents'); ?>",
modules: "<?php echo __('Critical modules'); ?>",
none: "<?php echo __('Critical'); ?>"
},
warning: {
agents: "<?php echo __('Warning agents'); ?>",
modules: "<?php echo __('Warning modules'); ?>",
none: "<?php echo __('Warning'); ?>"
},
unknown: {
agents: "<?php echo __('Unknown agents'); ?>",
modules: "<?php echo __('Unknown modules'); ?>",
none: "<?php echo __('Unknown'); ?>"
},
not_init: {
agents: "<?php echo __('Not init agents'); ?>",
modules: "<?php echo __('Not init modules'); ?>",
none: "<?php echo __('Not init'); ?>"
},
ok: {
agents: "<?php echo __('Normal agents'); ?>",
modules: "<?php echo __('Normal modules'); ?>",
none: "<?php echo __('Normal'); ?>"
}
}
});
}
},
dataType: "json"
});
}
// Show the modal window of an module
var moduleDetailsWindow = $("<div></div>");
moduleDetailsWindow
.hide()
.prop("id", "module_details_window")
.appendTo('body');
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period, module_name) {
var params = {};
var f = new Date();
period = $('#period').val();
params.selection_mode = $('input[name=selection_mode]:checked').val();
if(!params.selection_mode){params.selection_mode='fromnow';}
params.date_from = $('#text-date_from').val();
if(!params.date_from){params.date_from = f.getFullYear() + "/" + (f.getMonth() +1) + "/" + f.getDate();}
params.time_from = $('#text-time_from').val();
if(!params.time_from){params.time_from = f.getHours() + ":" + f.getMinutes();}
params.date_to = $('#text-date_to').val();
if(!params.date_to){params.date_to =f.getFullYear() + "/" + (f.getMonth() +1) + "/" + f.getDate();}
params.time_to = $('#text-time_to').val();
if(!params.time_to){params.time_to = f.getHours() + ":" + f.getMinutes();}
params.page = "include/ajax/module";
params.get_module_detail = 1;
params.server_name = server_name;
params.id_agent = id_agent;
params.id_module = module_id;
params.offset = offset;
params.period = period;
title = <?php echo "'" . __("Module: ") . "'" ?> ;
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: params,
dataType: "html",
success: function(data) {
$("#module_details_window").hide ()
.empty ()
.append (data)
.dialog ({
resizable: true,
draggable: true,
modal: true,
title: title + module_name,
overlay: {
opacity: 0.5,
background: "black"
},
width: 650,
height: 500
})
.show ();
refresh_pagination_callback(module_id, id_agent, server_name, module_name);
datetime_picker_callback();
forced_title_callback();
}
});
}
function datetime_picker_callback() {
$("#text-time_from, #text-time_to").timepicker({
showSecond: true,
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>',
minuteText: '<?php echo __('Minute');?>',
secondText: '<?php echo __('Second');?>',
currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
}
function refresh_pagination_callback (module_id, id_agent, server_name,module_name) {
$(".binary_dialog").click( function() {
var classes = $(this).attr('class');
classes = classes.split(' ');
var offset_class = classes[2];
offset_class = offset_class.split('_');
var offset = offset_class[1];
var period = $('#period').val();
show_module_detail_dialog(module_id, id_agent, server_name, offset, period,module_name);
return false;
});
}
</script>