Adapted views

This commit is contained in:
jose.gonzalez@pandorafms.com 2022-10-26 12:02:56 +02:00
parent c7aa456d60
commit 5e4bf4863c
6 changed files with 137 additions and 58 deletions

View File

@ -1,16 +1,32 @@
<?php
/**
* Custom fields first task.
*
* @category Custom Fields.
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 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; 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.
// Load globals.
global $config;
check_login();
ui_require_css_file('first_task');
@ -24,7 +40,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
<?php echo html_print_image('images/first_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
<?php
echo __(
"Custom fields are an easy way to personalized agent's information.
@ -33,6 +49,20 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
?>
</p>
<form action="index.php?sec=gagente&sec2=godmode/agentes/configure_field" method="post">
<?php
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create Custom Fields'),
'button_task',
false,
[ 'icon' => 'next' ],
true
),
]
);
?>
<input type="submit" class="button_task" value="<?php echo __('Create Custom Fields'); ?>" />
</form>
</div>

View File

@ -202,10 +202,19 @@ $table->data[1][2] = html_print_select(
echo '<form id="custom_status_monitor" method="post" action="index.php?sec=view&sec2=operation/agentes/status_monitor&section=fields&amp;pure='.$config['pure'].'">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
html_print_div(
[
'class' => 'action-buttons w100p',
'content' => html_print_submit_button(
__('Update'),
'update_button',
false,
[ 'icon' => 'update' ],
true
),
]
);
echo '</form>';
echo '</div>';
?>
<script type="text/javascript">

View File

@ -338,7 +338,7 @@ if ($ag_group > 0) {
echo "<table class='databox filters bolder mrgn_btn_10px' width='100%'>
<tr>";
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
echo "<form method='post'
action='index.php?sec=network&amp;sec2=godmode/reporting/map_builder'>";
} else {
@ -369,7 +369,15 @@ echo __('Group Recursion').'&nbsp;';
html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()');
echo "</td><td class='w22p'>";
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
html_print_submit_button(
__('Search'),
'search_visual_console',
false,
[
'icon' => 'search',
'mode' => 'secondary mini',
]
);
echo '</form>';
echo '</td>';
echo '</tr></table>';
@ -401,7 +409,7 @@ $table->align[4] = 'left';
// or has "VR" privileges, otherwise show only maps of user group
$filters['offset'] = $offset;
$filters['limit'] = $pagination;
if (!empty($search)) {
if (empty($search) === false) {
$filters['name'] = io_safe_input($search);
}
@ -410,7 +418,7 @@ if ($ag_group) {
}
$own_info = get_user_info($config['id_user']);
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
$url = 'index.php?sec=network&amp;sec2=godmode/reporting/map_builder&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
} else {
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
@ -441,7 +449,7 @@ if ($own_info['is_admin'] || $vconsoles_read) {
$total_maps = count($count_maps);
}
if (!$maps && !is_metaconsole()) {
if (!$maps && is_metaconsole() === false) {
$total = count(visual_map_get_user_layouts($config['id_user'], false, false, false));
if (!$total) {
include_once $config['homedir'].'/general/first_task/map_builder.php';
@ -453,7 +461,7 @@ if (!$maps && !is_metaconsole()) {
]
);
}
} else if (!$maps && is_metaconsole()) {
} else if (!$maps && is_metaconsole() === true) {
$total = count(visual_map_get_user_layouts($config['id_user'], false, false, false));
if (!$total) {
ui_print_info_message(
@ -473,20 +481,20 @@ if (!$maps && !is_metaconsole()) {
} else {
ui_pagination($total_maps, $url, $offset, $pagination);
foreach ($maps as $map) {
// ACL for the visual console permission
// ACL for the visual console permission.
$vconsole_write = false;
$vconsole_manage = false;
if (isset($map['vw'])) {
if (isset($map['vw']) === true) {
$vconsole_write = true;
}
if (isset($map['vm'])) {
if (isset($map['vm']) === true) {
$vconsole_manage = true;
}
$data = [];
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$data[0] = '<a href="index.php?sec=network&amp;sec2=operation/visual_console/render_view&amp;id='.$map['id'].'&amp;refr='.$refr.'">'.$map['name'].'</a>';
} else {
$data[0] = '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_visualmap='.$map['id'].'&amp;refr='.$refr.'">'.$map['name'].'</a>';
@ -499,7 +507,7 @@ if (!$maps && !is_metaconsole()) {
$vconsoles_manage_action_btn = check_acl_restricted_all($config['id_user'], $map['id_group'], 'VM');
if ($vconsoles_write_action_btn || $vconsoles_manage_action_btn) {
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$table->cellclass[] = [
3 => 'action_buttons',
4 => 'action_buttons',
@ -539,28 +547,36 @@ if (!$maps && !is_metaconsole()) {
}
if ($maps) {
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
echo '<div class="action-buttons w100p right_align">';
} else {
echo '<div class="w100p right right_align mrgn_btn_20px">';
}
}
if ($maps || defined('METACONSOLE')) {
if ($maps || is_metaconsole() === true) {
if ($vconsoles_write || $vconsoles_manage) {
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
echo '<form action="index.php?sec=network&amp;sec2=godmode/reporting/visual_console_builder" method="post">';
} else {
echo '<form action="index.php?sec=screen&sec2=screens/screens&action=visualmap&action2=new&operation=new_visualmap&tab=data&pure='.$pure.'" method="post">';
}
html_print_input_hidden('edit_layout', 1);
html_print_submit_button(
__('Create'),
'',
false,
'class="sub next"'
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create'),
'',
false,
[ 'icon' => 'next'],
true
),
]
);
echo '</form>';
}

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2007-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
@ -145,7 +145,7 @@ $ag_group = (int) get_parameter('ag_group', 0);
$recursion = (int) get_parameter('recursion', 0);
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
echo "<form method='post'
action='index.php?sec=network&amp;sec2=godmode/reporting/visual_console_favorite'>";
} else {
@ -185,7 +185,15 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
echo __('Group Recursion');
html_print_checkbox('recursion', 1, $recursion, false, false, '');
echo '</li><li>';
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
html_print_submit_button(
__('Search'),
'search_visual_console',
false,
[
'icon' => 'search',
'mode' => 'secondary mini',
]
);
echo '</li></ul></li></ul>';
echo '</form>';
@ -224,7 +232,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
} else {
echo "<ul class='container'>";
foreach ($favorite_array as $favorite_k => $favourite_v) {
if ($is_metaconsole) {
if (is_metaconsole() === true) {
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$favourite_v['id'];
} else {
$url = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='.$favourite_v['id'];

View File

@ -168,9 +168,7 @@ if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
$autosearch = true;
}
$is_metaconsole = is_metaconsole();
if (!$is_metaconsole) {
if (is_metaconsole() === false) {
$ag_group = (int) get_parameter('ag_group', 0);
} else {
$ag_group = get_parameter('ag_group', 0);
@ -221,7 +219,7 @@ if (is_numeric($ag_group)) {
}
// Agent group selector.
if (!$is_metaconsole) {
if (is_metaconsole() === false) {
if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) {
if ($recursion) {
$all_groups = groups_get_children_ids($ag_group, true);
@ -274,7 +272,7 @@ if (!$is_metaconsole) {
}
// Module group.
if ($is_metaconsole) {
if (is_metaconsole() === true) {
if ($modulegroup != '-1') {
$sql_conditions .= sprintf(' AND tagente_modulo.id_module_group '.$not_condition.' IN (%s)', $modulegroup);
}
@ -372,7 +370,7 @@ if (!empty($ag_custom_fields)) {
// Filter by tag.
if ($tag_filter !== 0) {
if ($is_metaconsole) {
if (is_metaconsole() === true) {
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
SELECT ttag_module.id_agente_modulo
FROM ttag_module
@ -417,7 +415,7 @@ if (!defined('METACONSOLE')) {
}
// Get limit_sql depend of the metaconsole or standard mode.
if ($is_metaconsole) {
if (is_metaconsole() === true) {
// Offset will be used to get the subset of modules.
$inferior_limit = $offset;
$superior_limit = ($config['block_size'] + $offset);
@ -516,7 +514,7 @@ $table->data[0][3] = html_print_select(
$rows_select = [];
$table->data[0][4] = __('Module group');
$rows_select[0] = __('Not assigned');
if (!$is_metaconsole) {
if (is_metaconsole() === false) {
$rows = db_get_all_rows_sql(
'SELECT *
FROM tmodule_group ORDER BY name'
@ -619,25 +617,25 @@ if ($develop_bypass) {
$typemodules = [];
$typemodules[1] = __('Data server module');
if ($network_available || $is_metaconsole) {
if ($network_available || is_metaconsole() === true) {
$typemodules[2] = __('Network server module');
}
if ($plugin_available || $is_metaconsole) {
if ($plugin_available || is_metaconsole() === true) {
$typemodules[4] = __('Plugin server module');
}
if ($wmi_available || $is_metaconsole) {
if ($wmi_available || is_metaconsole() === true) {
$typemodules[6] = __('WMI server module');
}
if ($prediction_available || $is_metaconsole) {
if ($prediction_available || is_metaconsole() === true) {
$typemodules[5] = __('Prediction server module');
}
if (enterprise_installed()) {
$typemodules[7] = __('Web server module');
if ($wux_available || $is_metaconsole) {
if ($wux_available || is_metaconsole() === true) {
$typemodules[8] = __('Wux server module');
}
}
@ -857,11 +855,20 @@ $table->data[3][0] = ui_toggle(
$table->colspan[4][0] = 7;
$table->cellstyle[4][0] = 'padding-top: 0px;';
$table->data[4][0] = html_print_submit_button(
__('Show'),
'uptbutton',
false,
'class="sub search mgn_tp_0 right"',
$table->data[4][0] = html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Show'),
'uptbutton',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);

View File

@ -247,7 +247,7 @@ $row[] = __('Agent status');
$row[] = html_print_select($agent_status_arr, 'status_agent', $status_agent, '', '', 0, true, false, true, '', false, 'width:10em');
$row[] = html_print_input_hidden('show_not_init_modules_hidden', $show_not_init_modules, true);
// Button
// Button.
if (is_metaconsole() === true) {
$table->data[] = $row;
$row = [];
@ -257,7 +257,16 @@ if (is_metaconsole() === true) {
$row = [];
}
$row[] = html_print_submit_button(__('Filter'), 'uptbutton', false, 'class="sub search"', true);
$row[] = html_print_submit_button(
__('Filter'),
'uptbutton',
false,
[
'icon' => 'search',
'mode' => 'secondary mini',
],
true
);
$table->data[] = $row;