2013-03-27 Miguel de Dios <miguel.dedios@artica.es>

* mobile/operation/events.php, mobile/operation/tactical.php,
	mobile/include/ui.class.php, mobile/include/style/main.css,
	mobile/images/datos_blue.png, mobile/images/datos_brown.png,
	mobile/images/datos_green.png, mobile/images/datos_pink.png,
	mobile/images/datos_grey.png, mobile/images/datos_red.png,
	mobile/images/datos_yellow.png: some fixes and changes in the
	Pandora mobile.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-27 17:51:35 +00:00
parent 2bc1d181b8
commit 72318258a6
12 changed files with 149 additions and 69 deletions

View File

@ -1,3 +1,13 @@
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
2013-03-27 Mario Pulido <mario.pulido@artica.es>
* include/help/es/help_network_map_enterprise.php,

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

View File

@ -8,14 +8,23 @@ body {
direction: ltr;
display: block;
font-family: Arial,Helvetica,sans-serif;
font-size: 11px;
font-size: 12px !important;
margin: 0;
text-align: left;
vertical-align: top;
}
.ui-header .ui-title {
font-size: 14px !important;
}
label, input, .ui-btn-inner {
font-size: 12px !important;
}
#tactical * {
font-size: 14px !important;
}
/*INIT----------Groups styles-----------------------------------------*/
.group_view tr {
@ -145,6 +154,8 @@ table#list_events th {
}
/*END-----------Events styles-----------------------------------------*/
/*INIT-----------Agents styles----------------------------------------*/
.red, .redb, .redi, .error {
color: #CC0000;
@ -160,6 +171,8 @@ table#list_events th {
}
/*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;
@ -172,7 +185,6 @@ table#list_events th {
/*INIT---------Fix to avoid clicks under loading message--------------*/
.ui-loader-background {
width:100% !important;

View File

@ -17,6 +17,7 @@ class Ui {
private static $instance;
private $title;
private $page_name;
private $endHeader = false;
private $header = array();
@ -81,10 +82,20 @@ class Ui {
}
}
public function createPage($title = null) {
public function createPage($title = null, $page_name = null) {
if (!isset($title)) {
$this->title = __('Pandora FMS mobile');
}
else {
$this->title = $title;
}
if (!isset($page_name)) {
$this->page_name = 'main_page';
}
else {
$this->page_name = $page_name;
}
$this->html = '';
$this->endHeader = false;
@ -193,7 +204,7 @@ class Ui {
$return .= 'href="#" ';
}
$return .= '>';
$return .= ' data-ajax="false">';
if (isset($options['text'])) {
$return .= $options['text'];
@ -265,8 +276,13 @@ class Ui {
$this->grid['cells'] = array();
}
public function contentGridAddCell($html) {
$this->grid['cells'][] = $html;
public function contentGridAddCell($html, $key = false) {
$k = uniqid('cell_');
if ($key !== false) {
$k = $key;
}
$this->grid['cells'][$k] = $html;
}
public function contentEndGrid() {
@ -278,10 +294,11 @@ class Ui {
$convert_cells_jquery_grid = array('a', 'b', 'c', 'd', 'e');
$html = "<div class='ui-grid-" .
$convert_columns_jquery_grid[count($this->grid['cells'])] . " ui-responsive'>\n";
$convert_columns_jquery_grid[count($this->grid['cells'])] .
" ui-responsive'>\n";
reset($convert_cells_jquery_grid);
foreach ($this->grid['cells'] as $cell) {
foreach ($this->grid['cells'] as $key => $cell) {
switch ($this->grid['mode']) {
default:
case 'responsive':
@ -290,7 +307,7 @@ class Ui {
break;
}
next($convert_cells_jquery_grid);
$html .= "<div class='ui-body ui-body-d'>\n";
$html .= "<div id='" . $key . "' class='ui-body ui-body-d'>\n";
$html .= $cell;
$html .= "</div>\n";
@ -352,7 +369,7 @@ class Ui {
public function getEndForm() {
$this->endForm = true;
$html = "<form action='" . $this->form['action'] . "' " .
$html = "<form data-ajax='false' action='" . $this->form['action'] . "' " .
"method='" . $this->form['method'] . "'>\n";
foreach ($this->form['fields'] as $field) {
$html .= $field . "\n";
@ -618,7 +635,7 @@ class Ui {
}
}
}
echo " <div data-role='page' id='main_page'>\n";
echo " <div data-dom-cache='false' data-role='page' id='" . $this->page_name . "'>\n";
echo " <div data-role='header' data-position='fixed' >\n";
echo " <h1>" . $this->header['title'] . "</h1>\n";
echo " " . $this->header['button_left'] . "\n";
@ -647,6 +664,14 @@ class Ui {
}
}
}
echo "<script type='text/javascript'>
$(document).bind('mobileinit', function(){
//Disable ajax link
$('.disable-ajax').click(function(event){
$.mobile.ajaxFormsEnabled = false;
});
});
</script>";
echo " </body>\n";
echo "</html>";
ob_end_flush();

View File

@ -59,7 +59,8 @@ class Events {
foreach ($events_db as $event) {
$end = 0;
$row = array();
$row[] = $event['evento'];
$row[] = '<a href="javascript: openDetails(' . $event['id_evento'] . ')">' .
io_safe_output($event['evento']) . '</a>';
/*
switch ($event['estado']) {
case 0:
@ -82,11 +83,19 @@ class Events {
"title" => $title_st,
"id" => 'status_img_' . $event["id_evento"]));
*/
$row[] = ui_print_timestamp ($event['timestamp_rep'], true);
$row[] = ui_print_agent_name ($event["id_agente"], true);
$status =
html_print_image ("mobile/images/" .
get_priority_class($event['criticity']) . ".png", true);
$status .= "&nbsp;";
if ($event['estado'] == 1) {
$img_st = "images/tick.png";
$title_st = __('Event validated');
$row[] = html_print_image ($img_st, true,
$status .= html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"height" => 16,
@ -94,10 +103,10 @@ class Events {
"id" => 'status_img_' . $event["id_evento"]));
}
else {
$row[] = '';
$status .= '';
}
$row[] = ui_print_timestamp ($event['timestamp_rep'], true);
$row[] = ui_print_agent_name ($event["id_agente"], true);
$row[] = $status;
$events[$event['id_evento']] = $row;
@ -578,12 +587,13 @@ class Events {
$events = array();
$field_event_name = __('Event Name');
$field_status = __('Validated');
$field_timestamp = __('Timestamp');
$field_agent = __('Agent');
$field_status = __('Status');
$row_class = array();
foreach ($events_db as $event) {
$row_class[$event['id_evento']] = "events " . get_priority_class($event['criticity']);
$row_class[$event['id_evento']] = "events";
// . get_priority_class($event['criticity']);
$row = array();
$row[$field_event_name] = '<a href="javascript: openDetails(' . $event['id_evento'] . ')">' .
@ -604,11 +614,20 @@ class Events {
break;
}
*/
$row[$field_timestamp] = ui_print_timestamp ($event['timestamp_rep'], true);
$row[$field_agent] = '<a href="index.php?page=agent&id_agent=' . $event["id_agente"] . '">' .
(string) agents_get_name($event["id_agente"]) . '</a>';
$row[$field_status] =
html_print_image ("mobile/images/" .
get_priority_class($event['criticity']) . ".png", true);
$row[$field_status] .= "&nbsp;";
if ($event['estado'] == 1) {
$img_st = "images/tick.png";
$title_st = __('Event validated');
$row[$field_status] = html_print_image ($img_st, true,
$row[$field_status] .= html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"height" => 16,
@ -616,11 +635,9 @@ class Events {
"id" => 'status_img_' . $event["id_evento"]));
}
else {
$row[$field_status] = '';
$row[$field_status] .= '';
}
$row[$field_timestamp] = ui_print_timestamp ($event['timestamp_rep'], true);
$row[$field_agent] = '<a href="index.php?page=agent&id_agent=' . $event["id_agente"] . '">' .
(string) agents_get_name($event["id_agente"]) . '</a>';
$events[$event['id_evento']] = $row;
@ -784,53 +801,69 @@ class Events {
$ui->contentAddHtml("<script type=\"text/javascript\">
var load_more_rows = 1;
var page = 1;
function add_rows(data) {
if (data.end) {
$(\"#loading_rows\").hide();
}
else {
$.each(data.events, function(key, event) {
$(\"table#list_events tbody\").append(\"<tr class='events'>\" +
\"<th></th>\" +
\"<td>\" + event[0] + \"</td>\" +
\"<td>\" + event[1] + \"</td>\" +
\"<td>\" + event[2] + \"</td>\" +
\"<td>\" + event[3] + \"</td>\" +
\"</tr>\");
});
//$.mobile.changePage();
//$(document).page();
//$(\"table#list_events\").table().table('refresh');
load_more_rows = 1;
}
}
function ajax_load_rows() {
if (load_more_rows) {
load_more_rows = 0;
postvars = {};
postvars[\"action\"] = \"ajax\";
postvars[\"parameter1\"] = \"events\";
postvars[\"parameter2\"] = \"get_events\";
postvars[\"filter\"] = $(\"select[name='filter']\").val();
postvars[\"group\"] = $(\"select[name='group']\").val();
postvars[\"status\"] = $(\"select[name='status']\").val();
postvars[\"type\"] = $(\"select[name='type']\").val();
postvars[\"severity\"] = $(\"select[name='severity']\").val();
postvars[\"free_search\"] = $(\"input[name='free_search']\").val();
postvars[\"hours_old\"] = $(\"input[name='hours_old']\").val();
postvars[\"page\"] = page;
page++;
$.post(\"index.php\",
postvars,
function (data) {
add_rows(data);
//For large screens load the new events
if (document.documentElement.scrollHeight == document.documentElement.clientHeight) {
ajax_load_rows();
}
},
\"json\");
}
}
$(document).ready(function() {
$(window).bind(\"scroll\", function () {
if (load_more_rows) {
if ($(this).scrollTop() + $(this).height()
>= ($(document).height() - 100)) {
load_more_rows = 0;
postvars = {};
postvars[\"action\"] = \"ajax\";
postvars[\"parameter1\"] = \"events\";
postvars[\"parameter2\"] = \"get_events\";
postvars[\"filter\"] = $(\"select[name='filter']\").val();
postvars[\"group\"] = $(\"select[name='group']\").val();
postvars[\"status\"] = $(\"select[name='status']\").val();
postvars[\"type\"] = $(\"select[name='type']\").val();
postvars[\"severity\"] = $(\"select[name='severity']\").val();
postvars[\"free_search\"] = $(\"input[name='free_search']\").val();
postvars[\"hours_old\"] = $(\"input[name='hours_old']\").val();
postvars[\"page\"] = page;
page++;
$.post(\"index.php\",
postvars,
function (data) {
if (data.end) {
$(\"#loading_rows\").hide();
}
else {
$.each(data.events, function(key, event) {
$(\"table#list_events tbody\").append(\"<tr>\" +
\"<th></th>\" +
\"<td>\" + event[0] + \"</td>\" +
\"<td>\" + event[1] + \"</td>\" +
\"<td>\" + event[2] + \"</td>\" +
\"<td>\" + event[3] + \"</td>\" +
\"</tr>\");
});
load_more_rows = 1;
}
},
\"json\");
}
if ($(this).scrollTop() + $(this).height()
>= ($(document).height() - 100)) {
ajax_load_rows();
}
});
});

View File

@ -97,7 +97,7 @@ class Tactical {
reporting_get_stats_agents_monitors($data);
$graph_js = ob_get_clean();
$formatted_data = $graph_js . $formatted_data;
$ui->contentGridAddCell($formatted_data);
$ui->contentGridAddCell($formatted_data, 'tactical');
$ui->contentEndGrid();
$this->getLastActivity();