From d449d7d2d962aa9afde2c979151fdf73c3aaa8ba Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 24 Apr 2013 12:36:32 +0000 Subject: [PATCH] 2013-04-24 Miguel de Dios * mobile/operation/groups.php, mobile/operation/agents.php, mobile/operation/tactical.php, mobile/operation/alerts.php, mobile/operation/agent.php, mobile/operation/events.php, mobile/operation/module_graph.php, mobile/operation/modules.php, mobile/include/style/main.css: some fixes. * include/functions.php: erased the lost trace. * include/functions_graph.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8042 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 ++++++ pandora_console/include/functions.php | 1 - pandora_console/include/functions_graph.php | 4 +- pandora_console/mobile/include/style/main.css | 40 ++++++++++++++++++ pandora_console/mobile/operation/agent.php | 14 ++----- pandora_console/mobile/operation/agents.php | 16 +++---- pandora_console/mobile/operation/alerts.php | 18 +++----- pandora_console/mobile/operation/events.php | 37 ++++++++++------ pandora_console/mobile/operation/groups.php | 14 ++----- .../mobile/operation/module_graph.php | 42 ++++++------------- pandora_console/mobile/operation/modules.php | 21 ++++------ pandora_console/mobile/operation/tactical.php | 14 ++----- 12 files changed, 121 insertions(+), 112 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 316aa9e2db..511ce9bc3e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2013-04-24 Miguel de Dios + + * mobile/operation/groups.php, mobile/operation/agents.php, + mobile/operation/tactical.php, mobile/operation/alerts.php, + mobile/operation/agent.php, mobile/operation/events.php, + mobile/operation/module_graph.php, mobile/operation/modules.php, + mobile/include/style/main.css: some fixes. + + * include/functions.php: erased the lost trace. + + * include/functions_graph.php: cleaned source code style. + 2013-04-24 Sergio Martin * godmode/servers/servers.build_table.php diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 1799c37b00..dd66c160de 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -892,7 +892,6 @@ function get_event_types ($id_type = false) { return $types; } else { - html_debug_print($id_type); return $types[$id_type]; } } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 280eda28f0..3c03787138 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2496,7 +2496,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", 'order' => 'utimestamp DESC')); - if(isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { + if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -2554,7 +2554,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, graphic_error (); } - if (empty($unit_name)){ + if (empty($unit_name)) { $unit = modules_get_unit($agent_module_id); } else diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index b3183b19f5..56bb1afec5 100644 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -537,6 +537,46 @@ table#list_events th { #list_Modules .cell_5 a { color: #000000 !important; } + +@media screen and (max-width: 35em) { + #list_Modules_Embedded .cell_1 .ui-table-cell-label, + #list_Modules_Embedded .cell_6 .ui-table-cell-label { + min-width: auto !important; + } + + #list_Modules_Embedded .cell_6 .ui-table-cell-label { + padding-left: 10px; + } + + #list_Modules_Embedded .cell_3, + #list_Modules_Embedded .cell_4 { + display: inline !important; + float: none !important; + } + + #list_Modules_Embedded .cell_0 .ui-table-cell-label, + #list_Modules_Embedded .cell_1 .ui-table-cell-label, + #list_Modules_Embedded .cell_3 .ui-table-cell-label, + #list_Modules_Embedded .cell_4 .ui-table-cell-label { + display: none; + } + + #list_Modules_Embedded .show_collapside { + display: inline !important; + } + + #list_Modules_Embedded .data { + white-space: nowrap; + } + + #list_Modules_Embedded .cell_2 { + display: none !important; + } +} + +#list_Modules_Embedded .cell_4 a { + color: #000000 !important; +} /*END------------Modules styles---------------------------------------*/ diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index a32128ff9b..a3a3b47e01 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -54,16 +54,10 @@ class Agent { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_agent() { diff --git a/pandora_console/mobile/operation/agents.php b/pandora_console/mobile/operation/agents.php index 08e90c4e84..57f6f4efd0 100644 --- a/pandora_console/mobile/operation/agents.php +++ b/pandora_console/mobile/operation/agents.php @@ -133,16 +133,10 @@ class Agents { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_agents() { @@ -248,7 +242,7 @@ class Agents { if (empty($agents_db)) $agents_db = array(); - html_debug_print($agents_db, true); + foreach ($agents_db as $agent) { $row = array(); diff --git a/pandora_console/mobile/operation/alerts.php b/pandora_console/mobile/operation/alerts.php index a7696b5bfc..0379d5e453 100644 --- a/pandora_console/mobile/operation/alerts.php +++ b/pandora_console/mobile/operation/alerts.php @@ -126,16 +126,10 @@ class Alerts { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_alerts() { @@ -218,10 +212,10 @@ class Alerts { public function listAlertsHtml ($return = false) { $countAlerts = alerts_get_alerts($this->group, - $this->free_search, $this->status, $this->standby, "LM", true, $this->id_agent); + $this->free_search, $this->status, $this->standby, "AR", true, $this->id_agent); $alerts = alerts_get_alerts($this->group, - $this->free_search, $this->status, $this->standby, "LM", false, $this->id_agent); + $this->free_search, $this->status, $this->standby, "AR", false, $this->id_agent); if (empty($alerts)) $alerts = array(); diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index eb9565a2e2..7c837b5fce 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -376,16 +376,10 @@ class Events { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_events() { @@ -646,15 +640,34 @@ class Events { } - if ($this->group > 0) { + $system = System::getInstance(); + $groups = users_get_groups($system->getConfig('id_user'), 'IR'); + + //Group selection + if ($this->group > 0 && in_array ($this->group, array_keys ($groups))) { //If a group is selected and it's in the groups allowed - $sql_post = " AND id_grupo = " . $this->group; + $sql_post .= " AND id_grupo = " . $this->group; + } + else { + if (is_user_admin ($system->getConfig('id_user'))) { + //Do nothing if you're admin, you get full access + $sql_post .= ""; + } + else { + //Otherwise select all groups the user has rights to. + $sql_post .= " AND id_grupo IN (" . + implode (",", array_keys ($groups)) . ")"; + } } if ($this->id_agent > 0) { $sql_post = " AND id_agente = " . $this->id_agent; } + // Skip system messages if user is not PM + if (!check_acl($system->getConfig('id_user'), 0, "PM")) { + $sql_post .= " AND id_grupo != 0"; + } //-------------------------------------------------------------- diff --git a/pandora_console/mobile/operation/groups.php b/pandora_console/mobile/operation/groups.php index 36bc6d39d8..3df21da6b2 100644 --- a/pandora_console/mobile/operation/groups.php +++ b/pandora_console/mobile/operation/groups.php @@ -47,16 +47,10 @@ class Groups { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_group() { diff --git a/pandora_console/mobile/operation/module_graph.php b/pandora_console/mobile/operation/module_graph.php index ca60ebc1c9..ad9c14d4d7 100644 --- a/pandora_console/mobile/operation/module_graph.php +++ b/pandora_console/mobile/operation/module_graph.php @@ -135,7 +135,7 @@ class ModuleGraph { $this->avg_only, false, $date, false, $urlImage, 'adapter_' . $this->graph_type, $time_compare, $this->unknown_graph); - if ($show_events_graph) { + if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, $this->width, $this->height, @@ -154,7 +154,7 @@ class ModuleGraph { $urlImage, 1, false, 'adapter_' . $this->graph_type, $time_compare, $this->unknown_graph); - if ($show_events_graph) { + if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, $this->width, $this->height, @@ -169,7 +169,7 @@ class ModuleGraph { $label, null, $this->draw_alerts, 1, false, $date, false, $urlImage, 'adapter_' . $this->graph_type); - if ($show_events_graph) { + if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, $this->width, $this->height, @@ -183,7 +183,7 @@ class ModuleGraph { $this->width, $this->height, $label, $unit_name, $this->draw_alerts, 1, $pure, $date); - if ($show_events_graph) { + if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, $this->width, $this->height, @@ -213,16 +213,10 @@ class ModuleGraph { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function javascript_code() { @@ -291,6 +285,8 @@ class ModuleGraph { } private function showModuleGraph() { + $agent_name = agents_get_name($this->module['id_agente']); + $ui = Ui::getInstance(); $ui->createPage(); @@ -303,7 +299,8 @@ class ModuleGraph { 'value' => $this->id, 'type' => 'hidden' ))); - $ui->contentBeginCollapsible("Options"); + $title = sprintf(__('Options for %s : %s'), $agent_name, $this->module["nombre"]); + $ui->contentBeginCollapsible($title); $ui->beginForm("index.php?page=module_graph&id=" . $this->id); $options = array( 'name' => 'draw_alerts', @@ -363,21 +360,6 @@ class ModuleGraph { ); $ui->formAddSlider($options); - /* - $items = array('1' => __('x1'), - '2' => __('x2'), - '3' => __('x3'), - '4' => __('x4')); - $options = array( - 'name' => 'zoom', - 'title' => __('Zoom'), - 'label' => __('Zoom'), - 'items' => $items, - 'selected' => $this->zoom - ); - $ui->formAddSelectBox($options); - */ - $options = array( 'name' => 'start_date', 'value' => $this->start_date, diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php index 7586949881..6e0a3cd293 100644 --- a/pandora_console/mobile/operation/modules.php +++ b/pandora_console/mobile/operation/modules.php @@ -155,16 +155,10 @@ class Modules { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_modules() { @@ -375,7 +369,7 @@ class Modules { $sql_limit = " LIMIT " . (int)($page * $system->getPageSize()) . "," . (int)$system->getPageSize(); } - $total = db_get_value_sql($sql_total. $sql); html_debug_print($sql_select . $sql . $sql_limit, true); + $total = db_get_value_sql($sql_total. $sql); $modules_db = db_get_all_rows_sql($sql_select . $sql . $sql_limit); if (empty($modules_db)) { @@ -520,9 +514,7 @@ class Modules { $listModules = $this->getListModules($page); //$ui->debug($listModules, true); - html_debug_print("-----------", true); - html_debug_print($listModules, true); - html_debug_print("===========", true); + if ($listModules['total'] == 0) { $html = '

' . __('No modules') . '

'; if (!$return) { @@ -537,6 +529,7 @@ class Modules { $ui->contentAddHtml($table->getHTML()); } else { + $table->id = 'list_Modules_Embedded'; $html = $table->getHTML(); return $html; diff --git a/pandora_console/mobile/operation/tactical.php b/pandora_console/mobile/operation/tactical.php index ec9355d68b..7332149144 100755 --- a/pandora_console/mobile/operation/tactical.php +++ b/pandora_console/mobile/operation/tactical.php @@ -39,16 +39,10 @@ class Tactical { } private function show_fail_acl() { - $ui = Ui::getInstance(); - - $ui->createPage(); - - $options['type'] = 'onStart'; - $options['title_text'] = __('You don\'t have access to this page'); - $options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); - $ui->addDialog($options); - - $ui->showPage(); + $error['title_text'] = __('You don\'t have access to this page'); + $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); + $home = new Home(); + $home->show($error); } private function show_tactical() {