Merge branch 'ent-8566-multiples-bugs-version-movil' into 'develop'

Ent 8566 multiples bugs version movil

See merge request artica/pandorafms!4716
This commit is contained in:
Daniel Rodriguez 2022-03-15 10:08:01 +00:00
commit 7af03dfeef
7 changed files with 172 additions and 104 deletions

View File

@ -2713,16 +2713,15 @@ function ui_print_status_image(
$imagepath = $path; $imagepath = $path;
} }
if ($imagepath == 'images/status_sets/default') { if ($imagepath === 'images/status_sets/default') {
$image_with_css = true; $image_with_css = true;
} }
$imagepath .= '/'.$type;
if ($image_with_css === true) { if ($image_with_css === true) {
$shape_status = get_shape_status_set($type); $shape_status = get_shape_status_set($type);
return ui_print_status_sets($type, $title, $return, $shape_status, $extra_info); return ui_print_status_sets($type, $title, $return, $shape_status, $extra_info);
} else { } else {
$imagepath .= '/'.$type;
if ($options === false) { if ($options === false) {
$options = []; $options = [];
} }
@ -2871,7 +2870,7 @@ function ui_print_status_sets(
$options = []; $options = [];
} }
if (isset($options['style'])) { if (isset($options['style']) === true) {
$options['style'] .= ' display: inline-block;'; $options['style'] .= ' display: inline-block;';
} else { } else {
$options['style'] = 'display: inline-block;'; $options['style'] = 'display: inline-block;';
@ -2881,15 +2880,15 @@ function ui_print_status_sets(
$options['style'] .= ' background: '.modules_get_color_status($status).';'; $options['style'] .= ' background: '.modules_get_color_status($status).';';
} }
if (isset($options['class'])) { if (isset($options['class']) === true) {
$options['class'] = $options['class']; $options['class'] = $options['class'];
} }
if ($title != '') { if (empty($title) === false) {
$options['title'] = empty($extra_info) ? $title : $title.'&#10'.$extra_info; $options['title'] = (empty($extra_info) === true) ? $title : $title.'&#10'.$extra_info;
$options['data-title'] = empty($extra_info) ? $title : $title.'<br>'.$extra_info; $options['data-title'] = (empty($extra_info) === true) ? $title : $title.'<br>'.$extra_info;
$options['data-use_title_for_force_title'] = 1; $options['data-use_title_for_force_title'] = 1;
if (isset($options['class'])) { if (isset($options['class']) === true) {
$options['class'] .= ' forced_title'; $options['class'] .= ' forced_title';
} else { } else {
$options['class'] = 'forced_title'; $options['class'] = 'forced_title';
@ -2901,15 +2900,13 @@ function ui_print_status_sets(
$output .= $k.'="'.$v.'"'; $output .= $k.'="'.$v.'"';
} }
$output .= '>'; $output .= '>&nbsp;</div>';
$output .= '</div>';
if ($return === false) { if ($return === false) {
echo $output; echo $output;
} else {
return $output;
} }
return $output;
} }

View File

@ -1348,6 +1348,12 @@ span.nobold * {
border-radius: 50%; border-radius: 50%;
} }
.status_small_rectangles {
width: 20px;
height: 10px;
display: inline-block;
}
.ui-content .ui-listview, .ui-content .ui-listview,
.ui-panel-inner > .ui-listview { .ui-panel-inner > .ui-listview {
margin: 0 !important; margin: 0 !important;

View File

@ -790,12 +790,11 @@ class Ui
echo ' <title>'.$this->title."</title>\n"; echo ' <title>'.$this->title."</title>\n";
echo " <meta charset='UTF-8' />\n"; echo " <meta charset='UTF-8' />\n";
echo " <meta name='viewport' content='width=device-width, initial-scale=1'>\n"; echo " <meta name='viewport' content='width=device-width, initial-scale=1'>\n";
echo ' <link rel="icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/ico" />'."\n";
echo ' <link rel="shortcut icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/x-icon" />'."\n";
echo " <link rel='stylesheet' href='include/style/main.css' />\n"; echo " <link rel='stylesheet' href='include/style/main.css' />\n";
// echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.4.5.css' />\n";
echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.5.0-rc1.min.css' />\n"; echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.5.0-rc1.min.css' />\n";
// echo " <script src='include/javascript/jquery.js.bakc'></script>\n";
echo " <script src='include/javascript/jquery.js'></script>\n"; echo " <script src='include/javascript/jquery.js'></script>\n";
// echo " <script src='include/javascript/jquery.mobile-1.4.5.js'></script>\n";
echo " <script src='include/javascript/jquery.mobile-1.5.0-rc1.js'></script>\n"; echo " <script src='include/javascript/jquery.mobile-1.5.0-rc1.js'></script>\n";
echo " <script src='../include/javascript/pandora.js'></script>\n"; echo " <script src='../include/javascript/pandora.js'></script>\n";
echo " <script src='../include/javascript/pandora_ui.js'></script>\n"; echo " <script src='../include/javascript/pandora_ui.js'></script>\n";

View File

@ -1,15 +1,33 @@
<?php <?php
// Pandora FMS - http://pandorafms.com // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// ================================================== /**
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Agent view for mobile
// Please see http://pandorafms.org for full contribution list *
// This program is free software; you can redistribute it and/or * @category Mobile
// modify it under the terms of the GNU General Public License * @package Pandora FMS
// as published by the Free Software Foundation for version 2. * @subpackage Community
// This program is distributed in the hope that it will be useful, * @version 1.0.0
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @license See below
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
// GNU General Public License for more details. * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
require_once '../include/functions_users.php'; require_once '../include/functions_users.php';
class Agent class Agent
@ -41,7 +59,7 @@ class Agent
var isgentoo = /Gentoo/i.test(navigator.userAgent); var isgentoo = /Gentoo/i.test(navigator.userAgent);
var iscentos = /CentOS/i.test(navigator.userAgent); var iscentos = /CentOS/i.test(navigator.userAgent);
var issuse = /SUSE/i.test(navigator.userAgent); var issuse = /SUSE/i.test(navigator.userAgent);
if(!(ismobile) && !(iswindows) && !(ismac) && !(isubuntu) && !(isfedora) && !(isredhat) && !(isdebian) && !(isgentoo) && !(iscentos) if(!(ismobile) && !(iswindows) && !(ismac) && !(isubuntu) && !(isfedora) && !(isredhat) && !(isdebian) && !(isgentoo) && !(iscentos)
&& !(issuse)){ && !(issuse)){
window.location.href = '".$config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$this->id."'; window.location.href = '".$config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$this->id."';
@ -256,10 +274,9 @@ class Agent
SECONDS_1DAY, SECONDS_1DAY,
'', '',
true, true,
false,
true, true,
1, 500,
'' 1
); );
$html .= '</div>'; $html .= '</div>';
$html .= '</div>'; $html .= '</div>';

View File

@ -1,15 +1,33 @@
<?php <?php
// Pandora FMS - http://pandorafms.com // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// ================================================== /**
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Agents list view for mobile
// Please see http://pandorafms.org for full contribution list *
// This program is free software; you can redistribute it and/or * @category Mobile
// modify it under the terms of the GNU General Public License * @package Pandora FMS
// as published by the Free Software Foundation for version 2. * @subpackage Community
// This program is distributed in the hope that it will be useful, * @version 1.0.0
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @license See below
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
// GNU General Public License for more details. * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
class Agents class Agents
{ {
@ -67,7 +85,7 @@ class Agents
$listAgents = $this->getListAgents($page, true); $listAgents = $this->getListAgents($page, true);
if (!empty($listAgents['agents'])) { if (empty($listAgents['agents']) === false) {
$end = 0; $end = 0;
$agents = []; $agents = [];
@ -96,7 +114,7 @@ class Agents
$system = System::getInstance(); $system = System::getInstance();
$user = User::getInstance(); $user = User::getInstance();
// Default // Default.
$filters = [ $filters = [
'free_search' => '', 'free_search' => '',
'status' => -1, 'status' => -1,
@ -104,7 +122,7 @@ class Agents
]; ];
$serialized_filters = (string) $system->getRequest('agents_filter'); $serialized_filters = (string) $system->getRequest('agents_filter');
if (!empty($serialized_filters)) { if (empty($serialized_filters) === true) {
$filters_unsafe = json_decode(base64_decode($serialized_filters, true), true); $filters_unsafe = json_decode(base64_decode($serialized_filters, true), true);
if ($filters_unsafe) { if ($filters_unsafe) {
$filters = $system->safeInput($filters_unsafe); $filters = $system->safeInput($filters_unsafe);
@ -144,8 +162,8 @@ class Agents
$filters['group'] = $this->group; $filters['group'] = $this->group;
} }
if (!empty($filters)) { if (empty($filters) === false) {
// Store the filter // Store the filter.
$this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters))); $this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters)));
} }
} }
@ -260,7 +278,7 @@ class Agents
$search_sql = ''; $search_sql = '';
if (!empty($this->free_search)) { if (empty($this->free_search) === false) {
$search_sql = " AND ( $search_sql = " AND (
alias LIKE '%".$this->free_search."%' alias LIKE '%".$this->free_search."%'
OR nombre LIKE '%".$this->free_search."%' OR nombre LIKE '%".$this->free_search."%'
@ -461,15 +479,13 @@ class Agents
"<script type=\"text/javascript\"> "<script type=\"text/javascript\">
var load_more_rows = 1; var load_more_rows = 1;
var page = 1; var page = 1;
function custom_scroll() { function custom_scroll() {
if (load_more_rows) { if (load_more_rows) {
if ($(this).scrollTop() + $(this).height() if ($(this).scrollTop() + $(this).height()
>= ($(document).height() - 100)) { >= ($(document).height() - 100)) {
load_more_rows = 0; load_more_rows = 0;
postvars = {}; postvars = {};
postvars[\"action\"] = \"ajax\"; postvars[\"action\"] = \"ajax\";
postvars[\"parameter1\"] = \"agents\"; postvars[\"parameter1\"] = \"agents\";
@ -479,7 +495,7 @@ class Agents
postvars[\"free_search\"] = $(\"input[name='free_search']\").val(); postvars[\"free_search\"] = $(\"input[name='free_search']\").val();
postvars[\"page\"] = page; postvars[\"page\"] = page;
page++; page++;
$.post(\"index.php\", $.post(\"index.php\",
postvars, postvars,
function (data) { function (data) {
@ -499,23 +515,26 @@ class Agents
\"<td class='cell_6'>\" + agent[8] + \"</td>\" + \"<td class='cell_6'>\" + agent[8] + \"</td>\" +
\"</tr>\"); \"</tr>\");
}); });
load_more_rows = 1; load_more_rows = 1;
refresh_link_listener_list_agents(); refresh_link_listener_list_agents();
} }
}, },
\"json\"); \"json\");
// Clean
$('#loading_rows').remove();
} }
} }
} }
$(document).ready(function() { $(document).ready(function() {
// Be sure of fill all of screen first.
custom_scroll();
$(window).bind(\"scroll\", function () { $(window).bind(\"scroll\", function () {
custom_scroll(); custom_scroll();
}); });
$(window).on(\"touchmove\", function(event) { $(window).on(\"touchmove\", function(event) {
custom_scroll(); custom_scroll();
}); });

View File

@ -1,15 +1,33 @@
<?php <?php
// Pandora FMS - http://pandorafms.com // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// ================================================== /**
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Alerts list view for mobile
// Please see http://pandorafms.org for full contribution list *
// This program is free software; you can redistribute it and/or * @category Mobile
// modify it under the terms of the GNU General Public License * @package Pandora FMS
// as published by the Free Software Foundation for version 2. * @subpackage Community
// This program is distributed in the hope that it will be useful, * @version 1.0.0
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @license See below
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
// GNU General Public License for more details. * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
class Alerts class Alerts
{ {

View File

@ -1,15 +1,33 @@
<?php <?php
// Pandora FMS - http://pandorafms.com // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// ================================================== /**
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Modules list view for mobile
// Please see http://pandorafms.org for full contribution list *
// This program is free software; you can redistribute it and/or * @category Mobile
// modify it under the terms of the GNU General Public License * @package Pandora FMS
// as published by the Free Software Foundation for version 2. * @subpackage Community
// This program is distributed in the hope that it will be useful, * @version 1.0.0
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @license See below
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
// GNU General Public License for more details. * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
class Modules class Modules
{ {
@ -106,7 +124,7 @@ class Modules
} }
if (isset($filters['status'])) { if (isset($filters['status'])) {
$this->status = $filters['status']; $this->status = (int) $filters['status'];
} }
if (isset($filters['name'])) { if (isset($filters['name'])) {
@ -143,7 +161,7 @@ class Modules
} }
$this->status = $system->getRequest('status', __('Status')); $this->status = $system->getRequest('status', __('Status'));
if (($this->status === __('Status')) || ($this->status == AGENT_MODULE_STATUS_ALL)) { if (($this->status === __('Status')) || ((int) $this->status === AGENT_MODULE_STATUS_ALL)) {
$this->status = AGENT_MODULE_STATUS_ALL; $this->status = AGENT_MODULE_STATUS_ALL;
} else { } else {
$this->default = false; $this->default = false;
@ -390,35 +408,28 @@ class Modules
} }
// Part SQL fro Status // Part SQL fro Status
if ($this->status == AGENT_MODULE_STATUS_NORMAL) { if ((int) $this->status == AGENT_MODULE_STATUS_NORMAL) {
// Normal // Normal.
$sql_conditions .= ' AND tagente_estado.estado = 0 $sql_conditions .= ' AND tagente_estado.estado = 0
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) '; AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
} else if ($this->status == AGENT_MODULE_STATUS_CRITICAL_BAD) { } else if ((int) $this->status === AGENT_MODULE_STATUS_CRITICAL_BAD) {
// Critical // Critical.
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0'; $sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0';
} else if ($this->status == AGENT_MODULE_STATUS_WARNING) { } else if ((int) $this->status === AGENT_MODULE_STATUS_WARNING) {
// Warning // Warning.
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0'; $sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0';
} else if ($this->status == AGENT_MODULE_STATUS_NOT_NORMAL) { } else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_NORMAL) {
// Not normal // Not normal.
$sql_conditions .= ' AND tagente_estado.estado <> 0'; $sql_conditions .= ' AND tagente_estado.estado <> 0';
} else if ($this->status == AGENT_MODULE_STATUS_UNKNOWN) { } else if ((int) $this->status === AGENT_MODULE_STATUS_UNKNOWN) {
// Unknown // Unknown.
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0'; $sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0';
} else if ($this->status == AGENT_MODULE_STATUS_NOT_INIT) { } else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_INIT) {
// Not init // Not init.
$sql_conditions .= ' AND tagente_estado.utimestamp = 0 $sql_conditions .= ' AND tagente_estado.utimestamp = 0
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)'; AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
} }
if ($this->status != AGENT_MODULE_STATUS_NOT_INIT) {
// When filter is not "not init"
// Not show not init modules. It's only operation view
$sql_conditions .= ' AND (tagente_estado.utimestamp != 0
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';
}
if ($this->tag > 0) { if ($this->tag > 0) {
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN ( $sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
SELECT ttag_module.id_agente_modulo SELECT ttag_module.id_agente_modulo
@ -435,7 +446,7 @@ class Modules
SELECT ttag_module.id_tag SELECT ttag_module.id_tag
FROM ttag_module FROM ttag_module
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo)) WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
AS tags, AS tags,
tagente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo,
tagente.intervalo AS agent_interval, tagente.intervalo AS agent_interval,
tagente.nombre AS agent_name, tagente.nombre AS agent_name,
@ -476,6 +487,7 @@ class Modules
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo'.$sql_conditions_all; ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo'.$sql_conditions_all;
$sql_limit = 'ORDER BY tagente.nombre ASC '; $sql_limit = 'ORDER BY tagente.nombre ASC ';
if (!$this->all_modules) { if (!$this->all_modules) {
$sql_limit = ' LIMIT '.(int) ($page * $system->getPageSize()).','.(int) $system->getPageSize(); $sql_limit = ' LIMIT '.(int) ($page * $system->getPageSize()).','.(int) $system->getPageSize();
} }