From 3509fd1b3d3994b0f283c6aba5aa97775c8d464a Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 2 Apr 2013 13:44:48 +0000 Subject: [PATCH] 2013-04-02 Miguel de Dios * mobile/operation/groups.php, mobile/include/style/main.css, include/functions_ui.php, include/functions_groups.php: change the skin of list groups. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7911 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 + pandora_console/include/functions_groups.php | 50 +++-- pandora_console/include/functions_ui.php | 4 +- pandora_console/mobile/include/style/main.css | 180 ++++++++++++++---- pandora_console/mobile/operation/groups.php | 77 +++++++- 5 files changed, 256 insertions(+), 61 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4b8860670d..9af6ce2b78 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2013-04-02 Miguel de Dios + + * mobile/operation/groups.php, mobile/include/style/main.css, + include/functions_ui.php, include/functions_groups.php: change the + skin of list groups. + 2013-04-02 Mario Pulido * godmode/category/category.php, diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index e00e891fc4..875b1bebbd 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -684,7 +684,7 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ $row["status"] = "group_view_unk"; } } - elseif ($data["monitor_ok"] > 0) { + elseif ($data["monitor_ok"] > 0) { if ($html) { echo ""; } @@ -711,11 +711,25 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ echo ""; } else { - $row[__('Group')] = $group['prefix']; - $row[__('Group')] .= ""; - $row[__('Group')] .= ui_print_group_icon ($id_group, true, "groups_small", '', false); - $row[__('Group')] .= ui_print_truncate_text($group['name']); - $row[__('Group')] .= ""; + $group_cell = __('Group'); + $row[$group_cell] = $group['prefix']; + $row[$group_cell] .= ""; + $row[$group_cell] .= ui_print_group_icon ($id_group, true, "groups_small", '', false); + $row[$group_cell] .= ui_print_truncate_text($group['name']); + $row[$group_cell] .= ""; + + $row['group_name'] = ui_print_truncate_text($group['name']); + + if ($id_group > 0) + $icon = (string) db_get_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group); + else + $icon = "world"; + + $row['group_icon'] = html_print_image("images/groups_small/" . $icon . ".png", + true, false, true); + + + //$row['group_icon'] = ui_print_group_icon ($id_group, true, "groups_small", '', false); } @@ -759,7 +773,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ echo ""; } else { - if ($data["total_agents"] > 0) { + //if ($data["total_agents"] > 0) { + if (true) { $row[__('Agents')] = ""; $row[__('Agents')] .= $data["total_agents"]; $row[__('Agents')] .= ""; @@ -787,7 +802,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ } } else { - if ($data["agents_unknown"] > 0) { + //if ($data["agents_unknown"] > 0) { + if (true) { $row[__('Agents unknown')] = ""; $row[__('Agents unknown')] .= $data["agents_unknown"]; $row[__('Agents unknown')] .= ""; @@ -812,7 +828,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ } } else { - if ($data["monitor_unknown"] > 0) { + //if ($data["monitor_unknown"] > 0) { + if (true) { $row[__('Unknown')] = ""; $row[__('Unknown')] .= $data["monitor_unknown"]; $row[__('Unknown')] .= ""; @@ -838,7 +855,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ } } else { - if ($data["monitor_not_init"] > 0) { + //if ($data["monitor_not_init"] > 0) { + if (true) { $row[__('Not init')] = ""; $row[__('Not init')] .= $data["monitor_not_init"]; $row[__('Not init')] .= ""; @@ -863,7 +881,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ echo ""; } else { - if ($data["monitor_ok"] > 0) { + //if ($data["monitor_ok"] > 0) { + if (true) { $row[__('Normal')] = ""; $row[__('Normal')] .= $data["monitor_ok"]; $row[__('Normal')] .= ""; @@ -889,7 +908,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ } } else { - if ($data["monitor_warning"] > 0) { + //if ($data["monitor_warning"] > 0) { + if (true) { $row[__('Warning')] = ""; $row[__('Warning')] .= $data["monitor_warning"]; $row[__('Warning')] .= ""; @@ -915,7 +935,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ } } else { - if ($data["monitor_critical"] > 0) { + //if ($data["monitor_critical"] > 0) { + if (true) { $row[__('Critical')] = ""; $row[__('Critical')] .= $data["monitor_critical"]; $row[__('Critical')] .= ""; @@ -941,7 +962,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $ } } else { - if ($data["monitor_alerts_fired"] > 0) { + //if ($data["monitor_alerts_fired"] > 0) { + if (true) { $row[__('Alerts fired')] = "";; $row[__('Alerts fired')] .= $data["monitor_alerts_fired"]; $row[__('Alerts fired')] .= ""; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 601b1f5a3a..1f621130e8 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -487,12 +487,12 @@ function ui_print_tags_warning ($return = false) { * @return string HTML code if return parameter is true. */ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small", $style='', $link = true) { - if($id_group > 0) + if ($id_group > 0) $icon = (string) db_get_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group); else $icon = "world"; - if($style == '') + if ($style == '') $style = 'width: 16px; height: 16px;'; $output = ''; diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index af884c02cb..4a08a4fa7c 100644 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -31,14 +31,31 @@ label, input, .ui-btn-inner { border-bottom: 3px solid white !important; } + + tr.group_view_crit, .group_view_crit { background-color: #FA3030; color: #000000 !important; } - .group_view_crit * { color: #000000 !important; } +.ui-btn-up-group_view_crit { + background: linear-gradient(#D50505, #FA3030) repeat scroll 0 0 #FA3030; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} +.ui-btn-hover-group_view_crit { + background: linear-gradient(#C41616, #E94141) repeat scroll 0 0 #E94141; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} + + .group_view_normal, .group_view_normal *, .group_view_norm, .group_view_norm * { @@ -48,6 +65,24 @@ tr.group_view_crit, .group_view_crit { .group_view_norm * { color: #000000 !important; } +.ui-btn-up-group_view_normal, +.ui-btn-up-group_view_norm { + background: linear-gradient(#D7D7D7, #FFFFFF) repeat scroll 0 0 #FFFFFF; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} +.ui-btn-hover-group_view_normal, +.ui-btn-hover-group_view_normal { + background: linear-gradient(#D7D7D7, #FFFFFF) repeat scroll 0 0 #FFFFFF; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} + + .group_view_ok, .group_view_ok * { background-color: #00C000; @@ -56,6 +91,22 @@ tr.group_view_crit, .group_view_crit { .group_view_ok * { color: #000000 !important; } +.ui-btn-up-group_view_ok { + background: linear-gradient(#007000, #00C000) repeat scroll 0 0 #00C000; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} +.ui-btn-hover-group_view_ok { + background: linear-gradient(#096709, #0FB10F) repeat scroll 0 0 #0FB10F; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} + + tr.group_view_warn, .group_view_warn, tr.group_view_warn.a, a.group_view_warn, tr.a.group_view_warn { background-color: #F5E535; @@ -63,6 +114,22 @@ tr.group_view_warn, .group_view_warn, tr.group_view_warn.a, a.group_view_warn, t a.group_view_warn { color: #000000 !important; } +.ui-btn-up-group_view_warn { + background: linear-gradient(#D0BF0A, #F5E535) repeat scroll 0 0 #F5E535; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} +.ui-btn-hover-group_view_warn { + background: linear-gradient(#BFB11B, #E4D746) repeat scroll 0 0 #E4D746; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} + + tr.group_view_alrm, .group_view_alrm { background-color: #ED8701; @@ -70,6 +137,22 @@ tr.group_view_alrm, .group_view_alrm { .group_view_alrm * { color: #000000 !important; } +.ui-btn-up-group_view_alrm { + background: linear-gradient(#9D5A01, #ED8701) repeat scroll 0 0 #ED8701; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} +.ui-btn-hover-group_view_alrm { + background: linear-gradient(#91580D, #DA8414) repeat scroll 0 0 #DA8414; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} + + tr.group_view_unk, .group_view_unk { background-color: #C4C4C4; @@ -77,6 +160,22 @@ tr.group_view_unk, .group_view_unk { .group_view_unk * { color: #000000 !important; } +.ui-btn-up-group_view_unk { + background: linear-gradient(#9C9C9C, #C4C4C4) repeat scroll 0 0 #C4C4C4; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} +.ui-btn-hover-group_view_unk { + background: linear-gradient(#888888, #B0B0B0) repeat scroll 0 0 #ECECEC; + border: 1px solid #111111; + color: #000000; + font-weight: bold; + text-shadow: none; +} + + tr.group_view_data, .group_view_data { color: #000000 !important; @@ -107,40 +206,40 @@ tr.group_view_data, .group_view_data { /*INIT----------Events styles-----------------------------------------*/ .datos_green, .datos_greenf9, .datos_green a, .datos_greenf9 a { - background-color: #52A000; - color: #FFFFFF !important; - text-shadow: none !important; + background-color: #52A000; + color: #FFFFFF !important; + text-shadow: none !important; } .datos_red, .datos_redf9, .datos_red a, .datos_redf9 a { - background-color: #FF3E41; - color: #FFFFFF !important; - text-shadow: none !important; + background-color: #FF3E41; + color: #FFFFFF !important; + text-shadow: none !important; } .datos_yellow, .datos_yellowf9, .datos_yellow a, .datos_yellowf9 a { - background-color: #F5E535; - color: #000000 !important; - text-shadow: none !important; + background-color: #F5E535; + color: #000000 !important; + text-shadow: none !important; } .datos_blue, .datos_bluef9, .datos_blue a, .datos_bluef9 a { - background-color: #77E2F2; - color: #000000 !important; - text-shadow: none !important; + background-color: #77E2F2; + color: #000000 !important; + text-shadow: none !important; } .datos_grey, .datos_greyf9, .datos_grey a, .datos_greyf9 a { - background-color: #E4E4E4; - color: #000000 !important; - text-shadow: none !important; + background-color: #E4E4E4; + color: #000000 !important; + text-shadow: none !important; } .datos_pink, .datos_pinkf9, .datos_pink a, .datos_pinkf9 a { - background-color: #FF92E9; - color: #000000 !important; - text-shadow: none !important; + background-color: #FF92E9; + color: #000000 !important; + text-shadow: none !important; } .datos_brown, .datos_brownf9, .datos_brown a, .datos_brownf9 a { - background-color: #C97A4A; - color: #000000 !important; - text-shadow: none !important; + background-color: #C97A4A; + color: #000000 !important; + text-shadow: none !important; } tr.events { @@ -295,21 +394,23 @@ table#list_events th { /*INIT-----------Agents styles----------------------------------------*/ .red, .redb, .redi, .error { - color: #CC0000; + color: #CC0000; } .green { - color: #5A8629; + color: #5A8629; } .grey { - color: #808080; - font-weight: bold; + color: #808080; + font-weight: bold; } /*END-----------Agents styles-----------------------------------------*/ + + /*INIT---------Fix the square border in search input------------------*/ .ui-input-search { border-radius: 0.6em 0.6em 0.6em 0.6em !important; @@ -323,6 +424,13 @@ table#list_events th { +ul.ui-listview li.ui-btn div.ui-btn-inner div.ui-btn-text { + padding-top: 5px; + padding-left: 5px; +} + + + /*INIT---------Fix the tons of air between the rows in small table----*/ .head_vertical { margin-top: 0px !important; @@ -343,19 +451,21 @@ table#list_events th { + + /*INIT---------Fix to avoid clicks under loading message--------------*/ .ui-loader-background { - width:100% !important; - height:100% !important; - top:0 !important; - margin: 0 !important; - background: rgba(0, 0, 0, 0.3) !important; - display:none !important; - position: fixed !important; - z-index:100 !important; + width:100% !important; + height:100% !important; + top:0 !important; + margin: 0 !important; + background: rgba(0, 0, 0, 0.3) !important; + display:none !important; + position: fixed !important; + z-index:100 !important; } .ui-loading .ui-loader-background { - display:block !important; + display:block !important; } /*END----------Fix to avoid clicks under loading message--------------*/ \ No newline at end of file diff --git a/pandora_console/mobile/operation/groups.php b/pandora_console/mobile/operation/groups.php index 03ffa08ad6..2d5575a175 100644 --- a/pandora_console/mobile/operation/groups.php +++ b/pandora_console/mobile/operation/groups.php @@ -27,11 +27,10 @@ class Groups { $this->correct_acl = true; $this->groups = $this->getListGroups(); - - foreach ($this->groups as $key => $group) { - $this->status[$key] = $group['status']; - unset($this->groups[$key]['status']); - } + //~ foreach ($this->groups as $key => $group) { + //~ $this->status[$key] = $group['status']; + //~ unset($this->groups[$key]['status']); + //~ } } else { $this->correct_acl = false; @@ -68,11 +67,68 @@ class Groups { $ui->showFooter(false); $ui->beginContent(); - $table = new Table(); - $table->setClass('group_view'); - $table->importFromHash($this->groups); - $table->setRowClass($this->status); - $ui->contentAddHtml($table->getHTML()); + $ui->contentAddHtml('
'); + $count = 0; + foreach ($this->groups as $group) { + $ui->contentAddHtml(' + + '); + $ui->contentAddHtml('
'); + $ui->contentAddHtml('

' . $group['group_name'] . '

'); + $ui->contentAddHtml('
    '); + $ui->contentAddHtml('
  • ' . + __('Agents') . + ' ' . $group[__('Agents')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Agents unknown') . + ' ' . $group[__('Agents unknown')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Unknown') . + ' ' . $group[__('Unknown')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Not init') . + ' ' . $group[__('Not init')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Normal') . + ' ' . $group[__('Normal')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Warning') . + ' ' . $group[__('Warning')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Critical') . + ' ' . $group[__('Critical')] . + '
  • '); + $ui->contentAddHtml('
  • ' . + __('Alerts fired') . + ' ' . $group[__('Alerts fired')] . + '
  • '); + $ui->contentAddHtml('
'); + $ui->contentAddHtml('
'); + + $count++; + } + $ui->contentAddHtml('
'); + + //$ui->contentAddHtml(ob_get_clean()); + //~ $table = new Table(); + //~ $table->setId('list_groups'); + //~ $table->setClass('group_view'); + //~ $table->importFromHash($this->groups); + //~ $table->setRowClass($this->status); + //~ $ui->contentAddHtml($table->getHTML()); $ui->endContent(); $ui->showPage(); @@ -105,6 +161,7 @@ class Groups { // For each valid group for this user, take data from agent and modules foreach ($groups as $id_group => $group) { $rows = groups_get_group_row($id_group, $groups, $group, $printed_groups, false); + if (!empty($rows)) $return = array_merge($return, $rows); }