2013-04-02 Miguel de Dios <miguel.dedios@artica.es>

* 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
This commit is contained in:
mdtrooper 2013-04-02 13:44:48 +00:00
parent fefe09c424
commit 9a5881c5af
5 changed files with 256 additions and 61 deletions

View File

@ -1,3 +1,9 @@
2013-04-02 Miguel de Dios <miguel.dedios@artica.es>
* 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 <mario.pulido@artica.es> 2013-04-02 Mario Pulido <mario.pulido@artica.es>
* godmode/category/category.php, * godmode/category/category.php,

View File

@ -711,11 +711,25 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
echo "</td>"; echo "</td>";
} }
else { else {
$row[__('Group')] = $group['prefix']; $group_cell = __('Group');
$row[__('Group')] .= "<a href='index.php?page=agents&id_group=" . $id_group . "'>"; $row[$group_cell] = $group['prefix'];
$row[__('Group')] .= ui_print_group_icon ($id_group, true, "groups_small", '', false); $row[$group_cell] .= "<a href='index.php?page=agents&id_group=" . $id_group . "'>";
$row[__('Group')] .= ui_print_truncate_text($group['name']); $row[$group_cell] .= ui_print_group_icon ($id_group, true, "groups_small", '', false);
$row[__('Group')] .= "</a>"; $row[$group_cell] .= ui_print_truncate_text($group['name']);
$row[$group_cell] .= "</a>";
$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 "</a>"; echo "</a>";
} }
else { else {
if ($data["total_agents"] > 0) { //if ($data["total_agents"] > 0) {
if (true) {
$row[__('Agents')] = "<a href='index.php?page=agents&id_group=" . $id_group . "'>"; $row[__('Agents')] = "<a href='index.php?page=agents&id_group=" . $id_group . "'>";
$row[__('Agents')] .= $data["total_agents"]; $row[__('Agents')] .= $data["total_agents"];
$row[__('Agents')] .= "</a>"; $row[__('Agents')] .= "</a>";
@ -787,7 +802,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
} }
} }
else { else {
if ($data["agents_unknown"] > 0) { //if ($data["agents_unknown"] > 0) {
if (true) {
$row[__('Agents unknown')] = "<a href='index.php?page=agents&id_group=" . $id_group . "&status=3'>"; $row[__('Agents unknown')] = "<a href='index.php?page=agents&id_group=" . $id_group . "&status=3'>";
$row[__('Agents unknown')] .= $data["agents_unknown"]; $row[__('Agents unknown')] .= $data["agents_unknown"];
$row[__('Agents unknown')] .= "</a>"; $row[__('Agents unknown')] .= "</a>";
@ -812,7 +828,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
} }
} }
else { else {
if ($data["monitor_unknown"] > 0) { //if ($data["monitor_unknown"] > 0) {
if (true) {
$row[__('Unknown')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=3'>"; $row[__('Unknown')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=3'>";
$row[__('Unknown')] .= $data["monitor_unknown"]; $row[__('Unknown')] .= $data["monitor_unknown"];
$row[__('Unknown')] .= "</a>"; $row[__('Unknown')] .= "</a>";
@ -838,7 +855,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
} }
} }
else { else {
if ($data["monitor_not_init"] > 0) { //if ($data["monitor_not_init"] > 0) {
if (true) {
$row[__('Not init')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=5'>"; $row[__('Not init')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=5'>";
$row[__('Not init')] .= $data["monitor_not_init"]; $row[__('Not init')] .= $data["monitor_not_init"];
$row[__('Not init')] .= "</a>"; $row[__('Not init')] .= "</a>";
@ -863,7 +881,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
echo "</td>"; echo "</td>";
} }
else { else {
if ($data["monitor_ok"] > 0) { //if ($data["monitor_ok"] > 0) {
if (true) {
$row[__('Normal')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=0'>"; $row[__('Normal')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=0'>";
$row[__('Normal')] .= $data["monitor_ok"]; $row[__('Normal')] .= $data["monitor_ok"];
$row[__('Normal')] .= "</a>"; $row[__('Normal')] .= "</a>";
@ -889,7 +908,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
} }
} }
else { else {
if ($data["monitor_warning"] > 0) { //if ($data["monitor_warning"] > 0) {
if (true) {
$row[__('Warning')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=1'>"; $row[__('Warning')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=1'>";
$row[__('Warning')] .= $data["monitor_warning"]; $row[__('Warning')] .= $data["monitor_warning"];
$row[__('Warning')] .= "</a>"; $row[__('Warning')] .= "</a>";
@ -915,7 +935,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
} }
} }
else { else {
if ($data["monitor_critical"] > 0) { //if ($data["monitor_critical"] > 0) {
if (true) {
$row[__('Critical')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=2'>"; $row[__('Critical')] = "<a href='index.php?page=modules&id_group=" . $id_group . "&status=2'>";
$row[__('Critical')] .= $data["monitor_critical"]; $row[__('Critical')] .= $data["monitor_critical"];
$row[__('Critical')] .= "</a>"; $row[__('Critical')] .= "</a>";
@ -941,7 +962,8 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups, $
} }
} }
else { else {
if ($data["monitor_alerts_fired"] > 0) { //if ($data["monitor_alerts_fired"] > 0) {
if (true) {
$row[__('Alerts fired')] = "<a href='index.php?page=alerts&group=" . $id_group . "&status=fired'>";; $row[__('Alerts fired')] = "<a href='index.php?page=alerts&group=" . $id_group . "&status=fired'>";;
$row[__('Alerts fired')] .= $data["monitor_alerts_fired"]; $row[__('Alerts fired')] .= $data["monitor_alerts_fired"];
$row[__('Alerts fired')] .= "</a>"; $row[__('Alerts fired')] .= "</a>";

View File

@ -31,14 +31,31 @@ label, input, .ui-btn-inner {
border-bottom: 3px solid white !important; border-bottom: 3px solid white !important;
} }
tr.group_view_crit, .group_view_crit { tr.group_view_crit, .group_view_crit {
background-color: #FA3030; background-color: #FA3030;
color: #000000 !important; color: #000000 !important;
} }
.group_view_crit * { .group_view_crit * {
color: #000000 !important; 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_normal, .group_view_normal *,
.group_view_norm, .group_view_norm * { .group_view_norm, .group_view_norm * {
@ -48,6 +65,24 @@ tr.group_view_crit, .group_view_crit {
.group_view_norm * { .group_view_norm * {
color: #000000 !important; 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 * { .group_view_ok, .group_view_ok * {
background-color: #00C000; background-color: #00C000;
@ -56,6 +91,22 @@ tr.group_view_crit, .group_view_crit {
.group_view_ok * { .group_view_ok * {
color: #000000 !important; 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 { tr.group_view_warn, .group_view_warn, tr.group_view_warn.a, a.group_view_warn, tr.a.group_view_warn {
background-color: #F5E535; 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 { a.group_view_warn {
color: #000000 !important; 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 { tr.group_view_alrm, .group_view_alrm {
background-color: #ED8701; background-color: #ED8701;
@ -70,6 +137,22 @@ tr.group_view_alrm, .group_view_alrm {
.group_view_alrm * { .group_view_alrm * {
color: #000000 !important; 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 { tr.group_view_unk, .group_view_unk {
background-color: #C4C4C4; background-color: #C4C4C4;
@ -77,6 +160,22 @@ tr.group_view_unk, .group_view_unk {
.group_view_unk * { .group_view_unk * {
color: #000000 !important; 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 { tr.group_view_data, .group_view_data {
color: #000000 !important; color: #000000 !important;
@ -310,6 +409,8 @@ table#list_events th {
/*INIT---------Fix the square border in search input------------------*/ /*INIT---------Fix the square border in search input------------------*/
.ui-input-search { .ui-input-search {
border-radius: 0.6em 0.6em 0.6em 0.6em !important; 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----*/ /*INIT---------Fix the tons of air between the rows in small table----*/
.head_vertical { .head_vertical {
margin-top: 0px !important; margin-top: 0px !important;
@ -343,6 +451,8 @@ table#list_events th {
/*INIT---------Fix to avoid clicks under loading message--------------*/ /*INIT---------Fix to avoid clicks under loading message--------------*/
.ui-loader-background { .ui-loader-background {
width:100% !important; width:100% !important;

View File

@ -27,11 +27,10 @@ class Groups {
$this->correct_acl = true; $this->correct_acl = true;
$this->groups = $this->getListGroups(); $this->groups = $this->getListGroups();
//~ foreach ($this->groups as $key => $group) {
foreach ($this->groups as $key => $group) { //~ $this->status[$key] = $group['status'];
$this->status[$key] = $group['status']; //~ unset($this->groups[$key]['status']);
unset($this->groups[$key]['status']); //~ }
}
} }
else { else {
$this->correct_acl = false; $this->correct_acl = false;
@ -68,11 +67,68 @@ class Groups {
$ui->showFooter(false); $ui->showFooter(false);
$ui->beginContent(); $ui->beginContent();
$table = new Table(); $ui->contentAddHtml('<div data-role="collapsible-set" data-theme="a" data-content-theme="d">');
$table->setClass('group_view'); $count = 0;
$table->importFromHash($this->groups); foreach ($this->groups as $group) {
$table->setRowClass($this->status); $ui->contentAddHtml('
$ui->contentAddHtml($table->getHTML()); <style type="text/css">
.ui-icon-group_' . $count . ' {
background: url("' . $group['group_icon'] . '") no-repeat scroll 0 0 transparent !important;
}
</style>
');
$ui->contentAddHtml('<div data-collapsed-icon="group_' . $count . '" ' .
'data-expanded-icon="group_' . $count . '" ' .
'data-iconpos="right" data-role="collapsible" ' .
'data-collapsed="true" data-theme="' . $group['status'] . '" data-content-theme="d">');
$ui->contentAddHtml('<h4>' . $group['group_name'] . '</h4>');
$ui->contentAddHtml('<ul data-role="listview">');
$ui->contentAddHtml('<li>' .
__('Agents') .
' ' . $group[__('Agents')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Agents unknown') .
' ' . $group[__('Agents unknown')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Unknown') .
' ' . $group[__('Unknown')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Not init') .
' ' . $group[__('Not init')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Normal') .
' ' . $group[__('Normal')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Warning') .
' ' . $group[__('Warning')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Critical') .
' ' . $group[__('Critical')] .
'</li>');
$ui->contentAddHtml('<li>' .
__('Alerts fired') .
' ' . $group[__('Alerts fired')] .
'</li>');
$ui->contentAddHtml('</ul>');
$ui->contentAddHtml('</div>');
$count++;
}
$ui->contentAddHtml('</div>');
//$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->endContent();
$ui->showPage(); $ui->showPage();
@ -105,6 +161,7 @@ class Groups {
// For each valid group for this user, take data from agent and modules // For each valid group for this user, take data from agent and modules
foreach ($groups as $id_group => $group) { foreach ($groups as $id_group => $group) {
$rows = groups_get_group_row($id_group, $groups, $group, $printed_groups, false); $rows = groups_get_group_row($id_group, $groups, $group, $printed_groups, false);
if (!empty($rows)) if (!empty($rows))
$return = array_merge($return, $rows); $return = array_merge($return, $rows);
} }