Sprint 2025Feb Improve UI-UX and Resources views

This commit is contained in:
Jose Gonzalez 2023-02-21 14:14:13 +01:00
parent 13aa4e77f1
commit 2fd52eff48
16 changed files with 886 additions and 550 deletions

View File

@ -1,16 +1,32 @@
<?php
/**
* Insert Data form.
*
* @category Extension.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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 global vars.
global $config;
require_once $config['homedir'].'/include/functions_agents.php';
@ -55,7 +71,24 @@ function mainInsertData()
{
global $config;
ui_print_page_header(__('Insert data'), 'images/extensions.png', false, '', true, '');
ui_print_standard_header(
__('Insert Data'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Insert Data'),
],
]
);
if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
@ -84,6 +117,13 @@ function mainInsertData()
$csv = false;
}
ui_print_warning_message(
sprintf(
__('Please check that the directory "%s" is writeable by the apache user. <br /><br />The CSV file format is date;value&lt;newline&gt;date;value&lt;newline&gt;... The date in CSV is in format Y/m/d H:i:s.'),
$config['remote_config']
)
);
if ($save) {
if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), 'AW')) {
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
@ -140,27 +180,25 @@ function mainInsertData()
}
}
echo '<div class="notify mrg_btt_15">';
echo sprintf(
__('Please check that the directory "%s" is writeable by the apache user. <br /><br />The CSV file format is date;value&lt;newline&gt;date;value&lt;newline&gt;... The date in CSV is in format Y/m/d H:i:s.'),
$config['remote_config']
);
echo '</div>';
$modules = [];
if ($agent_id > 0) {
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox m2020';
$table->style = [];
$table->style[0] = 'font-weight: bolder;';
$table->cellstyle[0][0] = 'width: 0';
$table->cellstyle[0][1] = 'width: 0';
$table->data = [];
$table->data[0][0] = __('Agent');
$table->data[0][1] = __('Module');
$table->data[0][2] = __('Date');
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'agent_name';
$params['value'] = $agent_name;
$params['value'] = ($save === true) ? '' : $agent_name;
$params['javascript_is_function_select'] = true;
$params['javascript_name_function_select'] = 'custom_select_function';
$params['javascript_code_function_select'] = '';
@ -170,18 +208,12 @@ function mainInsertData()
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][0] = __('Module');
$modules = [];
if ($agent_id) {
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
}
$table->data[1][0] = html_print_div(['class' => 'flex flex-items-center', 'content' => ui_print_agent_autocomplete_input($params)], true);
$table->data[1][1] = html_print_select(
$modules,
'id_agent_module',
$id_agent_module,
($save === true) ? '' : $id_agent_module,
true,
__('Select'),
0,
@ -191,13 +223,14 @@ function mainInsertData()
'',
empty($agent_id)
);
$table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[1][2] .= '&nbsp;';
$table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
$table->data[2][0] = __('Data');
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date');
$table->data[3][1] = html_print_input_text('date', $date, '', 11, 11, true).' ';
$table->data[3][1] .= html_print_input_text('time', $time, '', 7, 7, true);
$table->data[4][0] = __('CSV');
$table->data[4][1] = html_print_input_file('csv', true);
$table->data[2][1] = __('CSV');
$table->data[3][0] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][1] = html_print_input_file('csv', true);
echo "<form method='post' enctype='multipart/form-data'>";
@ -205,17 +238,16 @@ function mainInsertData()
html_print_input_hidden('save', 1);
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Save'),
'submit',
(empty($id_agent) === true),
[ 'icon' => 'next' ],
true
),
]
html_print_action_buttons(
html_print_submit_button(
__('Save'),
'submit',
// (empty($id_agent) === true),
false,
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
);
echo '</form>';
@ -267,8 +299,8 @@ function mainInsertData()
$('#id_agent_module').enable();
$('#id_agent_module').fadeIn ('normal');
$('#submit-submit').enable();
$('#submit-submit').fadeIn ('normal');
$('button [name="submit"]').removeClass('disabled_action_button');
$('button [name="submit"]').fadeIn ('normal');
}
});
}

View File

@ -1,4 +1,5 @@
<?php
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
/**
* Resource registration.
*
@ -14,7 +15,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 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
@ -239,13 +240,6 @@ function process_upload_xml_report($xml, $group_filter=0)
}
switch ($item['type']) {
case 1:
case 'simple_graph':
break;
case 'simple_baseline_graph':
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
@ -361,30 +355,6 @@ function process_upload_xml_report($xml, $group_filter=0)
}
break;
case 6:
case 'monitor_report':
break;
case 7:
case 'avg_value':
break;
case 8:
case 'max_value':
break;
case 9:
case 'min_value':
break;
case 10:
case 'sumatory':
break;
case 'agent_detailed_event':
case 'event_report_agent':
break;
case 'text':
$values['text'] = io_safe_input($item['text']);
break;
@ -405,18 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0)
$values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item->group));
break;
case 'event_report_module':
break;
case 'alert_report_module':
break;
case 'alert_report_agent':
break;
case 'alert_report_group':
break;
case 'url':
$values['external_source'] = io_safe_input($item['url']);
break;
@ -426,9 +384,32 @@ function process_upload_xml_report($xml, $group_filter=0)
$values['line_separator'] = io_safe_input($item['line_separator']);
$values['column_separator'] = io_safe_input($item['column_separator']);
break;
case 1:
case 'simple_graph':
case 'simple_baseline_graph':
case 6:
case 'monitor_report':
case 7:
case 'avg_value':
case 8:
case 'max_value':
case 9:
case 'min_value':
case 10:
case 'sumatory':
case 'event_report_module':
case 'alert_report_module':
case 'alert_report_agent':
case 'alert_report_group':
case 'agent_detailed_event':
case 'event_report_agent':
default:
// Do nothing.
break;
}
if (empty($agents_item)) {
if (empty($agents_item) === true) {
$id_content = db_process_sql_insert('treport_content', $values);
ui_print_result_message(
$id_content,
@ -782,7 +763,7 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
function process_upload_xml_component($xml)
{
// Extract components
// Extract components.
$components = [];
foreach ($xml->xpath('/component') as $componentElement) {
$name = io_safe_input((string) $componentElement->name);
@ -838,7 +819,7 @@ function process_upload_xml_component($xml)
$idComponent = false;
switch ((int) $componentElement->module_source) {
case 1:
// Local component
// Local component.
$values = [
'description' => $description,
'id_network_component_group' => $group,
@ -854,12 +835,12 @@ function process_upload_xml_component($xml)
// Network component
// for modules
// 15 = remote_snmp, 16 = remote_snmp_inc,
// 17 = remote_snmp_string, 18 = remote_snmp_proc
// 17 = remote_snmp_string, 18 = remote_snmp_proc.
$custom_string_1 = '';
$custom_string_2 = '';
$custom_string_3 = '';
if ($type >= 15 && $type <= 18) {
// New support for snmp v3
// New support for snmp v3.
$tcp_send = $snmp_version;
$plugin_user = $auth_user;
$plugin_pass = $auth_password;
@ -909,13 +890,13 @@ function process_upload_xml_component($xml)
'post_process' => $post_process,
]
);
if ((bool) $idComponent) {
if ((bool) $idComponent === true) {
$components[] = $idComponent;
}
break;
case 4:
// Plugin component
// Plugin component.
$idComponent = network_components_create_network_component(
$name,
$type,
@ -956,17 +937,13 @@ function process_upload_xml_component($xml)
'post_process' => $post_process,
]
);
if ((bool) $idComponent) {
if ((bool) $idComponent === true) {
$components[] = $idComponent;
}
break;
case 5:
// Prediction component
break;
case 6:
// WMI component
// WMI component.
$idComponent = network_components_create_network_component(
$name,
$type,
@ -1013,13 +990,17 @@ function process_upload_xml_component($xml)
'post_process' => $post_process,
]
);
if ((bool) $idComponent) {
if ((bool) $idComponent === true) {
$components[] = $idComponent;
}
break;
case 5:
// Prediction component.
case 7:
// Web component
// Web component.
default:
// Do nothing.
break;
}
@ -1030,9 +1011,9 @@ function process_upload_xml_component($xml)
);
}
// Extract the template
// Extract the template.
$templateElement = $xml->xpath('//template');
if (!empty($templateElement)) {
if (empty($templateElement) === false) {
$templateElement = $templateElement[0];
$templateName = (string) $templateElement->name;
@ -1092,9 +1073,26 @@ function resource_registration_extension_main()
include_once $config['homedir'].'/include/functions_db.php';
enterprise_include_once('include/functions_local_components.php');
ui_print_page_header(__('Resource registration'), 'images/extensions.png', false, '', true, '');
ui_print_standard_header(
__('Resource registration'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Resource registration'),
],
]
);
if (!extension_loaded('libxml')) {
if (extension_loaded('libxml') === false) {
ui_print_error_message(_('Error, please install the PHP libXML in the system.'));
return;
@ -1119,15 +1117,36 @@ function resource_registration_extension_main()
return;
}
echo '<div class=notify>';
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="https://pandorafms.com/Library/Library/">Public Resource Library</a>');
echo '</div>';
ui_print_warning_message(
__('This extension makes registering resource templates easier.').'<br>'.__('Here you can upload a resource template in .ptr format.').'<br>'.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="https://pandorafms.com/Library/Library/">Public Resource Library</a>')
);
echo '<br /><br />';
$table = new stdClass();
$table->class = 'databox m2020';
$table->id = 'resource_registration_table';
$table->data = [];
$table->data[0][0] = __('File to upload');
$table->data[0][1] = __('Group filter');
$table->data[1][0] = html_print_input_file('resource_upload', true);
$table->data[1][1] = html_print_select_groups(false, 'AW', true, 'group', '', '', __('All'), 0, true);
// Upload form.
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
echo '<form name="submit_plugin" method="POST" enctype="multipart/form-data">';
html_print_table($table);
html_print_action_buttons(
html_print_submit_button(
__('Upload'),
'upload',
false,
[ 'icon' => 'wand' ],
true
),
['type' => 'form_action']
);
echo '</form>';
/*
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
echo '<tr>';
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>";
echo '<td>'.__('Group filter: ').'</td>';
@ -1136,8 +1155,7 @@ function resource_registration_extension_main()
echo '</td>';
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
echo '</tr>';
echo '</table>';
echo '</form>';
echo '</table>';*/
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
return;

View File

@ -1,16 +1,32 @@
<?php
/**
* Edit Fields manager.
*
* @category Resources.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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 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.
// Load global vars.
global $config;
check_login();
@ -47,13 +63,8 @@ if ($id_field) {
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox m2020';
$table->id = 'configure_field';
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold';
$table->style[6] = 'font-weight: bold';
echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' class='invisible'>";
echo "<p class='center bolder'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>';
@ -75,7 +86,7 @@ echo '</div>';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
$table->data[1][0] = html_print_input_text(
'name',
$name,
'',
@ -84,30 +95,39 @@ $table->data[0][1] = html_print_input_text(
true
);
$table->data[1][0] = __('Pass type').ui_print_help_tip(
$table->data[2][0] = __('Pass type').ui_print_help_tip(
__('The fields with pass type enabled will be displayed like html input type pass in html'),
true
);
$table->data[1][1] = html_print_checkbox_switch(
$table->data[2][1] = __('Display on front').ui_print_help_tip(
__('The fields with display on front enabled will be displayed into the agent details'),
true
);
$table->data[2][2] = __('Link type');
$table->data[3][0] = html_print_checkbox_switch(
'is_password_type',
1,
$is_password_type,
true
);
$table->data[2][0] = __('Display on front').ui_print_help_tip(
__('The fields with display on front enabled will be displayed into the agent details'),
true
);
$table->data[2][1] = html_print_checkbox_switch(
$table->data[3][1] = html_print_checkbox_switch(
'display_on_front',
1,
$display_on_front,
true
);
$table->data[3][0] = __('Enabled combo');
$table->data[3][1] = html_print_checkbox_switch_extended(
$table->data[3][2] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
$table->data[4][0] = __('Enabled combo');
$table->data[5][0] = html_print_checkbox_switch_extended(
'is_combo_enable',
0,
$config['is_combo_enable'],
@ -117,12 +137,15 @@ $table->data[3][1] = html_print_checkbox_switch_extended(
true
);
$table->rowstyle[4] = 'display: none;';
$table->data[4][0] = __('Combo values').ui_print_help_tip(
$table->cellstyle[4][1] = 'display: none;';
$table->cellstyle[5][1] = 'display: none;';
$table->data[4][1] = __('Combo values').ui_print_help_tip(
__('Set values separated by comma'),
true
);
$table->data[4][1] = html_print_textarea(
$table->data[5][1] = html_print_textarea(
'combo_values',
3,
65,
@ -131,31 +154,40 @@ $table->data[4][1] = html_print_textarea(
true
);
$table->data[5][0] = __('Link type');
$table->data[5][1] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id_field) {
if ($id_field > 0) {
html_print_input_hidden('update_field', 1);
html_print_input_hidden('id_field', $id_field);
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
$buttonCaption = __('Update');
$buttonName = 'updbutton';
} else {
html_print_input_hidden('create_field', 1);
html_print_submit_button(__('Create'), 'crtbutton', false, 'class="sub wand"');
$buttonCaption = __('Create');
$buttonName = 'crtbutton';
}
echo '</div>';
$actionButtons = [];
$actionButtons[] = html_print_submit_button(
$buttonCaption,
$buttonName,
false,
[ 'icon' => 'wand' ],
true
);
$actionButtons[] = html_print_go_back_button(
'index.php?sec=gagente&sec2=godmode/agentes/fields_manager',
['button_class' => ''],
true
);
html_print_action_buttons(
implode('', $actionButtons),
['type' => 'form_action'],
);
echo '</form>';
?>

View File

@ -1,22 +1,37 @@
<?php
/**
* Fields manager.
*
* @category Resources.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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 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.
// Load global vars
// Load global vars.
global $config;
check_login();
if (!check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Group Management'
@ -27,7 +42,24 @@ if (!check_acl($config['id_user'], 0, 'PM')) {
}
// Header.
ui_print_page_header(__('Agents custom fields manager'), 'images/custom_field.png', false, '', true, '');
ui_print_standard_header(
__('Agents custom fields manager'),
'images/custom_field.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Custom fields'),
],
]
);
$create_field = (bool) get_parameter('create_field');
$update_field = (bool) get_parameter('update_field');
@ -114,8 +146,7 @@ $fields = db_get_all_rows_filter(
);
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->class = 'info_table m2020';
if ($fields) {
$table->head = [];
$table->head[0] = __('ID');
@ -140,43 +171,66 @@ if ($fields === false) {
foreach ($fields as $field) {
$data[0] = $field['id_field'];
$data[1] = $field['name'];
$data[1] = '<b>'.$field['name'].'</b>';
if ($field['display_on_front']) {
$data[2] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
} else {
$data[2] = html_print_image(
'images/icono_stop.png',
true,
['style' => 'width:21px;height:21px;']
);
}
$data[2] = html_print_image(
((bool) $field['display_on_front'] === true) ? 'images/validate.svg' : 'images/icono_stop.png',
true,
['class' => 'main_menu_icon invert_filter']
);
$table->cellclass[][3] = 'table_action_buttons';
$data[3] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'].'">'.html_print_image('images/config.png', true, ['alt' => __('Edit'), 'title' => __('Edit'), 'border' => '0', 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/fields_manager&delete_field=1&id_field='.$field['id_field'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'border' => '0', 'class' => 'invert_filter']).'</a>';
$tableActionButtons = [];
$tableActionButtons[] = html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'],
'content' => html_print_image(
'images/edit.svg',
true,
[
'title' => __('Edit'),
'class' => 'main_menu_icon invert_filter',
]
),
],
true
);
$tableActionButtons[] = html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/fields_manager&delete_field=1&id_field='.$field['id_field'],
'content' => html_print_image(
'images/delete.svg',
true,
[
'title' => __('Delete'),
'class' => 'main_menu_icon invert_filter',
]
),
'onClick' => 'if (!confirm(\' '.__('Are you sure?').'\')) return false;',
],
true
);
$data[3] = implode('', $tableActionButtons);
array_push($table->data, $data);
}
if ($fields) {
ui_pagination($count_fields, false, $offset);
html_print_table($table);
ui_pagination($count_fields, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
$tablePagination = ui_pagination($count_fields, false, $offset, 0, true, 'offset', false);
}
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create field'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
]
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';
html_print_action_buttons(
html_print_submit_button(
__('Create field'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
);
echo '</form>';

View File

@ -654,8 +654,7 @@ if ($agents !== false) {
$tableAgents = new stdClass();
$tableAgents->id = 'agent_list';
$tableAgents->class = 'info_table tactical_table';
$tableAgents->styleTable = 'margin: 0 10px';
$tableAgents->class = 'info_table tactical_table m2020';
$tableAgents->head = [];
$tableAgents->data = [];
// Header.

View File

@ -1168,7 +1168,7 @@ if ($modules !== false) {
[
'href' => 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'],
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
'image' => 'images/cluster@svg.svg',
'image' => 'images/cluster@os.svg',
'title' => __('Create network component'),
'disabled' => ((is_user_admin($config['id_user']) === true) && (int) $module['id_modulo'] === MODULE_NETWORK) === false,
'disabled_title' => ' ('.__('Disabled').')',

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 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
@ -52,35 +52,21 @@ $search = (int) get_parameter('search_category', 0);
$category_name = (string) get_parameter('category_name', '');
$tab = (string) get_parameter('tab', 'list');
if (is_metaconsole() === true) {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image(
'images/list.png',
true,
[
'title' => __('List categories'),
'class' => 'invert_filter',
]
).'</a>',
],
];
} else {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image(
'images/list.png',
true,
[
'title' => __('List categories'),
'class' => 'invert_filter',
]
).'</a>',
],
];
}
$sec = (is_metaconsole() === true) ? 'advanced' : 'galertas';
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec='.$sec.'&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image(
'images/logs@svg.svg',
true,
[
'title' => __('List categories'),
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
];
$buttons[$tab]['active'] = true;
@ -88,7 +74,24 @@ $buttons[$tab]['active'] = true;
if (is_metaconsole() === true) {
ui_meta_print_header(__('Categories configuration'), __('List'), $buttons);
} else {
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
ui_print_standard_header(
__('Categories configuration'),
'images/gm_modules.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Module categories'),
],
]
);
}
@ -152,12 +155,8 @@ $rowPair = true;
$iterator = 0;
if (empty($result) === false) {
// Prepare pagination.
ui_pagination($total_categories, $url);
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->class = 'info_table m2020';
$table->data = [];
$table->head = [];
@ -185,14 +184,20 @@ if (empty($result) === false) {
if (is_metaconsole() === true) {
$data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
$data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
'images/config.png',
'images/edit.svg',
true,
['title' => 'Edit']
[
'title' => __('Edit'),
'class' => 'main_menu_icon',
]
).'</a>&nbsp;&nbsp;';
$data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/cross.png',
'images/delet.svg',
true,
['title' => 'Delete']
[
'title' => __('Delete'),
'class' => 'main_menu_icon',
]
).'</a>';
} else {
if ($is_management_allowed === true) {
@ -203,16 +208,39 @@ if (empty($result) === false) {
if ($is_management_allowed === true) {
$table->cellclass[][1] = 'table_action_buttons';
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
'images/config.png',
true,
['title' => 'Edit']
).'</a>';
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/cross.png',
true,
['title' => 'Delete']
).'</a>';
$tableActionButtonsContent = [];
$tableActionButtonsContent[] = html_print_anchor(
[
'href' => 'index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category='.$category['id'].'&pure='.(int) $config['pure'],
'content' => html_print_image(
'images/edit.svg',
true,
[
'title' => __('Edit'),
'class' => 'main_menu_icon',
]
),
],
true
);
$tableActionButtonsContent[] = html_print_anchor(
[
'href' => 'index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'],
'onClick' => 'if (! confirm (\''.__('Are you sure?').'\')) return false',
'content' => html_print_image(
'images/delete.svg',
true,
[
'title' => __('Delete'),
'class' => 'main_menu_icon',
]
),
],
true
);
$data[1] = implode('', $tableActionButtonsContent);
}
}
@ -220,7 +248,7 @@ if (empty($result) === false) {
}
html_print_table($table);
ui_pagination($total_categories, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
$tablePagination = ui_pagination($total_categories, $url, $offset, 0, true, 'offset', false);
} else {
// No categories available or selected.
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
@ -228,24 +256,23 @@ if (empty($result) === false) {
if ($is_management_allowed === true) {
// Form to add new categories or search categories.
if (is_metaconsole() === true) {
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
} else {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
}
$sec = (is_metaconsole() === true) ? 'advanced' : 'gmodules';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
html_print_input_hidden('create_category', '1', true);
html_print_div(
html_print_action_buttons(
html_print_submit_button(
__('Create category'),
'create_button',
false,
[ 'icon' => 'next' ],
true
),
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create category'),
'create_button',
false,
[ 'icon' => 'next' ],
true
),
'type' => 'form_action',
'right_content' => $tablePagination,
]
);

View File

@ -50,36 +50,29 @@ $update_category = (int) get_parameter('update_category', 0);
$create_category = (int) get_parameter('create_category', 0);
$name_category = (string) get_parameter('name_category', '');
$tab = (string) get_parameter('tab', 'list');
// Main URL.
$mainUrl = 'index.php?sec=gagente&sec2=godmode/category/category';
$sec = (is_metaconsole() === true) ? 'advanced' : 'gmodules';
if (is_metaconsole() === true) {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image(
'images/list.png',
true,
[
'title' => __('List categories'),
'class' => 'invert_filter',
]
).'</a>',
],
];
} else {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=gmodules&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image(
'images/list.png',
true,
[
'title' => __('List categories'),
'class' => 'invert_filter',
]
).'</a>',
],
];
}
$buttons = [
'list' => [
'active' => false,
'text' => html_print_anchor(
[
'href' => 'index.php?sec='.$sec.'&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'],
'content' => html_print_image(
'images/logs@svg.svg',
true,
[
'title' => __('List categories'),
'class' => 'main_menu_icon invert_filter',
]
),
],
true
),
],
];
$buttons[$tab]['active'] = false;
@ -87,7 +80,25 @@ $buttons[$tab]['active'] = false;
if (is_metaconsole() === true) {
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
} else {
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
// Header.
ui_print_standard_header(
__('Manage category'),
'images/gm_modules.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => $mainUrl,
'label' => __('Module categories'),
],
]
);
}
@ -151,7 +162,7 @@ if ($create_category) {
// Form fields are filled here
// Get results when update action is performed.
if ($action == 'update' && $id_category != 0) {
if ($action === 'update' && $id_category != 0) {
$result_category = db_get_row_filter('tcategory', ['id' => $id_category]);
$name_category = $result_category['name'];
} //end if
@ -159,47 +170,28 @@ else {
$name_category = '';
}
// Create/Update category form.
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/category/edit_category&action='.$action.'&id_category='.$id_category.'&pure='.(int) $config['pure'].'" enctype="multipart/form-data">';
// Create/Update category form
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action='.$action.'&id_category='.$id_category.'&pure='.(int) $config['pure'].'" enctype="multipart/form-data">';
$table = new stdClass();
$table->id = 'edit_catagory_table';
$table->class = 'databox m2020';
if (!defined('METACONSOLE')) {
echo '<div align=left class="pandora_form w100p">';
} else {
echo '<div align=left class="pandora_form w100p">';
}
echo "<table border=0 cellpadding=4 cellspacing=4 class='databox filters' width=100%>";
if (defined('METACONSOLE')) {
if ($action == 'update') {
echo '<thead>
<tr>
<th align=center colspan=5>'.__('Update category').'</th>
</tr>
</thead>';
}
if ($action == 'new') {
echo '<thead>
<tr>
<th align=center colspan=5>'.__('Create category').'</th>
</tr>
</thead>';
$table->head = [];
if (is_metaconsole() === true) {
if ($action === 'update') {
$table->head[0] = __('Update category');
} else if ($action === 'new') {
$table->head[0] = __('Create category');
}
}
echo '<tr>';
echo "<td class='bolder'>";
$table->data = [];
html_print_label(__('Name'), 'name');
echo '</td>';
echo '<td>';
html_print_input_text('name_category', $name_category);
echo '</td>';
echo '</tr>';
$table->data[0][0] = __('Name');
$table->data[1][0] = html_print_input_text('name_category', $name_category, '', 50, 255, true);
echo '</table>';
html_print_table($table);
if ($action === 'update') {
html_print_input_hidden('update_category', 1);
@ -213,20 +205,25 @@ if ($action === 'update') {
$buttonIcon = 'next';
}
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
$buttonCaption,
$buttonName,
false,
[ 'icon' => $buttonIcon ],
true
),
]
$actionButtons = [];
$actionButtons[] = html_print_submit_button(
$buttonCaption,
$buttonName,
false,
[ 'icon' => $buttonIcon ],
true
);
$actionButtons[] = html_print_go_back_button(
$mainUrl,
['button_class' => ''],
true
);
html_print_action_buttons(
implode('', $actionButtons),
[ 'type' => 'form_action' ]
);
echo '</div>';
echo '</form>';
enterprise_hook('close_meta_frame');

View File

@ -26,9 +26,26 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
return;
}
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
// Header
ui_print_page_header(__('Module group management'), 'images/module_group.png', false, '', true, '');
ui_print_standard_header(
__('Module group management'),
'images/module_group.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Module groups'),
],
]
);
}
// Init vars
@ -60,33 +77,54 @@ if ($id_group) {
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox m2020';
$table->style[0] = 'font-weight: bold';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
$table->data[1][0] = html_print_input_text('name', $name, '', 35, 100, true);
echo '</span>';
if (is_metaconsole()) {
echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group">';
if (is_metaconsole() === true) {
$formUrl = 'index.php?sec=advanced&sec2=advanced/component_management&tab=module_group';
} else {
echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list">';
$formUrl = 'index.php?sec=gmodules&sec2=godmode/groups/modu_group_list';
}
echo '<form name="grupo" method="POST" action="'.$formUrl.'">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id_group) {
html_print_input_hidden('update_group', 1);
html_print_input_hidden('id_group', $id_group);
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
$actionButtonTitle = __('Update');
$actionButtonName = 'updbutton';
} else {
$actionButtonTitle = __('Create');
$actionButtonName = 'crtbutton';
html_print_input_hidden('create_group', 1);
html_print_submit_button(__('Create'), 'crtbutton', false, 'class="sub wand"');
}
echo '</div>';
$actionButtons = [];
$actionButtons[] = html_print_submit_button(
$actionButtonTitle,
$actionButtonName,
false,
['icon' => 'wand'],
true
);
$actionButtons[] = html_print_go_back_button(
ui_get_full_url('index.php?sec=gmodules&sec2=godmode/groups/modu_group_list'),
['button_class' => ''],
true
);
html_print_action_buttons(
implode('', $actionButtons),
['type' => 'form_action']
);
echo '</form>';
enterprise_hook('close_meta_frame');

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 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
@ -66,13 +66,23 @@ if (is_ajax() === true) {
if (is_metaconsole() === false) {
// Header.
ui_print_page_header(
__('Module groups defined in %s', get_product_name()),
ui_print_standard_header(
__('Module groups list'),
'images/module_group.png',
false,
'',
true,
''
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Module groups'),
],
]
);
}
@ -243,8 +253,7 @@ $sql = 'SELECT *
$groups = db_get_all_rows_sql($sql);
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->class = 'info_table m2020';
if (empty($groups) === false) {
$table->head = [];
@ -254,6 +263,8 @@ if (empty($groups) === false) {
$table->head[2] = __('Delete');
}
$table->size[0] = '5%';
$table->align = [];
$table->align[1] = 'left';
if ($is_management_allowed === true) {
@ -270,10 +281,10 @@ if (empty($groups) === false) {
if ($is_management_allowed === true) {
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon']).'</a>';
} else {
$table->cellclass[][2] = 'table_action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon']).'</a>';
}
} else {
$data[1] = '<strong>';
@ -284,9 +295,8 @@ if (empty($groups) === false) {
array_push($table->data, $data);
}
ui_pagination($total_groups, $url, $offset);
html_print_table($table);
ui_pagination($total_groups, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
$tablePagination = ui_pagination($total_groups, $url, $offset, 0, true, 'offset', false);
} else {
ui_print_info_message(
[
@ -298,16 +308,17 @@ if (empty($groups) === false) {
if ($is_management_allowed === true) {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
html_print_div(
html_print_action_buttons(
html_print_submit_button(
__('Create module group'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create module group'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
'type' => 'form_action',
'right_content' => $tablePagination,
]
);
echo '</form>';

View File

@ -1,17 +1,32 @@
<?php
/**
* Component group Management.
*
* @category Modules.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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 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.
// Load global vars
// Load global vars.
global $config;
check_login();
@ -32,16 +47,27 @@ require_once $config['homedir'].'/include/functions_network_components.php';
require_once $config['homedir'].'/include/functions_component_groups.php';
// Header
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
components_meta_print_header();
$sec = 'advanced';
} else {
ui_print_page_header(
__('Module management').' &raquo; '.__('Component group management'),
ui_print_standard_header(
__('Component group management'),
'',
false,
'',
true
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Component groups'),
],
]
);
$sec = 'gmodules';
}
@ -234,12 +260,11 @@ foreach ($groups as $group_key => $group_val) {
$groups = component_groups_get_groups_tree_recursive($groups_clean, 0, 0);
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->class = 'info_table m2020';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name');
if (is_management_allowed() === true || is_metaconsole()) {
if (is_management_allowed() === true || is_metaconsole() === true) {
$table->head[1] = __('Action');
}
@ -272,8 +297,14 @@ foreach ($groups as $group) {
$table->cellclass[][1] = 'table_action_buttons';
if (is_management_allowed() === true || is_metaconsole()) {
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
$data[1] = html_print_anchor(
[
'onClick' => 'if(confirm(\"'.__('Are you sure?').'\")) return true; else return false;',
'href' => 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg'].'&offset=0',
'content' => html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'main_menu_icon']),
],
true
);
}
array_push($table->data, $data);
@ -296,35 +327,63 @@ if (is_management_allowed() === false && is_metaconsole() === false) {
);
}
if (isset($data)) {
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_nc_groups'>";
html_print_input_hidden('multiple_delete', 1);
$actionButtons = [];
if (isset($data) === true) {
echo '<form id="multiple_delete_form" method="POST" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_nc_groups">';
html_print_table($table);
if (is_management_allowed() === true || is_metaconsole()) {
echo "<div class='pdd_l_10px float-right mrgn_btn_15px'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
}
echo '</form>';
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined component groups') ]);
}
if (is_management_allowed() === true || is_metaconsole()) {
echo '<form method="post" action='.$url.'>';
echo '<div class="float-right">';
html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
// Create form.
echo '<form id="create_form" method="POST" action="'.$url.'">';
html_print_input_hidden('new', 1);
echo '</form>';
// Create action button.
$actionButtons[] = html_print_submit_button(
__('Create'),
'crt',
false,
[
'icon' => 'wand',
'form' => 'create_form',
],
true
);
// Delete action button.
if (isset($data) === true) {
$actionButtons[] = html_print_input_hidden(
'multiple_delete',
1,
false,
false,
'form="multiple_delete_form"'
);
$actionButtons[] = html_print_submit_button(
__('Delete'),
'delete_btn',
false,
[
'icon' => 'delete',
'mode' => 'secondary',
'form' => 'multiple_delete_form',
],
true
);
}
}
html_print_action_buttons(
implode('', $actionButtons),
['type' => 'form_action']
);
enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
$( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){
@ -332,11 +391,11 @@ enterprise_hook('close_meta_frame');
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
@ -344,11 +403,7 @@ enterprise_hook('close_meta_frame');
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
}
});
});
</script>

View File

@ -1,17 +1,32 @@
<?php
/**
* Component group management form.
*
* @category Modules.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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 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.
// Load global vars
// Load global vars.
global $config;
check_login();
@ -28,12 +43,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'],
require_once $config['homedir'].'/include/functions_network_components.php';
$id = (int) get_parameter('id');
if (defined('METACONSOLE')) {
$sec = 'advanced';
} else {
$sec = 'gmodules';
}
$sec = (is_metaconsole() === true) ? 'advanced' : 'gmodules';
if ($id) {
$group = network_components_get_group($id);
@ -45,31 +55,24 @@ if ($id) {
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox m2020';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$table->class = 'databox data';
if ($id) {
$table->head[0] = __('Update Group Component');
} else {
$table->head[0] = __('Create Group Component');
}
$table->head[0] = ($id) ? __('Update Group Component') : __('Create Group Component');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->style[0] = 'width: 0';
$table->style[1] = 'width: 0';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text('name', $name, '', 15, 255, true);
$table->data[0][2] = __('Parent');
$table->data[0][3] = html_print_select(
$table->data[0][1] = __('Parent');
$table->data[1][0] = html_print_input_text('name', $name, '', 0, 255, true, false, false, '', 'w100p');
$table->data[1][1] = html_print_select(
network_components_get_groups(),
'parent',
$parent,
@ -81,17 +84,39 @@ $table->data[0][3] = html_print_select(
false
);
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_nc_groups">';
$manageNcGroupsUrl = 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_nc_groups';
echo '<form method="post" action="'.$manageNcGroupsUrl.'">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('update', 1);
html_print_input_hidden('id', $id);
html_print_submit_button(__('Update'), 'crt', false, 'class="sub upd"');
$actionButtonTitle = __('Update');
} else {
html_print_input_hidden('create', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub wand"');
$actionButtonTitle = __('Create');
}
echo '</div>';
$actionButtons = [];
$actionButtons[] = html_print_submit_button(
$actionButtonTitle,
'crt',
false,
['icon' => 'wand'],
true
);
$actionButtons[] = html_print_go_back_button(
$manageNcGroupsUrl,
['button_class' => ''],
true
);
html_print_action_buttons(
implode('', $actionButtons),
[ 'type' => 'form_action']
);
echo '</form>';

View File

@ -1,17 +1,32 @@
<?php
/**
* Module Type List.
*
* @category Modules.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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 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.
// Load global vars
// Load global vars.
global $config;
check_login();
@ -26,12 +41,30 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
}
// Header.
ui_print_page_header(__('Module management').' &raquo; '.__('Defined modules'), 'images/gm_modules.png', false, '', true);
ui_print_standard_header(
__('Defined module types'),
'images/module_group.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Module types'),
],
]
);
$update_module = (bool) get_parameter_post('update_module');
// Update
if ($update_module) {
if ($update_module === true) {
$name = get_parameter_post('name');
$id_type = get_parameter_post('id_type');
$description = get_parameter_post('description');
@ -54,43 +87,33 @@ if ($update_module) {
}
}
$table = new stdClass();
$table->id = 'module_type_list';
$table->class = 'info_table m2020';
$table->size = [];
$table->size[0] = '5%';
$table->size[1] = '5%';
$table->head = [];
$table->head[0] = __('ID');
$table->head[1] = __('Icon');
$table->head[2] = __('Name');
$table->head[3] = __('Description');
echo "<table cellpadding='0' cellspacing='0' width='100%' class='info_table'>";
echo '<thead>';
echo '<th>'.__('Icon').'</th>';
echo '<th>'.__('ID').'</th>';
echo '<th>'.__('Name').'</th>';
echo '<th>'.__('Description').'</th>';
echo '</thead';
$table->data = [];
$rows = db_get_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY nombre');
$rows = db_get_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY id_tipo');
if ($rows === false) {
$rows = [];
}
$color = 0;
foreach ($rows as $row) {
if ($color == 1) {
$tdcolor = 'datos';
$color = 0;
} else {
$tdcolor = 'datos2';
$color = 1;
}
$data[0] = $row['id_tipo'];
$data[1] = html_print_image('images/'.$row['icon'], true, ['class' => 'main_menu_icon invert_filter']);
$data[2] = $row['nombre'];
$data[3] = $row['descripcion'];
echo "
<tr>
<td class='$tdcolor' align=''>".html_print_image('images/'.$row['icon'], true, ['border' => '0', 'class' => 'invert_filter'])."</td>
<td class='$tdcolor'>
<b>".$row['id_tipo']."
</b></td>
<td class='$tdcolor'>
<b>".$row['nombre']."
</b></td>
<td class='$tdcolor'>
".$row['descripcion'].'
</td>
</tr>';
array_push($table->data, $data);
}
echo '</table>';
html_print_table($table);
// $tablePagination = ui_pagination($total_groups, $url, $offset, 0, true, 'offset', false);

View File

@ -62,23 +62,23 @@ if (is_management_allowed() === false) {
$table = new stdClass();
// $table->width = '100%';
$table->styleTable = 'margin: 10px 10px 0';
$table->class = 'info_table';
// $table->styleTable = 'margin: 10px 10px 0';
$table->class = 'info_table m2020';
$table->head[0] = '';
$table->head[1] = __('ID');
$table->head[0] = __('ID');
$table->head[1] = __('Icon');
$table->head[2] = __('Name');
$table->head[3] = __('Description');
if ($is_management_allowed === true) {
$table->head[4] = '';
}
$table->align[0] = 'center';
$table->align[1] = 'center';
if ($is_management_allowed === true) {
$table->align[4] = 'center';
}
$table->size[0] = '20px';
$table->size[0] = '5%';
if ($is_management_allowed === true) {
$table->size[4] = '20px';
}
@ -103,14 +103,22 @@ if ($osList === false) {
$table->data = [];
foreach ($osList as $os) {
$data = [];
$data[] = html_print_div(['class' => 'main_menu_icon', 'content' => ui_print_os_icon($os['id_os'], false, true)], true);
$data[] = $os['id_os'];
$data[] = html_print_div(['class' => 'main_menu_icon', 'content' => ui_print_os_icon($os['id_os'], false, true)], true);
if ($is_management_allowed === true) {
if (is_metaconsole() === true) {
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
$osNameUrl = 'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'];
} else {
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
$osNameUrl = 'index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'];
}
$data[] = html_print_anchor(
[
'href' => $osNameUrl,
'content' => io_safe_output($os['name']),
],
true
);
} else {
$data[] = io_safe_output($os['name']);
}

View File

@ -1982,15 +1982,17 @@ div#agent_wizard_subtabs {
}
table.databox {
background-color: #f9faf9;
background-color: #fff;
border-spacing: 0px;
-moz-box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%);
-webkit-box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%);
box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%);
border-radius: 4px;
border: 1px solid #e2e2e2;
border-radius: 6px;
/*-moz-box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%);*/
/* -webkit-box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%); */
/* box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%); */
border: 2px solid #c0ccdc;
padding: 20px;
margin-bottom: 20px;
width: -webkit-fill-available;
width: -moz-available;
}
.databox > tbody > tr > td {
@ -3717,7 +3719,7 @@ table#policy_modules td * {
}
.tactical_table > thead > tr span {
line-height: 26px;
/*line-height: 26px;*/
}
.info_table thead th .sort_arrow,
@ -6746,10 +6748,6 @@ div.graph div.legend table {
margin: 0px;
}
.mrgn_5px_a0 {
margin: 5px auto 0;
}
.mrgn_10px {
margin: 10px;
}
@ -7022,6 +7020,17 @@ div.graph div.legend table {
margin-bottom: 80px;
}
.m1010 {
margin: 10px;
}
.m1020 {
margin: 10px 20px;
}
.m2020 {
margin: 20px;
}
.snmp_view_div {
float: left;
padding-left: 30px;
@ -9887,7 +9896,8 @@ div#err_msg_centralised {
.inputFile {
background-color: #f6f7fb;
height: 16px;
font: normal normal normal 13px Pandora-Light;
font-family: "Pandora-Regular";
font-size: 12px;
padding: 5.5pt 20pt;
cursor: pointer;
color: #14524f;
@ -9908,12 +9918,13 @@ input,
textarea,
select {
background-color: #f6f7fb;
height: 38px;
border: 2px solid #c0ccdc;
border-radius: 6px;
height: 38px;
font-family: "Pandora-Regular";
font-size: 12px;
color: #333333;
padding-left: 12px;
font: normal normal normal 14px Pandora-Light;
color: #2b3332;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@ -10593,7 +10604,8 @@ tr.bring_next_field {
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
cursor: pointer;
font: normal normal normal 12px Pandora-Light !important;
font-family: "Pandora-Regular" !important;
font-size: 12px !important;
}
.select2-container .select2-selection--single {
@ -10891,7 +10903,7 @@ pre.external_tools_output {
.fixed_filter_bar {
position: sticky;
top: 114px;
margin-bottom: 10px;
/*margin-bottom: 10px;*/
border: 1px solid #e5e9ed;
background-color: #fff;
z-index: 1;

View File

@ -91,11 +91,13 @@
.info_table,
.filter_table {
background-color: #fff;
/* margin-bottom: 10px; */
border-spacing: 0;
border-collapse: collapse;
overflow: hidden;
border-radius: 5px;
border-radius: 6px;
border: 2px solid #c0ccdc;
width: -webkit-fill-available;
width: -moz-available;
margin-bottom: 50px !important;
}
.info_table > tbody > tr:nth-child(even) {
@ -111,20 +113,20 @@
}*/
.info_table > tbody > tr > th,
.info_table > thead > tr > th {
border-top: 1px solid #c0ccdc;
/*border-top: 1px solid #c0ccdc;*/
}
.info_table tr > td:first-child,
.info_table tr > th:first-child {
/*padding-left: 5px;*/
padding-left: 10px;
border-left: 1px solid #c0ccdc;
/*border-left: 1px solid #c0ccdc;*/
}
.info_table tr > td:last-child,
.info_table tr > th:last-child {
/*padding-right: 5px;*/
padding-right: 10px;
border-right: 1px solid #c0ccdc;
/*border-right: 1px solid #c0ccdc;*/
}
.info_table tr:first-child > th {
@ -155,8 +157,9 @@
}
.info_table > thead > tr * {
font-size: 10pt;
font-family: "Pandora-Regular";
font-size: 12px;
font-family: "Pandora-Bold";
line-height: 23px;
}
/* Radius top */
@ -186,12 +189,14 @@
/*margin-left: 0.5em;*/
}
.info_table > tbody > tr {
.info_table > tbody > tr:last-child {
/*border-bottom: 1px solid #e2e2e2;*/
border-top: 0;
border-bottom: 1px solid #c0ccdc;
/*border-bottom: 1px solid #c0ccdc;*/
/*
border-left: 1px solid #c0ccdc;
border-right: 1px solid #c0ccdc;
*/
}
.info_table > tbody > tr > th,
.info_table > thead > tr > th,