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

* mobile/operation/events.php, mobile/operation/module_graph.php,
	mobile/operation/modules.php, mobile/operation/networkmaps.php,
	mobile/operation/groups.php, mobile/operation/agents.php,
	mobile/operation/tactical.php, mobile/operation/networkmap.php,
	mobile/operation/alerts.php, mobile/operation/agent.php,
	mobile/include/ui.class.php: added the back button in the head and
	impoved the source code style to make more easy the merges with
	the last branch.
	
	* include/functions_graph.php: fixed PHP notices.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-07-03 13:59:38 +00:00
parent fe45fdf449
commit 13c8e650ed
13 changed files with 190 additions and 78 deletions

View File

@ -1,3 +1,16 @@
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
2013-07-03 Sergio Martin <sergio.martin@artica.es>
* godmode/snmpconsole/snmp_alert.php: Fixed malfunction of the

View File

@ -452,7 +452,7 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height , $title = '', $unit_name = null,
$show_alerts = false, $avg_only = 0, $date = 0, $unit = '',
$show_alerts = false, $avg_only = 0, $date = 0, $unit = '',
$baseline = 0, $return_data = 0, $show_title = true, $projection = false,
$adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '',
$show_unknown = false) {
@ -469,6 +469,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
global $graphic_type;
global $max_value;
$chart = array();
$color = array();
$legend = array();
@ -1213,6 +1214,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$flash_charts = false;
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
@ -1274,6 +1276,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
global $config;
global $graphic_type;
$data = array ();
$resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph
@ -1670,6 +1673,7 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) {
global $config;
global $graphic_type;
$data = array ();
$legend = array ();
@ -1702,6 +1706,7 @@ function graph_db_agentes_modulos($width, $height) {
global $config;
global $graphic_type;
$data = array ();
switch ($config['dbtype']){
@ -2332,6 +2337,7 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar',
$flash_charts = $config['flash_charts'];
if ($only_image) {
$flash_charts = false;
}
@ -2373,6 +2379,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
global $config;
global $graphic_type;
$data = array ();
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
@ -2463,6 +2470,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
// Prints an error image
function fs_error_image ($width = 300, $height = 110) {
global $config;
return graph_nodata_image($width, $height, 'area');
}
@ -2868,13 +2876,14 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
global $long_index;
global $series_type;
global $chart_extra_data;
if (empty($unit_name)) {
$unit = modules_get_unit($agent_module_id);
}
else
$unit = $unit_name;
$series_suffix_str = '';
if ($compare !== false) {
$series_suffix = '2';
@ -2963,6 +2972,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit =
return;
}
if ($period <= SECONDS_6HOURS) {
$chart_time_format = 'H:i:s';
}
@ -3001,6 +3011,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit =
}
}
$flash_chart = $config['flash_charts'];
if ($only_image) {
$flash_chart = false;
@ -3016,6 +3027,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit =
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return area_graph($flash_chart, $chart, $width, $height, array (), $sources,
array (), "images/image_problem.opaque.png", "", $unit, $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
@ -3157,6 +3169,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
global $graphic_type;
global $max_value;
// Set variables
if ($date == 0)
$date = get_system_time();
@ -3574,6 +3587,7 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
$adjust_time = SECONDS_1MINUTE;
if ($periodo == SECONDS_1DAY)
$adjust_time = SECONDS_1HOUR;
elseif ($periodo == SECONDS_1WEEK)
@ -3879,6 +3893,7 @@ function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=
function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
{
switch ($number) {
case 6:
return "FATAL";
@ -3902,6 +3917,7 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=
return "";
break;
}
}
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {

View File

@ -163,18 +163,22 @@ class Ui {
return $this->createButton($options);
}
public function createDefaultHeader($title = false) {
public function createDefaultHeader($title = false, $left_button = false) {
if ($title === false) {
$title = __('Pandora FMS mobile');
}
$this->createHeader(
$title,
$this->createHeaderButton(
if ($left_button === false) {
$left_button = $this->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Logout'),
'href' => 'index.php?action=logout')),
'href' => 'index.php?action=logout'));
}
$this->createHeader(
$title,
$left_button,
$this->createHeaderButton(
array('icon' => 'home',
'pos' => 'right',

View File

@ -30,7 +30,7 @@ class Agent {
if (!empty($this->agent)) {
$this->agent = $this->agent[0];
if ($system->checkACL('AR', $this->agent['id_grupo'])) {
$this->correct_acl = true;
}
@ -68,7 +68,13 @@ class Agent {
if ($this->id != 0) {
$agent_name = (string) agents_get_name ($this->id);
$ui->createDefaultHeader(sprintf(__("PandoraFMS: %s"), $agent_name));
$ui->createDefaultHeader(
sprintf(__("PandoraFMS: %s"), $agent_name),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=agents')));
}
else {
$ui->createDefaultHeader(__("PandoraFMS: Agents"));
@ -124,7 +130,8 @@ class Agent {
$graph_js = ob_get_clean();
$html = $graph_js . $html;
$html .= "<b>" . __('Events (24h)') . "</b><br />";
$html .= graph_graphic_agentevents ($this->id, 250, 15, 86400, '', true);
$html .= graph_graphic_agentevents(
$this->id, 250, 15, 86400, '', true);
$ui->contentGridAddCell($html);
$ui->contentEndGrid();

View File

@ -143,7 +143,12 @@ class Agents {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("PandoraFMS: Agents"));
$ui->createDefaultHeader(__("PandoraFMS: Agents"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();
$filter_title = sprintf(__('Filter Agents by %s'),
@ -255,6 +260,7 @@ class Agents {
$row[3] = $row[__('Group')] = ui_print_group_icon ($agent["id_grupo"], true);
$row[4] = $row[__('Interval')] = '<span class="show_collapside" style="vertical-align: 0%; display: none; font-weight: bolder;">&nbsp;&nbsp;' . __('I.') . ' </span>' .
'<span style="vertical-align: 0%;">' . human_time_description_raw($agent["intervalo"]) . '</span>';
$row[5] = $row[__('Status')] = '<span class="show_collapside" style="vertical-align: 10%; display: none; font-weight: bolder;">' . __('S.') . ' </span>' . agents_tree_view_status_img ($agent["critical_count"],
$agent["warning_count"], $agent["unknown_count"]);
$row[6] = $row[__('Alerts')] = '<span class="show_collapside" style="vertical-align: 10%; display: none; font-weight: bolder;">&nbsp;&nbsp;' . __('A.') . ' </span>' . agents_tree_view_alert_img ($agent["fired_count"]);

View File

@ -33,7 +33,7 @@ class Alerts {
function __construct() {
$this->alert_status_items = array(
'all_enabled' => __('All (Enabled)'),
'all' => __('All'),
'all' => __('All'),
'fired' => __('Fired'),
'notfired' => __('Not fired'),
'disabled' => __('Disabled'));
@ -136,7 +136,12 @@ class Alerts {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("PandoraFMS: Alerts"));
$ui->createDefaultHeader(__("PandoraFMS: Alerts"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();
$filter_title = sprintf(__('Filter Alerts by %s'),

View File

@ -483,7 +483,12 @@ class Events {
$ui->addDialog($options);
$ui->createDefaultHeader(__("PandoraFMS: Events"));
$ui->createDefaultHeader(__("PandoraFMS: Events"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();
$ui->contentAddHtml("<a id='detail_event_dialog_hook' href='#detail_event_dialog' style='display:none;'>detail_event_hook</a>");
@ -661,7 +666,7 @@ class Events {
}
if ($this->id_agent > 0) {
$sql_post = " AND id_agente = " . $this->id_agent;
$sql_post .= " AND id_agente = " . $this->id_agent;
}
// Skip system messages if user is not PM

View File

@ -57,7 +57,11 @@ class Groups {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("PandoraFMS: Groups"));
$ui->createDefaultHeader(__("PandoraFMS: Groups"), $ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();

View File

@ -17,6 +17,7 @@ class ModuleGraph {
private $acl = "AR";
private $id = 0;
private $id_agent = 0;
private $graph_type = "sparse";
private $period = SECONDS_1DAY;
private $draw_events = 0;
@ -50,6 +51,7 @@ class ModuleGraph {
$system = System::getInstance();
$this->id = (int)$system->getRequest('id', 0);
$this->id_agent = (int)$system->getRequest('id_agent', 0);
$this->module = modules_get_agentmodule($this->id);
$this->graph_type = return_graphtype($this->module["id_tipo_modulo"]);
@ -81,7 +83,7 @@ class ModuleGraph {
$this->height = (int)$system->getRequest('height', 0);
//Sancho says "put the height to 1/2 for to make more beautyful"
$this->height = $this->height / 2;
//$this->height = $this->height / 2;
$this->height -= 80; //Correct the height
@ -128,16 +130,27 @@ class ModuleGraph {
ob_start();
switch ($this->graph_type) {
case 'boolean':
$graph = grafico_modulo_boolean ($this->id,
$this->period, $this->draw_events,
$this->width, $this->height,
$label, $unit, $this->draw_alerts,
$this->avg_only, false, $date, false,
$urlImage, 'adapter_' . $this->graph_type,
$time_compare, $this->unknown_graph);
$graph = grafico_modulo_boolean (
$this->id,
$this->period,
$this->draw_events,
$this->width,
$this->height,
$label,
$unit,
$this->draw_alerts,
$this->avg_only,
false,
$date,
false,
$urlImage,
'adapter_' . $this->graph_type,
$time_compare,
$this->unknown_graph);
if ($this->draw_events) {
$graph .= '<br>';
$graph .= graphic_module_events($this->id,
$graph .= graphic_module_events(
$this->id,
$this->width, $this->height,
$this->period, $config['homeurl'],
$this->zoom,
@ -145,13 +158,26 @@ class ModuleGraph {
}
break;
case 'sparse':
$graph = grafico_modulo_sparse ($this->id,
$this->period, $this->draw_events,
$this->width, $this->height,
$label, null, $this->draw_alerts,
$this->avg_only, false, $date, $unit,
$this->baseline, 0, true, false,
$urlImage, 1, false,
$graph = grafico_modulo_sparse(
$this->id,
$this->period,
$this->draw_events,
$this->width,
$this->height,
$label,
null,
$this->draw_alerts,
$this->avg_only,
false,
$date,
$unit,
$this->baseline,
0,
true,
false,
$urlImage,
1,
false,
'adapter_' . $this->graph_type,
$time_compare, $this->unknown_graph);
if ($this->draw_events) {
@ -163,11 +189,20 @@ class ModuleGraph {
}
break;
case 'string':
$graph = grafico_modulo_string ($this->id,
$this->period, $this->draw_events,
$this->width, $this->height,
$label, null, $this->draw_alerts, 1,
false, $date, false, $urlImage,
$graph = grafico_modulo_string(
$this->id,
$this->period,
$this->draw_events,
$this->width,
$this->height,
$label,
null,
$this->draw_alerts,
1,
false,
$date,
false,
$urlImage,
'adapter_' . $this->graph_type);
if ($this->draw_events) {
$graph .= '<br>';
@ -178,11 +213,18 @@ class ModuleGraph {
}
break;
case 'log4x':
$graph = grafico_modulo_log4x ($this->id,
$this->period, $this->draw_events,
$this->width, $this->height,
$label, $unit_name, $this->draw_alerts,
1, $pure, $date);
$graph = grafico_modulo_log4x(
$this->id,
$this->period,
$this->draw_events,
$this->width,
$this->height,
$label,
$unit_name,
$this->draw_alerts,
1,
$pure,
$date);
if ($this->draw_events) {
$graph .= '<br>';
$graph .= graphic_module_events($this->id,
@ -291,7 +333,24 @@ class ModuleGraph {
$ui->createPage();
$ui->createDefaultHeader(sprintf(__("PandoraFMS: %s"), $this->module["nombre"]));
if ($this->id_agent) {
$ui->createDefaultHeader(
sprintf(__("PandoraFMS: %s"), $this->module["nombre"]),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=agent&id=' . $this->id_agent)));
}
else {
$ui->createDefaultHeader(
sprintf(__("PandoraFMS: %s"), $this->module["nombre"]),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=modules')));
}
$ui->showFooter(false);
$ui->beginContent();
$ui->contentAddHtml($ui->getInput(array(
@ -360,6 +419,7 @@ class ModuleGraph {
);
$ui->formAddSlider($options);
$options = array(
'name' => 'start_date',
'value' => $this->start_date,

View File

@ -165,7 +165,12 @@ class Modules {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("PandoraFMS: Modules"));
$ui->createDefaultHeader(__("PandoraFMS: Modules"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();
$filter_title = sprintf(__('Filter Modules by %s'),

View File

@ -80,8 +80,14 @@ class Networkmap {
$system = System::getInstance();
$ui->createPage();
$ui->createDefaultHeader(sprintf(__("PandoraFMS: Networkmap %s"),
$this->network_map['name']));
$ui->createDefaultHeader(
sprintf(__("PandoraFMS: Networkmap %s"),
$this->network_map['name']),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=networkmaps')));
$ui->showFooter(false);
$ui->beginContent();

View File

@ -98,7 +98,12 @@ class Networkmaps {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("PandoraFMS: Networkmaps"));
$ui->createDefaultHeader(__("PandoraFMS: Networkmaps"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();
$filter_title = sprintf(__('Filter Networkmaps by %s'),

View File

@ -49,7 +49,12 @@ class Tactical {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("PandoraFMS: Tactical"));
$ui->createDefaultHeader(__("PandoraFMS: Tactical"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php')));
$ui->showFooter(false);
$ui->beginContent();
$ui->contentBeginGrid('responsive');
@ -57,36 +62,7 @@ class Tactical {
$data['mobile'] = true;
$formatted_data = reporting_get_stats_indicators($data, 200, 10, false);
/*
$overview = '<fieldset class="databox" style="width:97%;">
<legend style="text-align:left; color: #666;">' .
$formatted_data['server_health']['title'] .
'</legend>' .
$formatted_data['server_health']['graph'] .
'</fieldset>' .
'<fieldset class="databox" style="width:97%;">
<legend style="text-align:left; color: #666;">' .
$formatted_data['monitor_health']['title'] .
'</legend>' .
$formatted_data['monitor_health']['graph'] .
'</fieldset>' .
'</fieldset>' .
'<fieldset class="databox" style="width:97%;">
<legend style="text-align:left; color: #666;">' .
$formatted_data['module_sanity']['title'] .
'</legend>' .
$formatted_data['module_sanity']['graph'] .
'</fieldset>' .
'</fieldset>' .
'<fieldset class="databox" style="width:97%;">
<legend style="text-align:left; color: #666;">' .
$formatted_data['alert_level']['title'] .
'</legend>' .
$formatted_data['alert_level']['graph'] .
'</fieldset>';
*/
$overview = '<table>
<tr>
<td>' . $formatted_data['server_health']['title'] . '</td>