Adapt views and refactor

This commit is contained in:
jose.gonzalez@pandorafms.com 2022-10-28 15:01:00 +02:00
parent 97b249d5a5
commit 195611a3c1
16 changed files with 195 additions and 111 deletions

View File

@ -1,16 +1,32 @@
<?php
/**
* Planned downtimes view
*
* @category Community
* @package Pandora FMS
* @subpackage Tools
* @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.
// Begin.
global $config;
check_login();
ui_require_css_file('first_task');
@ -22,7 +38,7 @@ ui_require_css_file('first_task');
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Scehduled Downtime')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<?php
echo __(
"%s contains a scheduled downtime management system.
@ -34,7 +50,12 @@ ui_require_css_file('first_task');
?>
</p>
<form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Scheduled Downtime'); ?>" />
<?php
html_print_submit_button(
__('Create Scheduled Downtime'),
'button_task'
);
?>
</form>
</div>
</div>

View File

@ -369,7 +369,10 @@ $row[] = html_print_submit_button(
__('Search'),
'search',
false,
'class="sub search"',
[
'icon' => 'search',
'mode' => 'mini',
],
true
);
@ -582,17 +585,23 @@ if ($downtimes === false && $filter_performed === false) {
// Info message.
echo '<div class="nf">'.__('No scheduled downtime').'</div>';
echo '<div class="action-buttons w100p" >';
// Create button.
if ($write_permisson === true) {
echo '&nbsp;';
echo '<form method="post" class="display_in" action="'.$url_editor.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create'),
'create',
false,
['icon' => 'next'],
true
),
]
);
echo '</form>';
}
echo '</div>';
} else {
// Has downtimes.
echo '<form method="post" action="'.$url_list.'">';

View File

@ -324,7 +324,7 @@ if ($id_component_type == COMPONENT_TYPE_WMI) {
4,
5,
];
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$categories[] = 10;
}
@ -335,7 +335,7 @@ if ($id_component_type == COMPONENT_TYPE_WMI) {
4,
5,
];
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$categories[] = 10;
}
@ -350,7 +350,7 @@ echo '<form name="component" method="post">';
$table->width = '100%';
$table->class = 'databox filters';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
if ($id) {
$table->head[0] = __('Update Network Component');
} else {
@ -363,26 +363,47 @@ if (defined('METACONSOLE')) {
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_button(__('Go back'), 'go_back', false, '', 'class="sub cancel"');
html_print_input_hidden('id_component_type', $id_component_type);
if ($id) {
html_print_input_hidden('update_component', 1);
html_print_input_hidden('id', $id);
$buttonCaption = __('Update');
$buttonIcon = 'update';
$buttonName = 'upd';
html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"');
} else {
html_print_input_hidden('create_component', 1);
html_print_input_hidden('create_network_from_module', 0);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub wand"');
$buttonCaption = __('Create');
$buttonIcon = 'wand';
$buttonName = 'crt';
}
echo '</div>';
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_button(
__('Go back'),
'go_back',
false,
'',
['icon' => 'cancel'],
true
).html_print_submit_button(
$buttonCaption,
$buttonName,
false,
['icon' => $buttonIcon],
true
),
]
);
echo '</form>';
ui_require_javascript_file('pandora_modules');
?>
<script language="JavaScript" type="text/javascript">
<!--
$('#button-go_back').click(function () {
window.location.href = "<?php echo ui_get_full_url('index.php?sec=templates&sec2=godmode/modules/manage_network_components'); ?>";

View File

@ -291,25 +291,18 @@ $output .= '</tr>';
$output .= '</table>';
$stringButton = ($edit_graph === true) ? __('Update') : __('Create');
$output .= html_print_div(
[
'class' => 'w100p',
'content' => "<input type=submit name='store' class='sub next right databox' value='".$stringButton."'>",
],
true
);
$output .= html_print_div(
[
'class' => 'w100p',
'content' => html_print_button(
__('Go back'),
'go_back',
'class' => 'action-buttons',
'content' => html_print_submit_button(
($edit_graph === true) ? __('Update') : __('Create'),
'store',
false,
'window.location.href = \'index.php?sec=reporting&sec2=godmode/reporting/graphs\'',
'class="sub cancel right"',
[ 'icon' => 'next' ],
true
).html_print_go_back_button(
'index.php?sec=reporting&sec2=godmode/reporting/graphs',
[],
true
),
],

View File

@ -77,6 +77,7 @@ $table_remote->id = 'ehorus-remote-setup';
$table_remote->class = 'databox filters';
$table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold';
$table_remote->style['control'] = 'display: flex;align-items: center;';
// Enable eHorus user configuration.
$row = [];

View File

@ -239,7 +239,7 @@ $integria_users_csv = integria_api_call(null, null, null, null, 'get_users', [])
$csv_array = explode("\n", $integria_users_csv);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
if (empty($csv_line) === false) {
$integria_users_values[$csv_line] = $csv_line;
}
}
@ -272,6 +272,7 @@ $table_remote->id = 'integria-remote-setup';
$table_remote->class = 'databox filters';
$table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold';
$table_remote->style['control'] = 'display: flex;align-items: center;';
// Enable eHorus user configuration.
$row = [];

View File

@ -182,7 +182,7 @@ class DiscoveryTaskList extends HTML
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'attributes' => [ 'icon' => 'cancel' ],
'return' => true,
],
],
@ -192,7 +192,7 @@ class DiscoveryTaskList extends HTML
'name' => 'refresh',
'label' => __('Refresh'),
'type' => 'button',
'attributes' => 'class="sub upd"',
'attributes' => [ 'icon' => 'cog'],
'return' => true,
'script' => 'location.href = \''.$this->url.'\';',
],

View File

@ -647,7 +647,7 @@ class HostDevices extends Wizard
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'attributes' => ['icon' => 'cancel'],
'return' => true,
],
],
@ -746,7 +746,7 @@ class HostDevices extends Wizard
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'attributes' => ['icon' => 'cancel'],
'return' => true,
],
],

View File

@ -415,7 +415,7 @@ class Wizard
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'attributes' => ['icon' => 'cancel'],
'return' => true,
],
],

View File

@ -313,7 +313,7 @@ class CustomNetScan extends Wizard
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'attributes' => ['icon' => 'cancel'],
'return' => true,
],
],
@ -421,7 +421,7 @@ class CustomNetScan extends Wizard
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'attributes' => ['icon' => 'cancel'],
'return' => true,
],
],
@ -559,7 +559,7 @@ class CustomNetScan extends Wizard
'name' => 'submit',
'label' => $str,
'type' => 'submit',
'attributes' => 'class="sub next"',
'attributes' => [ 'icon' => 'next' ],
'return' => true,
],
];
@ -725,7 +725,7 @@ class CustomNetScan extends Wizard
'name' => 'submit',
'label' => __('Finish'),
'type' => 'submit',
'attributes' => 'class="sub next"',
'attributes' => ['icon' => 'update'],
'return' => true,
],
];

View File

@ -468,7 +468,19 @@ class ManageNetScanScripts extends Wizard
echo "<form name=reconscript method='post' action='".$url."'>";
echo html_print_input_hidden('page', 1, true);
echo "<input name='crtbutton' type='submit' class='sub next float-right' value='".__('Add')."'>";
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Add'),
'crtbutton',
false,
[ 'icon' => 'next' ],
true
),
],
true
);
echo '</form>';
} else {
ui_print_info_message(
@ -756,16 +768,30 @@ class ManageNetScanScripts extends Wizard
html_print_table($table);
echo '<table width=100%>';
echo '<tr><td align="right">';
if ($id_script === 0) {
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
$buttonName = 'crtbutton';
$buttonCaption = __('Create');
$buttonIcon = 'wand';
} else {
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
$buttonName = 'updbutton';
$buttonCaption = __('Update');
$buttonIcon = 'update';
}
echo '</form></table>';
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
$buttonCaption,
$buttonName,
false,
[ 'icon' => $buttonIcon ],
true
),
]
);
echo '</form>';
ui_require_javascript_file('pandora_modules');
}

View File

@ -2173,7 +2173,7 @@ function html_print_extended_select_for_time(
false,
$class,
$readonly,
'padding: 7px 3px;'.$select_style,
'padding: 7px 3px;height: 32px;'.$select_style,
false,
false,
false,
@ -4695,7 +4695,7 @@ function html_print_autocomplete_modules(
$text_color = '';
$module_icon = 'images/search_module.png';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
if ($config['style'] === 'pandora_black' && is_metaconsole() === false) {
$text_color = 'color: white';
$module_icon = 'images/brick.menu.png';
}
@ -4709,11 +4709,11 @@ function html_print_autocomplete_modules(
100,
false,
'',
['style' => 'border: none; padding: 2px 5px; margin-bottom: 4px; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$module_icon.') 95% right; '.$text_color.'']
['style' => 'background: url('.$module_icon.') 95% right; '.$text_color.'']
);
html_print_input_hidden($name.'_hidden', $id_agent_module);
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
}
@ -6301,7 +6301,10 @@ function html_print_go_back_button(string $url, array $options=[], bool $return=
'go_back',
false,
'window.location.href = \''.$url.'\'',
'class="sub '.($options['action_class'] ?? ' cancel').' right"',
[
'icon' => ($options['action_class'] ?? 'cancel'),
'mode' => 'secondary',
],
true
),
],

View File

@ -164,10 +164,6 @@ span.breadcrumb_link {
* Discovery forms structure
*/
form.discovery * {
font-size: 10pt;
}
form.discovery .label_select b {
font-weight: bolder;
}

View File

@ -9338,7 +9338,7 @@ span.ColorPickerDivSample {
}
.select2-container .select2-selection--single {
background-color: #fff !important;
background-color: #f6f7fb !important;
height: 32px !important;
border: 1px solid #c0ccdc !important;
border-radius: 8px !important;
@ -9430,14 +9430,6 @@ span.ColorPickerDivSample {
}
/* FINISH SELECT2 */
.password_input {
background-color: transparent !important;
border: none !important;
border-radius: 0 !important;
border-bottom: 1px solid #ccc !important;
margin-bottom: 4px !important;
padding: 2px 5px !important;
}
.dataTables_wrapper {
overflow: auto;

View File

@ -221,10 +221,6 @@
background: #fff;
}
.filters input {
background: #fbfbfb;
}
.datos4 {
/*Add because in php the function html_print_table write style in cell and this is style head.*/
text-align: center;

View File

@ -1,16 +1,25 @@
<?php
/**
* Export Data view
*
* @category Community
* @package Pandora FMS
* @subpackage Tools
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2022 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
// 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 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.
global $config;
// Load global vars
@ -30,7 +39,7 @@ if (!check_acl($config['id_user'], 0, 'RR')) {
ui_require_javascript_file('calendar');
// Header
// Header.
ui_print_page_header(__('Export data'), 'images/server_export_mc.png');
$group = get_parameter_post('group', 0);
@ -264,7 +273,7 @@ if (empty($export_btn) || $show_form) {
$agents[$row['id_agente']] = $row['nombre'];
}
// Src code of lightning image with skins
// Src code of lightning image with skins.
$src_code = html_print_image('images/lightning_go.png', true, false, true);
$params = [];
@ -275,10 +284,11 @@ if (empty($export_btn) || $show_form) {
$params['value'] = agents_get_name($agent);
$params['javascript_is_function_select'] = true;
$params['add_none_module'] = false;
$params['size'] = 38;
$params['selectbox_id'] = 'module_arr';
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
// Module selector
// Module selector.
$table->data[2][0] = '<b>'.__('Modules').'</b>';
$table->data[2][0] .= ui_print_help_tip(__('No modules of type string. You can not calculate their average'), true);
@ -288,8 +298,8 @@ if (empty($export_btn) || $show_form) {
$modules = [];
}
if (!empty($modules)) {
// remove modules of type string because you cant calculate their average.
if (empty($modules) === false) {
// Remove modules of type string because you cant calculate their average.
$i = 0;
foreach ($modules as $key => $module) {
$id_module_type = modules_get_agentmodule_type($key);
@ -301,6 +311,9 @@ if (empty($export_btn) || $show_form) {
case 33:
unset($modules[$i]);
break;
default:
continue;
}
$i++;
@ -308,20 +321,20 @@ if (empty($export_btn) || $show_form) {
}
$disabled_export_button = false;
if (empty($modules)) {
if (empty($modules) === true) {
$disabled_export_button = true;
}
$table->data[2][1] = html_print_select($modules, 'module_arr[]', array_keys($modules), '', '', 0, true, true, true, 'w155', false);
$table->data[2][1] = html_print_select($modules, 'module_arr[]', array_keys($modules), '', '', 0, true, true, true, 'w250px', false);
// Start date selector
// Start date selector.
$table->data[3][0] = '<b>'.__('Begin date').'</b>';
$table->data[3][1] = html_print_input_text(
'start_date',
date('Y-m-d', (get_system_time() - SECONDS_1DAY)),
false,
10,
13,
10,
true
);
@ -343,13 +356,13 @@ if (empty($export_btn) || $show_form) {
true
);
// End date selector
// End date selector.
$table->data[4][0] = '<b>'.__('End date').'</b>';
$table->data[4][1] = html_print_input_text(
'end_date',
date('Y-m-d', get_system_time()),
false,
10,
13,
10,
true
);
@ -371,7 +384,7 @@ if (empty($export_btn) || $show_form) {
true
);
// Export type
// Export type.
$table->data[5][0] = '<b>'.__('Export type').'</b>';
$export_types = [];
@ -380,14 +393,26 @@ if (empty($export_btn) || $show_form) {
$export_types['excel'] = __('MS Excel');
$export_types['avg'] = __('Average per hour/day');
$table->data[5][1] = html_print_select($export_types, 'export_type', $export_type, '', '', 0, true, false, true, 'w130', false);
$table->data[5][1] = html_print_select($export_types, 'export_type', $export_type, '', '', 0, true, false, true, 'w250px', false);
html_print_table($table);
// Submit button
echo '<div class="action-buttons w100p">';
html_print_button(__('Export'), 'export_btn', false, 'change_action()', 'class="sub wand"');
echo '</div></form>';
// Submit button.
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_button(
__('Export'),
'export_btn',
false,
'change_action()',
['icon' => 'wand'],
true
),
]
);
echo '</form>';
}
ui_require_jquery_file('pandora.controls');