Merge remote-tracking branch 'origin/develop' into ent-985t push

9-nuevos-widgets-para-mostrar-datos-en-dashboard-avg-sum-max-min

Conflicts:
	pandora_console/operation/agentes/estado_agente.php
This commit is contained in:
daniel 2023-03-13 09:23:53 +01:00
commit 80c81daafa
729 changed files with 45591 additions and 20494 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.769-230306 Version: 7.0NG.769-230313
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230306" pandora_version="7.0NG.769-230313"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769'; use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230306'; use constant AGENT_BUILD => '230313';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230306 %define release 230313
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230306 %define release 230313
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230306" PI_BUILD="230313"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230306} {230313}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.769 Build 230306") #define PANDORA_VERSION ("7.0NG.769 Build 230313")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.769(Build 230306))" VALUE "ProductVersion", "(7.0NG.769(Build 230313))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.769-230306 Version: 7.0NG.769-230313
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230306" pandora_version="7.0NG.769-230313"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -377,17 +377,17 @@ function mainAgentsModules()
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp; $fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp;
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.' offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.'
&full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>'; &full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
} else if ($full_modules_selected[0] && $full_agents_id[0]) { } else if ($full_modules_selected[0] && $full_agents_id[0]) {
$full_modules = urlencode(implode(';', $full_modules_selected)); $full_modules = urlencode(implode(';', $full_modules_selected));
$full_agents = urlencode(implode(';', $full_agents_id)); $full_agents = urlencode(implode(';', $full_agents_id));
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp; $fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp;
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.' offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.'
&full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>'; &full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
} else { } else {
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp; $fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp;
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&show_type='.$show_type.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>'; offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&show_type='.$show_type.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
} }
} }
@ -397,61 +397,139 @@ function mainAgentsModules()
1 => __('Show module data'), 1 => __('Show module data'),
]; ];
$filter_type_label = '<b>'.__('Information to be shown').'</b>'; $filter_type = html_print_label_input_block(
$filter_type = html_print_select($show_select, 'show_type', $show_type, '', '', 0, true, false, false, '', false, 'min-width: 180px;'); __('Information to be shown'),
html_print_select(
// Groups. $show_select,
$filter_groups_label = '<b>'.__('Group').'</b>'; 'show_type',
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;'); $show_type,
'',
$filter_recursion_label = '</td><td><b>'.__('Recursion').'</b>'; '',
$filter_recursion = html_print_checkbox('recursion', 1, 0, true).'</td>'; 0,
// Groups module. true,
$filter_module_groups_label = '<b>'.__('Module group').'</b>'; false,
$filter_module_groups = html_print_select_from_sql( false,
'SELECT * FROM tmodule_group ORDER BY name', '',
'modulegroup', false,
$modulegroup, 'width: 100%;'
'', )
__('All'), );
0,
true, $filter_groups = html_print_label_input_block(
false, __('Group'),
true, html_print_select_groups(
false, false,
'width: auto;' 'AR',
true,
'group_id',
$group_id,
'',
'',
'',
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$filter_groups .= html_print_label_input_block(
__('Recursion'),
html_print_checkbox_switch('recursion', 1, 0, true),
[
'div_class' => 'add-input-reverse',
'label_class' => 'label-thin',
]
);
$filter_module_groups = html_print_label_input_block(
__('Module group'),
html_print_select_from_sql(
'SELECT * FROM tmodule_group ORDER BY name',
'modulegroup',
$modulegroup,
'',
__('All'),
0,
true,
false,
true,
false,
'width: 100%;'
)
); );
// Agent.
$agents = agents_get_group_agents($group_id); $agents = agents_get_group_agents($group_id);
if ((empty($agents)) || $agents == -1) { if ((empty($agents)) || $agents == -1) {
$agents = []; $agents = [];
} }
$filter_agents_label = '<b>'.__('Agents').'</b>'; $filter_agents = html_print_label_input_block(
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;'); __('Agents'),
html_print_select(
$agents,
'id_agents2[]',
$agents_id,
'',
'',
0,
true,
true,
true,
'',
false,
'width: 100%;'
)
);
// Type show. // Type show.
$selection = [ $selection = [
0 => __('Show common modules'), 0 => __('Show common modules'),
1 => __('Show all modules'), 1 => __('Show all modules'),
]; ];
$filter_type_show_label = '<b>'.__('Show common modules').'</b>'; $filter_type_show = html_print_label_input_block(
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;'); __('Show common modules'),
html_print_select(
$selection,
'selection_agent_module',
$selection_a_m,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
// Modules. // Modules.
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false); $all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
$filter_modules_label = '<b>'.__('Module').'</b>'; $filter_modules = html_print_label_input_block(
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;'); __('Module'),
html_print_select(
// Update. $all_modules,
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true); 'module[]',
$modules_selected,
'',
'',
0,
true,
true,
false,
'',
false,
'width: 100%;'
)
);
$onheader = [ $onheader = [
'updated_time' => $updated_time, 'updated_time' => $updated_time,
'fullscreen' => $fullscreen, 'fullscreen' => $fullscreen,
'combo_module_groups' => $filter_module_groups,
'combo_groups' => $filter_groups,
]; ];
/* /*
@ -467,7 +545,7 @@ function mainAgentsModules()
false, false,
'', '',
false, false,
(array) $updated_time, $onheader,
[ [
[ [
'link' => '', 'link' => '',
@ -479,12 +557,6 @@ function mainAgentsModules()
], ],
] ]
); );
echo '<table class="w100p">';
echo '<tr>';
echo "<td> <span class='float-right'>".$fullscreen['text'].'</span> </td>';
echo '</tr>';
echo '</table>';
} else { } else {
if ($full_agents_id[0]) { if ($full_agents_id[0]) {
$full_modules = urlencode(implode(';', $full_modules_selected)); $full_modules = urlencode(implode(';', $full_modules_selected));
@ -525,11 +597,11 @@ function mainAgentsModules()
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<a target="_top" href="'.$url.'">'; echo '<a target="_top" href="'.$url.'">';
echo html_print_image( echo html_print_image(
'images/normal_screen.png', 'images/exit_fullscreen@svg.svg',
true, true,
[ [
'title' => __('Back to normal mode'), 'title' => __('Back to normal mode'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
echo '</a>'; echo '</a>';
@ -574,35 +646,46 @@ function mainAgentsModules()
if ($config['pure'] != 1) { if ($config['pure'] != 1) {
$show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" class="w100p">'; $show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" class="w100p">';
$show_filters .= '<table class="w100p no-border" cellpadding="15" cellspacing="0" border="0">'; $show_filters .= '<table class="filter-table-adv w100p no-border" cellpadding="4" cellspacing="4">';
$show_filters .= '<tr>'; $show_filters .= '<tr>';
$show_filters .= '<td>'.$filter_type_label.'</td>'; $show_filters .= '<td width="33%">'.$filter_type.'</td>';
$show_filters .= '<td>'.$filter_type.'</td>'; $show_filters .= '<td width="33%">'.$filter_groups.'</td>';
$show_filters .= '<td width="33%">'.$filter_module_groups.'</td>';
$show_filters .= '</tr>'; $show_filters .= '</tr>';
$show_filters .= '<tr>'; $show_filters .= '<tr>';
$show_filters .= '<td>'.$filter_groups_label.'</td>';
$show_filters .= '<td>'.$filter_groups.'&nbsp;&nbsp;&nbsp;'.$filter_recursion_label.$filter_recursion.'</td>';
$show_filters .= '<td></td>';
$show_filters .= '<td></td>';
$show_filters .= '<td>'.$filter_module_groups_label.'</td>';
$show_filters .= '<td>'.$filter_module_groups.'</td>';
$show_filters .= '</tr>';
$show_filters .= '<tr>';
$show_filters .= '<td>'.$filter_agents_label.'</td>';
$show_filters .= '<td>'.$filter_agents.'</td>'; $show_filters .= '<td>'.$filter_agents.'</td>';
$show_filters .= '<td>'.$filter_type_show_label.'</td>';
$show_filters .= '<td>'.$filter_type_show.'</td>'; $show_filters .= '<td>'.$filter_type_show.'</td>';
$show_filters .= '<td>'.$filter_modules_label.'</td>';
$show_filters .= '<td>'.$filter_modules.'</td>'; $show_filters .= '<td>'.$filter_modules.'</td>';
$show_filters .= '</tr>'; $show_filters .= '</tr>';
$show_filters .= '<tr>';
$show_filters .= "<td colspan=6 ><span class='right pdd_r_35px mrgn_top_25px'>".$filter_update.'</span></td>';
$show_filters .= '</tr>';
$show_filters .= '</table>'; $show_filters .= '</table>';
$show_filters .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Filter'),
'srcbutton',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
$show_filters .= '</form>'; $show_filters .= '</form>';
ui_toggle( ui_toggle(
$show_filters, $show_filters,
__('Filters ').ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true) '<span class="subsection_header_title">'.__('Filters ').'</span>'.ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true),
'filter_form',
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
); );
} }
@ -751,11 +834,11 @@ function mainAgentsModules()
return; return;
} }
echo '<table cellpadding="4" cellspacing="4" border="0" class="agents_modules_table w100p">'; echo '<table cellpadding="4" cellspacing="4" border="0" class="info_table mrgn_btn_20px">';
echo '<tr>'; echo '<tr>';
echo "<th width='140px' class='pdd_r_10px lign_right'>".__('Agents').' / '.__('Modules').'</th>'; echo "<th width='140px' class='pdd_r_10px align_right'>".__('Agents').' / '.__('Modules').'</th>';
if ($hor_offset > 0) { if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block); $new_hor_offset = ($hor_offset - $block);
@ -804,7 +887,20 @@ function mainAgentsModules()
// Prepare pagination. // Prepare pagination.
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m; $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
ui_pagination($total_pagination, $url); $tablePagination = ui_pagination(
$total_pagination,
$url,
0,
0,
true,
'offset',
false
);
html_print_action_buttons(
'',
[ 'right_content' => $tablePagination ]
);
foreach ($agents as $agent) { foreach ($agents as $agent) {
// Get stats for this group. // Get stats for this group.

View File

@ -195,129 +195,183 @@ function extension_api_checker()
); );
} }
ui_print_page_header( // Header.
__('API checker'), ui_print_standard_header(
__('Extensions'),
'images/extensions.png', 'images/extensions.png',
false, false,
'', '',
true, true,
'' [],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('API checker'),
],
]
); );
$table = new stdClass(); $table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$row = []; $row = [];
$row[] = __('IP'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('ip', $ip, '', 50, 255, true); __('IP'),
html_print_input_text('ip', $ip, '', 50, 255, true)
);
$row[] = html_print_label_input_block(
__('%s Console URL', get_product_name()),
html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true)
);
$table->data[] = $row; $table->data[] = $row;
$row = []; $row = [];
$row[] = __('%s Console URL', get_product_name()); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true); __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true),
html_print_input_text('token', $token, '', 50, 255, true)
);
$row[] = html_print_label_input_block(
__('API Pass'),
html_print_input_password('apipass', $apipass, '', 50, 255, true)
);
$table->data[] = $row; $table->data[] = $row;
$row = []; $row = [];
$row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('token', $token, '', 50, 255, true); __('User'),
$table->data[] = $row; html_print_input_text('user', $user, '', 50, 255, true)
);
$row = []; $row[] = html_print_label_input_block(
$row[] = __('API Pass'); __('Password'),
$row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true); html_print_input_password('password', $password, '', 50, 255, true)
$table->data[] = $row; );
$row = [];
$row[] = __('User');
$row[] = html_print_input_text('user', $user, '', 50, 255, true);
$table->data[] = $row;
$row = [];
$row[] = __('Password');
$row[] = html_print_input_password('password', $password, '', 50, 255, true);
$table->data[] = $row; $table->data[] = $row;
$table2 = new stdClass(); $table2 = new stdClass();
$table2->width = '100%';
$table2->class = 'databox filters filter-table-adv';
$table2->size[0] = '50%';
$table2->size[1] = '50%';
$table2->data = []; $table2->data = [];
$row = []; $row = [];
$row[] = __('Action (get or set)'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('op', $op, '', 50, 255, true); __('Action (get or set)'),
html_print_input_text('op', $op, '', 50, 255, true)
);
$row[] = html_print_label_input_block(
__('Operation'),
html_print_input_text('op2', $op2, '', 50, 255, true)
);
$table2->data[] = $row; $table2->data[] = $row;
$row = []; $row = [];
$row[] = __('Operation'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('op2', $op2, '', 50, 255, true); __('ID'),
html_print_input_text('id', $id, '', 50, 255, true)
);
$row[] = html_print_label_input_block(
__('ID 2'),
html_print_input_text('id2', $id2, '', 50, 255, true)
);
$table2->data[] = $row; $table2->data[] = $row;
$row = []; $row = [];
$row[] = __('ID'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('id', $id, '', 50, 255, true); __('Return Type'),
html_print_input_text('return_type', $return_type, '', 50, 255, true)
);
$row[] = html_print_label_input_block(
__('Other'),
html_print_input_text('other', $other, '', 50, 255, true)
);
$table2->data[] = $row; $table2->data[] = $row;
$row = []; $row = [];
$row[] = __('ID 2'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('id2', $id2, '', 50, 255, true); __('Other Mode'),
$table2->data[] = $row; html_print_input_text('other_mode', $other_mode, '', 50, 255, true)
);
$row = [];
$row[] = __('Return Type');
$row[] = html_print_input_text('return_type', $return_type, '', 50, 255, true);
$table2->data[] = $row;
$row = [];
$row[] = __('Other');
$row[] = html_print_input_text('other', $other, '', 50, 255, true);
$table2->data[] = $row;
$row = [];
$row[] = __('Other Mode');
$row[] = html_print_input_text('other_mode', $other_mode, '', 50, 255, true);
$table2->data[] = $row; $table2->data[] = $row;
$table3 = new stdClass(); $table3 = new stdClass();
$table3->width = '100%';
$table3->class = 'databox filters filter-table-adv';
$table3->size[0] = '50%';
$table3->size[1] = '50%';
$table3->data = []; $table3->data = [];
$row = []; $row = [];
$row[] = __('Raw URL'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('url', $url, '', 50, 2048, true); __('Raw URL'),
html_print_input_text('url', $url, '', 50, 2048, true)
);
$table3->data[] = $row; $table3->data[] = $row;
echo "<form method='post'>"; echo "<form method='post' class='max_floating_element_size'>";
echo '<fieldset>'; echo '<fieldset class="mrgn_btn_10px">';
echo '<legend>'.__('Credentials').'</legend>'; echo '<legend>'.__('Credentials').'</legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
echo '<fieldset>'; echo '<fieldset class="mrgn_btn_10px">';
echo '<legend>'.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).'</legend>'; echo '<legend>'.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).'</legend>';
html_print_table($table2); html_print_table($table2);
echo '</fieldset>'; echo '</fieldset>';
echo "<div class='right'>"; echo "<div class='right'>";
echo '</div>'; echo '</div>';
echo '<fieldset>'; echo '<fieldset class="mrgn_btn_10px">';
echo '<legend>'.__('Custom URL').'</legend>'; echo '<legend>'.__('Custom URL').'</legend>';
html_print_table($table3); html_print_table($table3);
echo '</fieldset>'; echo '</fieldset>';
echo "<div class='right'>";
html_print_input_hidden('api_execute', 1); html_print_input_hidden('api_execute', 1);
html_print_submit_button(__('Call'), 'submit', false, 'class="sub next"');
echo '</div>'; html_print_action_buttons(
html_print_submit_button(
__('Call'),
'submit',
false,
[ 'icon' => 'next' ],
true
)
);
echo '</form>'; echo '</form>';
if ($api_execute === true) { if ($api_execute === true) {
echo '<fieldset>'; echo '<fieldset class="mrgn_0px mrgn_btn_10px pdd_15px" style="max-width: 1122px;">';
echo '<legend>'.__('Result').'</legend>'; echo '<legend>'.__('Result').'</legend>';
echo __('URL').'<br />'; echo html_print_label_input_block(
html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true); __('URL'),
echo "&nbsp;<a id='show_icon' title='".__('Show URL')."' href='javascript: show_url();'>"; html_print_input_password('url', $return_call_api['url'], '', 150, 255, true, true, false, 'mrgn_top_10px'),
html_print_image('images/input_zoom.png'); ['label_class' => 'font-title-font']
echo '</a>'; );
echo '<br />'; echo '<br />';
echo __('Result').'<br />'; echo html_print_label_input_block(
html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"'); __('Result'),
html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"', true, 'w100p mrgn_top_10px'),
['label_class' => 'font-title-font']
);
echo '</fieldset>'; echo '</fieldset>';
} }
?> ?>

View File

@ -21,13 +21,23 @@ function extension_db_status()
$db_name = get_parameter('db_name', ''); $db_name = get_parameter('db_name', '');
$db_status_execute = (bool) get_parameter('db_status_execute', false); $db_status_execute = (bool) get_parameter('db_status_execute', false);
ui_print_page_header( ui_print_standard_header(
__('DB Schema check'), __('DB Schema check'),
'images/extensions.png', 'images/extensions.png',
false, false,
'db_status_tab', 'db_status_tab',
true, true,
'' [],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Run test'),
],
]
); );
if (!is_user_admin($config['id_user'])) { if (!is_user_admin($config['id_user'])) {
@ -46,32 +56,89 @@ function extension_db_status()
__('At the moment the checks is for MySQL/MariaDB.') __('At the moment the checks is for MySQL/MariaDB.')
); );
echo "<form method='post'>"; echo "<form method='post' class='max_floating_element_size'>";
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('DB settings').'</legend>'; echo '<legend>'.__('DB settings').'</legend>';
$table = new stdClass(); $table = new stdClass();
$table->data = []; $table->data = [];
$row = []; $row = [];
$row[] = __('DB User with privileges'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true); __('DB User with privileges'),
$row[] = __('DB Password for this user'); html_print_input_text(
$row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true); 'db_user',
$db_user,
'',
50,
255,
true,
false,
false,
'',
'w100p mrgn_top_10px'
)
);
$row[] = html_print_label_input_block(
__('DB Password for this user'),
html_print_input_password(
'db_password',
$db_password,
'',
50,
255,
true,
false,
false,
'w100p mrgn_top_10px'
)
);
$table->data[] = $row; $table->data[] = $row;
$row = []; $row = [];
$row[] = __('DB Hostname'); $row[] = html_print_label_input_block(
$row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true); __('DB Hostname'),
$row[] = __('DB Name (temporal for testing)'); html_print_input_text(
$row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true); 'db_host',
$db_host,
'',
50,
255,
true,
false,
false,
'',
'w100p mrgn_top_10px'
)
);
$row[] = html_print_label_input_block(
__('DB Name (temporal for testing)'),
html_print_input_text(
'db_name',
$db_name,
'',
50,
255,
true,
false,
false,
'',
'w100p mrgn_top_10px'
)
);
$table->data[] = $row; $table->data[] = $row;
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
echo "<div class='right'>"; html_print_action_buttons(
html_print_input_hidden('db_status_execute', 1); html_print_submit_button(
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"'); __('Execute Test'),
echo '</div>'; 'submit',
false,
[ 'icon' => 'cog' ],
true
)
);
html_print_input_hidden('db_status_execute', 1);
echo '</form>'; echo '</form>';
if ($db_status_execute) { if ($db_status_execute) {

View File

@ -76,10 +76,6 @@ function dbmgr_extension_main()
global $config; global $config;
if (is_metaconsole() === true) {
open_meta_frame();
}
if (!is_user_admin($config['id_user'])) { if (!is_user_admin($config['id_user'])) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -92,7 +88,21 @@ function dbmgr_extension_main()
$sql = (string) get_parameter('sql'); $sql = (string) get_parameter('sql');
$node_id = (int) get_parameter('node_id', -1); $node_id = (int) get_parameter('node_id', -1);
ui_print_page_header(__('Database interface'), 'images/gm_db.png', false, false, true); // Header.
ui_print_standard_header(
__('Database interface'),
'images/gm_db.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Extensions'),
],
]
);
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$img = '../../images/warning_modern.png'; $img = '../../images/warning_modern.png';
@ -122,47 +132,37 @@ function dbmgr_extension_main()
echo $warning_message; echo $warning_message;
} }
ui_print_warning_message(
__(
"This is an advanced extension to interface with %s database directly from WEB console
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
if you don't know </b>exactly</b> what are you are doing,
this means that you can severily damage your setup using this extension.
This extension is intended to be used <b>only by experienced users</b>
with a depth knowledge of %s internals.",
get_product_name(),
get_product_name(),
get_product_name()
)
);
echo "<form method='post' action=''>"; echo "<form method='post' action=''>";
$table = new stdClass(); $table = new stdClass();
$table->id = 'db_interface'; $table->id = 'db_interface';
$table->class = 'databox'; $table->class = 'databox no_border filter-table-adv';
$table->width = '100%'; $table->width = '100%';
$table->data = []; $table->data = [];
$table->head = [];
$table->colspan = []; $table->colspan = [];
$table->rowstyle = []; $table->style[0] = 'width: 30%;';
$table->style[1] = 'width: 70%;';
$table->colspan[0][0] = 2;
$table->colspan[1][0] = 2; $table->colspan[1][0] = 2;
$table->rowspan[2][0] = 3;
$table->rowclass[0] = 'notify'; $data[0][0] = "<b>Some samples of usage:</b> <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
$table->rowclass[3] = 'pdd_5px'; $data[0][0] = html_print_label_input_block(
$table->rowclass[3] = 'flex-content-right'; __('Some samples of usage:'),
$table->rowclass[4] = 'flex-content-right'; "<blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>"
$data[0][0] = __(
"This is an advanced extension to interface with %s database directly from WEB console
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
if you don't know </b>exactly</b> what are you are doing,
this means that you can severily damage your setup using this extension.
This extension is intended to be used <b>only by experienced users</b>
with a depth knowledge of %s internals.",
get_product_name(),
get_product_name(),
get_product_name()
);
$data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
$data[2][0] = html_print_textarea(
'sql',
5,
50,
html_entity_decode($sql, ENT_QUOTES),
'',
true
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
@ -181,32 +181,57 @@ function dbmgr_extension_main()
$servers = []; $servers = [];
} }
$data[3][2] = html_print_input( $data[0][1] = html_print_label_input_block(
[ __('Select query target'),
'name' => 'node_id', html_print_select(
'type' => 'select', $servers,
'fields' => $servers, 'node_id',
'selected' => $node_id, $node_id,
'nothing' => __('This metaconsole'), '',
'nothing_value' => -1, __('This metaconsole'),
'return' => true, -1,
'label' => _('Select query target'), true,
] false,
false,
'w40p',
false,
'width: 40%;'
)
); );
} }
$data[4][2] = '<div class="action-buttons w100p">'; $data[1][0] = html_print_textarea(
$data[4][2] .= html_print_submit_button( 'sql',
3,
50,
html_entity_decode($sql, ENT_QUOTES),
'placeholder="'.__('Type your query here...').'"',
true,
'w100p'
);
$execute_button = html_print_submit_button(
__('Execute SQL'), __('Execute SQL'),
'', '',
false, false,
'class="sub next"', [ 'icon' => 'cog' ],
true true
); );
$data[4][2] .= '</div>';
$table->data = $data; $table->data = $data;
html_print_table($table); // html_print_table($table);
html_print_action_buttons($execute_button);
ui_toggle(
html_print_table($table, true),
'<span class="subsection_header_title">'.__('SQL query').'</span>',
__('SQL query'),
'query',
false,
false,
'',
'white-box-content no_border',
'box-flat white_table_graph fixed_filter_bar'
);
echo '</form>'; echo '</form>';
// Processing SQL Code. // Processing SQL Code.
@ -214,10 +239,6 @@ function dbmgr_extension_main()
return; return;
} }
echo '<br />';
echo '<hr />';
echo '<br />';
try { try {
if (\is_metaconsole() === true && $node_id !== -1) { if (\is_metaconsole() === true && $node_id !== -1) {
$node = new Node($node_id); $node = new Node($node_id);
@ -282,22 +303,17 @@ function dbmgr_extension_main()
html_print_table($table); html_print_table($table);
echo '</div>'; echo '</div>';
if (is_metaconsole()) {
close_meta_frame();
}
} }
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// This adds a option in the operation menu. // This adds a option in the operation menu.
extensions_add_meta_menu_option( extensions_add_meta_menu_option(
'DB interface', __('DB interface'),
'PM', 'PM',
'gextensions', 'gextensions',
'database.png', 'database.png',
'v1r1', 'v1r1'
'gdbman'
); );
extensions_add_meta_function('dbmgr_extension_main'); extensions_add_meta_function('dbmgr_extension_main');

View File

@ -24,7 +24,6 @@ table.dbmanager th {
} }
textarea { textarea {
min-height: 50px; width: 100% !important;
height: 50px; max-width: 100% !important;
width: 95%;
} }

View File

@ -25,13 +25,28 @@ function extension_uploader_extensions()
return; return;
} }
ui_print_page_header( // Header.
__('Uploader extension'), ui_print_standard_header(
__('Extensions'),
'images/extensions.png', 'images/extensions.png',
false, false,
'', '',
true, true,
'' [],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('Uploader extension'),
],
]
); );
$upload = (bool) get_parameter('upload', 0); $upload = (bool) get_parameter('upload', 0);
@ -77,20 +92,52 @@ function extension_uploader_extensions()
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->size[0] = '20%';
$table->size[1] = '20%';
$table->size[2] = '60%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Upload extension');
$table->data[0][1] = html_print_input_file('extension', true).ui_print_help_tip(__('Upload the extension as a zip file.'), true); $table->data[0][0] = html_print_label_input_block(
__('Upload extension').ui_print_help_tip(__('Upload the extension as a zip file.'), true),
html_print_input_file(
'extension',
true,
[
'required' => true,
'accept' => '.zip',
]
)
);
if (enterprise_installed()) { if (enterprise_installed()) {
$table->data[0][2] = __('Upload enterprise extension').'&nbsp;'.html_print_checkbox('upload_enterprise', 1, false, true); $table->data[0][1] = html_print_label_input_block(
__('Upload enterprise extension'),
html_print_checkbox(
'upload_enterprise',
1,
false,
true
)
);
} else {
$table->data[0][1] = '';
} }
$table->data[0][2] = '';
echo "<form method='post' enctype='multipart/form-data'>"; echo "<form method='post' enctype='multipart/form-data'>";
html_print_table($table); html_print_table($table);
echo "<div class='right' style='width: ".$table->width."'>";
html_print_input_hidden('upload', 1); html_print_input_hidden('upload', 1);
html_print_submit_button(__('Upload'), 'submit', false, 'class="sub add"'); html_print_action_buttons(
echo '</div>'; html_print_submit_button(
__('Upload'),
'submit',
false,
['icon' => 'wand'],
true
)
);
echo '</form>'; echo '</form>';
} }

View File

@ -115,19 +115,41 @@ function pandora_files_repo_godmode()
} }
// Header tabs. // Header tabs.
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/setup.png', true, ['title' => __('Administration view'), 'class' => 'invert_filter']).'</a>'; $godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$godmode['godmode'] = 1; $godmode['godmode'] = 1;
$godmode['active'] = 1; $godmode['active'] = 1;
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/eye_show.png', true, ['title' => __('Operation view'), 'class' => 'invert_filter']).'</a>'; $operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$operation['operation'] = 1; $operation['operation'] = 1;
$onheader = [ $onheader = [
'godmode' => $godmode, 'godmode' => $godmode,
'operation' => $operation, 'operation' => $operation,
]; ];
// Header. // Header.
ui_print_page_header(__('Files repository manager'), 'images/extensions.png', false, '', true, $onheader); ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
$onheader,
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('Files repository manager'),
],
]
);
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/'; $full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
include_once $full_extensions_dir.'files_repo/functions_files_repo.php'; include_once $full_extensions_dir.'files_repo/functions_files_repo.php';
@ -204,10 +226,10 @@ function pandora_files_repo_operation()
// Header tabs. // Header tabs.
$onheader = []; $onheader = [];
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/setup.png', true, ['title' => __('Administration view'), 'class' => 'invert_filter']).'</a>'; $godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$godmode['godmode'] = 1; $godmode['godmode'] = 1;
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/eye_show.png', true, ['title' => __('Operation view'), 'class' => 'invert_filter']).'</a>'; $operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$operation['operation'] = 1; $operation['operation'] = 1;
$operation['active'] = 1; $operation['active'] = 1;

View File

@ -32,17 +32,15 @@ if (isset($file_id) && $file_id > 0) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->style = []; $table->size[0] = '50%';
$table->style[0] = 'font-weight: bold;'; $table->size[1] = '50%';
$table->style[2] = 'text-align: center;';
$table->colspan = [];
$table->data = []; $table->data = [];
// GROUPS // GROUPS.
$groups = groups_get_all(); $groups = groups_get_all();
// Add the All group to the beginning to be always the first // Add the All group to the beginning to be always the first.
// Use this instead array_unshift to keep the array keys // Use this instead array_unshift to keep the array keys.
$groups = ([0 => __('All')] + $groups); $groups = ([0 => __('All')] + $groups);
$groups_selected = []; $groups_selected = [];
foreach ($groups as $id => $name) { foreach ($groups as $id => $name) {
@ -52,66 +50,110 @@ foreach ($groups as $id => $name) {
} }
$row = []; $row = [];
$row[0] = __('Groups'); $row[0] = html_print_label_input_block(
$row[1] = '<div class="w290px">'.html_print_select_groups( __('Groups'),
// Id_user. html_print_select_groups(
false, // Id_user.
// Privilege. false,
'AR', // Privilege.
// ReturnAllGroup. 'AR',
true, // ReturnAllGroup.
// Name. true,
'groups[]', // Name.
// Selected. 'groups[]',
$groups_selected, // Selected.
// Script. $groups_selected,
'', // Script.
// Nothing. '',
'', // Nothing.
// Nothing_value. '',
0, // Nothing_value.
// Return. 0,
true, // Return.
// Multiple. true,
true // Multiple.
).'</div>'; true
$table->data[] = $row; )
$table->colspan[][1] = 3; );
// DESCRIPTION // DESCRIPTION.
$row = []; $row[1] = html_print_label_input_block(
$row[0] = __('Description'); __('Description').ui_print_help_tip(__('Only 200 characters are permitted'), true),
$row[0] .= ui_print_help_tip(__('Only 200 characters are permitted'), true); html_print_textarea(
$row[1] = html_print_textarea('description', 3, 20, $file['description'], 'class="file_repo_description"', true); 'description',
4,
20,
$file['description'],
'class="file_repo_description" style="min-height: 60px; max-height: 60px;"',
true
)
);
$table->data[] = $row; $table->data[] = $row;
$table->colspan[][1] = 3;
// FILE and SUBMIT BUTTON // FILE and SUBMIT BUTTON.
$row = []; $row = [];
// Public checkbox // Public checkbox.
$checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true); $checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true);
$style = 'class="inline padding-2-10"'; $style = 'class="inline padding-2-10"';
$row[0] = __('File'); $row[0] = __('File');
if ($file_id > 0) { if ($file_id > 0) {
$row[1] = $file['name']; $submit_button = html_print_submit_button(
$row[2] = "<div $style>".__('Public link')."&nbsp;$checkbox</div>"; __('Update'),
$row[3] = html_print_submit_button(__('Update'), 'submit', false, 'class="sub upd"', true); 'submit',
$row[3] .= html_print_input_hidden('update_file', 1, true); false,
$row[3] .= html_print_input_hidden('file_id', $file_id, true); ['icon' => 'wand'],
true
);
$row[0] = html_print_label_input_block(
__('File'),
$file['name']
);
$row[1] = html_print_label_input_block(
__('Public link'),
$checkbox.html_print_input_hidden(
'file_id',
$file_id,
true
)
);
} else { } else {
$row[1] = html_print_input_file('upfile', true); $submit_button = html_print_submit_button(
$row[2] = "<div $style>".__('Public link')."&nbsp;$checkbox</div>"; __('Add'),
$row[3] = html_print_submit_button(__('Add'), 'submit', false, 'class="sub add"', true); 'submit',
$row[3] .= html_print_input_hidden('add_file', 1, true); false,
['icon' => 'wand'],
true
);
$row[0] = html_print_label_input_block(
__('File'),
html_print_input_file(
'upfile',
true
)
);
$row[1] = html_print_label_input_block(
__('Public link'),
$checkbox.html_print_input_hidden(
'add_file',
1,
true
)
);
} }
$table->data[] = $row; $table->data[] = $row;
$table->colspan[][1] = 1;
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo'); $url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
echo "<form method='post' action='$url' enctype='multipart/form-data'>"; echo "<form method='post' action='$url' enctype='multipart/form-data'>";
html_print_table($table); html_print_table($table);
html_print_action_buttons($submit_button);
echo '</form>'; echo '</form>';
?> ?>

View File

@ -98,7 +98,7 @@ if (!empty($files)) {
// Last modification // Last modification
// Public URL // Public URL
$data[4] = ''; $data[4] = '';
$table->cellclass[][4] = 'action_buttons'; $table->cellclass[][4] = 'table_action_buttons';
if (!empty($file['hash'])) { if (!empty($file['hash'])) {
$public_url = ui_get_full_url( $public_url = ui_get_full_url(
EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash'] EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']
@ -133,9 +133,12 @@ if (!empty($files)) {
); );
$data[4] .= "<a href=\"$config_url\">"; $data[4] .= "<a href=\"$config_url\">";
$data[4] .= html_print_image( $data[4] .= html_print_image(
'images/config.png', 'images/edit.svg',
true, true,
['title' => __('Edit')] [
'title' => __('Edit'),
'class' => 'main_menu_icon invert_filter',
]
); );
// Edit image // Edit image
$data[4] .= '</a>'; $data[4] .= '</a>';
@ -145,11 +148,11 @@ if (!empty($files)) {
); );
$data[4] .= " <a href=\"$delete_url\" onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\">"; $data[4] .= " <a href=\"$delete_url\" onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\">";
$data[4] .= html_print_image( $data[4] .= html_print_image(
'images/cross.png', 'images/delete.svg',
true, true,
[ [
'title' => __('Delete'), 'title' => __('Delete'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
// Delete image // Delete image

View File

@ -1,16 +1,32 @@
<?php <?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 // Load global vars.
// ==================================================
// 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.
global $config; global $config;
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
@ -55,7 +71,24 @@ function mainInsertData()
{ {
global $config; 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'])) { if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) {
db_pandora_audit( db_pandora_audit(
@ -84,6 +117,13 @@ function mainInsertData()
$csv = false; $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 ($save) {
if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), 'AW')) { 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.')); 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">'; $modules = [];
echo sprintf( if ($agent_id > 0) {
__('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.'), $modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
$config['remote_config'] }
);
echo '</div>';
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->class = 'databox filter-table-adv';
$table->class = 'databox filters';
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bolder;'; $table->cellstyle[0][0] = 'width: 0';
$table->cellstyle[0][1] = 'width: 0';
$table->data = []; $table->data = [];
$table->data[0][0] = '<label>'.__('Agent').'</label>';
$table->data[0][0] = __('Agent'); $table->data[0][1] = '<label>'.__('Module').'</label>';
$table->data[0][2] = '<label>'.__('Date').'</label>';
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'agent_name'; $params['input_name'] = 'agent_name';
$params['value'] = $agent_name; $params['value'] = ($save === true) ? '' : $agent_name;
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['javascript_name_function_select'] = 'custom_select_function'; $params['javascript_name_function_select'] = 'custom_select_function';
$params['javascript_code_function_select'] = ''; $params['javascript_code_function_select'] = '';
@ -170,18 +208,12 @@ function mainInsertData()
$params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id; $params['hidden_input_idagent_value'] = $agent_id;
$table->data[0][1] = ui_print_agent_autocomplete_input($params); $table->data[1][0] = html_print_div(['class' => 'flex flex-items-center', 'content' => ui_print_agent_autocomplete_input($params)], true);
$table->data[1][0] = __('Module');
$modules = [];
if ($agent_id) {
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
}
$table->data[1][1] = html_print_select( $table->data[1][1] = html_print_select(
$modules, $modules,
'id_agent_module', 'id_agent_module',
$id_agent_module, ($save === true) ? '' : $id_agent_module,
true, true,
__('Select'), __('Select'),
0, 0,
@ -191,22 +223,45 @@ function mainInsertData()
'', '',
empty($agent_id) empty($agent_id)
); );
$table->data[2][0] = __('Data'); $table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true); $table->data[1][2] .= '&nbsp;';
$table->data[3][0] = __('Date'); $table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
$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[2][0] = '<label>'.__('Data').'</label>';
$table->data[4][0] = __('CSV'); $table->data[2][1] = '<label>'.__('CSV').'</label>';
$table->data[4][1] = html_print_input_file('csv', true); $table->data[3][0] = html_print_input_text(
'data',
$data,
__('Data'),
40,
60,
true
);
$table->data[3][1] = html_print_div(
[
'class' => '',
'content' => html_print_input_file('csv', true),
],
true
);
echo "<form method='post' enctype='multipart/form-data'>"; echo "<form method='post' enctype='multipart/form-data'>";
html_print_table($table); html_print_table($table);
echo "<div class='right' style='width: ".$table->width."'>";
html_print_input_hidden('save', 1); html_print_input_hidden('save', 1);
html_print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"');
echo '</div>'; html_print_action_buttons(
html_print_submit_button(
__('Save'),
'submit',
// (empty($id_agent) === true),
false,
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
);
echo '</form>'; echo '</form>';
@ -257,8 +312,8 @@ function mainInsertData()
$('#id_agent_module').enable(); $('#id_agent_module').enable();
$('#id_agent_module').fadeIn ('normal'); $('#id_agent_module').fadeIn ('normal');
$('#submit-submit').enable(); $('button [name="submit"]').removeClass('disabled_action_button');
$('#submit-submit').fadeIn ('normal'); $('button [name="submit"]').fadeIn ('normal');
} }
}); });
} }

View File

@ -266,24 +266,68 @@ function mainModuleGroups()
] ]
); );
echo "<table cellpadding='4' cellspacing='4' class='databox filters bolder margin-bottom-10' width='100%'> $output = "<form method='post'
<tr>"; action='index.php?sec=view&sec2=extensions/module_groups'>";
echo "<form method='post'
action='index.php?sec=view&sec2=extensions/module_groups'>";
echo '<td>'; $output .= "<table cellpadding='4' cellspacing='4' class='filter-table-adv margin-bottom-10' width='100%'><tr>";
echo __('Search by agent group').'&nbsp;'; $output .= '<td>';
html_print_input_text('agent_group_search', $agent_group_search); $output .= html_print_label_input_block(
__('Search by agent group'),
html_print_input_text(
'agent_group_search',
$agent_group_search,
'',
50,
255,
true
)
);
echo '</td><td>'; $output .= '</td><td>';
echo __('Search by module group').'&nbsp;'; $output .= html_print_label_input_block(
html_print_input_text('module_group_search', $module_group_search); __('Search by module group'),
html_print_input_text(
'module_group_search',
$module_group_search,
'',
50,
255,
true
)
);
$output .= '</td>';
$output .= '</tr></table>';
echo '</td><td>'; $output .= html_print_div(
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>"; [
echo '</form>'; 'class' => 'action-buttons',
echo '<td>'; 'content' => html_print_submit_button(
echo '</tr></table>'; __('Filter'),
'srcbutton',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
$output .= '</form>';
ui_toggle(
$output,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
$cell_style = ' $cell_style = '
min-width: 60px; min-width: 60px;
@ -299,26 +343,35 @@ function mainModuleGroups()
if ($info && $array_module_group) { if ($info && $array_module_group) {
$table = new StdClass(); $table = new StdClass();
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; $table->class = 'info_table';
$table->style[0] = 'font-weight: bolder; min-width: 230px;';
$table->width = '100%'; $table->width = '100%';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#333';
} else {
$background_color = '#fff';
}
$head[0] = __('Groups'); $head[0] = __('Groups');
$headstyle[0] = 'width: 20%; font-weight: bolder;'; $headstyle[0] = 'width: 20%; font-weight: bolder;';
foreach ($array_module_group as $key => $value) { foreach ($array_module_group as $key => $value) {
$headstyle[] = 'min-width: 60px;max-width: 5%;text-align:center; color: #ffffff; background-color: #373737; font-weight: bolder;'; $headstyle[] = 'min-width: 60px;max-width: 5%;text-align:center; font-weight: bolder;';
$head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '&hellip;', 'color:#FFF'); $head[] = ui_print_truncate_text(
$value,
GENERIC_SIZE_TEXT,
true,
true,
true,
'&hellip;'
);
} }
$i = 0; $i = 0;
foreach ($array_for_defect as $key => $value) { foreach ($array_for_defect as $key => $value) {
$deep = groups_get_group_deep($key); $deep = groups_get_group_deep($key);
$data[$i][0] = $deep.ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '&hellip;', 'color:#FFF'); $data[$i][0] = $deep.ui_print_truncate_text(
$value['data']['name'],
GENERIC_SIZE_TEXT,
true,
true,
true,
'&hellip;'
);
$j = 1; $j = 1;
if (isset($array_data[$key])) { if (isset($array_data[$key])) {
foreach ($value['gm'] as $k => $v) { foreach ($value['gm'] as $k => $v) {
@ -378,25 +431,37 @@ function mainModuleGroups()
$table->headstyle = $headstyle; $table->headstyle = $headstyle;
$table->data = $data; $table->data = $data;
ui_pagination($counter);
echo "<div class='w100p' style='overflow-x:auto;'>"; echo "<div class='w100p' style='overflow-x:auto;'>";
html_print_table($table); html_print_table($table);
echo '</div>'; echo '</div>';
ui_pagination($counter); $tablePagination = ui_pagination(
$counter,
false,
0,
0,
true,
'offset',
false
);
echo "<div class='legend_basic w99p'>"; html_print_action_buttons(
echo '<table >'; '',
echo "<tr><td colspan='2' class='pdd_b_10px'><b>".__('Legend').'</b></td></tr>'; [ 'right_content' => $tablePagination ]
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module group and agent have at least one alarm fired.').'</td></tr>'; );
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module group and agent have at least one module in critical status and the others in any status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'</td></tr>'; $show_legend = '<div>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'</td></tr>'; $show_legend .= '<table>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module group and agent have all modules in OK status').'</td></tr>'; $show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module group and agent have at least one alarm fired.').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__('Blue cell when the module group and agent have all modules in not init status.').'</td></tr>'; $show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module group and agent have at least one module in critical status and the others in any status').'</td></tr>';
echo '</table>'; $show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'</td></tr>';
echo '</div>'; $show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'</td></tr>';
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module group and agent have all modules in OK status').'</td></tr>';
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__('Blue cell when the module group and agent have all modules in not init status.').'</td></tr>';
$show_legend .= '</table>';
$show_legend .= '</div>';
ui_toggle($show_legend, __('Legend'));
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('This table shows in columns the modules group and in rows agents group. The cell shows all modules') ]); ui_print_info_message(['no_close' => true, 'message' => __('This table shows in columns the modules group and in rows agents group. The cell shows all modules') ]);
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups or module groups') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups or module groups') ]);

View File

@ -11,11 +11,12 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
function view_logfile($file_name) function view_logfile($file_name, $toggle=false)
{ {
global $config; global $config;
$memory_limit = ini_get('memory_limit'); $memory_limit = ini_get('memory_limit');
$code = '';
if (strstr($memory_limit, 'M') !== false) { if (strstr($memory_limit, 'M') !== false) {
$memory_limit = str_replace('M', '', $memory_limit); $memory_limit = str_replace('M', '', $memory_limit);
@ -31,21 +32,37 @@ function view_logfile($file_name)
$file_size = filesize($file_name); $file_size = filesize($file_name);
if ($memory_limit < $file_size) { if ($memory_limit < $file_size) {
echo "<h2>$file_name (".__('File is too large than PHP memory allocated in the system.').')</h2>'; $code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
echo '<h2>'.__('The preview file is imposible.').'</h2>'; $code .= '<h2>'.__('The preview file is imposible.').'</h2>';
} else if ($file_size > ($config['max_log_size'] * 1000)) { } else if ($file_size > ($config['max_log_size'] * 1000)) {
$data = file_get_contents($file_name, false, null, ($file_size - ($config['max_log_size'] * 1000))); $data = file_get_contents($file_name, false, null, ($file_size - ($config['max_log_size'] * 1000)));
echo "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>'; $code .= "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>';
echo "<textarea class='pandora_logs' name='$file_name'>"; $code .= "<textarea class='pandora_logs' name='$file_name'>";
echo '... '; $code .= '... ';
echo $data; $code .= $data;
echo '</textarea><br><br>'; $code .= '</textarea><br><br>';
} else { } else {
$data = file_get_contents($file_name); $data = file_get_contents($file_name);
echo "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>'; $code .= "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>';
echo "<textarea class='pandora_logs' name='$file_name'>"; $code .= "<textarea class='pandora_logs' name='$file_name'>";
echo $data; $code .= $data;
echo '</textarea><br><br>'; $code .= '</textarea><br><br></pre>';
}
if ($toggle === true) {
ui_toggle(
$code,
'<span class="subsection_header_title">'.$file_name.'</span>',
$file_name,
'a',
false,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph'
);
} else {
echo $code;
} }
} }
} }
@ -64,21 +81,45 @@ function pandoralogs_extension_main()
return; return;
} }
ui_print_page_header(__('System logfile viewer'), 'images/extensions.png', false, '', true, ''); // Header.
ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('System logfile viewer'),
],
]
);
echo '<p>'.__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'</p>'; ui_print_info_message(
__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'<br>
echo '<p>'.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment').'</p>'; '.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment')
);
$logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora'; $logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora';
// Do not attempt to show console log if disabled. // Do not attempt to show console log if disabled.
if ($config['console_log_enabled']) { if ($config['console_log_enabled']) {
view_logfile($config['homedir'].'/log/console.log'); view_logfile($config['homedir'].'/log/console.log', true);
} }
view_logfile($logs_directory.'/pandora_server.log'); view_logfile($logs_directory.'/pandora_server.log', true);
view_logfile($logs_directory.'/pandora_server.error'); view_logfile($logs_directory.'/pandora_server.error', true);
} }

View File

@ -151,7 +151,7 @@ function quickShell()
'name' => 'submit', 'name' => 'submit',
'label' => __('Retry'), 'label' => __('Retry'),
'type' => 'submit', 'type' => 'submit',
'attributes' => 'class="sub next"', 'attributes' => ['icon' => 'next'],
'return' => true, 'return' => true,
], ],
], ],
@ -202,7 +202,7 @@ function quickShell()
'arguments' => [ 'arguments' => [
'type' => 'submit', 'type' => 'submit',
'label' => __('Connect'), 'label' => __('Connect'),
'attributes' => 'class="sub next"', 'attributes' => ['icon' => 'cog'],
], ],
], ],
], ],
@ -544,7 +544,7 @@ if (empty($agent_id) === false
// TabName. // TabName.
__('QuickShell'), __('QuickShell'),
// TabIcon. // TabIcon.
'images/ehorus/terminal.png', 'images/quick-shell@svg.svg',
// TabFunction. // TabFunction.
'quickShell', 'quickShell',
// Version. // Version.

View File

@ -74,61 +74,11 @@ function pandora_realtime_graphs()
); );
} }
$chart[time()]['graph'] = '0';
$interactive_graph = true;
$color = [];
$legend = '';
$long_index = [];
$no_data_image = '';
$canvas = '<div id="graph_container" class="graph_container">';
$canvas .= '<div id="chartLegend" class="chartLegend"></div>';
$width = 800;
$height = 300;
$data_array['realtime']['data'][0][0] = (time() - 10);
$data_array['realtime']['data'][0][1] = 0;
$data_array['realtime']['data'][1][0] = time();
$data_array['realtime']['data'][1][1] = 0;
$data_array['realtime']['color'] = 'green';
$params = [
'agent_module_id' => false,
'period' => 300,
'width' => $width,
'height' => $height,
'unit' => $unit,
'only_image' => $only_image,
'homeurl' => $homeurl,
'type_graph' => 'area',
'font' => $config['fontpath'],
'font-size' => $config['font_size'],
'array_data_create' => $data_array,
'show_legend' => false,
'show_menu' => false,
];
$canvas .= grafico_modulo_sparse($params);
$canvas .= '</div>';
echo $canvas;
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->id = 'table-form'; $table->id = 'table-form';
$table->class = 'databox filters'; $table->class = 'filter-table-adv';
$table->style = []; $table->style = [];
$table->cellpadding = '0';
$table->cellspacing = '0';
$table->style['graph'] = 'font-weight: bold;';
$table->style['refresh'] = 'font-weight: bold;';
$table->style['incremental'] = 'font-weight: bold;';
$table->style['reset'] = 'font-weight: bold;';
$table->style['snmp_address'] = 'font-weight: bold;';
$table->style['snmp_community'] = 'font-weight: bold;';
$table->style['snmp_oid'] = 'font-weight: bold;';
$table->style['snmp_oid'] = 'font-weight: bold;';
$table->data = []; $table->data = [];
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name()); $graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
@ -158,15 +108,22 @@ function pandora_realtime_graphs()
$refresh = get_parameter('refresh', '1000'); $refresh = get_parameter('refresh', '1000');
if ($graph != 'snmp_module') { if ($graph != 'snmp_module') {
$data['graph'] = __('Graph').'&nbsp;&nbsp;'; $data['graph'] = html_print_label_input_block(
$data['graph'] .= html_print_select( __('Graph'),
$graph_fields, html_print_select(
'graph', $graph_fields,
$graph, 'graph',
'', $graph,
'', '',
0, '',
true 0,
true,
false,
true,
'',
false,
'width: 100%'
)
); );
} }
@ -179,18 +136,35 @@ function pandora_realtime_graphs()
$agent_alias = io_safe_output(get_parameter('agent_alias', '')); $agent_alias = io_safe_output(get_parameter('agent_alias', ''));
$module_name = io_safe_output(get_parameter('module_name', '')); $module_name = io_safe_output(get_parameter('module_name', ''));
$module_incremental = get_parameter('incremental', 0); $module_incremental = get_parameter('incremental', 0);
$data['module_info'] = $agent_alias.': <b>'.$module_name.'</b>'; $data['module_info'] = html_print_label_input_block(
$agent_alias.': '.$module_name,
// Append all the hidden in this cell. html_print_input_hidden(
$data['module_info'] .= html_print_input_hidden( 'incremental',
'incremental', $module_incremental,
$module_incremental, true
true ).html_print_select(
['snmp_module' => '-'],
'graph',
'snmp_module',
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%; display: none;'
)
); );
$data['module_info'] .= html_print_select( }
['snmp_module' => '-'],
'graph', $data['refresh'] = html_print_label_input_block(
'snmp_module', __('Refresh interval'),
html_print_select(
$refresh_fields,
'refresh',
$refresh,
'', '',
'', '',
0, 0,
@ -199,33 +173,17 @@ function pandora_realtime_graphs()
true, true,
'', '',
false, false,
'display: none;' 'width: 100%'
)
);
if ($graph != 'snmp_module') {
$data['incremental'] = html_print_label_input_block(
__('Incremental'),
html_print_checkbox_switch('incremental', 1, 0, true)
); );
} }
$data['refresh'] = __('Refresh interval').'&nbsp;&nbsp;';
$data['refresh'] .= html_print_select(
$refresh_fields,
'refresh',
$refresh,
'',
'',
0,
true
);
if ($graph != 'snmp_module') {
$data['incremental'] = __('Incremental').'&nbsp;&nbsp;';
$data['incremental'] .= html_print_checkbox('incremental', 1, 0, true);
}
$data['reset'] = html_print_button(
__('Clear graph'),
'reset',
false,
'javascript:realtimeGraphs.clearGraph();',
'class="sub delete mgn_tp_0" ',
true
);
$table->data[] = $data; $table->data[] = $data;
if ($graph == 'snmp_interface' || $graph == 'snmp_module') { if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
@ -236,10 +194,79 @@ function pandora_realtime_graphs()
html_print_input_hidden('rel_path', get_parameter('rel_path', '')); html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
// Print the form. // Print the form.
echo '<form id="realgraph" method="post">'; $searchForm = '<form id="realgraph" method="post">';
html_print_table($table); $searchForm .= html_print_table($table, true);
echo '</form>'; $searchForm .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Clear graph'),
'srcbutton',
false,
[
'icon' => 'delete',
'mode' => 'mini',
'onClick' => 'javascript:realtimeGraphs.clearGraph();',
],
true
),
],
true
);
$searchForm .= '</form>';
ui_toggle(
$searchForm,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
$chart[time()]['graph'] = '0';
$canvas = '<div id="graph_container" class="graph_container">';
$canvas .= '<div id="chartLegend" class="chartLegend"></div>';
$width = 800;
$height = 300;
$data_array['realtime']['data'][0][0] = (time() - 10);
$data_array['realtime']['data'][0][1] = 0;
$data_array['realtime']['data'][1][0] = time();
$data_array['realtime']['data'][1][1] = 0;
$data_array['realtime']['color'] = 'green';
$params = [
'agent_module_id' => false,
'period' => 300,
'width' => $width,
'height' => $height,
'only_image' => false,
'type_graph' => 'area',
'font' => $config['fontpath'],
'font-size' => $config['font_size'],
'array_data_create' => $data_array,
'show_legend' => false,
'show_menu' => false,
'backgroundColor' => 'transparent',
];
$canvas .= grafico_modulo_sparse($params);
$canvas .= '</div>';
html_print_div(
[
'class' => 'white_box',
'content' => $canvas,
]
);
// echo $canvas;
// Define a custom action to save // Define a custom action to save
// the OID selected in the SNMP browser to the form. // the OID selected in the SNMP browser to the form.
html_print_input_hidden( html_print_input_hidden(

View File

@ -12,6 +12,5 @@
#graph_container { #graph_container {
width: 800px; width: 800px;
margin: 20px auto; margin: 20px auto;
background-color: white;
border-radius: 3px; border-radius: 3px;
} }

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Resources exportation view.
*
* @category Extensions.
* @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 // Load global vars.
// ==================================================
// 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.
if (isset($_GET['get_ptr'])) { if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) { if ($_GET['get_ptr'] == 1) {
$ownDir = dirname(__FILE__).'/'; $ownDir = dirname(__FILE__).'/';
@ -123,13 +139,6 @@ function output_xml_report($id)
$agent = null; $agent = null;
switch (io_safe_output($item['type'])) { switch (io_safe_output($item['type'])) {
case 1:
case 'simple_graph':
break;
case 'simple_baseline_graph':
break;
case 2: case 2:
case 'custom_graph': case 'custom_graph':
case 'automatic_custom_graph': case 'automatic_custom_graph':
@ -169,30 +178,6 @@ function output_xml_report($id)
} }
break; 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': case 'text':
echo '<text><![CDATA['.io_safe_output($item['text'])."]]></text>\n"; echo '<text><![CDATA['.io_safe_output($item['text'])."]]></text>\n";
break; break;
@ -224,18 +209,6 @@ function output_xml_report($id)
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n"; echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
break; break;
case 'event_report_module':
break;
case 'alert_report_module':
break;
case 'alert_report_agent':
break;
case 'alert_report_group':
break;
case 'url': case 'url':
echo '<url><![CDATA['.io_safe_output($values['external_source']).']]></url>'; echo '<url><![CDATA['.io_safe_output($values['external_source']).']]></url>';
break; break;
@ -245,6 +218,29 @@ function output_xml_report($id)
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>'; echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>'; echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
break; 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 'agent_detailed_event':
case 'event_report_agent':
case 'event_report_module':
case 'alert_report_module':
case 'alert_report_agent':
case 'alert_report_group':
default:
// Do nothing.
break;
} }
echo "</item>\n"; echo "</item>\n";
@ -417,25 +413,59 @@ function resource_exportation_extension_main()
$hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php'); $hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php');
ui_print_page_header(__('Resource exportation'), 'images/extensions.png', false, '', true, ''); ui_print_standard_header(
__('Resource exportation'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Resource exporting'),
],
]
);
echo '<div class=notify>'; ui_print_warning_message(
echo __('This extension makes exportation of resource template more easy.').' '.__('You can export resource templates in .ptr format.'); __('This extension makes exportation of resource template more easy.').'<br>'.__('You can export resource templates in .ptr format.')
echo '</div>'; );
echo '<br /><br />';
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->class = 'databox filter-table-adv';
$table->style[0] = 'width: 30%;'; $table->id = 'resource_exportation_table';
$table->style[1] = 'width: 10%;'; $table->style = [];
$table->class = 'databox filters'; $table->style[0] = 'width: 30%';
$table->data[0][0] = __('Report'); $table->style[1] = 'vertical-align: bottom;';
$table->data[0][1] = html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true); $table->data = [];
$table->data[0][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', 'class="sub config"', true); $table->data[0][] = html_print_label_input_block(
$table->data[1][0] = __('Visual console'); __('Report'),
$table->data[1][1] = html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true); html_print_div(
$table->data[1][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', 'class="sub config"', true); [
'class' => 'flex-content-left',
'content' => html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true),
],
true
)
);
$table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', ['mode' => 'link'], true);
$table->data[1][] = html_print_label_input_block(
__('Visual console'),
html_print_div(
[
'class' => 'flex-content-left',
'content' => html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true),
],
true
)
);
$table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', ['mode' => 'link'], true);
if ($hook_enterprise === true) { if ($hook_enterprise === true) {
add_rows_for_enterprise($table->data); add_rows_for_enterprise($table->data);

View File

@ -1,4 +1,5 @@
<?php <?php
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
/** /**
* Resource registration. * 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 * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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']) { switch ($item['type']) {
case 1:
case 'simple_graph':
break;
case 'simple_baseline_graph':
break;
case 2: case 2:
case 'custom_graph': case 'custom_graph':
case 'automatic_custom_graph': case 'automatic_custom_graph':
@ -361,30 +355,6 @@ function process_upload_xml_report($xml, $group_filter=0)
} }
break; 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': case 'text':
$values['text'] = io_safe_input($item['text']); $values['text'] = io_safe_input($item['text']);
break; 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)); $values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item->group));
break; break;
case 'event_report_module':
break;
case 'alert_report_module':
break;
case 'alert_report_agent':
break;
case 'alert_report_group':
break;
case 'url': case 'url':
$values['external_source'] = io_safe_input($item['url']); $values['external_source'] = io_safe_input($item['url']);
break; break;
@ -426,9 +384,32 @@ function process_upload_xml_report($xml, $group_filter=0)
$values['line_separator'] = io_safe_input($item['line_separator']); $values['line_separator'] = io_safe_input($item['line_separator']);
$values['column_separator'] = io_safe_input($item['column_separator']); $values['column_separator'] = io_safe_input($item['column_separator']);
break; 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); $id_content = db_process_sql_insert('treport_content', $values);
ui_print_result_message( ui_print_result_message(
$id_content, $id_content,
@ -782,7 +763,7 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
function process_upload_xml_component($xml) function process_upload_xml_component($xml)
{ {
// Extract components // Extract components.
$components = []; $components = [];
foreach ($xml->xpath('/component') as $componentElement) { foreach ($xml->xpath('/component') as $componentElement) {
$name = io_safe_input((string) $componentElement->name); $name = io_safe_input((string) $componentElement->name);
@ -838,7 +819,7 @@ function process_upload_xml_component($xml)
$idComponent = false; $idComponent = false;
switch ((int) $componentElement->module_source) { switch ((int) $componentElement->module_source) {
case 1: case 1:
// Local component // Local component.
$values = [ $values = [
'description' => $description, 'description' => $description,
'id_network_component_group' => $group, 'id_network_component_group' => $group,
@ -854,12 +835,12 @@ function process_upload_xml_component($xml)
// Network component // Network component
// for modules // for modules
// 15 = remote_snmp, 16 = remote_snmp_inc, // 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_1 = '';
$custom_string_2 = ''; $custom_string_2 = '';
$custom_string_3 = ''; $custom_string_3 = '';
if ($type >= 15 && $type <= 18) { if ($type >= 15 && $type <= 18) {
// New support for snmp v3 // New support for snmp v3.
$tcp_send = $snmp_version; $tcp_send = $snmp_version;
$plugin_user = $auth_user; $plugin_user = $auth_user;
$plugin_pass = $auth_password; $plugin_pass = $auth_password;
@ -909,13 +890,13 @@ function process_upload_xml_component($xml)
'post_process' => $post_process, 'post_process' => $post_process,
] ]
); );
if ((bool) $idComponent) { if ((bool) $idComponent === true) {
$components[] = $idComponent; $components[] = $idComponent;
} }
break; break;
case 4: case 4:
// Plugin component // Plugin component.
$idComponent = network_components_create_network_component( $idComponent = network_components_create_network_component(
$name, $name,
$type, $type,
@ -956,17 +937,13 @@ function process_upload_xml_component($xml)
'post_process' => $post_process, 'post_process' => $post_process,
] ]
); );
if ((bool) $idComponent) { if ((bool) $idComponent === true) {
$components[] = $idComponent; $components[] = $idComponent;
} }
break; break;
case 5:
// Prediction component
break;
case 6: case 6:
// WMI component // WMI component.
$idComponent = network_components_create_network_component( $idComponent = network_components_create_network_component(
$name, $name,
$type, $type,
@ -1013,13 +990,17 @@ function process_upload_xml_component($xml)
'post_process' => $post_process, 'post_process' => $post_process,
] ]
); );
if ((bool) $idComponent) { if ((bool) $idComponent === true) {
$components[] = $idComponent; $components[] = $idComponent;
} }
break; break;
case 5:
// Prediction component.
case 7: case 7:
// Web component // Web component.
default:
// Do nothing.
break; break;
} }
@ -1030,9 +1011,9 @@ function process_upload_xml_component($xml)
); );
} }
// Extract the template // Extract the template.
$templateElement = $xml->xpath('//template'); $templateElement = $xml->xpath('//template');
if (!empty($templateElement)) { if (empty($templateElement) === false) {
$templateElement = $templateElement[0]; $templateElement = $templateElement[0];
$templateName = (string) $templateElement->name; $templateName = (string) $templateElement->name;
@ -1092,9 +1073,26 @@ function resource_registration_extension_main()
include_once $config['homedir'].'/include/functions_db.php'; include_once $config['homedir'].'/include/functions_db.php';
enterprise_include_once('include/functions_local_components.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.')); ui_print_error_message(_('Error, please install the PHP libXML in the system.'));
return; return;
@ -1119,15 +1117,42 @@ function resource_registration_extension_main()
return; return;
} }
echo '<div class=notify>'; ui_print_warning_message(
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>'); __('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 '</div>'; );
echo '<br /><br />'; $table = new stdClass();
$table->class = 'databox filter-table-adv';
$table->id = 'resource_registration_table';
$table->data = [];
$table->data[0][] = html_print_label_input_block(
__('File to upload'),
html_print_input_file('resource_upload', true)
);
$table->data[0][] = html_print_label_input_block(
__('Group filter'),
html_print_select_groups(false, 'AW', true, 'group', '', '', __('All'), 0, true)
);
// Upload form. // Upload form.
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>"; 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">'; 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 '<tr>';
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>"; echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>";
echo '<td>'.__('Group filter: ').'</td>'; echo '<td>'.__('Group filter: ').'</td>';
@ -1136,8 +1161,7 @@ function resource_registration_extension_main()
echo '</td>'; echo '</td>';
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />"; echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';*/
echo '</form>';
if (isset($_FILES['resource_upload']['tmp_name']) === false) { if (isset($_FILES['resource_upload']['tmp_name']) === false) {
return; return;

View File

@ -1,16 +1,33 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Users
* @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 // Begin.
// ==================================================
// 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.
function users_extension_main() function users_extension_main()
{ {
users_extension_main_god(false); users_extension_main_god(false);
@ -34,7 +51,24 @@ function users_extension_main_god($god=true)
} }
// Header. // Header.
ui_print_page_header(__('Users connected'), $image, false, '', $god); ui_print_standard_header(
__('List of users connected'),
$image,
false,
'',
$god,
[],
[
[
'link' => '',
'label' => __('Workspace'),
],
[
'link' => '',
'label' => __('Users connected'),
],
]
);
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up'); $check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
if ($check_profile === false && !users_is_admin()) { if ($check_profile === false && !users_is_admin()) {

View File

@ -1,5 +1,65 @@
START TRANSACTION; START TRANSACTION;
UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1;
UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2;
UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3;
UPDATE tconfig_os SET `icon_name` = 'freebsd@os.svg' WHERE `id_os` = 4;
UPDATE tconfig_os SET `icon_name` = 'HP@os.svg' WHERE `id_os` = 5;
UPDATE tconfig_os SET `icon_name` = 'cisco@os.svg' WHERE `id_os` = 7;
UPDATE tconfig_os SET `icon_name` = 'apple@os.svg' WHERE `id_os` = 8;
UPDATE tconfig_os SET `icon_name` = 'windows@os.svg' WHERE `id_os` = 9;
UPDATE tconfig_os SET `icon_name` = 'other-OS@os.svg' WHERE `id_os` = 10;
UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 11;
UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 12;
UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 13;
UPDATE tconfig_os SET `icon_name` = 'embedded@os.svg' WHERE `id_os` = 14;
UPDATE tconfig_os SET `icon_name` = 'android@os.svg' WHERE `id_os` = 15;
UPDATE tconfig_os SET `icon_name` = 'vmware@os.svg' WHERE `id_os` = 16;
UPDATE tconfig_os SET `icon_name` = 'routers@os.svg' WHERE `id_os` = 17;
UPDATE tconfig_os SET `icon_name` = 'switch@os.svg' WHERE `id_os` = 18;
UPDATE tconfig_os SET `icon_name` = 'satellite@os.svg' WHERE `id_os` = 19;
UPDATE tconfig_os SET `icon_name` = 'mainframe@os.svg' WHERE `id_os` = 20;
UPDATE tconfig_os SET `icon_name` = 'cluster@os.svg' WHERE `id_os` = 100;
UPDATE tgrupo SET `icon` = 'servers@groups.svg' WHERE `id_grupo` = 2;
UPDATE tgrupo SET `icon` = 'firewall@groups.svg' WHERE `id_grupo` = 4;
UPDATE tgrupo SET `icon` = 'database@groups.svg' WHERE `id_grupo` = 8;
UPDATE tgrupo SET `icon` = 'network@groups.svg' WHERE `id_grupo` = 9;
UPDATE tgrupo SET `icon` = 'unknown@groups.svg' WHERE `id_grupo` = 10;
UPDATE tgrupo SET `icon` = 'workstation@groups.svg' WHERE `id_grupo` = 11;
UPDATE tgrupo SET `icon` = 'applications@groups.svg' WHERE `id_grupo` = 12;
UPDATE tgrupo SET `icon` = 'web@groups.svg' WHERE `id_grupo` = 13;
UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 1;
UPDATE `ttipo_modulo` SET `icon` = 'generic-boolean@svg.svg' WHERE `id_tipo` = 2;
UPDATE `ttipo_modulo` SET `icon` = 'generic-string@svg.svg' WHERE `id_tipo` = 3;
UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 4;
UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 5;
UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-boolean-data@svg.svg' WHERE `id_tipo` = 6;
UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-latency@svg.svg' WHERE `id_tipo` = 7;
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-numeric-data@svg.svg' WHERE `id_tipo` = 8;
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-boolean-data@svg.svg' WHERE `id_tipo` = 9;
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 10;
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-incremental-data@svg.svg' WHERE `id_tipo` = 11;
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-numeric-data@svg.svg' WHERE `id_tipo` = 15;
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 16;
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 17;
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 18;
UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 21;
UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 22;
UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 23;
UPDATE `ttipo_modulo` SET `icon` = 'wux@svg.svg' WHERE `id_tipo` = 25;
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 30;
UPDATE `ttipo_modulo` SET `icon` = 'web-analisys-data@svg.svg' WHERE `id_tipo` = 31;
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 32;
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 33;
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-numeric-data@svg.svg' WHERE `id_tipo` = 34;
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-boolean-data@svg.svg' WHERE `id_tipo` = 35;
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-alphanumeric-data@svg.svg' WHERE `id_tipo` = 36;
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-incremental-data@svg.svg' WHERE `id_tipo` = 37;
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 38;
UPDATE `ttipo_modulo` SET `icon` = 'keepalive@svg.svg' WHERE `id_tipo` = 100;
CREATE TABLE IF NOT EXISTS `tagent_filter` ( CREATE TABLE IF NOT EXISTS `tagent_filter` (
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT, `id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_name` VARCHAR(600) NOT NULL, `id_name` VARCHAR(600) NOT NULL,
@ -27,4 +87,72 @@ CREATE INDEX idx_disabled ON talert_template_modules (disabled);
INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent&#x20;safe&#x20;mode&#x20;not&#x20;enable', 'select&#x20;alias&#x20;from&#x20;tagente&#x20;where&#x20;safe_mode_module&#x20;=&#x20;0'); INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent&#x20;safe&#x20;mode&#x20;not&#x20;enable', 'select&#x20;alias&#x20;from&#x20;tagente&#x20;where&#x20;safe_mode_module&#x20;=&#x20;0');
CREATE TABLE IF NOT EXISTS `twelcome_tip` (
`id` INT NOT NULL AUTO_INCREMENT,
`id_lang` VARCHAR(20) NULL,
`id_profile` INT NOT NULL,
`title` VARCHAR(255) NOT NULL,
`text` TEXT NOT NULL,
`url` VARCHAR(255) NULL,
`enable` TINYINT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `twelcome_tip_file` (
`id` INT NOT NULL AUTO_INCREMENT,
`twelcome_tip_file` INT NOT NULL,
`filename` VARCHAR(255) NOT NULL,
`path` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `twelcome_tip_file`
FOREIGN KEY (`twelcome_tip_file`)
REFERENCES `twelcome_tip` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
INSERT INTO `twelcome_tip` VALUES
(1,'es',0,'¿Sab&iacute;as&#x20;que&#x20;puedes&#x20;monitorizar&#x20;webs?','De&#x20;manera&#x20;sencilla&#x20;a&#x20;trav&eacute;s&#x20;de&#x20;chequeos&#x20;HTTP&#x20;est&aacute;ndar&#x20;o&#x20;transaccional&#x20;mediante&#x20;transacciones&#x20;centralizadas&#x20;WUX,&#x20;o&#x20;descentralizadas&#x20;con&#x20;el&#x20;plugin&#x20;UX&#x20;de&#x20;agente.','https://pandorafms.com/manual/es/documentation/03_monitoring/06_web_monitoring','1'),
(2,'es',0,'Monitorizaci&oacute;n&#x20;remota&#x20;de&#x20;dispositivos&#x20;SNMP','Los&#x20;dispositivos&#x20;de&#x20;red&#x20;como&#x20;switches,&#x20;AP,&#x20;routers&#x20;y&#x20;firewalls&#x20;se&#x20;pueden&#x20;monitorizar&#x20;remotamente&#x20;usando&#x20;el&#x20;protocolo&#x20;SNMP.&#x20;Basta&#x20;con&#x20;saber&#x20;su&#x20;IP,&#x20;la&#x20;comunidad&#x20;SNMP&#x20;y&#x20;lanzar&#x20;un&#x20;wizard&#x20;SNMP&#x20;desde&#x20;la&#x20;consola.','https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_snmp','1'),
(3,'es',0,'Monitorizar&#x20;rutas&#x20;desde&#x20;una&#x20;IP&#x20;a&#x20;otra','Existe&#x20;un&#x20;plugin&#x20;especial&#x20;que&#x20;sirve&#x20;para&#x20;monitorizar&#x20;visualmente&#x20;las&#x20;rutas&#x20;desde&#x20;una&#x20;IP&#x20;a&#x20;otra&#x20;de&#x20;manera&#x20;visual&#x20;y&#x20;din&aacute;mica,&#x20;seg&uacute;n&#x20;va&#x20;cambiando&#x20;con&#x20;el&#x20;tiempo.','https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_de_rutas','1'),
(4,'es',0,'¿Tu&#x20;red&#x20;pierde&#x20;paquetes?','Se&#x20;puede&#x20;medir&#x20;la&#x20;p&eacute;rdida&#x20;de&#x20;paquetes&#x20;en&#x20;tu&#x20;red&#x20;usando&#x20;un&#x20;agente&#x20;y&#x20;un&#x20;plugin&#x20;libre&#x20;llamado&#x20;&ldquo;Packet&#x20;Loss&rdquo;.&#x20;Esto&#x20;es&#x20;especialmente&#x20;&uacute;til&#x20;en&#x20;redes&#x20;Wifi&#x20;o&#x20;redes&#x20;compartidas&#x20;con&#x20;muchos&#x20;usuarios.&#x20;Escribimos&#x20;un&#x20;art&iacute;culo&#x20;en&#x20;nuestro&#x20;blog&#x20;hablando&#x20;de&#x20;ello,&#x20;echale&#x20;un&#x20;vistazo','https://pandorafms.com/blog/es/perdida-de-paquetes/','1'),
(5,'es',0,'Usar&#x20;Telegram&#x20;con&#x20;Pandora&#x20;FMS','Perfecto&#x20;para&#x20;recibir&#x20;alertas&#x20;con&#x20;gr&aacute;ficas&#x20;empotradas&#x20;y&#x20;personalizar&#x20;as&iacute;&#x20;la&#x20;recepci&oacute;n&#x20;de&#x20;avisos&#x20;de&#x20;manera&#x20;individual&#x20;o&#x20;en&#x20;un&#x20;canal&#x20;com&uacute;n&#x20;con&#x20;mas&#x20;personas.&#x20;','https://pandorafms.com/library/telegram-bot-cli/','1'),
(6,'es',0,'Monitorizar&#x20;JMX&#x20;&#40;Tomcat,&#x20;Websphere,&#x20;Weblogic,&#x20;Jboss,&#x20;Apache&#x20;Kafka,&#x20;Jetty,&#x20;GlassFish&hellip;&#41;','Existe&#x20;un&#x20;plugin&#x20;Enterprise&#x20;que&#x20;sirve&#x20;para&#x20;monitorizar&#x20;cualquier&#x20;tecnolog&iacute;a&#x20;JMX.&#x20;Se&#x20;puede&#x20;usar&#x20;de&#x20;manera&#x20;local&#x20;&#40;como&#x20;plugin&#x20;local&#41;&#x20;o&#x20;de&#x20;manera&#x20;remota&#x20;con&#x20;el&#x20;plugin&#x20;server.','https://pandorafms.com/library/jmx-monitoring/','1'),
(7,'es',0,'¿Sabes&#x20;que&#x20;cada&#x20;usuario&#x20;puede&#x20;tener&#x20;su&#x20;propia&#x20;Zona&#x20;Horaria?','Se&#x20;puede&#x20;establecer&#x20;zonas&#x20;horarias&#x20;diferentes&#x20;para&#x20;cada&#x20;usuario,&#x20;de&#x20;manera&#x20;que&#x20;interprete&#x20;los&#x20;datos&#x20;teniendo&#x20;en&#x20;cuenta&#x20;la&#x20;diferencia&#x20;horaria.&#x20;Pandora&#x20;FMS&#x20;tambi&eacute;n&#x20;puede&#x20;tener&#x20;servidores&#x20;y&#x20;agentes&#x20;en&#x20;diferentes&#x20;zonas&#x20;horarias.&#x20;¡Por&#x20;todo&#x20;el&#x20;mundo!','','1'),
(8,'es',0,'Paradas&#x20;planificadas','Se&#x20;puede&#x20;definir,&#x20;a&#x20;nivel&#x20;de&#x20;agente&#x20;y&#x20;a&#x20;nivel&#x20;de&#x20;m&oacute;dulo,&#x20;per&iacute;odos&#x20;en&#x20;los&#x20;cuales&#x20;se&#x20;ignoren&#x20;las&#x20;alertas&#x20;y/o&#x20;los&#x20;datos&#x20;recogidos.&#x20;Es&#x20;perfecto&#x20;para&#x20;planificar&#x20;paradas&#x20;de&#x20;servicio&#x20;o&#x20;desconexi&oacute;n&#x20;de&#x20;los&#x20;sistemas&#x20;monitorizados.&#x20;Tambi&eacute;n&#x20;afecta&#x20;a&#x20;los&#x20;informes&#x20;SLA,&#x20;evitando&#x20;que&#x20;se&#x20;tengan&#x20;en&#x20;cuenta&#x20;esos&#x20;intervalos&#x20;de&#x20;tiempo.&#x20;&#x20;&#x20;&#x20;','https://pandorafms.com/manual/es/documentation/04_using/11_managing_and_administration#paradas_de_servicio_planificadas','1'),
(9,'es',0,'Personalizar&#x20;los&#x20;emails&#x20;de&#x20;alerta&#x20;','¿Sab&iacute;as&#x20;que&#x20;se&#x20;pueden&#x20;personalizar&#x20;los&#x20;mails&#x20;de&#x20;alertas&#x20;de&#x20;Pandora?&#x20;Solo&#x20;tienes&#x20;que&#x20;editar&#x20;el&#x20;c&oacute;digo&#x20;HTML&#x20;por&#x20;defecto&#x20;de&#x20;las&#x20;acciones&#x20;de&#x20;alerta&#x20;de&#x20;tipo&#x20;email.&#x20;&#x20;','https://pandorafms.com/manual/en/documentation/04_using/01_alerts#editing_an_action','1'),
(10,'es',0,'Usando&#x20;iconos&#x20;personalizados&#x20;en&#x20;consolas&#x20;visuales&#x20;','Gracias&#x20;a&#x20;los&#x20;iconos&#x20;personalizados&#x20;se&#x20;pueden&#x20;crear&#x20;vistas&#x20;muy&#x20;personalizadas,&#x20;como&#x20;la&#x20;de&#x20;la&#x20;imagen,&#x20;que&#x20;representa&#x20;racks&#x20;con&#x20;los&#x20;tipos&#x20;de&#x20;servidores&#x20;en&#x20;el&#x20;orden&#x20;que&#x20;est&aacute;n&#x20;colocados&#x20;dentro&#x20;del&#x20;rack.&#x20;Perfecto&#x20;para&#x20;que&#x20;un&#x20;t&eacute;cnico&#x20;sepa&#x20;exactamente&#x20;qu&eacute;&#x20;m&aacute;quina&#x20;esta&#x20;fallando.&#x20;M&aacute;s&#x20;visual&#x20;no&#x20;puede&#x20;ser,&#x20;de&#x20;ahi&#x20;el&#x20;nombre.&#x20;&#x20;','https://pandorafms.com/manual/start?id=es/documentation/04_using/05_data_presentation_visual_maps','1'),
(11,'es',0,'Consolas&#x20;visuales:&#x20;mapas&#x20;de&#x20;calor&#x20;','La&#x20;consola&#x20;permite&#x20;integrar&#x20;en&#x20;un&#x20;fondo&#x20;personalizado&#x20;una&#x20;serie&#x20;de&#x20;datos,&#x20;que&#x20;en&#x20;funci&oacute;n&#x20;de&#x20;su&#x20;valor&#x20;se&#x20;representen&#x20;con&#x20;unos&#x20;colores&#x20;u&#x20;otros,&#x20;en&#x20;tiempo&#x20;real.&#x20;Las&#x20;aplicaciones&#x20;son&#x20;infinitas,&#x20;solo&#x20;depende&#x20;de&#x20;tu&#x20;imaginaci&oacute;n.&#x20;&#x20;&#x20;','https://pandorafms.com/manual/es/documentation/04_using/05_data_presentation_visual_maps#mapa_de_calor_o_nube_de_color','1'),
(12,'es',0,'Auditor&iacute;a&#x20;interna&#x20;de&#x20;la&#x20;consola&#x20;','La&#x20;consola&#x20;registra&#x20;todas&#x20;las&#x20;actividades&#x20;relevantes&#x20;de&#x20;cada&#x20;usuario&#x20;conectado&#x20;a&#x20;la&#x20;consola.&#x20;Esto&#x20;incluye&#x20;la&#x20;aplicaci&oacute;n&#x20;de&#x20;configuraciones,&#x20;validaciones&#x20;de&#x20;eventos&#x20;y&#x20;alertas,&#x20;conexi&oacute;n&#x20;y&#x20;desconexi&oacute;n&#x20;y&#x20;cientos&#x20;de&#x20;otras&#x20;operaciones.&#x20;La&#x20;seguridad&#x20;en&#x20;Pandora&#x20;FMS&#x20;ha&#x20;sido&#x20;siempre&#x20;una&#x20;de&#x20;las&#x20;caracter&iacute;sticas&#x20;del&#x20;dise&ntilde;o&#x20;de&#x20;su&#x20;arquitectura.&#x20;&#x20;','https://pandorafms.com/manual/es/documentation/04_using/11_managing_and_administration#log_de_auditoria','1'),
(13,'es',0,'Sistema&#x20;de&#x20;provisi&oacute;n&#x20;autom&aacute;tica&#x20;de&#x20;agentes&#x20;','El&#x20;sistema&#x20;de&#x20;autoprovisi&oacute;n&#x20;de&#x20;agentes,&#x20;permite&#x20;que&#x20;un&#x20;agente&#x20;reci&eacute;n&#x20;ingresado&#x20;en&#x20;el&#x20;sistema&#x20;aplique&#x20;autom&aacute;ticamente&#x20;cambios&#x20;en&#x20;su&#x20;configuraci&oacute;n&#x20;&#40;como&#x20;moverlo&#x20;de&#x20;grupo,&#x20;asignarle&#x20;ciertos&#x20;valores&#x20;en&#x20;campos&#x20;personalizados&#41;&#x20;y&#x20;por&#x20;supuesto&#x20;aplicarle&#x20;determinadas&#x20;politicas&#x20;de&#x20;monitorizaci&oacute;n.&#x20;Es&#x20;una&#x20;de&#x20;las&#x20;funcionalidades&#x20;m&aacute;s&#x20;potentes,&#x20;orientadas&#x20;a&#x20;gestionar&#x20;parques&#x20;de&#x20;sistemas&#x20;muy&#x20;extensos.&#x20;&#x20;','https://pandorafms.com/manual/start?id=es/documentation/02_installation/05_configuration_agents#configuracion_automatica_de_agentes','1'),
(14,'es',0,'Modo&#x20;oscuro&#x20;','¿Sabes&#x20;que&#x20;existe&#x20;un&#x20;modo&#x20;oscuro&#x20;en&#x20;Pandora&#x20;FMS?&#x20;Un&#x20;administrador&#x20;lo&#x20;puede&#x20;activar&#x20;a&#x20;nivel&#x20;global&#x20;desde&#x20;las&#x20;opciones&#x20;de&#x20;configuraci&oacute;n&#x20;visuales&#x20;o&#x20;cualquier&#x20;usuario&#x20;a&#x20;nivel&#x20;individual,&#x20;en&#x20;las&#x20;opciones&#x20;de&#x20;usuario.&#x20;','','1'),
(15,'es',0,'Google&#x20;Sheet&#x20;','¿Sabes&#x20;que&#x20;se&#x20;puede&#x20;coger&#x20;el&#x20;valor&#x20;de&#x20;una&#x20;celda&#x20;de&#x20;una&#x20;hoja&#x20;de&#x20;c&aacute;lculo&#x20;de&#x20;Google&#x20;Sheet?,&#x20;utilizamos&#x20;la&#x20;API&#x20;para&#x20;pedir&#x20;el&#x20;dato&#x20;a&#x20;trav&eacute;s&#x20;de&#x20;un&#x20;plugin&#x20;remoto.&#x20;Es&#x20;perfecto&#x20;para&#x20;construir&#x20;cuadros&#x20;de&#x20;mando&#x20;de&#x20;negocio,&#x20;obtener&#x20;alertas&#x20;en&#x20;tiempo&#x20;real&#x20;y&#x20;crear&#x20;tus&#x20;propios&#x20;informes&#x20;a&#x20;medida.&#x20;&#x20;','https://pandorafms.com/library/google-sheets-plugin/','1'),
(16,'es',0,'Tablas&#x20;de&#x20;ARP','¿Sabes&#x20;que&#x20;existe&#x20;un&#x20;m&oacute;dulo&#x20;de&#x20;inventario&#x20;para&#x20;sacar&#x20;las&#x20;tablas&#x20;ARP&#x20;de&#x20;tus&#x20;servidores&#x20;windows?&#x20;Es&#x20;f&aacute;cil&#x20;de&#x20;instalar&#x20;y&#x20;puede&#x20;darte&#x20;informaci&oacute;n&#x20;muy&#x20;detallada&#x20;de&#x20;tus&#x20;equipos.','https://pandorafms.com/library/arp-table-windows-local/','1'),
(17,'es',0,'Enlaces&#x20;de&#x20;red&#x20;en&#x20;la&#x20;consola&#x20;visual&#x20;','Existe&#x20;un&#x20;elemento&#x20;de&#x20;consola&#x20;visual&#x20;llamado&#x20;&ldquo;Network&#x20;link&rdquo;&#x20;que&#x20;permite&#x20;mostrar&#x20;visualmente&#x20;la&#x20;uni&oacute;n&#x20;de&#x20;dos&#x20;interfaces&#x20;de&#x20;red,&#x20;su&#x20;estado&#x20;y&#x20;el&#x20;tr&aacute;fico&#x20;de&#x20;subida/bajada,&#x20;de&#x20;una&#x20;manera&#x20;muy&#x20;visual.&#x20;&#x20;','https://pandorafms.com/manual/es/documentation/04_using/05_data_presentation_visual_maps#enlace_de_red','1'),
(18,'es',0,'¿Conoces&#x20;los&#x20;informes&#x20;de&#x20;disponibilidad?&#x20;','Son&#x20;muy&#x20;&uacute;tiles&#x20;ya&#x20;que&#x20;te&#x20;dicen&#x20;el&#x20;tiempo&#x20;&#40;%&#41;&#x20;que&#x20;un&#x20;chequeo&#x20;ha&#x20;estado&#x20;en&#x20;diferentes&#x20;estados&#x20;a&#x20;lo&#x20;largo&#x20;de&#x20;un&#x20;lapso&#x20;de&#x20;tiempo,&#x20;por&#x20;ejemplo,&#x20;una&#x20;semana.&#x20;Ofrece&#x20;datos&#x20;crudos&#x20;completos&#x20;de&#x20;lo&#x20;que&#x20;se&#x20;ha&#x20;hecho&#x20;con&#x20;el&#x20;detalle&#x20;suficiente&#x20;para&#x20;convencer&#x20;a&#x20;un&#x20;proveedor&#x20;o&#x20;un&#x20;cliente.&#x20;&#x20;','','1'),
(19,'es',0,'Gr&aacute;ficas&#x20;de&#x20;disponibilidad&#x20;','Parecidos&#x20;a&#x20;los&#x20;informes&#x20;de&#x20;disponibilidad,&#x20;pero&#x20;mucho&#x20;mas&#x20;visuales,&#x20;ofrecen&#x20;el&#x20;detalle&#x20;de&#x20;estado&#x20;de&#x20;un&#x20;monitor&#x20;a&#x20;lo&#x20;largo&#x20;del&#x20;tiempo.&#x20;Se&#x20;pueden&#x20;agrupar&#x20;con&#x20;otro&#x20;m&oacute;dulo&#x20;para&#x20;ofrecer&#x20;datos&#x20;finales&#x20;teniendo&#x20;en&#x20;cuenta&#x20;la&#x20;alta&#x20;disponibilidad&#x20;de&#x20;un&#x20;servicio.&#x20;Son&#x20;perfectos&#x20;para&#x20;su&#x20;uso&#x20;en&#x20;informes&#x20;a&#x20;proveedores&#x20;y/o&#x20;clientes.&#x20;&#x20;','https://pandorafms.com/manual/es/documentation/04_using/08_data_presentation_reports#grafico_de_disponibilidad','1'),
(20,'es',0,'Zoom&#x20;en&#x20;gr&aacute;ficas&#x20;de&#x20;datos&#x20;','¿Sabes&#x20;que&#x20;Pandora&#x20;FMS&#x20;permite&#x20;hacer&#x20;zoom&#x20;en&#x20;una&#x20;parte&#x20;de&#x20;la&#x20;gr&aacute;fica.&#x20;Con&#x20;eso&#x20;ampliar&aacute;s&#x20;la&#x20;informaci&oacute;n&#x20;de&#x20;la&#x20;gr&aacute;fica.&#x20;Si&#x20;est&aacute;s&#x20;viendo&#x20;una&#x20;gr&aacute;fica&#x20;de&#x20;un&#x20;mes&#x20;y&#x20;ampl&iacute;as,&#x20;podr&aacute;s&#x20;ver&#x20;los&#x20;datos&#x20;de&#x20;ese&#x20;intervalo.&#x20;Si&#x20;utilizas&#x20;una&#x20;gr&aacute;fica&#x20;con&#x20;datos&#x20;de&#x20;resoluci&oacute;n&#x20;completa&#x20;&#40;los&#x20;llamamos&#x20;gr&aacute;ficas&#x20;TIP&#41;&#x20;podr&aacute;s&#x20;ver&#x20;el&#x20;detalle&#x20;de&#x20;cada&#x20;dato,&#x20;aunque&#x20;tu&#x20;gr&aacute;fica&#x20;tenga&#x20;miles&#x20;de&#x20;muestras.&#x20;&#x20;','','1'),
(21,'es',0,'Gr&aacute;ficas&#x20;de&#x20;resoluci&oacute;n&#x20;completa&#x20;','Pandora&#x20;FMS&#x20;y&#x20;otras&#x20;herramientas&#x20;cuando&#x20;tienen&#x20;que&#x20;mostrar&#x20;una&#x20;gr&aacute;fica&#x20;obtienen&#x20;los&#x20;datos&#x20;de&#x20;la&#x20;fuente&#x20;de&#x20;datos&#x20;y&#x20;luego&#x20;&ldquo;simplifican&rdquo;&#x20;la&#x20;gr&aacute;fica,&#x20;ya&#x20;que&#x20;si&#x20;la&#x20;serie&#x20;de&#x20;datos&#x20;tiene&#x20;10,000&#x20;elementos&#x20;y&#x20;la&#x20;gr&aacute;fica&#x20;solo&#x20;tiene&#x20;300&#x20;pixeles&#x20;de&#x20;ancho&#x20;no&#x20;pueden&#x20;caber&#x20;todos,&#x20;asi&#x20;que&#x20;se&#x20;&ldquo;simplifican&rdquo;&#x20;esos&#x20;10,000&#x20;puntos&#x20;en&#x20;solo&#x20;300.&#x20;&#x20;&#x20;Sin&#x20;embargo&#x20;al&#x20;simplificar&#x20;se&#x20;pierde&#x20;&ldquo;detalle&rdquo;&#x20;en&#x20;la&#x20;gr&aacute;fica,&#x20;y&#x20;por&#x20;supuesto&#x20;no&#x20;podemos&#x20;&ldquo;hacer&#x20;zoom&rdquo;.&#x20;Las&#x20;gr&aacute;ficas&#x20;de&#x20;Pandora&#x20;FMS&#x20;permiten&#x20;mostrar&#x20;y&#x20;usar&#x20;todos&#x20;los&#x20;datos&#x20;en&#x20;una&#x20;gr&aacute;fica,&#x20;que&#x20;llamamos&#x20;&ldquo;TIP&rdquo;&#x20;que&#x20;muestra&#x20;todos&#x20;los&#x20;puntos&#x20;superpuestos&#x20;y&#x20;adem&aacute;s&#x20;permite&#x20;que&#x20;al&#x20;hacer&#x20;zoom&#x20;no&#x20;se&#x20;pierda&#x20;resoluci&oacute;n.&#x20;&#x20;&#x20;','','1'),
(22,'es',0,'Pol&iacute;tica&#x20;de&#x20;contrase&ntilde;as','La&#x20;consola&#x20;de&#x20;Pandora&#x20;FMS&#x20;tiene&#x20;un&#x20;sistema&#x20;de&#x20;gesti&oacute;n&#x20;de&#x20;pol&iacute;tica&#x20;de&#x20;credenciales,&#x20;para&#x20;reforzar&#x20;la&#x20;seguridad&#x20;local&#x20;&#40;adem&aacute;s&#x20;de&#x20;permitir&#x20;la&#x20;autenticaci&oacute;n&#x20;externa&#x20;contra&#x20;un&#x20;LDAP,&#x20;Active&#x20;Directory&#x20;o&#x20;SAML&#41;.&#x20;A&#x20;trav&eacute;s&#x20;de&#x20;este&#x20;sistema&#x20;podemos&#x20;forzar&#x20;cambios&#x20;de&#x20;password&#x20;cada&#x20;X&#x20;d&iacute;as,&#x20;guardar&#x20;un&#x20;hist&oacute;rico&#x20;de&#x20;passwords&#x20;usadas&#x20;o&#x20;evitar&#x20;el&#x20;uso&#x20;de&#x20;ciertas&#x20;contrase&ntilde;as&#x20;entre&#x20;otras&#x20;acciones.&#x20;&#x20;','https://pandorafms.com/manual/es/documentation/04_using/12_console_setup?s%5B%5D%3Dcontrase%25C3%25B1as#password_policy','1'),
(23,'es',0,'Autenticaci&oacute;n&#x20;de&#x20;doble&#x20;factor&#x20;','Es&#x20;posible&#x20;activar&#x20;&#40;y&#x20;forzar&#x20;su&#x20;uso&#x20;a&#x20;todos&#x20;los&#x20;usuarios&#41;&#x20;un&#x20;sistema&#x20;de&#x20;doble&#x20;autenticaci&oacute;n&#x20;&#40;usando&#x20;Google&#x20;Auth&#41;&#x20;para&#x20;que&#x20;cualquier&#x20;usuario&#x20;se&#x20;autentique&#x20;adem&aacute;s&#x20;de&#x20;con&#x20;una&#x20;contrase&ntilde;a,&#x20;con&#x20;un&#x20;sistema&#x20;de&#x20;token&#x20;de&#x20;un&#x20;solo&#x20;uso,&#x20;dando&#x20;al&#x20;sistema&#x20;mucha&#x20;m&aacute;s&#x20;seguridad.&#x20;&#x20;','https://pandorafms.com/manual/en/documentation/04_using/12_console_setup?s%5B%5D%3Dgoogle%26s%5B%5D%3Dauth#authentication','1');
INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`, `filename`, `path`) VALUES
(1, 'monitorizar_web.png', 'images/tips/'),
(2, 'monitorizar_snmp.png', 'images/tips/'),
(3, 'monitorizar_desde_ip.png', 'images/tips/'),
(4, 'tu_red_pierde_paquetes.png', 'images/tips/'),
(5, 'telegram_con_pandora.png', 'images/tips/'),
(6, 'monitorizar_con_jmx.png', 'images/tips/'),
(7, 'usuario_zona_horaria.png', 'images/tips/'),
(8, 'paradas_planificadas.png', 'images/tips/'),
(9, 'personalizar_los_emails.png', 'images/tips/'),
(10, 'iconos_personalizados.png', 'images/tips/'),
(11, 'mapa_de_calor.png', 'images/tips/'),
(12, 'auditoria.png', 'images/tips/'),
(15, 'google_sheets.png', 'images/tips/'),
(17, 'enlaces_consola_visual.png', 'images/tips/'),
(18, 'informe_disponibiliad.png', 'images/tips/'),
(19, 'graficas_disponibilidad.png', 'images/tips/'),
(20, 'zoom_en_graficas.png', 'images/tips/'),
(22, 'politica_de_pass.png', 'images/tips/');
COMMIT; COMMIT;

View File

@ -1,16 +1,32 @@
<?php <?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 // Load globals.
// ==================================================
// 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.
global $config; global $config;
check_login(); check_login();
ui_require_css_file('first_task'); 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')]); ?> <?php echo html_print_image('images/first_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
</div> </div>
<div class="text_task"> <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 <?php
echo __( echo __(
"Custom fields are an easy way to personalized agent's information. "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> </p>
<form action="index.php?sec=gagente&sec2=godmode/agentes/configure_field" method="post"> <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'); ?>" /> <input type="submit" class="button_task" value="<?php echo __('Create Custom Fields'); ?>" />
</form> </form>
</div> </div>

View File

@ -15,9 +15,6 @@ global $config;
check_login(); check_login();
ui_require_css_file('first_task'); ui_require_css_file('first_task');
?> ?>
<?php
ui_print_info_message(['no_close' => true, 'message' => __('There are no custom graphs defined yet.') ]);
?>
<div class="new_task"> <div class="new_task">
<div class="image_task"> <div class="image_task">
@ -36,7 +33,17 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
?> ?>
</p> </p>
<form action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder" method="post"> <form action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Custom Graph'); ?>" /> <?php
html_print_action_buttons(
html_print_submit_button(
__('Create Custom Graph'),
'button_task',
false,
['icon' => 'wand'],
true
)
);
?>
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,28 +1,38 @@
<?php <?php
/**
* Map builder First Task.
*
* @category Topology maps
* @package Pandora FMS
* @subpackage Visual consoles
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-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 // Begin.
// ==================================================
// 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.
global $config; global $config;
global $vconsoles_write; global $vconsoles_write;
global $vconsoles_manage; global $vconsoles_manage;
check_login(); check_login();
ui_require_css_file('first_task'); ui_require_css_file('first_task');
ui_print_info_message(
[
'no_close' => true,
'message' => __('There are no visual console defined yet.'),
]
);
if ($vconsoles_write || $vconsoles_manage) { if ($vconsoles_write || $vconsoles_manage) {
?> ?>
@ -31,7 +41,7 @@ if ($vconsoles_write || $vconsoles_manage) {
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?> <?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Visual Console'); ?></h3><p id="description_task"> <h3> <?php echo __('Visual Consoles'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.", '%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",
@ -41,8 +51,18 @@ if ($vconsoles_write || $vconsoles_manage) {
?> ?>
</p> </p>
<form action="index.php?sec=network&amp;sec2=godmode/reporting/visual_console_builder" method="post"> <form action="index.php?sec=network&amp;sec2=godmode/reporting/visual_console_builder" method="post">
<?php html_print_input_hidden('edit_layout', 1); ?> <?php
<input type="submit" class="button_task" value="<?php echo __('Create Visual Console'); ?>" /> html_print_input_hidden('edit_layout', 1);
html_print_action_buttons(
html_print_submit_button(
__('Create a Visual Console'),
'button_task',
false,
['icon' => 'wand'],
true
)
);
?>
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,16 +1,32 @@
<?php <?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 // Begin.
// ==================================================
// 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.
global $config; global $config;
check_login(); check_login();
ui_require_css_file('first_task'); 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')]); ?> <?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Scehduled Downtime')]); ?>
</div> </div>
<div class="text_task"> <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 <?php
echo __( echo __(
"%s contains a scheduled downtime management system. "%s contains a scheduled downtime management system.
@ -34,7 +50,12 @@ ui_require_css_file('first_task');
?> ?>
</p> </p>
<form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post"> <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> </form>
</div> </div>
</div> </div>

View File

@ -1,29 +1,44 @@
<?php <?php
/**
* Services first task.
*
* @category Topology maps
* @package Pandora FMS
* @subpackage Services
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-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 // Begin.
// ==================================================
// 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.
global $config; global $config;
check_login(); check_login();
ui_require_css_file('first_task'); ui_require_css_file('first_task');
?> ?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no services defined yet.') ]); ?>
<?php if ((bool) $agent_w === true) { ?> <?php if ((bool) $agent_w === true) { ?>
<div class="new_task"> <div class="new_task">
<div class="image_task"> <div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?> <?php echo html_print_image('images/item-service.svg', true, ['title' => __('Services'), 'class' => 'w120px']); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Services'); ?></h3> <h3> <?php echo __('Services'); ?></h3>
<p id="description_task"> <p id="description_task">
<?php <?php
echo __( echo __(
@ -37,9 +52,18 @@ ui_require_css_file('first_task');
?> ?>
</p> </p>
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post"> <form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" /> <?php
html_print_action_buttons(
html_print_submit_button(
__('Create a service'),
'button_task',
false,
['icon' => 'wand'],
true
)
);
?>
</form> </form>
</div> </div>
</div> </div>
<?php <?php

View File

@ -26,7 +26,7 @@ config_check();
echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass); echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
?> ?>
<div id="header_table_inner"> <div id="header_table_inner">
<?php <?php
// ======= Notifications Discovery =============================================== // ======= Notifications Discovery ===============================================
$notifications_numbers = notifications_get_counters(); $notifications_numbers = notifications_get_counters();
@ -37,7 +37,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
// ======= Servers List =============================================== // ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
$servers_list = '<div id="servers_list">';
$servers = []; $servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
if ($servers['all'] != 0) { if ($servers['all'] != 0) {
@ -45,22 +44,33 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$servers['down'] = ($servers['all'] - $servers['up']); $servers['down'] = ($servers['all'] - $servers['up']);
if ($servers['up'] == 0) { if ($servers['up'] == 0) {
// All Servers down or no servers at all. // All Servers down or no servers at all.
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]); $servers_check_img = html_print_image('images/system_error@header.svg', true, ['alt' => 'cross', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Down')]);
} else if ($servers['down'] != 0) { } else if ($servers['down'] != 0) {
// Some servers down. // Some servers down.
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]); $servers_check_img = html_print_image('images/system_warning@header.svg', true, ['alt' => 'error', 'class' => 'main_menu_icon bot', 'title' => $servers['down'].' '.__('servers down')]);
} else { } else {
// All servers up. // All servers up.
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]); $servers_check_img = html_print_image('images/system_ok@header.svg', true, ['alt' => 'ok', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Ready')]);
} }
unset($servers); unset($servers);
// Since this is the header, we don't like to trickle down variables. // Since this is the header, we don't like to trickle down variables.
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">'; $servers_check_img_link = html_print_anchor(
$servers_check_img_link .= $servers_check_img; [
$servers_check_img_link .= '</a>'; 'href' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
'content' => $servers_check_img,
],
true
);
}; };
$servers_list .= $servers_check_img_link.'</div>';
$servers_list = html_print_div(
[
'id' => 'servers_list',
'content' => $servers_check_img_link,
],
true
);
} }
@ -71,9 +81,9 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$check_minor_release_available = db_check_minor_relase_available(); $check_minor_release_available = db_check_minor_relase_available();
if ($check_minor_release_available) { if ($check_minor_release_available === true) {
if (users_is_admin($config['id_user'])) { if (users_is_admin($config['id_user'])) {
if ($config['language'] == 'es') { if ($config['language'] === 'es') {
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/es/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s'); set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/es/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
} else { } else {
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/en/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('About minor release update').'</a>', 'minor release/s available'); set_pandora_error_for_header('There are one or more minor releases waiting for update. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/en/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('About minor release update').'</a>', 'minor release/s available');
@ -107,6 +117,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} }
} }
$search_bar .= '<div id="result_order" class="result_order"></div>';
$search_bar .= '<input id="keywords" name="keywords"'; $search_bar .= '<input id="keywords" name="keywords"';
if (!isset($config['search_keywords'])) { if (!isset($config['search_keywords'])) {
$search_bar .= "value='".__('Enter keywords to search')."'"; $search_bar .= "value='".__('Enter keywords to search')."'";
@ -116,15 +127,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$search_bar .= "value='".$config['search_keywords']."'"; $search_bar .= "value='".$config['search_keywords']."'";
} }
$search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" $search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" onkeyup="showinterpreter()" class="search_input"/>';
onkeyup="showinterpreter()" class="search_input"/>';
$search_bar .= '<div id="result_order" class="result_order"></div>';
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />"; $search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
$search_bar .= '</form>'; $search_bar .= '</form>';
$header_searchbar = '<div id="header_searchbar">'.$search_bar.'</div>'; $header_searchbar = '<div id="header_searchbar">'.$search_bar.'</div>';
} }
@ -227,10 +234,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
if ($do_refresh) { if ($do_refresh) {
$autorefresh_img = html_print_image( $autorefresh_img = html_print_image(
'images/header_refresh_gray.png', 'images/auto_refresh@header.svg',
true, true,
[ [
'class' => 'bot', 'class' => 'main_menu_icon bot',
'alt' => 'lightning', 'alt' => 'lightning',
'title' => __('Configure autorefresh'), 'title' => __('Configure autorefresh'),
] ]
@ -293,10 +300,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:block'; $display_counter = 'display:block';
} else { } else {
$autorefresh_img = html_print_image( $autorefresh_img = html_print_image(
'images/header_refresh_disabled_gray.png', 'images/auto_refresh@header.svg',
true, true,
[ [
'class' => 'bot autorefresh_disabled invert_filter', 'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
'alt' => 'lightning', 'alt' => 'lightning',
'title' => __('Disabled autorefresh'), 'title' => __('Disabled autorefresh'),
] ]
@ -312,10 +319,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} }
} else { } else {
$autorefresh_img = html_print_image( $autorefresh_img = html_print_image(
'images/header_refresh_disabled_gray.png', 'images/auto_refresh@header.svg',
true, true,
[ [
'class' => 'bot autorefresh_disabled invert_filter', 'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
'alt' => 'lightning', 'alt' => 'lightning',
'title' => __('Disabled autorefresh'), 'title' => __('Disabled autorefresh'),
] ]
@ -350,9 +357,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_feedback .= '<div id="modal-feedback-form" class="invisible"></div>'; $header_feedback .= '<div id="modal-feedback-form" class="invisible"></div>';
$header_feedback .= '<div id="msg-header" class="invisible"></div>'; $header_feedback .= '<div id="msg-header" class="invisible"></div>';
$header_feedback .= html_print_image( $header_feedback .= html_print_image(
'images/feedback-header.png', 'images/send_feedback@header.svg',
true, true,
[ [
'class' => 'main_menu_icon invert_filter',
'title' => __('Feedback'), 'title' => __('Feedback'),
'id' => 'feedback-header', 'id' => 'feedback-header',
'alt' => __('Feedback'), 'alt' => __('Feedback'),
@ -373,11 +381,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_support = '<div id="header_support">'; $header_support = '<div id="header_support">';
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">'; $header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
$header_support .= html_print_image( $header_support .= html_print_image(
'images/header_support.png', 'images/support@header.svg',
true, true,
[ [
'title' => __('Go to support'), 'title' => __('Go to support'),
'class' => 'bot invert_filter', 'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user', 'alt' => 'user',
] ]
); );
@ -387,11 +395,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_docu = '<div id="header_docu">'; $header_docu = '<div id="header_docu">';
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'; $header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
$header_docu .= html_print_image( $header_docu .= html_print_image(
'images/header_docu.png', 'images/documentation@header.svg',
true, true,
[ [
'title' => __('Go to documentation'), 'title' => __('Go to documentation'),
'class' => 'bot invert_filter', 'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user', 'alt' => 'user',
] ]
); );
@ -399,34 +407,38 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
// User. // User.
if (is_user_admin($config['id_user']) == 1) { // $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png';
$header_user = html_print_image( $headerUser = [];
'images/header_user_admin_green.png', $headerUser[] = html_print_image(
true, 'images/edit_user@header.svg',
[ true,
'title' => __('Edit my user'), [
'class' => 'bot', 'title' => __('Edit my user'),
'alt' => 'user', 'class' => 'main_menu_icon bot invert_filter',
] 'alt' => 'user',
); ]
} else { );
$header_user = html_print_image(
'images/header_user_green.png',
true,
[
'title' => __('Edit my user'),
'class' => 'bot',
'alt' => 'user',
]
);
}
$header_user = '<div id="header_user"><a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$header_user.'<span id="user_name_header"> ('.$config['id_user'].')</span></a></div>'; $headerUser[] = sprintf('<span id="user_name_header">[ %s ]</span>', $config['id_user']);
$header_user = html_print_div(
[
'id' => 'header_user',
'content' => html_print_anchor(
[
'href' => sprintf('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user=%s', $config['id_user']),
'content' => implode('', $headerUser),
],
true
),
],
true
);
// Logout. // Logout.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">'; $header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout .= html_print_image( $header_logout .= html_print_image(
'images/header_logout_gray.png', 'images/sign_out@header.svg',
true, true,
[ [
'alt' => __('Logout'), 'alt' => __('Logout'),
@ -456,10 +468,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
</div> <!-- Closes #table_header_inner --> </div> <!-- Closes #table_header_inner -->
</div> <!-- Closes #table_header --> </div> <!-- Closes #table_header -->
<!-- Notifications content wrapper-->
<div id='notification-content' class='invisible'/></div>
<!-- Old style div wrapper --> <!-- Old style div wrapper -->
<div id="alert_messages" class="invisible"></div> <div id="alert_messages" class="invisible"></div>

View File

@ -30,16 +30,21 @@ require_once __DIR__.'/../include/functions_html.php';
if ($config['visual_animation']) { if ($config['visual_animation']) {
echo '<style> echo '<style>
@keyframes login_move { div.container_login {
from {margin-left: 10%;margin-right: 10%;opacity:0.1} animation: container_login 3s ease;
to {margin-left: 5%;margin-right: 5%;opacity:1} }
}
@keyframes container_login {
0% {
div.container_login{ transform: scale(.9);
animation-name: login_move; opacity: 0.1;
animation-duration: 3s; }
}
100% {
transform: scale(1);
opacity: 1;
}
}
</style>'; </style>';
} }
@ -87,18 +92,36 @@ if (!empty($page) && !empty($sec)) {
} }
$login_body_style = ''; $login_body_style = '';
$login_body_class = '';
// Overrides the default background with the defined by the user. // Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) { $background_url = 'images/backgrounds/background_pandora_console_keys.jpg';
if (empty($config['random_background']) === false) {
$random_backgrounds = scandir($config['homedir'].'/images/backgrounds/random_backgrounds');
unset($random_backgrounds[0], $random_backgrounds[1]);
$random_background = array_rand($random_backgrounds);
$background_url = 'images/backgrounds/random_backgrounds/'.$random_backgrounds[$random_background];
$background_100 = 'background-size: 100% 100% !important; ';
}
if (empty($config['login_background']) === false) {
$background_url = 'images/backgrounds/'.$config['login_background']; $background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\""; $background_100 = 'background-size: 100% 100% !important; ';
} }
// Support for Internet Explorer and Microsoft Edge browsers // Support for Internet Explorer and Microsoft Edge browsers
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) {
$login_body_class = "class='login_body_trident'"; $background_url = 'images/backgrounds/background_pandora_console_keys.jpg';
$background_100 = '';
} }
if (empty($config['background_opacity']) === false) {
$opacity = $config['background_opacity'];
} else {
$opacity = 30;
}
$login_body_style = 'style="'.$background_100.'background: linear-gradient(rgba(0,0,0,.'.$opacity.'), rgba(0,0,0,.'.$opacity.")), url('".$background_url."');\"";
// Get alternative custom in case of db fail. // Get alternative custom in case of db fail.
$custom_fields = [ $custom_fields = [
'custom_logo_login', 'custom_logo_login',
@ -123,36 +146,36 @@ foreach ($custom_fields as $field) {
// Get the custom icons. // Get the custom icons.
$docs_logo = ui_get_docs_logo(); $docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo(); $support_logo = ui_get_support_logo();
echo '<div id="login_body" '.$login_body_class.' '.$login_body_style.'>'; echo '<div id="login_body" '.$login_body_style.'>';
echo '<div id="header_login">'; echo '<div id="header_login">';
echo '<div id="list_icon_docs_support"><ul>'; echo '<div id="list_icon_docs_support"><ul>';
if (isset($config['custom_docs_url'])) { if (isset($config['custom_docs_url'])) {
if ($docs_logo !== false) { if ($docs_logo !== false) {
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>'; echo '<li id="li_margin_doc_img"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
} }
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>'; echo '<li id="li_margin_doc"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>';
} else if (!$custom_conf_enabled) { } else if (!$custom_conf_enabled) {
echo '<li><a href="https://pandorafms.com/manual/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>'; echo '<li id="li_margin_doc_img"><a href="https://pandorafms.com/manual/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
echo '<li><a href="https://pandorafms.com/manual/" target="_blank">'.__('Docs').'</li>'; echo '<li id="li_margin_doc"><a href="https://pandorafms.com/manual/" target="_blank">'.__('Docs').'</li>';
} }
if (isset($config['custom_support_url'])) { if (isset($config['custom_support_url'])) {
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if ($support_logo !== false) { if ($support_logo !== false) {
echo '<li id="li_margin_left"><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>'; echo '<li id="li_margin_support_img"><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
} }
echo '<li><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>'; echo '<li id="li_margin_support"><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>';
} else { } else {
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>'; echo '<li id="li_margin_support_img"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
echo '<li>'.__('Support').'</li>'; echo '<li id="li_margin_support"><a href="https://support.pandorafms.com" target="_blank">'.__('Support').'</a></li>';
} }
} else if (!$custom_conf_enabled) { } else if (!$custom_conf_enabled) {
echo '<li id="li_margin_left"><a href="https://support.pandorafms.com" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>'; echo '<li id="li_margin_support_img"><a href="https://support.pandorafms.com" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
echo '<li><a href="https://support.pandorafms.com" target="_blank">'.__('Docs').'</li>'; echo '<li id="li_margin_support"><a href="https://support.pandorafms.com" target="_blank">'.__('Support').'</a></li>';
} }
echo '</ul></div>'; echo '</ul></div>';
@ -248,15 +271,30 @@ switch ($login_screen) {
echo '</div>'; echo '</div>';
echo '<div id="log_button" class="login_button invisible">'; echo '<div id="log_button" class="login_button invisible">';
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="next_login"'); html_print_submit_button(__('Login as admin'), 'login_button', false, [ 'fixed_id' => 'submit-login_button', 'class' => 'next_login']);
echo '</div>'; echo '</div>';
echo '<div class="login_button" id="remove_button">'; echo '<div class="login_button" id="remove_button">';
echo '<input type="button" id="input_saml" value="Login as admin" onclick="show_normal_menu()">'; html_print_submit_button(
__('Login as admin'),
'input_saml',
false,
[
'fixed_id' => 'submit-login_button',
'class' => 'next_login',
'onclick' => 'show_normal_menu()',
'id' => 'input_saml',
]
);
echo '</div>'; echo '</div>';
echo '<div class="login_button login_button_saml">'; echo '<div class="login_button login_button_saml">';
html_print_submit_button(__('Login with SAML'), 'login_button_saml', false, ''); html_print_submit_button(
__('Login with SAML'),
'login_button_saml',
false,
['class' => 'next_login secondary']
);
echo '</div>'; echo '</div>';
} else { } else {
echo '<div class="login_nick">'; echo '<div class="login_nick">';
@ -288,7 +326,15 @@ switch ($login_screen) {
); );
echo '</div>'; echo '</div>';
echo '<div class="login_button">'; echo '<div class="login_button">';
html_print_submit_button(__('Login'), 'login_button', false, 'class="next_login"'); html_print_submit_button(
__('Login'),
'login_button',
false,
[
'fixed_id' => 'submit-login_button',
'icon' => 'signin',
]
);
echo '</div>'; echo '</div>';
} }
break; break;
@ -302,12 +348,13 @@ switch ($login_screen) {
echo '<div class="login_nick">'; echo '<div class="login_nick">';
echo '<div>'; echo '<div>';
html_print_image('/images/icono_autenticacion.png', false);
echo '</div>'; echo '</div>';
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true); html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
echo '</div>'; echo '</div>';
echo '<div class="login_button">'; echo '<div class="login_button">';
html_print_submit_button(__('Check code').'&nbsp;&nbsp;>', 'login_button', false, 'class="next_login"'); // html_print_submit_button(__('Check code').'&nbsp;&nbsp;>', 'login_button', false, 'class="next_login"');
html_print_submit_button(__('Check code').'&nbsp;&nbsp;>', 'login_button', false, [ 'fixed_id' => 'submit-login_button', 'class' => 'next_login']);
echo '</div>'; echo '</div>';
break; break;
@ -337,17 +384,18 @@ if ($config['enterprise_installed']) {
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?'); echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
echo '</a>'; echo '</a>';
echo '<div id="centralized_mode_reset_dialog" title="'.__('Password reset').'" style="display:none">'; echo '<div id="centralized_mode_reset_dialog" title="'.__('Centralized mode').'" style="display:none">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]); echo html_print_image('images/icono_stop.png', true, ['alt' => __('Centralized mode'), 'border' => 0]);
echo '</div>'; echo '</div>';
echo '<div class="content_message_alert">'; echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">'; echo '<div class="text_message_alert">';
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>'; echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'centralized_mode_reset_button', false); html_print_submit_button('Ok', 'centralized_mode_reset_button', false, ['class' => 'mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -358,6 +406,16 @@ if ($config['enterprise_installed']) {
} }
} }
echo '
<div class="loader" id="spinner_login">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
';
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
// CSRF validation. // CSRF validation.
if (isset($_SESSION['csrf_code']) === true) { if (isset($_SESSION['csrf_code']) === true) {
unset($_SESSION['csrf_code']); unset($_SESSION['csrf_code']);
@ -368,7 +426,7 @@ html_print_csrf_hidden();
echo '</form></div>'; echo '</form></div>';
echo '<div class="login_data">'; echo '<div class="login_data">';
echo '<div class ="text_banner_login">'; echo '<div class ="text_banner_login">';
echo '<div><span class="span1 pandora_upper">'; echo '<div><span class="span1">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if ($config['custom_title1_login']) { if ($config['custom_title1_login']) {
echo io_safe_output($config['custom_title1_login']); echo io_safe_output($config['custom_title1_login']);
@ -395,7 +453,7 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
echo '</div>'; echo '</div>';
echo '<div class ="img_banner_login">'; echo '<div class ="img_banner_login">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (isset($config['custom_splash_login'])) { if (empty($config['custom_splash_login']) === false && $config['custom_splash_login'] !== 'default') {
html_print_image( html_print_image(
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'], 'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
false, false,
@ -407,25 +465,39 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
false false
); );
} else { } else {
html_print_image( echo '
'enterprise/images/custom_splash_login/splash_image_default.png', <div class="loginimg-container">
false, <div class="lineone"></div>
[ <div class="linetwo"></div>
'alt' => 'logo', <div class="linethree"></div>
'border' => 0, <div style="display:flex;">
], <div class="towerone"></div>
false, <div class="towertwo"></div>
false <div class="towerthree"></div>
); <div class="towerfour"></div>
</div>
</div>
';
} }
} else { } else {
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true); echo '
<div class="loginimg-container">
<div class="lineone"></div>
<div class="linetwo"></div>
<div class="linethree"></div>
<div style="display:flex;">
<div class="towerone"></div>
<div class="towertwo"></div>
<div class="towerthree"></div>
<div class="towerfour"></div>
</div>
</div>
';
} }
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
echo '</div>'; echo '</div>';
if (empty($process_error_message) && isset($mail)) { if (empty($process_error_message) && isset($mail)) {
@ -439,25 +511,28 @@ if (empty($process_error_message) && isset($mail)) {
echo '<h1>'.__('INFO').'</h1>'; echo '<h1>'.__('INFO').'</h1>';
echo '<p>'.__('An email has been sent to your email address').'</p>'; echo '<p>'.__('An email has been sent to your email address').'</p>';
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'reset_correct_button', false); html_print_submit_button('Ok', 'reset_correct_button', false, ['class' => 'mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
} else if (isset($process_error_message) && !empty($process_error_message)) { } else if (isset($process_error_message) && !empty($process_error_message)) {
echo '<div id="reset_correct" title="'.__('Password reset').'">'; echo '<div id="reset_correct" title="'.__('Error').'">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]); echo html_print_image('images/icono_stop.png', true, ['alt' => __('Forbidden'), 'border' => 0]);
echo '</div>'; echo '</div>';
echo '<div class="content_message_alert">'; echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">'; echo '<div class="text_message_alert">';
echo '<h1>'.__('ERROR').'</h1>'; echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$process_error_message.'</p>'; echo '<p>'.$process_error_message.'</p>';
echo '<br>';
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'reset_correct_button', false); html_print_submit_button('Ok', 'reset_correct_button', false, ['class' => 'mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -476,8 +551,9 @@ if (isset($correct_reset_pass_process)) {
echo '<h1>'.__('SUCCESS').'</h1>'; echo '<h1>'.__('SUCCESS').'</h1>';
echo '<p>'.$correct_reset_pass_process.'</p>'; echo '<p>'.$correct_reset_pass_process.'</p>';
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'final_process_correct_button', false); html_print_submit_button('Ok', 'final_process_correct_button', false, ['class' => 'mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -485,9 +561,36 @@ if (isset($correct_reset_pass_process)) {
} }
if (isset($login_failed)) { if (isset($login_failed)) {
$nick = get_parameter_post('nick'); $nick = io_safe_input(get_parameter_post('nick'));
$fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick); $user_in_db = db_get_row_filter(
'tusuario',
['id_user' => $nick],
'*'
);
$fails = $user_in_db['failed_attempt'];
// If user not exist, and attempts its enable, lets make array and fails attemps.
if ($fails == false && $config['enable_pass_policy'] && $user_in_db === false) {
$nick_array_error = json_decode(base64_decode($config['nicks_error']), true);
$nick = strtolower($nick);
if (isset($nick_array_error[$nick]) !== false) {
$nick_array_error[$nick] += 1;
} else {
$nick_array_error[$nick] = 1;
}
$fails = $nick_array_error[$nick];
// Save or update the array.
if ($config['nicks_error']) {
config_update_value('nicks_error', base64_encode(json_encode($nick_array_error)));
} else {
config_create_value('nicks_error', base64_encode(json_encode($nick_array_error)));
}
} else {
$fails = ++$fails;
}
$attemps = ($config['number_attempts'] - $fails); $attemps = ($config['number_attempts'] - $fails);
$attemps = ($attemps < 0) ? 0 : $attemps;
echo '<div id="login_failed" title="'.__('Login failed').'">'; echo '<div id="login_failed" title="'.__('Login failed').'">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -500,12 +603,18 @@ if (isset($login_failed)) {
echo '</div>'; echo '</div>';
if ($config['enable_pass_policy']) { if ($config['enable_pass_policy']) {
echo '<div class="text_message_alert">'; echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>'; if ($attemps !== 0 && $user_in_db['login_blocked'] == 0) {
echo '<p><strong>'.__('Remaining attempts: ').$attemps.'</strong></p>';
} else {
echo '<p><strong>'.__('User is blocked').'</strong></p>';
}
echo '</div>'; echo '</div>';
} }
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false); html_print_submit_button('Ok', 'hide-login-error', false, ['class' => ' mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -528,8 +637,9 @@ if ($login_screen == 'logout') {
} }
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-logout', false); html_print_submit_button('Ok', 'hide-login-logout', false, ['class' => ' mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -547,8 +657,9 @@ if ($login_screen === 'disabled_access_node') {
echo '<h1>'.__('Centralized user in metaconsole').'</h1>'; echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>'; echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-logout', false); html_print_submit_button('Ok', 'hide-login-logout', false, ['class' => 'mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -655,8 +766,9 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
echo '<h1>'.$title.'</h1>'; echo '<h1>'.$title.'</h1>';
echo '<p> '.$message.'</h1>'; echo '<p> '.$message.'</h1>';
echo '</div>'; echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false); html_print_submit_button('Ok', 'hide-login-error', false, ['class' => 'mini float-right']);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -711,7 +823,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
}); });
$("#submit-hide-login-error").click (function () { $("#button-hide-login-error").click (function () {
$("#modal_alert" ).dialog('close'); $("#modal_alert" ).dialog('close');
}); });
@ -726,19 +838,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 220,
width: 528, width: 528,
clickOutside: true, clickOutside: true,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black"
},
open: function (event, ui) {
$(".ui-widget-overlay").click(function () {
$('#login_logout').dialog('close');
});
} }
}); });
}); });
$("#submit-hide-login-logout").click (function () { $("#button-hide-login-logout").click (function () {
document.location = "<?php echo ui_get_full_url('index.php'); ?>"; $( "#login_logout" ).dialog( "close" );
}); });
}); });
break; break;
@ -749,7 +865,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 220,
width: 528, width: 528,
clickOutside: true, clickOutside: true,
overlay: { overlay: {
@ -759,7 +874,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
}); });
$("#submit-hide-login-logout").click (function () { $("#button-hide-login-logout").click (function () {
document.location = "<?php echo ui_get_full_url('index.php'); ?>"; document.location = "<?php echo ui_get_full_url('index.php'); ?>";
}); });
}); });
@ -773,7 +888,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 400,
width: 700, width: 700,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
@ -791,8 +905,8 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 220, height: 230,
width: 528, width: 530,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black"
@ -800,12 +914,11 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
}); });
$("#submit-hide-login-error").click (function () { $("#button-hide-login-error").click (function () {
$("#login_failed" ).dialog('close'); $("#login_failed" ).dialog('close');
$("#login_correct_pass").dialog('close'); $("#login_correct_pass").dialog('close');
}); });
}); });
$('#nick').focus(); $('#nick').focus();
break; break;
} }
@ -816,7 +929,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 220,
width: 528, width: 528,
clickOutside: true, clickOutside: true,
overlay: { overlay: {
@ -826,7 +938,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
}); });
$("#submit-reset_correct_button").click (function () { $("#button-reset_correct_button").click (function () {
$("#reset_correct").dialog('close'); $("#reset_correct").dialog('close');
}); });
}); });
@ -837,7 +949,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 220,
width: 528, width: 528,
clickOutside: true, clickOutside: true,
overlay: { overlay: {
@ -857,7 +968,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 220,
width: 528, width: 528,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
@ -870,5 +980,18 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
} }
$(document).ready(function () {
$('#submit-login_button span').removeAttr('style');
$('#spinner_login').hide();
});
$('#submit-login_button').click(function (e) {
$('.login_nick').hide();
$('.login_pass').hide();
$('.login_button').hide();
$('.reset_password').hide();
$('#spinner_login').show();
});
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -124,8 +124,14 @@ foreach ($stats as $stat) {
} }
$status .= '</table>'; $status .= '</table>';
$table->rowclass = [];
$table->rowclass[0] = 'w100p';
$table->rowclass[1] = 'w100p';
$table->rowclass[2] = 'w100p';
$table->rowclass[3] = 'w100p';
$table->rowclass[4] = 'w100p';
$table->rowclass[5] = 'w100p';
$table->data[0][0] = $status; $table->data[0][0] = $status;
$table->rowclass[] = '';
$table->data[] = $tdata; $table->data[] = $tdata;

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -26,38 +26,21 @@
* ============================================================================ * ============================================================================
*/ */
use function PHPSTORM_META\map;
// Begin. // Begin.
if (isset($config['id_user']) === false) { if (isset($config['id_user']) === false) {
include 'general/login_page.php'; include 'general/login_page.php';
exit(); exit();
} }
?> require_once 'include/functions_menu.php';
<script type="text/javascript" language="javascript">
$(document).ready(function(){ // Global variable. Do not delete.
var menuType_value = "<?php echo ($_SESSION['menu_type'] ?? ''); ?>"; $tab_active = '';
if (menuType_value === '' || menuType_value === 'classic') {
$('ul.submenu').css('left', '214px');
}
else{
$('ul.submenu').css('left', '59px');
}
});
</script>
<?php
$autohidden_menu = 0;
if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_menu'] === true) {
$autohidden_menu = 1;
}
// Start of full lateral menu. // Start of full lateral menu.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass); echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$url_logo = ui_get_full_url('index.php'); $url_logo = ui_get_full_url('index.php');
if (is_reporting_console_node() === true) { if (is_reporting_console_node() === true) {
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist'; $url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
@ -76,311 +59,401 @@ html_print_div(
), ),
], ],
true true
), ).'<div id="button_collapse" class="button_'.$menuTypeClass.'" style="cursor: pointer"></div>',
] ]
); );
require 'operation/menu.php'; $display_classic = '';
require 'godmode/menu.php'; $display_collapsed = 'display: none;';
if ($menuTypeClass === 'collapsed') {
$display_classic = 'display: none;';
$display_collapsed = '';
}
html_print_div(
[ // Tabs.
'id' => 'button_collapse', echo '<div id="menu_tabs">';
'class' => sprintf('button_collapse button_%s', $menuTypeClass), // Tabs classic.
] echo '<ul class="tabs_ul" style="'.$display_classic.'">';
); echo '<li id="tab_display" class="tabs_li"><span>'.__('Operation').'</span></a></li>';
echo '<li id="tab_management" class="tabs_li"><span>'.__('Management').'</span></a></li>';
echo '</ul>';
echo '<div class="div_border_line" style="'.$display_classic.'"><div id="tab_line_1" class="border_line"></div><div id="tab_line_2" class="border_line"></div></div>';
// Tabs collapse.
echo '<div class="tabs_collapsed" style="'.$display_collapsed.'">';
echo '<div class="tabs_collapsed_container">';
echo '<div id="tab_collapsed_display" class="tabs_collapsed_div" title="'.__('Operation').'"><div class="tabs_collapsed_display"></div></div>';
echo '<div id="tab_collapsed_management" class="tabs_collapsed_div" title="'.__('Management').'"><div class="tabs_collapsed_management"></div></div>';
echo '</div></div>';
echo '</div>'; echo '</div>';
// Menu_container.
ui_require_jquery_file('cookie');
$config_fixed_header = false; echo '<div id="div_display">';
if (isset($config['fixed_header']) === true) { require 'operation/menu.php';
$config_fixed_header = $config['fixed_header']; echo '</div>';
} echo '<div id="div_management">';
require 'godmode/menu.php';
echo '</div>';
echo '</div>';
?> ?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$('#button_collapse').on('click', function() {
if($('#menu_full').hasClass('menu_full_classic')){
localStorage.setItem("menuType", "collapsed");
$('ul.submenu').css('left', '59px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
}
else if($('#menu_full').hasClass('menu_full_collapsed')){
localStorage.setItem("menuType", "classic");
$('ul.submenu').css('left', '214px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
}
$('.logo_full').toggle();
$('.logo_icon').toggle();
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
$('#button_collapse').toggleClass('button_classic button_collapsed');
$('div#title_menu').toggleClass('title_menu_classic title_menu_collapsed');
$('div#page').toggleClass('page_classic page_collapsed');
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
});
var autohidden_menu = <?php echo $autohidden_menu; ?>;
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
var id_user = "<?php echo $config['id_user']; ?>";
var cookie_name = id_user + '-pandora_menu_state';
var cookie_name_encoded = btoa(cookie_name);
var click_display = "<?php echo $config['click_display']; ?>";
var menuState = $.cookie(cookie_name_encoded);
if (!menuState) {
menuState = {};
}
else {
menuState = JSON.parse(menuState);
open_submenus();
}
function open_submenus () {
$.each(menuState, function (index, value) {
if (value)
$('div.menu>ul>li#' + index + '>ul').show();
});
//$('div.menu>ul>li.selected>ul').removeClass('invisible');
}
function close_submenus () {
$.each(menuState, function (index, value) {
if (value)
$('div.menu>ul>li#' + index + '>ul').hide();
});
//$('div.menu>ul>li.selected>ul').addClass('invisible');
}
/* ]]> */
</script>
<script type="text/javascript"> <script type="text/javascript">
openTime = 0;
openTime2 = 0;
handsIn = 0;
handsIn2 = 0;
/**
* Positionate the submenu elements. Add a negative top.
*
* @param int index It is the position of li.menu_icon in the ul.
* @param string id_submenu It is the id of first level submenu.
* @param string id_submenu2 It is the id of second level submenu.
* @param int item_height It is the height of a menu item (28 o 35).
*
* @return (int) The position (in px).
*/
function menu_calculate_top(index, id_submenu, id_submenu2, item_height){
var level1 = index;
var level2 = $('#'+id_submenu+' ul.submenu > li').length;
var level3 = $('#'+id_submenu2+' > li.sub_subMenu').length;
var item_height = item_height;
level2--;
if (id_submenu2 !== false) {
// If level3 is set, the position is calculated like box is in the center.
// wiouth considering level2 box can be moved.
level3--;
total = (level1 + level3);
comp = level3;
} else {
total = (level1 + level2);
comp = level2;
}
// Positionate in the middle
if (total > 12 && ((total < 18) || ((level1 - comp) <= 4))) {
return - ( Math.floor(comp / 2) * item_height);
}
// Positionate in the bottom
if (total >= 18) {
return (- comp * item_height);
}
// return 0 by default
return 0;
}
/**
* Get the menu items to be positioned.
*
* @param string item It is the selector of the current element.
*
* @return Add the top position in a inline style.
*/
function get_menu_items(item){
var item_height = parseInt(item.css('min-height'));
var id_submenu = item.attr('id');
var id_submenu2 = false;
var index = item.index();
if(item.parent().hasClass('godmode')){
index = index+6; // This is because the menu has divided in two parts.
}
var top_submenu = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
top_submenu = top_submenu+'px';
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
$('.has_submenu').mouseenter(function() {
id_submenu2 = item.attr('id');
id_submenu2 = $('#'+id_submenu2+' ul.submenu2').attr('id');
var top_submenu2 = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
top_submenu2 = top_submenu2+'px';
$('#'+id_submenu2).css('top', top_submenu2);
});
}
/*
* Show and hide submenus
*/
if(!click_display){
$('.menu_icon').mouseenter(function() {
table_hover = $(this);
handsIn = 1;
openTime = new Date().getTime();
$("ul#sub"+table_hover[0].id).show();
get_menu_items(table_hover);
if( typeof(table_noHover) != 'undefined')
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
$("ul#sub"+table_noHover[0].id).hide();
}).mouseleave(function() {
table_noHover = $(this);
handsIn = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime;
if(opened > 3000 && handsIn == 0) {
openTime = 4000;
$("ul#sub"+table_noHover[0].id).hide();
}
}, 2500);
});
}else{
$(document).ready(function() { $(document).ready(function() {
if (autohidden_menu) { menuActionButtonResizing();
$('.menu_icon').on("click", function() { const menuTypeClass = '<?php echo $menuTypeClass; ?>';
if( typeof(table_hover) != 'undefined'){ if (menuTypeClass === 'classic' && menuTypeClass !== localStorage.getItem('menuType')) {
$("ul#sub"+table_hover[0].id).hide(); localStorage.setItem('menuType', 'classic');
}
const tab = '<?php echo $tab_active; ?>';
if (tab === 'management') {
$('#tab_line_2').addClass('tabs_selected');
$('#div_display').css('display', 'none');
$('#div_management').css('display', 'block');
$('#tab_display').addClass('head_tab_unselected').removeClass('head_tab_selected');
$('#tab_management').addClass('head_tab_selected').removeClass('head_tab_unselected');
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_display');
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_oval');
} else {
$('#tab_line_1').addClass('tabs_selected');
$('#tab_management').addClass('head_tab_unselected').removeClass('head_tab_selected');
$('#tab_display').addClass('head_tab_selected').removeClass('head_tab_unselected');
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_management');
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_oval');
}
$('#tab_display,#tab_collapsed_display').click(function() {
$('#tab_line_1').addClass('tabs_selected');
$('#tab_line_2').removeClass('tabs_selected');
$('#div_management').css('display', 'none');
$('#div_display').css('display', 'block');
$('#tab_management').addClass('head_tab_unselected').removeClass('head_tab_selected');
$('#tab_display').addClass('head_tab_selected').removeClass('head_tab_unselected');
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_management');
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_oval');
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_oval');
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_display');
});
$('#tab_management,#tab_collapsed_management').click(function() {
$('#tab_line_2').addClass('tabs_selected');
$('#tab_line_1').removeClass('tabs_selected');
$('#div_display').css('display', 'none');
$('#div_management').css('display', 'block');
$('#tab_display').addClass('head_tab_unselected').removeClass('head_tab_selected');
$('#tab_management').addClass('head_tab_selected').removeClass('head_tab_unselected');
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_display');
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_oval');
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_oval');
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_management');
});
$('#button_collapse').click(function() {
if ($('#menu_full').hasClass('menu_full_classic')) {
localStorage.setItem("menuType", "collapsed");
$('ul.submenu').css('left', '80px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
$('.tabs_ul').hide();
$('.div_border_line').hide();
$('.tabs_collapsed').show();
$(".title_menu_classic").children('div[class*=icon_]').each(function() {
$(this).removeClass('w15p').addClass('w100p');
});
$(".title_menu_classic").children('div[class*=arrow_]').each(function() {
$(this).hide();
});
$(".title_menu_classic").children('span').each(function() {
$(this).hide();
});
$('ul.submenu').css('position', 'fixed');
$('ul.submenu').css('left', '60px');
$('li.selected').each(function() {
$(`#sub${this.id}`).hide();
})
} else if ($('#menu_full').hasClass('menu_full_collapsed')) {
localStorage.setItem("menuType", "classic");
$('ul.submenu').css('left', '280px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
$('.tabs_ul').show();
$('.div_border_line').show();
$('.tabs_collapsed').hide();
$(".title_menu_classic").children('div[class*=icon_]').each(function() {
$(this).removeClass('w100p').addClass('w15p');
});
$(".title_menu_classic").children('div[class*=arrow_]').each(function() {
$(this).show();
});
$(".title_menu_classic").children('span').each(function() {
$(this).show();
});
$('ul.submenu').css('position', '');
$('ul.submenu').css('left', '80px');
$('li.selected').each(function() {
$(`#sub${this.id}`).show();
})
}
$('.logo_full').toggle();
$('.logo_icon').toggle();
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
$('#button_collapse').toggleClass('button_classic button_collapsed');
$('div#page').toggleClass('page_classic page_collapsed');
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
menuActionButtonResizing();
});
const id_selected = '<?php echo $menu1_selected; ?>';
if (id_selected != '') {
var menuType_val = localStorage.getItem("menuType");
if (menuType_val === 'classic') {
$(`ul#subicon_${id_selected}`).show();
}
// Arrow.
$(`#icon_${id_selected}`).children().first().children().last().removeClass('arrow_menu_down');
$(`#icon_${id_selected}`).children().first().children().last().addClass('arrow_menu_up');
// Span.
$(`#icon_${id_selected}`).children().first().children().eq(1).addClass('span_selected');
const id_selected2 = '<?php echo $menu2_selected; ?>';
if (id_selected2 != '') {
if ($(`#sub${id_selected2}`).length > 0) {
$(`#sub${id_selected2}`).show();
// Arrow.
$(`#${id_selected2}`).children().first().children().last().removeClass('arrow_menu_down');
$(`#${id_selected2}`).children().first().children().last().addClass('arrow_menu_up');
// Span.
$(`#${id_selected2}`).children().first().children().first().addClass('span_selected');
// Vertical line.
$(`.sub_subMenu.selected`).prepend(`<div class="element_submenu_selected left_3"></div>`);
} else {
$(`#${id_selected2}`).addClass('submenu_selected_no_submenu');
$(`#${id_selected2}`).children().first().children().first().css('color', '#fff');
// Vertical line.
$(`#${id_selected2}`).prepend(`<div class="element_submenu_selected"></div>`);
} }
}
}
var click_display = "<?php echo $config['click_display']; ?>";
$('.menu_icon').mouseenter(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_hover = $(this); table_hover = $(this);
handsIn = 1; handsIn = 1;
openTime = new Date().getTime(); openTime = new Date().getTime();
$("ul#sub"+table_hover[0].id).show(); $("ul#sub"+table_hover[0].id).show();
get_menu_items(table_hover); get_menu_items(table_hover);
}).mouseleave(function() { if (typeof(table_noHover) != 'undefined') {
if ("ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id ) {
$("ul#sub"+table_noHover[0].id).hide();
}
}
}
}).mouseleave(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_noHover = $(this); table_noHover = $(this);
handsIn = 0; handsIn = 0;
setTimeout(function() { setTimeout(function() {
opened = new Date().getTime() - openTime; opened = new Date().getTime() - openTime;
if(opened > 5000 && handsIn == 0) { if(opened > 2500 && handsIn == 0) {
openTime = 6000; openTime = 4000;
$("ul#sub"+table_noHover[0].id).hide(); $("ul#sub"+table_noHover[0].id).hide();
} }
}, 5500); }, 2500);
}); }
} else { });
$('.menu_icon').on("click", function() {
if( typeof(table_hover) != 'undefined'){ $('.has_submenu').mouseenter(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_hover2 = $(this);
handsIn2 = 1;
openTime2 = new Date().getTime();
$("#sub"+table_hover2[0].id).show();
if( typeof(table_noHover2) != 'undefined') {
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id ) {
$("ul#sub"+table_noHover2[0].id).hide();
}
}
}
}).mouseleave(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_noHover2 = table_hover2;
handsIn2 = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime2;
if(opened >= 3000 && handsIn2 == 0) {
openTime2 = 4000;
$("ul#sub"+table_hover2[0].id).hide();
}
}, 3500);
}
});
$('#container').click(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
openTime = 4000;
if( typeof(table_hover) != 'undefined') {
$("ul#sub"+table_hover[0].id).hide(); $("ul#sub"+table_hover[0].id).hide();
} }
table_hover = $(this);
handsIn = 1; if( typeof(table_hover2) != 'undefined') {
openTime = new Date().getTime(); $("ul#sub"+table_hover2[0].id).hide();
$("ul#sub"+table_hover[0].id).show(); }
get_menu_items(table_hover); }
}); });
$('.title_menu_classic').click(function() {
var menuType_val = localStorage.getItem("menuType");
if (click_display || (!click_display && menuType_val === 'classic')) {
const table_hover = $(this).parent();
const id = table_hover[0].id;
const classes = $(`#${id}`).attr('class');
if (id === 'icon_about') {
return;
}
var menuType_val = localStorage.getItem("menuType");
if (classes.includes('selected') === true) {
if (menuType_val === 'collapsed' && $(`ul#sub${id}`).is(':hidden')) {
$(`ul#sub${id}`).show();
get_menu_items(table_hover);
} else {
$(`#${id}`).removeClass('selected');
$(`ul#sub${id}`).hide();
// Arrow.
table_hover.children().first().children().last().removeClass('arrow_menu_up');
table_hover.children().first().children().last().addClass('arrow_menu_down');
// Span.
table_hover.children().first().children().eq(1).removeClass('span_selected');
}
} else {
if (menuType_val === 'collapsed') {
// hide all submenus.
$('ul[id^=sub]').hide();
$(`ul#sub${id}`).show();
// Unselect all.
$(`li[id^=icon_]`).removeClass('selected');
$(`#${id}`).addClass('selected');
get_menu_items(table_hover);
} else {
$(`ul#sub${id}`).show();
$(`#${id}`).addClass('selected');
// Arrow.
$(this).children().last().removeClass('arrow_menu_down');
$(this).children().last().addClass('arrow_menu_up');
// Span.
$(this).children().eq(1).addClass('span_selected');
}
}
}
});
$('.has_submenu').click(function() {
var menuType_val = localStorage.getItem("menuType");
if (click_display || (!click_display && menuType_val === 'classic')) {
const table_hover2 = $(this);
const id = table_hover2[0].id;
const classes = $(`#${id}`).attr('class');
if (classes.includes('submenu_selected') === true) {
$(`#${id}`).removeClass('submenu_selected');
$(`#${id}`).addClass('submenu_not_selected');
$(`#sub${id}`).hide();
// Arrow.
table_hover2.children().first().children().last().removeClass('arrow_menu_up');
table_hover2.children().first().children().last().addClass('arrow_menu_down');
// Span.
table_hover2.children().first().children().first().removeClass('span_selected');
} else {
$(`#${id}`).removeClass('submenu_not_selected');
$(`#${id}`).addClass('submenu_selected');
$(`#sub${id}`).show();
// Arrow.
table_hover2.children().first().children().last().removeClass('arrow_menu_down');
table_hover2.children().first().children().last().addClass('arrow_menu_up');
// Span.
table_hover2.children().first().children().first().addClass('span_selected');
}
}
});
$('.sub_subMenu').click(function (event) {
event.stopPropagation();
});
/**
* Get the menu items to be positioned.
*
* @param string item It is the selector of the current element.
*
* @return Add the top position in a inline style.
*/
function get_menu_items(item) {
var item_height = parseInt(item.css('min-height'));
var id_submenu = item.attr('id');
var index = item.index();
var top_submenu = menu_calculate_top(index, item_height);
top_submenu = top_submenu+'px';
$('#'+id_submenu+' ul.submenu').css('position', 'fixed');
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
$('#'+id_submenu+' ul.submenu').css('left', '60px');
}
/**
* Positionate the submenu elements. Add a negative top.
*
* @param int index It is the position of li.menu_icon in the ul.
* @param int item_height It is the height of a menu item (35).
*
* @return (int) The position (in px).
*/
function menu_calculate_top(index, item_height) {
const height_position = index * item_height;
const height_logo = $('.logo_green').outerHeight(true);
const height_tabs = $('#menu_tabs').outerHeight(true);
const padding_menu = parseInt($('.godmode').css('padding-top'));
return height_logo + height_tabs + padding_menu + height_position;
} }
}); });
}
$('.has_submenu').mouseenter(function() {
table_hover2 = $(this);
handsIn2 = 1;
openTime2 = new Date().getTime();
$("#sub"+table_hover2[0].id).show();
if( typeof(table_noHover2) != 'undefined')
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
$("ul#sub"+table_noHover2[0].id).hide();
}).mouseleave(function() {
table_noHover2 = table_hover2;
handsIn2 = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime2;
if(opened >= 3000 && handsIn2 == 0) {
openTime2 = 4000;
$("ul#sub"+table_hover2[0].id).hide();
}
}, 3500);
});
$(document).ready(function() {
if(!click_display){
$('#container').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
});
}else{
$('#main').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
});
}
$('div.menu>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
});
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
openTime = 4000;
if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide();
if( typeof(table_hover2) != 'undefined')
$("ul#sub"+table_hover2[0].id).hide();
});
});
</script> </script>

View File

@ -1,167 +1,77 @@
<html> <?php
<head> echo '<script src="'.ui_get_full_url('include/javascript/jquery.current.js', false, false, false).'" type="text/javascript"></script>';
<style>
#alert_messages_na{ $message = '';
-moz-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
z-index:2;
position:fixed;
width:700px;
background:white;
left:50%;
top:20%;
margin-left:-350px;
if ($config['history_db_connection'] === false) {
$message = __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.');
} else {
$message = __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
} }
.modalheade{ $custom_conf_enabled = false;
text-align:center; foreach ($config as $key => $value) {
width:100%; if (preg_match('/._alt/i', $key)) {
height:37px; $custom_conf_enabled = true;
left:0px; break;
background-color:#82b92e;
}
.modalheadertex{
color:white;
position:relative;
font-size:13pt;
top:8px;
}
.modalconten{
color:black;
background:white;
}
.modalcontentim{
float:left;
margin-left:30px;
margin-top:30px;
margin-bottom:30px;
}
.modalcontenttex{
float:left;
text-align:justify;
color:black;
font-size: 9.5pt;
line-height:13pt;
margin-top:40px;
width:430px;
margin-left:30px;
}
.modalwikibutto{
cursor:pointer;
text-align:center;
margin-right:45px;
float:right;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin-bottom:30px;
border-radius: 3px;
width:170px;
height:30px;
border: 1px solid #82b92e;
margin-top:8%;
background-color:#82b92e;
}
.modalwikibuttontex{
color:#ffffff;
font-size:10pt;
position:relative;
top:6px;
}
#opacity{
background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
background:black;
opacity:0.1;
left:0px;
top:0px;
width:100%;
height:100%;
position: fixed;
z-index: 1;
}
img.modalclose {
text-align: right;
float: right;
padding-right: 11px;
padding-top: 11px;
vertical-align: middle;
cursor:pointer;
}
</style>
</head>
<body>
<div id="alert_messages_na">
<div class='modalheade'>
<span class='modalheadertex'>
<?php echo __('Database error'); ?>
</span>
<img class='modalclose' src='<?php echo $config['homeurl']; ?>/images/icono_cerrar.png'>
</div>
<div class='modalconten'>
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
<div class='modalcontenttex'>
<?php
if ($config['history_db_connection'] === false) {
echo __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.');
} else {
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
}
?>
</div>
</div>
<?php
$custom_conf_enabled = false;
foreach ($config as $key => $value) {
if (preg_match('/._alt/i', $key)) {
$custom_conf_enabled = true;
break;
}
} }
}
if (!$custom_conf_enabled || isset($config['custom_docs_url_alt'])) { if (empty($custom_conf_enabled) === true || isset($config['custom_docs_url_alt']) === true) {
if (isset($config['custom_docs_url_alt'])) { if (isset($config['custom_docs_url_alt']) === true) {
$docs_url = $config['custom_docs_url_alt']; $docs_url = $config['custom_docs_url_alt'];
} else { } else {
$docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration'; $docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration';
}
echo '
<a href="'.ui_get_full_external_url($docs_url).'" target="_blank">
<div class="modalwikibutto">
<span class="modalwikibuttontex">'.__('Documentation').'
</span>
</div>
</a>
';
} }
}
echo '<div id="mysqlerr" title="'.__('Error').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/mysqlerr.png', true, ['alt' => __('Mysql error'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<h1>'.__('Database error').'</h1>';
echo '<p>'.$message.'</p>';
echo '<br>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button(
__('Documentation'),
'mysqlerr_button',
false,
['class' => 'mini float-right']
);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
?>
?>
</a>
</div>
<div id="opacity"></div>
</body>
</html>
<script> <script>
$(function() {
$(".modalclose").click(function(){ $("#mysqlerr").dialog({
$('div#alert_messages_na').toggle(); resizable: true,
$('div#opacity').toggle(); draggable: true,
modal: true,
width: 700,
clickOutside: true,
overlay: {
opacity: 0.5,
background: "black"
}
}); });
});
$("#mysqlerr").hide();
$("#button-mysqlerr_button").click (function () {
window.open('<?php echo ui_get_full_external_url($docs_url); ?>', '_blank');
});
$(document).ready(function () {
$("#mysqlerr").show();
});
</script> </script>

View File

@ -77,7 +77,7 @@ if (! $id || ! file_exists($help_file)) {
echo '<div class="msg msg_pandora_help">'.__("%s help system has been called with a help reference that currently don't exist. There is no help content to show.", get_product_name()).'</div></div></div>'; echo '<div class="msg msg_pandora_help">'.__("%s help system has been called with a help reference that currently don't exist. There is no help content to show.", get_product_name()).'</div></div></div>';
echo '<br /><br />'; echo '<br /><br />';
echo '<div id="footer_help">'; echo '<div id="footer_help">';
include 'footer.php'; // include 'footer.php';
return; return;
} }
@ -100,7 +100,7 @@ ob_end_clean();
echo $help; echo $help;
echo '</div>'; echo '</div>';
echo '<div id="footer_help">'; echo '<div id="footer_help">';
require 'footer.php'; // require 'footer.php';
echo '</div>'; echo '</div>';
?> ?>
</body> </body>

View File

@ -31,6 +31,7 @@ global $config;
require_once $config['homedir'].'/include/functions_register.php'; require_once $config['homedir'].'/include/functions_register.php';
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php'; require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
require_once $config['homedir'].'/include/class/TipsWindow.class.php';
if ((bool) is_ajax() === true) { if ((bool) is_ajax() === true) {
@ -109,6 +110,16 @@ try {
$welcome = false; $welcome = false;
} }
try {
if (isset($_SESSION['showed_tips_window']) === false) {
$tips_window = new TipsWindow();
if ($tips_window !== null) {
$tips_window->run();
}
}
} catch (Exception $e) {
}
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
if (isset($config['2FA_all_users']) === false) { if (isset($config['2FA_all_users']) === false) {

View File

@ -59,7 +59,7 @@ ui_print_warning_message(
] ]
); );
$table = new StdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->data = []; $table->data = [];

View File

@ -59,23 +59,22 @@ $result = integria_api_call(null, null, null, null, 'get_incidents', $params, fa
$result = json_decode($result, true); $result = json_decode($result, true);
$count = count($result); if (empty($result) === true) {
$result = array_slice($result, $offset, $config['block_size']);
if (empty($result)) {
$result = []; $result = [];
$count = 0; $count = 0;
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />'; echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
return; return;
} else {
$count = count($result);
$result = array_slice($result, $offset, $config['block_size']);
} }
// Show pagination // Show pagination.
ui_pagination($count, $url, $offset, 0, false, 'offset'); ui_pagination($count, $url, $offset, 0, false, 'offset');
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query. // ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
echo '<br />'; echo '<br />';
// Show headers // Show headers.
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox'; $table->class = 'databox';
$table->cellpadding = 4; $table->cellpadding = 4;

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,35 @@
<?php <?php
/**
* Agent Modules Templates.
*
* @category Module
* @package Pandora FMS
* @subpackage Agent Configuration
* @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.
global $config; global $config;
// Load global vars // Load global vars.
if (!isset($id_agente)) { if (isset($id_agente) === false) {
die('Not Authorized'); die('Not Authorized');
} }
@ -23,8 +38,8 @@ require_once $config['homedir'].'/include/functions_modules.php';
// ========================== // ==========================
// TEMPLATE ASSIGMENT LOGIC // TEMPLATE ASSIGMENT LOGIC
// ========================== // ==========================
if (isset($_POST['template_id'])) { if (isset($_POST['template_id']) === true) {
// Take agent data // Take agent data.
$row = db_get_row('tagente', 'id_agente', $id_agente); $row = db_get_row('tagente', 'id_agente', $id_agente);
if ($row !== false) { if ($row !== false) {
$intervalo = $row['intervalo']; $intervalo = $row['intervalo'];
@ -49,7 +64,8 @@ if (isset($_POST['template_id'])) {
$npc = []; $npc = [];
} }
$success_count = $error_count = 0; $success_count = 0;
$error_count = 0;
$modules_already_added = []; $modules_already_added = [];
foreach ($npc as $row) { foreach ($npc as $row) {
@ -60,7 +76,7 @@ if (isset($_POST['template_id'])) {
} }
foreach ($nc as $row2) { foreach ($nc as $row2) {
// Insert each module from tnetwork_component into agent // Insert each module from tnetwork_component into agent.
$values = [ $values = [
'id_agente' => $id_agente, 'id_agente' => $id_agente,
'id_tipo_modulo' => $row2['type'], 'id_tipo_modulo' => $row2['type'],
@ -113,14 +129,14 @@ if (isset($_POST['template_id'])) {
$name = $row2['name']; $name = $row2['name'];
// Put tags in array if the component has to add them later // Put tags in array if the component has to add them later.
if (!empty($row2['tags'])) { if (empty($row2['tags']) === false) {
$tags = explode(',', $row2['tags']); $tags = explode(',', $row2['tags']);
} else { } else {
$tags = []; $tags = [];
} }
// Check if this module exists in the agent // Check if this module exists in the agent.
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente]); $module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente]);
if ($module_name_check !== false) { if ($module_name_check !== false) {
@ -132,13 +148,13 @@ if (isset($_POST['template_id'])) {
if ($id_agente_modulo === false) { if ($id_agente_modulo === false) {
$error_count++; $error_count++;
} else { } else {
if (!empty($tags)) { if (empty($tags) === false) {
// Creating tags // Creating tags.
$tag_ids = []; $tag_ids = [];
foreach ($tags as $tag_name) { foreach ($tags as $tag_name) {
$tag_id = tags_get_id($tag_name); $tag_id = tags_get_id($tag_name);
// If tag exists in the system we store to create it // If tag exists in the system we store to create it.
$tag_ids[] = $tag_id; $tag_ids[] = $tag_id;
} }
@ -152,7 +168,7 @@ if (isset($_POST['template_id'])) {
} }
if ($error_count > 0) { if ($error_count > 0) {
if (empty($modules_already_added)) { if (empty($modules_already_added) === true) {
ui_print_error_message(__('Error adding modules').sprintf(' (%s)', $error_count)); ui_print_error_message(__('Error adding modules').sprintf(' (%s)', $error_count));
} else { } else {
ui_print_error_message(__('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added)); ui_print_error_message(__('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added));
@ -168,8 +184,6 @@ if (isset($_POST['template_id'])) {
// ========================== // ==========================
// TEMPLATE ASSIGMENT FORM // TEMPLATE ASSIGMENT FORM
// ========================== // ==========================
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
$nps = db_get_all_fields_in_table('tnetwork_profile', 'name'); $nps = db_get_all_fields_in_table('tnetwork_profile', 'name');
if ($nps === false) { if ($nps === false) {
$nps = []; $nps = [];
@ -180,44 +194,45 @@ foreach ($nps as $row) {
$select[$row['id_np']] = $row['name']; $select[$row['id_np']] = $row['name'];
} }
echo '<table width="100%" cellpadding="0" cellspacing="0" class="databox filters" >'; $filterTable = new stdClass();
echo "<tr><td class='datos w50p'>"; $filterTable->width = '100%';
html_print_select($select, 'template_id', '', '', '', 0, false, false, true, '', false, 'max-width: 200px !important'); $filterTable->class = 'fixed_filter_bar';
echo '</td>'; $filterTable->data = [];
echo '<td class="datos">'; $filterTable->data[0][0] = __('Module templates');
html_print_submit_button(__('Assign'), 'crt', false, 'class="sub next mgn_tp_0"'); $filterTable->data[1][0] = html_print_select($select, 'template_id', '', '', '', 0, true, false, true, '', false, 'max-width: 200px !important');
echo '</td>'; $filterTable->data[1][1] = html_print_div(
echo '</tr>'; [
echo '</form>'; 'class' => 'action-buttons',
echo '</table>'; 'content' => html_print_submit_button(
echo '</form>'; __('Assign'),
'crt',
false,
[
'icon' => 'wand',
'mode' => 'secondary mini',
],
true
),
],
true
);
$outputFilterTable = '<form style="border:0" class="fixed_filter_bar" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
$outputFilterTable .= html_print_table($filterTable, true);
$outputFilterTable .= '</form>';
echo $outputFilterTable;
// ========================== // ==========================
// MODULE VISUALIZATION TABLE // MODULE VISUALIZATION TABLE
// ========================== // ==========================
switch ($config['dbtype']) { $sql = sprintf(
case 'mysql': 'SELECT *
case 'postgresql': FROM tagente_modulo
$sql = sprintf( WHERE id_agente = %d AND delete_pending = false
'SELECT * ORDER BY id_module_group, nombre',
FROM tagente_modulo $id_agente
WHERE id_agente = %d AND delete_pending = false );
ORDER BY id_module_group, nombre',
$id_agente
);
break;
case 'oracle':
$sql = sprintf(
'SELECT *
FROM tagente_modulo
WHERE id_agente = %d
AND (delete_pending <> 1 AND delete_pending IS NOT NULL)
ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)',
$id_agente
);
break;
}
$result = db_get_all_rows_sql($sql); $result = db_get_all_rows_sql($sql);
if ($result === false) { if ($result === false) {
@ -233,10 +248,10 @@ $table->head = [];
$table->data = []; $table->data = [];
$table->align = []; $table->align = [];
$table->head[0] = __('Module name'); $table->head[0] = '<span>'.__('Module name').'</span>';
$table->head[1] = __('Type'); $table->head[1] = '<span>'.__('Type').'</span>';
$table->head[2] = __('Description'); $table->head[2] = '<span>'.__('Description').'</span>';
$table->head[3] = __('Action'); $table->head[3] = '<span>'.__('Action').'</span>';
$table->align[1] = 'left'; $table->align[1] = 'left';
$table->align[3] = 'left'; $table->align[3] = 'left';
@ -245,27 +260,43 @@ $table->size[1] = '5%';
$table->size[3] = '8%'; $table->size[3] = '8%';
foreach ($result as $row) { foreach ($result as $row) {
$table->cellclass[][3] = 'table_action_buttons';
$data = []; $data = [];
$data[0] = '<span>'.$row['nombre']; $data[0] = '<span>'.$row['nombre'];
if ($row['id_tipo_modulo'] > 0) { $data[1] = ($row['id_tipo_modulo'] > 0) ? ui_print_moduletype_icon($row['id_tipo_modulo'], true, false, true) : '';
$data[1] = html_print_image('images/'.modules_show_icon_type($row['id_tipo_modulo']), true, ['border' => '0', 'class' => 'invert_filter']);
} else {
$data[1] = '';
}
$data[2] = mb_substr($row['descripcion'], 0, 60); $data[2] = mb_substr($row['descripcion'], 0, 60);
$data[3] = html_print_menu_button(
$table->cellclass[][3] = 'action_buttons'; [
$data[3] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).'</a>'; 'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'],
$data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'].'">'.html_print_image('images/config.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Update')]).'</a>'; 'image' => 'images/delete.svg',
'title' => __('Delete'),
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
],
true
);
$data[3] .= html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'],
'image' => 'images/edit.svg',
'title' => __('Edit'),
],
true
);
array_push($table->data, $data); array_push($table->data, $data);
} }
if (!empty($table->data)) { if (empty($table->data) === false) {
html_print_table($table); $output = html_print_table($table, true);
unset($table);
} else { } else {
ui_print_empty_data(__('No modules')); $output = ui_print_empty_data(__('No modules'), '', true);
} }
html_print_div(
[
'class' => 'datatable_form',
'content' => $output,
]
);

View File

@ -295,7 +295,6 @@ if ($create_agent) {
'fixed_ip' => $fixed_ip, 'fixed_ip' => $fixed_ip,
] ]
); );
enterprise_hook('update_agent', [$id_agente]);
} else { } else {
$id_agente = false; $id_agente = false;
} }
@ -377,94 +376,97 @@ $img_style = [
if ($id_agente) { if ($id_agente) {
// View tab. // View tab.
$viewtab['text'] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">'.html_print_image( $viewtab['text'] = html_print_anchor(
'images/eye.png',
true,
[ [
'title' => __('View'), 'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente,
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/enable.svg',
).'</a>'; true,
[
if ($tab == 'view') { 'title' => __('View'),
$viewtab['active'] = true; 'class' => 'invert_filter main_menu_icon',
} else { ]
$viewtab['active'] = false; ),
} ],
true
);
$viewtab['active'] = ($tab === 'view');
$viewtab['operation'] = 1; $viewtab['operation'] = 1;
// Main tab. // Main tab.
$maintab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'">'.html_print_image( $maintab['text'] = html_print_anchor(
'images/gm_setup.png',
true,
[ [
'title' => __('Setup'), 'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente,
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/configuration@svg.svg',
).'</a>'; true,
if ($tab == 'main') { [
$maintab['active'] = true; 'title' => __('Setup'),
} else { 'class' => 'invert_filter main_menu_icon',
$maintab['active'] = false; ]
} ),
],
true
);
$maintab['active'] = ($tab === 'main');
// Module tab. // Module tab.
$moduletab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">'.html_print_image( $moduletab['text'] = html_print_anchor(
'images/gm_modules.png',
true,
[ [
'title' => __('Modules'), 'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente,
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/modules@svg.svg',
).'</a>'; true,
[
'title' => __('Modules'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
if ($tab == 'module') { $moduletab['active'] = ($tab === 'module');
$moduletab['active'] = true;
} else {
$moduletab['active'] = false;
}
// Alert tab. // Alert tab.
$alerttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">'.html_print_image( $alerttab['text'] = html_print_anchor(
'images/gm_alerts.png',
true,
[ [
'title' => __('Alerts'), 'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente,
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/alert@svg.svg',
).'</a>'; true,
[
'title' => __('Alerts'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
if ($tab == 'alert') { $alerttab['active'] = ($tab === 'alert');
$alerttab['active'] = true;
} else {
$alerttab['active'] = false;
}
// Template tab. // Template tab.
$templatetab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente.'">'.html_print_image( $templatetab['text'] = html_print_menu_button(
'images/templates.png',
true,
[ [
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente,
'image' => 'images/modules-group@svg.svg',
'title' => __('Module templates'), 'title' => __('Module templates'),
'class' => 'invert_filter', ],
] true
).'</a>'; );
if ($tab == 'template') {
$templatetab['active'] = true;
} else {
$templatetab['active'] = false;
}
$templatetab['active'] = ($tab === 'template');
// Inventory. // Inventory.
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image( $inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/page_white_text.png', 'images/hardware-software-component@svg.svg',
true, true,
[ [
'title' => __('Inventory'), 'title' => __('Inventory'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>'; ).'</a>';
@ -474,11 +476,6 @@ if ($id_agente) {
$inventorytab['active'] = false; $inventorytab['active'] = false;
} }
if ($inventorytab == -1) {
$inventorytab = '';
}
$has_remote_conf = enterprise_hook( $has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration', 'config_agents_has_remote_configuration',
[$id_agente] [$id_agente]
@ -490,7 +487,7 @@ if ($id_agente) {
if ($has_remote_conf === true) { if ($has_remote_conf === true) {
// Plugins. // Plugins.
$pluginstab = enterprise_hook('plugins_tab'); $pluginstab = enterprise_hook('plugins_tab');
if ($pluginstab == -1) { if ($pluginstab === ENTERPRISE_NOT_HOOK) {
$pluginstab = ''; $pluginstab = '';
} }
} else { } else {
@ -500,60 +497,60 @@ if ($id_agente) {
// Collection. // Collection.
if ((int) $config['license_nms'] !== 1) { if ((int) $config['license_nms'] !== 1) {
$collectiontab = enterprise_hook('collection_tab'); $collectiontab = enterprise_hook('collection_tab');
if ($collectiontab === ENTERPRISE_NOT_HOOK) {
if ($collectiontab == -1) {
$collectiontab = ''; $collectiontab = '';
} }
} else {
$collectiontab = '';
} }
// NetworkConfigManager tab. // NetworkConfigManager tab.
$ncm_tab = enterprise_hook('networkconfigmanager_tab'); $ncm_tab = enterprise_hook('networkconfigmanager_tab');
if ($ncm_tab === ENTERPRISE_NOT_HOOK) { if ($ncm_tab === ENTERPRISE_NOT_HOOK) {
$ncm_tab = ''; $ncm_tab = '';
} }
// Group tab. // Group tab.
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'.html_print_image( $grouptab['text'] = html_print_menu_button(
'images/group.png',
true,
[ [
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group,
'image' => 'images/groups@svg.svg',
'title' => __('Group'), 'title' => __('Group'),
'class' => 'invert_filter', ],
] true
).'</a>'; );
$grouptab['active'] = false; $grouptab['active'] = false;
$gistab = []; $gistab = [];
// GIS tab. // TODO. OVERRIDE.
if ($config['activate_gis']) { $config['activate_gis'] = true;
$gistab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente.'">'.html_print_image(
'images/gm_gis.png',
true,
[
'title' => __('GIS data'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'gis') { // GIS tab.
$gistab['active'] = true; if ((bool) $config['activate_gis'] === true) {
} else { $gistab['text'] = html_print_menu_button(
$gistab['active'] = false; [
} 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente,
'image' => 'images/poi@svg.svg',
'title' => __('GIS data'),
],
true
);
$gistab['active'] = ($tab === 'gis');
} }
// Agent wizard tab. // Agent wizard tab.
$agent_wizard['text'] = '<a href="javascript:" class="agent_wizard_tab">'.html_print_image( $agent_wizard['text'] = html_print_menu_button(
'images/wand_agent.png',
true,
[ [
'href' => 'javascript:',
'class' => 'agent_wizard_tab',
'image' => 'images/wizard@svg.svg',
'title' => __('Agent wizard'), 'title' => __('Agent wizard'),
'class' => 'invert_filter', ],
] true
).'</a>'; );
// Hidden subtab layer. // Hidden subtab layer.
$agent_wizard['sub_menu'] = '<ul class="mn subsubmenu invisible float-none">'; $agent_wizard['sub_menu'] = '<ul class="mn subsubmenu invisible float-none">';
@ -601,42 +598,34 @@ if ($id_agente) {
// Incident tab. // Incident tab.
if ($total_incidents > 0) { if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'.html_print_image( $incidenttab['text'] = html_print_menu_button(
'images/book_edit.png',
true,
[ [
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'), 'title' => __('Incidents'),
'class' => 'invert_filter', ],
] true
).'</a>'; );
if ($tab == 'incident') { $incidenttab['active'] = ($tab === 'incident');
$incidenttab['active'] = true;
} else {
$incidenttab['active'] = false;
}
} }
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
if ($has_remote_conf) { if ($has_remote_conf !== false) {
$agent_name = agents_get_name($id_agente); $agent_name = agents_get_name($id_agente);
$agent_name = io_safe_output($agent_name); $agent_name = io_safe_output($agent_name);
$agent_md5 = md5($agent_name, false); $agent_md5 = md5($agent_name, false);
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">'.html_print_image( $remote_configuration_tab['text'] = html_print_menu_button(
'images/remote_configuration.png',
true,
[ [
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5,
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Remote configuration'), 'title' => __('Remote configuration'),
'class' => 'invert_filter', ],
] true
).'</a>'; );
if ($tab == 'remote_configuration') {
$remote_configuration_tab['active'] = true;
} else {
$remote_configuration_tab['active'] = false;
}
$remote_configuration_tab['active'] = ($tab === 'remote_configuration');
$onheader = [ $onheader = [
'view' => $viewtab, 'view' => $viewtab,
@ -719,37 +708,32 @@ if ($id_agente) {
// This add information to the header. // This add information to the header.
switch ($tab) { switch ($tab) {
case 'main': case 'main':
$tab_description = '- '.__('Setup');
$help_header = 'main_tab'; $help_header = 'main_tab';
$tab_name = 'Setup'; $tab_name = __('Setup');
break; break;
case 'collection': case 'collection':
$tab_description = '- '.__('Collection'); $tab_name = __('Collection');
$tab_name = 'Collection';
break; break;
case 'ncm': case 'ncm':
$tab_description = '- '.__('Network config manager'); $tab_name = __('Network config manager');
$tab_name = 'Network config manager';
break; break;
case 'inventory': case 'inventory':
$tab_description = '- '.__('Inventory');
$help_header = 'inventory_tab'; $help_header = 'inventory_tab';
$tab_name = 'Inventory'; $tab_name = __('Inventory');
break; break;
case 'plugins': case 'plugins':
$tab_description = '- '.__('Agent plugins');
$help_header = 'plugins_tab'; $help_header = 'plugins_tab';
$tab_name = __('Agent plugins');
break; break;
case 'module': case 'module':
$type_module_t = get_parameter('moduletype', ''); $type_module_t = get_parameter('moduletype', '');
$tab_description = '- '.__('Modules'); $tab_name = __('Modules');
$tab_name = 'Modules'; if ($type_module_t === 'webux') {
if ($type_module_t == 'webux') {
$help_header = 'wux_console'; $help_header = 'wux_console';
} else { } else {
$help_header = 'local_module_tab'; $help_header = 'local_module_tab';
@ -757,47 +741,42 @@ if ($id_agente) {
break; break;
case 'alert': case 'alert':
$tab_description = '- '.__('Alert');
$help_header = 'manage_alert_list'; $help_header = 'manage_alert_list';
$tab_name = 'Alerts'; $tab_name = __('Alerts');
break; break;
case 'template': case 'template':
$tab_description = '- '.__('Templates'); $tab_name = __('Module templates');
$tab_name = 'Module templates';
break; break;
case 'gis': case 'gis':
$tab_description = '- '.__('Gis'); $tab_name = __('Gis');
$help_header = 'gis_tab'; $help_header = 'gis_tab';
break; break;
case 'incident': case 'incident':
$tab_description = '- '.__('Incidents'); $tab_name = __('Incidents');
break; break;
case 'remote_configuration': case 'remote_configuration':
$tab_description = '- '.__('Remote configuration'); $tab_name = __('Remote configuration');
break; break;
case 'agent_wizard': case 'agent_wizard':
switch (get_parameter('wizard_section')) { switch (get_parameter('wizard_section')) {
case 'snmp_explorer': case 'snmp_explorer':
$tab_description = '- '.__('SNMP Wizard');
$help_header = 'agent_snmp_explorer_tab'; $help_header = 'agent_snmp_explorer_tab';
$tab_name = 'SNMP Wizard'; $tab_name = __('SNMP Wizard');
break; break;
case 'snmp_interfaces_explorer': case 'snmp_interfaces_explorer':
$tab_description = '- '.__('SNMP Interfaces wizard'); $tab_name = __('SNMP Interfaces Wizard');
$help_header = 'agent_snmp_interfaces_explorer_tab'; $help_header = 'agent_snmp_interfaces_explorer_tab';
$tab_name = 'SNMP Interfaces wizard';
break; break;
case 'wmi_explorer': case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard'); $tab_name = __('WMI Wizard');
$help_header = 'agent_snmp_wmi_explorer_tab'; $help_header = 'agent_snmp_wmi_explorer_tab';
$tab_name = 'WMI Wizard';
break; break;
default: default:
@ -826,48 +805,49 @@ if ($id_agente) {
} }
$helper = ($help_header === 'main_tab') ? 'main_tab' : ''; $helper = ($help_header === 'main_tab') ? 'main_tab' : '';
$pure = get_parameter('pure', 0); $pure = (int) get_parameter('pure');
if (!$pure) { if ($pure === 0) {
ui_print_page_header( ui_print_standard_header(
agents_get_alias($id_agente), __('Agent setup view'),
'images/setup.png', 'images/agent.png',
false, false,
$helper, $helper,
true,
$onheader,
false, false,
'', $onheader,
$config['item_title_size_text'], [
'',
ui_print_breadcrums(
[ [
__('Resources'), 'link' => '',
__('Manage agents'), 'label' => __('Resources'),
'<span class="breadcrumb_active">'.$tab_name.'</span>', ],
] [
) 'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
'label' => __('Manage agents'),
],
[
'link' => '',
'label' => $tab_name,
],
]
); );
} }
} else { } else {
// Create agent. ui_print_standard_header(
ui_print_page_header( __('Create agent'),
__('Agent manager'),
'images/agent.png', 'images/agent.png',
false, false,
'create_agent',
true,
'', '',
false, false,
'', [],
GENERIC_SIZE_TEXT, [
'',
ui_print_breadcrums(
[ [
__('Resources'), 'link' => '',
__('Manage agents'), 'label' => __('Resources'),
'<span class="breadcrumb_active">'.__('Create agent').'</span>', ],
] [
) 'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
'label' => __('Manage agents'),
],
]
); );
} }
@ -892,7 +872,8 @@ if ($delete_conf_file) {
ui_print_result_message( ui_print_result_message(
$correct, $correct,
__('Conf file deleted successfully'), __('Conf file deleted successfully'),
__('Could not delete conf file') __('Could not delete conf file'),
[ 'autoclose' => true ]
); );
} }
@ -1250,9 +1231,9 @@ if ($id_agente) {
$intervalo = $agent['intervalo']; $intervalo = $agent['intervalo'];
// Define interval in seconds. // Define interval in seconds.
$nombre_agente = $agent['nombre']; $nombre_agente = $agent['nombre'];
if (empty($alias)) { if (empty($alias) === true) {
$alias = $agent['alias']; $alias = $agent['alias'];
if (empty($alias)) { if (empty($alias) === true) {
$alias = $nombre_agente; $alias = $nombre_agente;
} }
} }
@ -1291,7 +1272,7 @@ $duplicate_module = (int) get_parameter('duplicate_module');
$edit_module = (bool) get_parameter('edit_module'); $edit_module = (bool) get_parameter('edit_module');
// GET DATA for MODULE UPDATE OR MODULE INSERT. // GET DATA for MODULE UPDATE OR MODULE INSERT.
if ($update_module || $create_module) { if ($update_module === true || $create_module === true) {
$id_grupo = agents_get_agent_group($id_agente); $id_grupo = agents_get_agent_group($id_agente);
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo); $all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
@ -1318,12 +1299,7 @@ if ($update_module || $create_module) {
*/ */
$post_process = (string) get_parameter('post_process', 0.0); $post_process = (string) get_parameter('post_process', 0.0);
if (get_parameter('prediction_module')) { $prediction_module = (int) get_parameter('prediction_module');
$prediction_module = 1;
} else {
$prediction_module = 0;
}
$max_timeout = (int) get_parameter('max_timeout'); $max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries'); $max_retries = (int) get_parameter('max_retries');
$min = (int) get_parameter('min'); $min = (int) get_parameter('min');
@ -1580,11 +1556,11 @@ if ($update_module || $create_module) {
} }
$cron_interval = $minute_from.$minute_to.' '.$hour_from.$hour_to.' '.$mday_from.$mday_to.' '.$month_from.$month_to.' '.$wday_from.$wday_to; $cron_interval = $minute_from.$minute_to.' '.$hour_from.$hour_to.' '.$mday_from.$mday_to.' '.$month_from.$month_to.' '.$wday_from.$wday_to;
if (!cron_check_syntax($cron_interval)) { if (cron_check_syntax($cron_interval) === false) {
$cron_interval = ''; $cron_interval = '';
} }
if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) { if ($prediction_module !== MODULE_PREDICTION_SYNTHETIC) {
unset($serialize_ops); unset($serialize_ops);
enterprise_hook( enterprise_hook(
'modules_delete_synthetic_operations', 'modules_delete_synthetic_operations',
@ -1709,7 +1685,7 @@ if ($update_module) {
$values['plugin_parameter'] = ''; $values['plugin_parameter'] = '';
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ((int) $key === 1) {
if ($http_user) { if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
} }
@ -1728,12 +1704,12 @@ if ($update_module) {
// In local modules, the interval is updated by agent. // In local modules, the interval is updated by agent.
$module_kind = (int) get_parameter('moduletype'); $module_kind = (int) get_parameter('moduletype');
if ($module_kind == MODULE_DATA) { if ($module_kind === MODULE_DATA) {
unset($values['module_interval']); unset($values['module_interval']);
} }
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC if ($prediction_module === MODULE_PREDICTION_SYNTHETIC
&& $serialize_ops == '' && empty($serialize_ops) === true
) { ) {
$result = false; $result = false;
} else { } else {
@ -1754,7 +1730,7 @@ if ($update_module) {
} }
} }
if (is_error($result)) { if (is_error($result) === true) {
switch ($result) { switch ($result) {
case ERR_EXIST: case ERR_EXIST:
$msg = __('There was a problem updating module. Another module already exists with the same name.'); $msg = __('There was a problem updating module. Another module already exists with the same name.');
@ -1787,7 +1763,7 @@ if ($update_module) {
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']) "Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
); );
} else { } else {
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) { if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook( enterprise_hook(
'modules_create_synthetic_operations', 'modules_create_synthetic_operations',
[ [
@ -1821,28 +1797,16 @@ if ($create_module) {
// Old configuration data must always be empty in case of creation. // Old configuration data must always be empty in case of creation.
$old_configuration_data = ''; $old_configuration_data = '';
if (isset($_POST['combo_snmp_oid'])) { if (isset($_POST['combo_snmp_oid']) === true) {
$combo_snmp_oid = get_parameter_post('combo_snmp_oid'); $combo_snmp_oid = get_parameter_post('combo_snmp_oid');
} }
if ($snmp_oid == '') { if (empty($snmp_oid) === true) {
$snmp_oid = $combo_snmp_oid; $snmp_oid = $combo_snmp_oid;
} }
$id_module = (int) get_parameter('id_module'); $id_module = (int) get_parameter('id_module');
switch ($config['dbtype']) {
case 'oracle':
if (empty($description) || !isset($description)) {
$description = ' ';
}
break;
default:
// Default.
break;
}
$values = [ $values = [
'id_tipo_modulo' => $id_module_type, 'id_tipo_modulo' => $id_module_type,
'descripcion' => $description, 'descripcion' => $description,
@ -1911,13 +1875,13 @@ if ($create_module) {
'warning_time' => $warning_time, 'warning_time' => $warning_time,
]; ];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) { if ($id_module_type === 30 || $id_module_type === 31 || $id_module_type === 32 || $id_module_type === 33) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']); $plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = ''; $values['plugin_parameter'] = '';
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ((int) $key === 1) {
if ($http_user) { if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
} }
@ -1925,15 +1889,13 @@ if ($create_module) {
if ($http_pass) { if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
} }
$values['plugin_parameter'] .= $value.'&#x0a;';
} else {
$values['plugin_parameter'] .= $value.'&#x0a;';
} }
$values['plugin_parameter'] .= $value.'&#x0a;';
} }
} }
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC && $serialize_ops == '') { if ((int) $prediction_module === MODULE_PREDICTION_SYNTHETIC && empty($serialize_ops) === true) {
$id_agent_module = false; $id_agent_module = false;
} else { } else {
$id_agent_module = modules_create_agent_module( $id_agent_module = modules_create_agent_module(
@ -1945,7 +1907,7 @@ if ($create_module) {
); );
} }
if (is_error($id_agent_module)) { if (is_error($id_agent_module) === true) {
switch ($id_agent_module) { switch ($id_agent_module) {
case ERR_EXIST: case ERR_EXIST:
$msg = __('There was a problem adding module. Another module already exists with the same name.'); $msg = __('There was a problem adding module. Another module already exists with the same name.');
@ -1974,7 +1936,7 @@ if ($create_module) {
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']) "Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
); );
} else { } else {
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) { if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook( enterprise_hook(
'modules_create_synthetic_operations', 'modules_create_synthetic_operations',
[ [
@ -2254,8 +2216,8 @@ if ($disable_module) {
} }
// UPDATE GIS. // UPDATE GIS.
$updateGIS = get_parameter('update_gis', 0); $updateGIS = (bool) get_parameter('update_gis', 0);
if ($updateGIS) { if ($updateGIS === true) {
$updateGisData = get_parameter('update_gis_data'); $updateGisData = get_parameter('update_gis_data');
$lastLatitude = get_parameter('latitude'); $lastLatitude = get_parameter('latitude');
$lastLongitude = get_parameter('longitude'); $lastLongitude = get_parameter('longitude');
@ -2525,7 +2487,7 @@ switch ($tab) {
if(wizard_tab_showed <= 0) { if(wizard_tab_showed <= 0) {
$('.subsubmenu').hide("fast"); $('.subsubmenu').hide("fast");
} }
},15000); },1500);
} }
/* ]]> */ /* ]]> */

View File

@ -1,16 +1,32 @@
<?php <?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 // Load global vars.
// ==================================================
// 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; global $config;
check_login(); check_login();
@ -47,13 +63,8 @@ if ($id_field) {
} }
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->class = 'databox';
$table->class = 'databox filters';
$table->id = 'configure_field'; $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 "<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>'; 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 = [];
$table->data[0][0] = __('Name'); $table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text( $table->data[1][0] = html_print_input_text(
'name', 'name',
$name, $name,
'', '',
@ -84,30 +95,39 @@ $table->data[0][1] = html_print_input_text(
true 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'), __('The fields with pass type enabled will be displayed like html input type pass in html'),
true 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', 'is_password_type',
1, 1,
$is_password_type, $is_password_type,
true true
); );
$table->data[3][1] = html_print_checkbox_switch(
$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(
'display_on_front', 'display_on_front',
1, 1,
$display_on_front, $display_on_front,
true true
); );
$table->data[3][2] = html_print_checkbox_switch_extended(
$table->data[3][0] = __('Enabled combo'); 'is_link_enabled',
$table->data[3][1] = html_print_checkbox_switch_extended( 1,
$is_link_enabled,
false,
'',
'',
true
);
$table->data[4][0] = __('Enabled combo');
$table->data[5][0] = html_print_checkbox_switch_extended(
'is_combo_enable', 'is_combo_enable',
0, 0,
$config['is_combo_enable'], $config['is_combo_enable'],
@ -117,12 +137,15 @@ $table->data[3][1] = html_print_checkbox_switch_extended(
true 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'), __('Set values separated by comma'),
true true
); );
$table->data[4][1] = html_print_textarea( $table->data[5][1] = html_print_textarea(
'combo_values', 'combo_values',
3, 3,
65, 65,
@ -131,31 +154,40 @@ $table->data[4][1] = html_print_textarea(
true 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">'; echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table); 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('update_field', 1);
html_print_input_hidden('id_field', $id_field); html_print_input_hidden('id_field', $id_field);
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"'); $buttonCaption = __('Update');
$buttonName = 'updbutton';
} else { } else {
html_print_input_hidden('create_field', 1); 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>'; echo '</form>';
?> ?>

View File

@ -1,22 +1,37 @@
<?php <?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 // Load global vars.
// ==================================================
// 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; global $config;
check_login(); check_login();
if (!check_acl($config['id_user'], 0, 'PM')) { if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access Group Management' 'Trying to access Group Management'
@ -27,7 +42,24 @@ if (!check_acl($config['id_user'], 0, 'PM')) {
} }
// Header. // 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'); $create_field = (bool) get_parameter('create_field');
$update_field = (bool) get_parameter('update_field'); $update_field = (bool) get_parameter('update_field');
@ -114,7 +146,6 @@ $fields = db_get_all_rows_filter(
); );
$table = new stdClass(); $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
if ($fields) { if ($fields) {
$table->head = []; $table->head = [];
@ -140,34 +171,66 @@ if ($fields === false) {
foreach ($fields as $field) { foreach ($fields as $field) {
$data[0] = $field['id_field']; $data[0] = $field['id_field'];
$data[1] = $field['name'];
$data[1] = '<b>'.$field['name'].'</b>'; $data[2] = html_print_image(
((bool) $field['display_on_front'] === true) ? 'images/validate.svg' : 'images/fail@svg.svg',
true,
['class' => 'main_menu_icon invert_filter']
);
if ($field['display_on_front']) { $table->cellclass[][3] = 'table_action_buttons';
$data[2] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']); $tableActionButtons = [];
} else { $tableActionButtons[] = html_print_anchor(
$data[2] = html_print_image( [
'images/icono_stop.png', 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'],
true, 'content' => html_print_image(
['style' => 'width:21px;height:21px;'] 'images/edit.svg',
); true,
} [
'title' => __('Edit'),
'class' => 'main_menu_icon invert_filter',
]
),
],
true
);
$table->cellclass[][3] = 'action_buttons'; $tableActionButtons[] = html_print_anchor(
$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>'; '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); array_push($table->data, $data);
} }
if ($fields) { if ($fields) {
ui_pagination($count_fields, false, $offset);
html_print_table($table); 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">'; echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; html_print_action_buttons(
html_print_submit_button(__('Create field'), 'crt', false, 'class="sub next"'); html_print_submit_button(
echo '</div>'; __('Create field'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
);
echo '</form>'; echo '</form>';

View File

@ -235,7 +235,7 @@ if (db_get_num_rows($sql) == 0) {
if ($id_policy) { if ($id_policy) {
$policy = policies_get_policy($id_policy); $policy = policies_get_policy($id_policy);
$data[0] = '<a href="index.php?sec=gmodules&sec2='.ENTERPRISE_DIR.'/godmode/policies/policies&id='.$id_policy.'">'; $data[0] = '<a href="index.php?sec=gmodules&sec2='.ENTERPRISE_DIR.'/godmode/policies/policies&id='.$id_policy.'">';
$data[0] .= html_print_image('images/policies_mc.png', true, ['border' => '0', 'title' => $policy['name']]); $data[0] .= html_print_image('images/policy@svg.svg', true, ['border' => '0', 'title' => $policy['name'], 'class' => 'main_menu_icon invert_filter']);
$data[0] .= '</a>'; $data[0] .= '</a>';
} else { } else {
$data[0] = ''; $data[0] = '';
@ -247,15 +247,15 @@ if (db_get_num_rows($sql) == 0) {
$data[4] = human_time_description_raw($row['interval']); $data[4] = human_time_description_raw($row['interval']);
// Delete module // Delete module
$data[5] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&delete_inventory_module='.$row['id_agent_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'; $data[5] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&delete_inventory_module='.$row['id_agent_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[5] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']); $data[5] .= html_print_image('images/delete.svg', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'main_menu_icon invert_filter']);
$data[5] .= '</b></a>&nbsp;&nbsp;'; $data[5] .= '</b></a>&nbsp;&nbsp;';
// Update module // Update module
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">'; $data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">';
$data[5] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']); $data[5] .= html_print_image('images/edit.svg', true, ['border' => '0', 'title' => __('Update'), 'class' => 'main_menu_icon invert_filter']);
$data[5] .= '</b></a>&nbsp;&nbsp;'; $data[5] .= '</b></a>&nbsp;&nbsp;';
// Force refresh module // Force refresh module
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&force_inventory_module='.$row['id_agent_module_inventory'].'">'; $data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&force_inventory_module='.$row['id_agent_module_inventory'].'">';
$data[5] .= html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force'), 'class' => 'invert_filter']).'</b></a>'; $data[5] .= html_print_image('images/change-active.svg', true, ['border' => '0', 'title' => __('Force'), 'class' => 'main_menu_icon invert_filter']).'</b></a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -36,10 +36,10 @@ $ag_group = get_parameter('ag_group_refresh', -1);
$sortField = get_parameter('sort_field'); $sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none'); $sort = get_parameter('sort', 'none');
$recursion = (bool) get_parameter('recursion', false); $recursion = (bool) get_parameter('recursion', false);
$disabled = get_parameter('disabled', 0); $disabled = (int) get_parameter('disabled');
$os = get_parameter('os', 0); $os = (int) get_parameter('os');
if ($ag_group == -1) { if ($ag_group === -1) {
$ag_group = (int) get_parameter('ag_group', -1); $ag_group = (int) get_parameter('ag_group', -1);
} }
@ -68,15 +68,16 @@ if (! check_acl(
enterprise_include_once('include/functions_policies.php'); enterprise_include_once('include/functions_policies.php');
require_once 'include/functions_agents.php'; require_once 'include/functions_agents.php';
require_once 'include/functions_users.php'; require_once 'include/functions_users.php';
enterprise_include_once('include/functions_config_agents.php');
$search = get_parameter('search', ''); $search = get_parameter('search');
// Prepare the tab system to the future. // Prepare the tab system to the future.
$tab = 'view'; $tab = 'view';
// Setup tab. // Setup tab.
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image( $viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image(
'images/eye_show.png', 'images/see-details@svg.svg',
true, true,
[ [
'title' => __('View'), 'title' => __('View'),
@ -132,20 +133,19 @@ $agent_to_delete = (int) get_parameter('borrar_agente');
$enable_agent = (int) get_parameter('enable_agent'); $enable_agent = (int) get_parameter('enable_agent');
$disable_agent = (int) get_parameter('disable_agent'); $disable_agent = (int) get_parameter('disable_agent');
if ($disable_agent != 0) { if ($disable_agent !== 0) {
$server_name = db_get_row_sql( $server_name = db_get_row_sql(
'select server_name from tagente where id_agente = '.$disable_agent 'select server_name from tagente where id_agente = '.$disable_agent
); );
} else if ($enable_agent != 0) { } else if ($enable_agent !== 0) {
$server_name = db_get_row_sql( $server_name = db_get_row_sql(
'select server_name from tagente where id_agente = '.$enable_agent 'select server_name from tagente where id_agente = '.$enable_agent
); );
} }
$result = null; $result = null;
if ($agent_to_delete) { if ($agent_to_delete > 0) {
$id_agente = $agent_to_delete; $id_agente = $agent_to_delete;
if (check_acl_one_of_groups( if (check_acl_one_of_groups(
$config['id_user'], $config['id_user'],
@ -171,17 +171,10 @@ if ($agent_to_delete) {
__('Could not be deleted.') __('Could not be deleted.')
); );
if (enterprise_installed()) { if (enterprise_installed() === true) {
// Check if the remote config file still exist. // Check if the remote config file still exist.
if (isset($config['remote_config'])) { if (isset($config['remote_config']) === true) {
enterprise_include_once( if ((bool) enterprise_hook('config_agents_has_remote_configuration', [$id_agente]) === true) {
'include/functions_config_agents.php'
);
if (enterprise_hook(
'config_agents_has_remote_configuration',
[$id_agente]
)
) {
ui_print_error_message( ui_print_error_message(
__('Maybe the files conf or md5 could not be deleted') __('Maybe the files conf or md5 could not be deleted')
); );
@ -190,7 +183,7 @@ if ($agent_to_delete) {
} }
} }
if ($enable_agent) { if ($enable_agent > 0) {
$result = db_process_sql_update( $result = db_process_sql_update(
'tagente', 'tagente',
['disabled' => 0], ['disabled' => 0],
@ -198,7 +191,7 @@ if ($enable_agent) {
); );
$alias = io_safe_output(agents_get_alias($enable_agent)); $alias = io_safe_output(agents_get_alias($enable_agent));
if ($result) { if ((bool) $result !== false) {
// Update the agent from the metaconsole cache. // Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php'); enterprise_include_once('include/functions_agents.php');
$values = ['disabled' => 0]; $values = ['disabled' => 0];
@ -236,7 +229,7 @@ if ($enable_agent) {
); );
} }
if ($disable_agent) { if ($disable_agent > 0) {
$result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]); $result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]);
$alias = io_safe_output(agents_get_alias($disable_agent)); $alias = io_safe_output(agents_get_alias($disable_agent));
@ -279,28 +272,45 @@ if ($disable_agent) {
); );
} }
echo "<table cellpadding='4' cellspacing='4' class='databox filters font_bold margin-bottom-10' width='100%'>
<tr>";
echo "<form method='post'
action='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'>";
echo '<td>';
echo __('Group').'&nbsp;';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl( if ((bool) $own_info['is_admin'] === false && (bool) check_acl(
$config['id_user'], $config['id_user'],
0, 0,
'AR' 'AR'
) && !check_acl($config['id_user'], 0, 'AW') ) === false && (bool) check_acl($config['id_user'], 0, 'AW') === false
) { ) {
$return_all_group = false; $return_all_group = false;
} else { } else {
$return_all_group = true; $return_all_group = true;
} }
echo '<div class="w250px inline">'; $showAgentFields = [
html_print_select_groups( 2 => __('Everyone'),
1 => __('Only disabled'),
0 => __('Only enabled'),
];
$pre_fields = db_get_all_rows_sql(
'select distinct(tagente.id_os),tconfig_os.name from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'
);
$fields = [];
foreach ($pre_fields as $key => $value) {
$fields[$value['id_os']] = $value['name'];
}
// Filter table.
$filterTable = new stdClass();
$filterTable->class = 'fixed_filter_bar';
$filterTable->data = [];
$filterTable->cellstyle[0][0] = 'width:0';
$filterTable->cellstyle[0][1] = 'width:0';
$filterTable->cellstyle[0][2] = 'width:0';
$filterTable->cellstyle[0][3] = 'width:0';
$filterTable->data[0][0] = __('Group');
$filterTable->data[1][0] = html_print_select_groups(
false, false,
'AR', 'AR',
$return_all_group, $return_all_group,
@ -309,71 +319,78 @@ html_print_select_groups(
'this.form.submit();', 'this.form.submit();',
'', '',
0, 0,
false, true,
false, false,
true, true,
'', '',
false false
); );
echo '</div></td>';
// Recursion checkbox. $filterTable->data[0][1] = __('Recursion');
echo '<td>'; $filterTable->data[1][1] = html_print_checkbox_switch(
echo __('Recursion').'&nbsp;';
html_print_checkbox(
'recursion', 'recursion',
1, 1,
$recursion, $recursion,
false, true,
false, false,
'this.form.submit()' 'this.form.submit()'
); );
echo '</td>';
echo '<td>'; $filterTable->data[0][2] = __('Show agents');
echo __('Show Agents').'&nbsp;'; $filterTable->data[1][2] = html_print_select(
$fields = [ $showAgentFields,
2 => __('Everyone'),
1 => __('Only disabled'),
0 => __('Only enabled'),
];
html_print_select(
$fields,
'disabled', 'disabled',
$disabled, $disabled,
'this.form.submit()' 'this.form.submit()',
); '',
0,
echo '</td>';
echo '<td>';
echo __('Operative System').'&nbsp;';
$pre_fields = db_get_all_rows_sql(
'select distinct(tagente.id_os),tconfig_os.name from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'
);
$fields = [];
foreach ($pre_fields as $key => $value) {
$fields[$value['id_os']] = $value['name'];
}
html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0);
echo '</td><td>';
echo __('Search').'&nbsp;';
html_print_input_text('search', $search, '', 12);
echo ui_print_help_tip(
__('Search filter by alias, name, description, IP address or custom fields content'),
true true
); );
echo '</td><td>'; $filterTable->data[0][3] = __('Operating System');
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>"; $filterTable->data[1][3] = html_print_select(
echo '</form>'; $fields,
echo '<td>'; 'os',
echo '</tr></table>'; $os,
'this.form.submit()',
'All',
0,
true
);
$filterTable->data[0][4] = __('Free search');
$filterTable->data[0][4] .= ui_print_help_tip(
__('Search filter by alias, name, description, IP address or custom fields content'),
true
);
$filterTable->data[1][4] = html_print_input_text(
'search',
$search,
'',
12,
255,
true
);
$filterTable->cellstyle[1][5] = 'vertical-align: bottom';
$filterTable->data[1][5] = html_print_submit_button(
__('Filter'),
'srcbutton',
false,
[
'icon' => 'search',
'class' => 'float-right',
'mode' => 'secondary mini',
],
true
);
// Print filter table.
echo '<form method=\'post\' action=\'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente\'>';
html_print_table($filterTable);
echo '</form>';
// Data table.
$selected = true; $selected = true;
$selectNameUp = false; $selectNameUp = false;
$selectNameDown = false; $selectNameDown = false;
@ -381,6 +398,8 @@ $selectOsUp = false;
$selectOsDown = false; $selectOsDown = false;
$selectGroupUp = false; $selectGroupUp = false;
$selectGroupDown = false; $selectGroupDown = false;
$selectRemoteUp = false;
$selectRemoteDown = false;
switch ($sortField) { switch ($sortField) {
case 'remote': case 'remote':
switch ($sort) { switch ($sort) {
@ -553,7 +572,7 @@ if ($disabled == 1) {
} }
} }
if ($os != 0) { if ($os !== 0) {
$search_sql .= ' AND id_os = '.$os; $search_sql .= ' AND id_os = '.$os;
} }
@ -562,7 +581,7 @@ $user_groups_to_sql = '';
if ($ag_group > 0) { if ($ag_group > 0) {
$ag_groups = []; $ag_groups = [];
$ag_groups = (array) $ag_group; $ag_groups = (array) $ag_group;
if ($recursion) { if ($recursion === true) {
$ag_groups = groups_get_children_ids($ag_group, true); $ag_groups = groups_get_children_ids($ag_group, true);
} }
@ -610,23 +629,15 @@ $sql = sprintf(
); );
$agents = db_get_all_rows_sql($sql); $agents = db_get_all_rows_sql($sql);
$custom_font_size = '';
// Delete rnum row generated by oracle_recode_query() function.
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
for ($i = 0; $i < count($agents); $i++) {
unset($agents[$i]['rnum']);
}
}
// Prepare pagination. // Prepare pagination.
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); // ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
if ($agents !== false) { if ($agents !== false) {
// Urls to sort the table. // Urls to sort the table.
if ($config['language'] == 'ja' if ($config['language'] === 'ja'
|| $config['language'] == 'zh_CN' || $config['language'] === 'zh_CN'
|| $own_info['language'] == 'ja' || $own_info['language'] === 'ja'
|| $own_info['language'] == 'zh_CN' || $own_info['language'] === 'zh_CN'
) { ) {
// Adds a custom font size for Japanese and Chinese language. // Adds a custom font size for Japanese and Chinese language.
$custom_font_size = 'custom_font_size'; $custom_font_size = 'custom_font_size';
@ -641,38 +652,33 @@ if ($agents !== false) {
$url_up_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled'; $url_up_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled';
$url_down_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled'; $url_down_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled';
$tableAgents = new stdClass();
$tableAgents->id = 'agent_list';
$tableAgents->class = 'info_table tactical_table';
$tableAgents->head = [];
$tableAgents->data = [];
// Header.
$tableAgents->head[0] = '<span>'.__('Agent name').'</span>';
$tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown);
$tableAgents->head[1] = '<span title=\''.__('Remote agent configuration').'\'>'.__('R').'</span>';
$tableAgents->head[1] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown);
$tableAgents->head[2] = '<span>'.__('OS').'</span>';
$tableAgents->head[2] .= ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown);
$tableAgents->head[3] = '<span>'.__('Type').'</span>';
$tableAgents->head[4] = '<span>'.__('Group').'</span>';
$tableAgents->head[4] .= ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown);
$tableAgents->head[5] = '<span>'.__('Description').'</span>';
$tableAgents->head[6] = '<span>'.__('Actions').'</span>';
// Body.
foreach ($agents as $key => $agent) {
// Begin Update tagente.remote with 0/1 values.
$resultHasRemoteConfig = ((int) enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]) > 0);
db_process_sql_update(
'tagente',
['remote' => ((int) $resultHasRemoteConfig) ],
'id_agente = '.$agent['id_agente'].''
);
echo "<table cellpadding='0' id='agent_list' cellspacing='0' width='100%' class='info_table'>";
echo '<thead><tr>';
echo '<th>'.__('Agent name').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown).'</th>';
echo "<th title='".__('Remote agent configuration')."'>".__('R').ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown).'</th>';
echo '<th>'.__('OS').ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown).'</th>';
echo '<th>'.__('Type').'</th>';
echo '<th>'.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).'</th>';
echo '<th>'.__('Description').'</th>';
echo "<th class='context_help_body'>".__('Actions').'</th>';
echo '</tr></thead>';
$color = 1;
$rowPair = true;
$iterator = 0;
foreach ($agents as $agent) {
// Begin Update tagente.remote 0/1 with remote agent function return.
if (enterprise_hook(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
)
) {
db_process_sql_update(
'tagente',
['remote' => 1],
'id_agente = '.$agent['id_agente'].''
);
} else {
db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].'');
}
// End Update tagente.remote 0/1 with remote agent function return.
$all_groups = agents_get_all_groups_agent( $all_groups = agents_get_all_groups_agent(
$agent['id_agente'], $agent['id_agente'],
$agent['id_grupo'] $agent['id_grupo']
@ -688,87 +694,66 @@ if ($agents !== false) {
'AD' 'AD'
); );
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']); $cluster = db_get_row_sql(
'select id from tcluster where id_agent = '.$agent['id_agente']
);
// Do not show the agent if there is not enough permissions. if ($check_aw === false && $check_ad === false) {
if (!$check_aw && !$check_ad) {
continue; continue;
} }
if ($color == 1) { if ((int) $agent['id_os'] === CLUSTER_OS_ID) {
$tdcolor = 'datos'; $cluster = PandoraFMS\Cluster::loadFromAgentId($agent['id_agente']);
$color = 0; $agentNameUrl = sprintf(
'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id=%s',
$cluster->id()
);
$agentViewUrl = sprintf(
'index.php?sec=reporting&sec2=operation/cluster/cluster&op=view&id=%s',
$cluster->id()
);
} else { } else {
$tdcolor = 'datos2'; $main_tab = ($check_aw === true) ? 'main' : 'module';
$color = 1; $agentNameUrl = sprintf(
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=%s&id_agente=%s',
$main_tab,
$agent['id_agente']
);
$agentViewUrl = sprintf(
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
$agent['id_agente']
);
} }
if (empty($agent['alias']) === true) {
if ($rowPair) {
$rowclass = 'rowPair';
} else {
$rowclass = 'rowOdd';
}
$rowPair = !$rowPair;
$iterator++;
// Agent name.
echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>";
if ($agent['disabled']) {
echo '<em>';
}
echo '<span class="left">';
echo '<strong>';
if ($check_aw) {
$main_tab = 'main';
} else {
$main_tab = 'module';
}
if ($agent['alias'] == '') {
$agent['alias'] = $agent['nombre']; $agent['alias'] = $agent['nombre'];
} }
if ($agent['id_os'] == CLUSTER_OS_ID) { $additionalDataAgentName = [];
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
);
$url = 'index.php?sec=reporting&sec2=';
$url .= 'operation/cluster/cluster';
$url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id()
);
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
} else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</span>'.'</a>';
}
echo '</strong>'; $inPlannedDowntime = db_get_sql(
$in_planned_downtime = db_get_sql(
'SELECT executed FROM tplanned_downtime 'SELECT executed FROM tplanned_downtime
INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1 WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1
AND tplanned_downtime.type_downtime <> "disable_agent_modules"' AND tplanned_downtime.type_downtime <> "disable_agent_modules"'
); );
if ($agent['disabled']) { if ($inPlannedDowntime !== false) {
ui_print_help_tip(__('Disabled')); $additionalDataAgentName[] = ui_print_help_tip(
__('Module in scheduled downtime'),
if (!$in_planned_downtime) { true,
echo '</em>'; 'images/clock.svg'
} );
} }
if ($agent['quiet']) { if ((bool) $agent['disabled'] === true) {
echo '&nbsp;'; $additionalDataAgentName[] = ui_print_help_tip(__('Disabled'));
html_print_image( }
if ((bool) $agent['quiet'] === true) {
$additionalDataAgentName[] = html_print_image(
'images/dot_blue.png', 'images/dot_blue.png',
false, true,
[ [
'border' => '0', 'border' => '0',
'title' => __('Quiet'), 'title' => __('Quiet'),
@ -777,183 +762,254 @@ if ($agents !== false) {
); );
} }
if ($in_planned_downtime) { // Agent name column (1). Agent name.
ui_print_help_tip( $agentNameColumn = html_print_anchor(
__('Agent in scheduled downtime'), [
false, 'href' => ui_get_full_url($agentNameUrl),
'images/minireloj-16.png' 'title' => $agent['nombre'],
); 'content' => ui_print_truncate_text($agent['alias'], 'agent_medium').implode('', $additionalDataAgentName),
],
true
);
echo '</em>'; $additionalOptionsAgentName = [];
// Additional options generation.
if ($check_aw === true) {
$additionalOptionsAgentName[] = html_print_anchor(
[
'href' => ui_get_full_url($agentNameUrl),
'content' => __('Edit'),
],
true
);
} }
echo '</span><div class="left actions clear_left" style=" visibility: hidden">'; if ((int) $agent['id_os'] !== 100) {
if ($check_aw) { $additionalOptionsAgentName[] = html_print_anchor(
if ($agent['id_os'] == CLUSTER_OS_ID) { [
$cluster = PandoraFMS\Cluster::loadFromAgentId( 'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$agent['id_agente']),
$agent['id_agente'] 'content' => __('Modules'),
); ],
$url = 'index.php?sec=reporting&sec2='; true
$url .= 'operation/cluster/cluster'; );
$url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id()
);
echo '<a href="'.$url.'">'.__('Edit').'</a>';
echo ' | ';
} else {
echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente='.$agent['id_agente'].'">'.__('Edit').'</a>';
echo ' | ';
}
} }
if ($agent['id_os'] != 100) { $additionalOptionsAgentName[] = html_print_anchor(
echo '<a href="index.php?sec=gagente& [
sec2=godmode/agentes/configurar_agente&tab=module& 'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$agent['id_agente']),
id_agente='.$agent['id_agente'].'">'.__('Modules').'</a>'; 'content' => __('Alerts'),
echo ' | '; ],
} true
);
echo '<a href="index.php?sec=gagente& $additionalOptionsAgentName[] = html_print_anchor(
sec2=godmode/agentes/configurar_agente&tab=alert& [
id_agente='.$agent['id_agente'].'">'.__('Alerts').'</a>'; 'href' => ui_get_full_url($agentViewUrl),
echo ' | '; 'content' => __('View'),
],
true
);
if ($agent['id_os'] == CLUSTER_OS_ID) { // Agent name column (2). Available options.
$cluster = PandoraFMS\Cluster::loadFromAgentId( $agentAvailableActionsColumn = html_print_div(
$agent['id_agente'] [
'class' => 'left actions clear_left w100p',
'style' => 'visibility: hidden',
'content' => implode(' | ', $additionalOptionsAgentName),
],
true
);
// Remote Configuration column.
if ($resultHasRemoteConfig === true) {
$remoteConfigurationColumn = html_print_menu_button(
[
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1'),
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Edit remote config'),
],
true
); );
$url = 'index.php?sec=reporting&sec2=';
$url .= 'operation/cluster/cluster';
$url = ui_get_full_url(
$url.'&op=view&id='.$cluster->id()
);
echo '<a href="'.$url.'">'.__('View').'</a>';
} else { } else {
echo '<a href="index.php?sec=estado $remoteConfigurationColumn = '';
&sec2=operation/agentes/ver_agente
&id_agente='.$agent['id_agente'].'">'.__('View').'</a>';
} }
echo '</div>'; // Operating System icon column.
echo '</td>'; $osIconColumn = html_print_div(
[
'class' => 'main_menu_icon invert_filter',
'content' => ui_print_os_icon($agent['id_os'], false, true),
],
true
);
echo "<td align='left' class='$tdcolor'>"; // Agent type column.
// Has remote configuration ? $agentTypeIconColumn = ui_print_type_agent_icon(
if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php');
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
echo "<a href='index.php?".'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$agent['id_agente']."&disk_conf=1'>";
echo html_print_image(
'images/application_edit.png',
true,
[
'align' => 'middle',
'title' => __('Edit remote config'),
'class' => 'invert_filter',
]
);
echo '</a>';
}
}
echo '</td>';
// Operating System icon.
echo "<td class='$tdcolor' align='left' valign='middle'>";
ui_print_os_icon($agent['id_os'], false);
echo '</td>';
// Type agent (Networt, Software or Satellite).
echo "<td class='$tdcolor' align='left' valign='middle'>";
echo ui_print_type_agent_icon(
$agent['id_os'], $agent['id_os'],
$agent['ultimo_contacto_remoto'], $agent['ultimo_contacto_remoto'],
$agent['ultimo_contacto'], $agent['ultimo_contacto'],
true,
$agent['remote'], $agent['remote'],
$agent['agent_version'] $agent['agent_version']
); );
echo '</td>';
// Group icon and name column.
$agentGroupIconColumn = html_print_div(
[
'class' => 'main_menu_icon invert_filter',
'content' => ui_print_group_icon($agent['id_grupo'], true),
],
true
);
// Group icon and name. // Description column.
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>'; $descriptionColumn = ui_print_truncate_text(
$agent['comentarios'],
'description',
true,
true,
true,
'[&hellip;]'
);
// Description. $agentActionButtons = [];
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]').'</span></td>';
// Action if ((bool) $agent['disabled'] === true) {
// When there is only one element in page it's necesary go back page. $agentDisableEnableTitle = __('Enable agent');
if ((count($agents) == 1) && ($offset >= $config['block_size'])) { $agentDisableEnableAction = 'enable_agent';
$offsetArg = ($offset - $config['block_size']); $agentDisableEnableCaption = __('You are going to enable a cluster agent. Are you sure?');
$agentDisableEnableIcon = 'change-pause.svg';
} else { } else {
$offsetArg = $offset; $agentDisableEnableTitle = __('Disable agent');
$agentDisableEnableAction = 'disable_agent';
$agentDisableEnableCaption = __('You are going to disable a cluster agent. Are you sure?');
$agentDisableEnableIcon = 'change-active.svg';
} }
echo "<td class='$tdcolor action_buttons' align='left' width=7% valign='middle'>"; $agentActionButtons[] = html_print_menu_button(
[
'href' => ui_get_full_url(
sprintf(
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&%s_agent=%s&group_id=%s&recursion=%s&search=%s&offset=%s&sort_field=%s&sort=%s&disabled=%s',
$agentDisableEnableAction,
$agent['id_agente'],
$ag_group,
$recursion,
$search,
'',
$sortField,
$sort,
$disabled
)
),
'onClick' => ($agent['id_os'] === CLUSTER_OS_ID) ? sprintf('if (!confirm(\'%s\')) return false', $agentDisableEnableCaption) : 'return true;',
'image' => sprintf('images/%s', $agentDisableEnableIcon),
'title' => $agentDisableEnableTitle,
],
true
);
if ($agent['disabled']) { if ($check_aw === true && is_management_allowed() === true) {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& if ($agent['id_os'] !== CLUSTER_OS_ID) {
enable_agent=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'"; $onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
if ($agent['id_os'] != 100) {
echo '>';
} else { } else {
echo ' onClick="if (!confirm(\' '.__('You are going to enable a cluster agent. Are you sure?').'\')) return false;">'; $onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;';
} }
echo html_print_image('images/lightbulb_off.png', true, ['alt' => __('Enable agent'), 'title' => __('Enable agent'), 'class' => 'filter_none']).'</a>'; $agentActionButtons[] = html_print_menu_button(
} else { [
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& 'href' => ui_get_full_url(
disable_agent=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'"; sprintf(
if ($agent['id_os'] != 100) { 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=%s&%s_agent=%s&group_id=%s&recursion=%s&search=%s&offset=%s&sort_field=%s&sort=%s&disabled=%s',
echo '>'; $agent['id_agente'],
} else { $agentDisableEnableAction,
echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return false;">'; $agent['id_agente'],
} $ag_group,
$recursion,
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).'</a>'; $search,
'',
$sortField,
$sort,
$disabled
)
),
'onClick' => $onClickActionDeleteAgent,
'image' => sprintf('images/delete.svg'),
'title' => __('Delete agent'),
],
true
);
} }
if ($check_aw && is_management_allowed() === true) { // Action buttons column.
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& $actionButtonsColumn = implode('', $agentActionButtons);
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'"; // Defined class for action buttons.
$tableAgents->cellclass[$key][6] = 'table_action_buttons';
if ($agent['id_os'] != 100) { // Row data.
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; $tableAgents->data[$key][0] = $agentNameColumn;
} else { $tableAgents->data[$key][0] .= $agentAvailableActionsColumn;
echo ' onClick="if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;">'; $tableAgents->data[$key][1] = $remoteConfigurationColumn;
} $tableAgents->data[$key][2] = $osIconColumn;
$tableAgents->data[$key][3] = $agentTypeIconColumn;
echo html_print_image('images/cross.png', true, ['border' => '0', 'class' => 'invert_filter']).'</a>'; $tableAgents->data[$key][4] = $agentGroupIconColumn;
} $tableAgents->data[$key][5] = $descriptionColumn;
$tableAgents->data[$key][6] = $actionButtonsColumn;
echo '</td>';
} }
echo '</table>'; html_print_table($tableAgents);
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
echo "<table width='100%'><tr><td align='right'>"; $tablePagination = ui_pagination(
$total_agents,
ui_get_url_refresh(
[
'group_id' => $group_id,
'search' => $search,
'sort_field' => $sortField,
'sort' => $sort,
'status' => $status,
]
),
0,
0,
true,
'offset',
false,
'dataTables_paginate paging_simple_numbers'
);
/*
ui_pagination(
$total_agents,
"index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os",
$offset
);
*/
} else { } else {
$tablePagination = '';
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);
} }
if (check_acl($config['id_user'], 0, 'AW')) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
// Create agent button. // Create agent button.
echo '<div class="action-buttons">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_submit_button(
__('Create agent'), html_print_action_buttons(
'crt-2', html_print_submit_button(
false, __('Create agent'),
'class="sub next"' 'crt-2',
false,
[ 'icon' => 'next' ],
true
),
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
]
); );
echo '</form>'; echo '</form>';
echo '</div>';
} }
echo '</td></tr></table>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">

File diff suppressed because it is too large Load Diff

View File

@ -396,9 +396,9 @@ if ($id_agent_module) {
); );
} }
} else { } else {
if (isset($moduletype) === false) { if (isset($moduletype) === false || $moduletype === 0) {
$moduletype = (string) get_parameter('moduletype'); $moduletype = (string) get_parameter('moduletype');
if ($_SESSION['create_module'] && $config['welcome_state'] == 1) { if ((bool) $_SESSION['create_module'] === true && (bool) $config['welcome_state'] === true) {
$moduletype = 'networkserver'; $moduletype = 'networkserver';
} }
@ -581,11 +581,11 @@ if ($__code_from !== 'policies') {
$tag_acl = true; $tag_acl = true;
// If edit a existing module. // If edit a existing module.
if (!empty($id_agent_module)) { if (empty($id_agent_module) === false) {
$tag_acl = tags_check_acl_by_module($id_agent_module); $tag_acl = tags_check_acl_by_module($id_agent_module);
} }
if (!$tag_acl) { if ($tag_acl !== true) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager' 'Trying to access agent manager'
@ -595,16 +595,15 @@ if ($__code_from !== 'policies') {
} }
} }
switch ($moduletype) { switch ($moduletype) {
case 'dataserver': case 'dataserver':
case MODULE_DATA: case MODULE_DATA:
$moduletype = MODULE_DATA; $moduletype = MODULE_DATA;
// Has remote configuration ? // Has remote configuration ?
$remote_conf = false; $remote_conf = false;
if (enterprise_installed()) { if (enterprise_installed() === true) {
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
$remote_conf = enterprise_hook( $remote_conf = (bool) enterprise_hook(
'config_agents_has_remote_configuration', 'config_agents_has_remote_configuration',
[$id_agente] [$id_agente]
); );
@ -621,7 +620,7 @@ switch ($moduletype) {
]; ];
include 'module_manager_editor_common.php'; include 'module_manager_editor_common.php';
include 'module_manager_editor_data.php'; include 'module_manager_editor_data.php';
if ($config['enterprise_installed'] && $remote_conf) { if ((bool) $config['enterprise_installed'] === true && $remote_conf === true) {
if ($id_agent_module) { if ($id_agent_module) {
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
$configuration_data = enterprise_hook( $configuration_data = enterprise_hook(
@ -649,7 +648,7 @@ switch ($moduletype) {
4, 4,
5, 5,
]; ];
if (enterprise_installed()) { if (enterprise_installed() === true) {
$categories[] = 10; $categories[] = 10;
} }
@ -700,7 +699,7 @@ switch ($moduletype) {
$moduletype = MODULE_WEB; $moduletype = MODULE_WEB;
// Remove content of $ip_target when it is ip_agent because // Remove content of $ip_target when it is ip_agent because
// it is used as HTTP auth (server) ....ONLY IN NEW MODULE!!! // it is used as HTTP auth (server) ....ONLY IN NEW MODULE!!!
if (empty($id_agent_module) if (empty($id_agent_module) === true
&& ($ip_target === agents_get_address($id_agente)) && ($ip_target === agents_get_address($id_agente))
) { ) {
$ip_target = ''; $ip_target = '';
@ -724,8 +723,8 @@ switch ($moduletype) {
} }
if ($config['enterprise_installed'] && $id_agent_module) { if ((bool) $config['enterprise_installed'] === true && $id_agent_module) {
if (policies_is_module_in_policy($id_agent_module)) { if (policies_is_module_in_policy($id_agent_module) === true) {
policies_add_policy_linkation($id_agent_module); policies_add_policy_linkation($id_agent_module);
} }
} }
@ -733,27 +732,45 @@ if ($config['enterprise_installed'] && $id_agent_module) {
echo '<h3 id="message" class="error invisible"></h3>'; echo '<h3 id="message" class="error invisible"></h3>';
// TODO: Change to the ui_print_error system. // TODO: Change to the ui_print_error system.
echo '<form method="post" id="module_form">'; $outputForm = '<form method="post" id="module_form">';
$outputForm .= ui_toggle(
ui_toggle(
html_print_table($table_simple, true), html_print_table($table_simple, true),
__('Base options'), '<span class="subsection_header_title">'.__('Base options').'</span>',
'', '',
'', '',
false false,
true,
'',
'',
'box-flat white_table_flex white_table_graph_fixed'
); );
ui_toggle( $outputForm .= ui_toggle(
html_print_table($table_advanced, true), html_print_table($table_advanced, true),
__('Advanced options') '<span class="subsection_header_title">'.__('Advanced options').'</span>',
); '',
ui_toggle( '',
html_print_table($table_macros, true), true,
__('Custom macros') true,
'',
'',
'box-flat white_table_flex white_table_graph_fixed'
); );
if ($moduletype != 13) { $outputForm .= ui_toggle(
ui_toggle( html_print_table($table_macros, true),
'<span class="subsection_header_title">'.__('Custom macros').'</span>',
'',
'',
true,
true,
'',
'',
'box-flat white_table_flex white_table_graph_fixed'
);
if ((int) $moduletype !== 13) {
$outputForm .= ui_toggle(
html_print_table( html_print_table(
$table_new_relations, $table_new_relations,
true true
@ -761,51 +778,78 @@ if ($moduletype != 13) {
$table_relations, $table_relations,
true true
), ),
__('Module relations') '<span class="subsection_header_title">'.__('Module relations').'<span>',
'',
'',
true,
true,
'',
'',
'box-flat white_table_flex white_table_graph_fixed'
); );
} }
// Submit. // Submit.
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
if ($id_agent_module) { if ($id_agent_module) {
html_print_submit_button( $actionButtons = html_print_submit_button(
__('Update'), __('Update'),
'updbutton', 'updbutton',
false, false,
'class="sub upd"' [ 'icon' => 'update' ],
true
); );
html_print_input_hidden('update_module', 1); $actionButtons .= html_print_button(
html_print_input_hidden('id_agent_module', $id_agent_module); __('Delete'),
html_print_input_hidden('id_module_type', $id_module_type); 'deleteModule',
false,
if ($config['enterprise_installed'] && $remote_conf) { 'window.location.assign("index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'")',
?> [
<script type="text/javascript"> 'icon' => 'delete',
var check_remote_conf = true; 'mode' => 'secondary',
</script> ],
<?php true
} );
$actionButtons .= html_print_input_hidden('update_module', 1, true);
$actionButtons .= html_print_input_hidden('id_agent_module', $id_agent_module, true);
$actionButtons .= html_print_input_hidden('id_module_type', $id_module_type, true);
} else { } else {
html_print_submit_button( $actionButtons = html_print_submit_button(
__('Create'), __('Create'),
'crtbutton', 'crtbutton',
false, false,
'class="sub wand"' [ 'icon' => 'wand' ],
true
); );
html_print_input_hidden('id_module', $moduletype);
html_print_input_hidden('create_module', 1);
if ($config['enterprise_installed'] && $remote_conf) { $actionButtons .= html_print_input_hidden('id_module', $moduletype, true);
?> $actionButtons .= html_print_input_hidden('create_module', 1, true);
<script type="text/javascript">
var check_remote_conf = true;
</script>
<?php
}
} }
echo '</div>'; $actionButtons .= html_print_go_back_button(
echo '</form>'; 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente,
['button_class' => ''],
true
);
$outputForm .= html_print_action_buttons(
$actionButtons,
['type' => 'form_action'],
true
);
if ((bool) $config['enterprise_installed'] === true && $remote_conf === true) {
$outputForm .= '<script type="text/javascript">var check_remote_conf = true;</script>';
}
$outputForm .= '</form>';
html_print_div(
[
'class' => 'max_floating_element_size',
'content' => $outputForm,
],
false
);
ui_require_jquery_file('ui'); ui_require_jquery_file('ui');
ui_require_jquery_file('form'); ui_require_jquery_file('form');

View File

@ -1,9 +1,8 @@
<?php <?php
/** /**
* Extension to manage a list of gateways and the node address where they should * Network module manager editor.
* point to.
* *
* @category Extensions * @category Modules
* @package Pandora FMS * @package Pandora FMS
* @subpackage Community * @subpackage Community
* @version 1.0.0 * @version 1.0.0
@ -15,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -28,10 +27,12 @@
*/ */
global $config; global $config;
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
require_once $config['homedir'].'/include/functions_snmp_browser.php'; require_once $config['homedir'].'/include/functions_snmp_browser.php';
$snmp_browser_path = (is_metaconsole()) ? '../../' : ''; $snmp_browser_path = (is_metaconsole() === true) ? '../../' : '';
$snmp_browser_path .= 'include/javascript/pandora_snmp_browser.js'; $snmp_browser_path .= 'include/javascript/pandora_snmp_browser.js';
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>"; echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>";
// Define a custom action to save the OID selected // Define a custom action to save the OID selected
@ -63,13 +64,13 @@ if (strstr($page, 'policy_modules') === false) {
if ($disabledBecauseInPolicy) { if ($disabledBecauseInPolicy) {
$disabledTextBecauseInPolicy = 'readonly = "yes"'; $disabledTextBecauseInPolicy = 'readonly = "yes"';
$classdisabledBecauseInPolicy = 'readonly'; $classdisabledBecauseInPolicy = 'readonly';
$largeclassdisabledBecauseInPolicy = 'class = readonly'; $largeclassdisabledBecauseInPolicy = 'readonly';
} }
} }
define('ID_NETWORK_COMPONENT_TYPE', 2); define('ID_NETWORK_COMPONENT_TYPE', 2);
if (empty($edit_module)) { if (empty($edit_module) === true) {
// Function in module_manager_editor_common.php. // Function in module_manager_editor_common.php.
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} }
@ -78,12 +79,20 @@ $extra_title = __('Network server module');
$data = []; $data = [];
$data[0] = __('Target IP'); $data[0] = __('Target IP');
if ((int) $id_module_type !== 6 && $id_module_type !== 7) {
$data[1] = __('Port');
}
$table_simple->rowclass['caption_target_ip'] = 'w50p';
push_table_simple($data, 'caption_target_ip');
$data = [];
// Show agent_for defect. // Show agent_for defect.
if ($page == 'enterprise/godmode/policies/policy_modules') { if ($page === 'enterprise/godmode/policies/policy_modules') {
if ($ip_target != 'auto' && $ip_target != '') { if (empty($ip_target) === false && $ip_target !== 'auto') {
$custom_ip_target = $ip_target; $custom_ip_target = $ip_target;
$ip_target = 'custom'; $ip_target = 'custom';
} else if ($ip_target == '') { } else if (empty($ip_target) === true) {
$ip_target = 'force_pri'; $ip_target = 'force_pri';
$custom_ip_target = ''; $custom_ip_target = '';
} else { } else {
@ -95,7 +104,7 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
$target_ip_values['force_pri'] = __('Force primary key'); $target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom'); $target_ip_values['custom'] = __('Custom');
$data[1] = html_print_select( $data[0] = html_print_select(
$target_ip_values, $target_ip_values,
'ip_target', 'ip_target',
$ip_target, $ip_target,
@ -105,39 +114,38 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
true, true,
false, false,
false, false,
'', 'w100p',
false, false,
'width:200px;'
); );
$data[1] .= html_print_input_text('custom_ip_target', $custom_ip_target, '', 15, 60, true); $data[0] .= html_print_input_text('custom_ip_target', $custom_ip_target, '', 0, 60, true, false, false, '', 'w100p');
} else { } else {
if ($ip_target == 'auto') { if ($ip_target === 'auto') {
$ip_target = agents_get_address($id_agente); $ip_target = agents_get_address($id_agente);
} }
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true); $data[0] = html_print_input_text('ip_target', $ip_target, '', 0, 60, true, false, false, '', 'w100p');
} }
// In ICMP modules, port is not configurable. // In ICMP modules, port is not configurable.
if ($id_module_type >= 6 && $id_module_type <= 7) { if ($id_module_type !== 6 && $id_module_type !== 7) {
$data[2] = ''; $tcp_port = (empty($tcp_port) === false) ? $tcp_port : get_parameter('tcp_port');
$data[3] = ''; $data[1] = html_print_input_text(
} else {
$data[2] = __('Port');
$data[3] = html_print_input_text(
'tcp_port', 'tcp_port',
$tcp_port, $tcp_port,
'', '',
5, 0,
20, 20,
true, true,
$disabledBecauseInPolicy, $disabledBecauseInPolicy,
false, false,
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy.' w100p',
); );
} else {
$data[1] = '';
} }
$table_simple->rowclass['target_ip'] = 'w50p';
push_table_simple($data, 'target_ip'); push_table_simple($data, 'target_ip');
$user_groups = users_get_groups(false, 'AR'); $user_groups = users_get_groups(false, 'AR');
@ -162,7 +170,10 @@ if (empty($credentials) === false) {
$data = []; $data = [];
$data[0] = __('Credential store'); $data[0] = __('Credential store');
$data[1] = html_print_select( push_table_simple($data, 'caption_snmp_credentials');
$data = [];
$data[0] = html_print_select(
$fields, $fields,
'credentials', 'credentials',
0, 0,
@ -178,102 +189,93 @@ if (empty($credentials) === false) {
'', '',
false false
); );
push_table_simple($data, 'snmp_credentials'); push_table_simple($data, 'snmp_credentials');
} }
$data = [];
$data[0] = __('SNMP community');
$data[1] = __('SNMP version');
$data[2] = __('SNMP OID');
$data[2] .= ui_print_help_icon('snmpwalk', true);
$table_simple->cellclass['snmp_1'][0] = 'w25p';
$table_simple->cellclass['snmp_1'][1] = 'w25p';
$table_simple->cellclass['snmp_1'][2] = 'w50p';
push_table_simple($data, 'snmp_1');
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module) === true) {
$adopt = policies_is_module_adopt($id_agent_module);
} else {
$adopt = false;
}
if ($adopt === false) {
$snmpCommunityInput = html_print_input_text(
'snmp_community',
$snmp_community,
'',
0,
60,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy.' w100p'
);
} else {
$snmpCommunityInput = html_print_input_text(
'snmp_community',
$snmp_community,
'',
0,
60,
true,
false,
false,
'',
'w100p'
);
}
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c'; $snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3'; $snmp_versions['3'] = 'v. 3';
$data = []; $snmpVersionsInput = html_print_select(
$data[0] = __('SNMP community'); $snmp_versions,
$adopt = false; 'snmp_version',
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) { ($id_module_type >= 15 && $id_module_type <= 18) ? $snmp_version : 0,
$adopt = policies_is_module_adopt($id_agent_module); '',
} '',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy,
'width: 100%',
'',
$classdisabledBecauseInPolicy.' w100p'
);
if (!$adopt) { if ($disabledBecauseInPolicy === true) {
$data[1] = html_print_input_text(
'snmp_community',
$snmp_community,
'',
15,
60,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
} else {
$data[1] = html_print_input_text(
'snmp_community',
$snmp_community,
'',
15,
60,
true,
false
);
}
$data[2] = _('SNMP version');
if ($id_module_type >= 15 && $id_module_type <= 18) {
$data[3] = html_print_select(
$snmp_versions,
'snmp_version',
$snmp_version,
'',
'',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
} else {
$data[3] = html_print_select(
$snmp_versions,
'snmp_version',
0,
'',
'',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
}
if ($disabledBecauseInPolicy) {
if ($id_module_type >= 15 && $id_module_type <= 18) { if ($id_module_type >= 15 && $id_module_type <= 18) {
$data[3] .= html_print_input_hidden('snmp_version', $tcp_send, true); $snmpVersionsInput .= html_print_input_hidden('snmp_version', $tcp_send, true);
} }
} }
push_table_simple($data, 'snmp_1');
$data = []; $data = [];
$data[0] = __('SNMP OID'); $table_simple->cellclass['snmp_2'][0] = 'w25p';
$data[1] = '<span class="left w50p">'; $table_simple->cellclass['snmp_2'][1] = 'w25p';
$data[1] .= html_print_input_text( $table_simple->cellclass['snmp_2'][2] = 'w50p';
$data[0] = $snmpCommunityInput;
$data[1] = $snmpVersionsInput;
$data[2] = html_print_input_text(
'snmp_oid', 'snmp_oid',
$snmp_oid, $snmp_oid,
'', '',
30, 0,
255, 255,
true, true,
$disabledBecauseInPolicy, $disabledBecauseInPolicy,
@ -281,8 +283,8 @@ $data[1] .= html_print_input_text(
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy
); );
$data[1] .= '<span class="invisible" id="oid">'; $data[2] .= '<span class="invisible" id="oid">';
$data[1] .= html_print_select( $data[2] .= html_print_select(
[], [],
'select_snmp_oid', 'select_snmp_oid',
$snmp_oid, $snmp_oid,
@ -295,7 +297,7 @@ $data[1] .= html_print_select(
'', '',
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
$data[1] .= html_print_image( $data[2] .= html_print_image(
'images/edit.png', 'images/edit.png',
true, true,
[ [
@ -303,26 +305,27 @@ $data[1] .= html_print_image(
'id' => 'edit_oid', 'id' => 'edit_oid',
] ]
); );
$data[1] .= '</span>'; $data[2] .= '</span>';
$data[1] .= '</span><span class="right w50p right">'; $data[2] .= html_print_button(
$data[1] .= html_print_button( __('SNMP Walk'),
__('SNMP walk'),
'snmp_walk', 'snmp_walk',
false, false,
'snmpBrowserWindow()', 'snmpBrowserWindow()',
'class="sub next"', [ 'mode' => 'link' ],
true true
); );
$data[1] .= ui_print_help_icon('snmpwalk', true);
$data[1] .= '</span>';
$table_simple->colspan['snmp_2'][1] = 3;
push_table_simple($data, 'snmp_2'); push_table_simple($data, 'snmp_2');
// Advanced stuff. // Advanced stuff.
$data = []; $data = [];
$data[0] = __('TCP send'); $data[0] = __('TCP send');
$data[1] = html_print_textarea( $data[1] = __('TCP receive');
push_table_simple($data, 'caption_tcp_send_receive');
$data = [];
$data[0] = html_print_textarea(
'tcp_send', 'tcp_send',
2, 2,
65, 65,
@ -331,11 +334,6 @@ $data[1] = html_print_textarea(
true, true,
$largeclassdisabledBecauseInPolicy $largeclassdisabledBecauseInPolicy
); );
$table_simple->colspan['tcp_send'][1] = 3;
push_table_simple($data, 'tcp_send');
$data[0] = __('TCP receive');
$data[1] = html_print_textarea( $data[1] = html_print_textarea(
'tcp_rcv', 'tcp_rcv',
2, 2,
@ -345,9 +343,8 @@ $data[1] = html_print_textarea(
true, true,
$largeclassdisabledBecauseInPolicy $largeclassdisabledBecauseInPolicy
); );
$table_simple->colspan['tcp_receive'][1] = 3;
push_table_simple($data, 'tcp_receive'); push_table_simple($data, 'tcp_send_receive');
if ($id_module_type < 8 || $id_module_type > 11) { if ($id_module_type < 8 || $id_module_type > 11) {
// NOT TCP. // NOT TCP.
@ -475,33 +472,41 @@ push_table_simple($data, 'field_snmpv3_row3');
$data = []; $data = [];
$data[0] = __('Command'); $data[0] = __('Command');
$data[1] = html_print_input_text_extended( $data[0] .= ui_print_help_tip(
'command_text',
$command_text,
'command_text',
'',
100,
10000,
$disabledBecauseInPolicy,
'',
$largeClassDisabledBecauseInPolicy,
true
);
$data[1] .= ui_print_help_tip(
__( __(
'Please use single quotation marks when necessary. '."\n".' 'Please use single quotation marks when necessary. '."\n".'
If double quotation marks are needed, please escape them with a backslash (\&quot;)' If double quotation marks are needed, please escape them with a backslash (\&quot;)'
), ),
true true
); );
$table_simple->colspan['row-cmd-row-1'][1] = 3; push_table_simple($data, 'caption-row-cmd-row-1');
$data = [];
$data[0] = html_print_input_text_extended(
'command_text',
$command_text,
'command_text',
'',
0,
10000,
$disabledBecauseInPolicy,
'',
$largeClassDisabledBecauseInPolicy.' class="w100p"',
true
);
$table_simple->rowclass['row-cmd-row-1'] = 'w100p';
push_table_simple($data, 'row-cmd-row-1'); push_table_simple($data, 'row-cmd-row-1');
require_once $config['homedir'].'/include/class/CredentialStore.class.php'; $data = [];
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
$data[0] = __('Credential identifier'); $data[0] = __('Credential identifier');
$data[1] = html_print_select( $data[1] = __('Connection method');
// $table_simple->rowclass['row-cmd-row-1'] = 'w100p';
$table_simple->cellclass['caption-row-cmd-row-2'][0] = 'w50p';
$table_simple->cellclass['caption-row-cmd-row-2'][1] = 'w50p';
push_table_simple($data, 'caption-row-cmd-row-2');
$data = [];
$data[0] = html_print_select(
$array_credential_identifier, $array_credential_identifier,
'command_credential_identifier', 'command_credential_identifier',
$command_credential_identifier, $command_credential_identifier,
@ -512,10 +517,18 @@ $data[1] = html_print_select(
false, false,
false, false,
'', '',
$disabledBecauseInPolicy $disabledBecauseInPolicy,
'width: 100%;'
); );
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>'; $data[0] .= html_print_button(
__('Manage credentials'),
'manage_credentials_button',
false,
'window.location.assign("index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox")',
[ 'mode' => 'link' ],
true
);
$array_os = [ $array_os = [
'inherited' => __('Inherited'), 'inherited' => __('Inherited'),
@ -523,8 +536,7 @@ $array_os = [
'windows' => __('Windows remote'), 'windows' => __('Windows remote'),
]; ];
$data[2] = __('Connection method'); $data[1] = html_print_select(
$data[3] = html_print_select(
$array_os, $array_os,
'command_os', 'command_os',
$command_os, $command_os,
@ -535,9 +547,11 @@ $data[3] = html_print_select(
false, false,
false, false,
'', '',
$disabledBecauseInPolicy $disabledBecauseInPolicy,
'width: 100%;'
); );
$table_simple->cellclass['row-cmd-row-2'][0] = 'w50p';
$table_simple->cellclass['row-cmd-row-2'][1] = 'w50p';
push_table_simple($data, 'row-cmd-row-2'); push_table_simple($data, 'row-cmd-row-2');
if ($id_module_type !== 34 if ($id_module_type !== 34
@ -545,7 +559,9 @@ if ($id_module_type !== 34
&& $id_module_type !== 36 && $id_module_type !== 36
&& $id_module_type !== 37 && $id_module_type !== 37
) { ) {
$table_simple->rowstyle['caption-row-cmd-row-1'] = 'display: none;';
$table_simple->rowstyle['row-cmd-row-1'] = 'display: none;'; $table_simple->rowstyle['row-cmd-row-1'] = 'display: none;';
$table_simple->rowstyle['caption-row-cmd-row-2'] = 'display: none;';
$table_simple->rowstyle['row-cmd-row-2'] = 'display: none;'; $table_simple->rowstyle['row-cmd-row-2'] = 'display: none;';
} }
@ -581,9 +597,13 @@ $(document).ready (function () {
(this.value == "37") (this.value == "37")
) { ) {
$("#simple-row-cmd-row-1").attr("style", ""); $("#simple-row-cmd-row-1").attr("style", "");
$("#simple-caption-row-cmd-row-1").attr("style", "");
$("#simple-row-cmd-row-2").attr("style", ""); $("#simple-row-cmd-row-2").attr("style", "");
$("#simple-caption-row-cmd-row-2").attr("style", "");
} else { } else {
$("#simple-caption-row-cmd-row-1").css("display", "none");
$("#simple-row-cmd-row-1").css("display", "none"); $("#simple-row-cmd-row-1").css("display", "none");
$("#simple-caption-row-cmd-row-2").css("display", "none");
$("#simple-row-cmd-row-2").css("display", "none"); $("#simple-row-cmd-row-2").css("display", "none");
} }
}); });
@ -704,7 +724,7 @@ $(document).ready (function () {
$("#text-custom_ip_target").hide(); $("#text-custom_ip_target").hide();
} }
$('#ip_target').change(function() { $('#ip_target').change(function() {
if($(this).val() == 'custom') { if($(this).val() === 'custom') {
$("#text-custom_ip_target").show(); $("#text-custom_ip_target").show();
} }
else{ else{

View File

@ -1,16 +1,31 @@
<?php <?php
/**
* Prediction module manager editor.
*
* @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.
enterprise_include_once('include/functions_policies.php'); enterprise_include_once('include/functions_policies.php');
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php'); enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
require_once 'include/functions_agents.php'; require_once 'include/functions_agents.php';
@ -31,7 +46,7 @@ $is_service = false;
$is_synthetic = false; $is_synthetic = false;
$is_synthetic_avg = false; $is_synthetic_avg = false;
$ops = false; $ops = false;
if ($row !== false && is_array($row)) { if ($row !== false && is_array($row) === true) {
$prediction_module = $row['prediction_module']; $prediction_module = $row['prediction_module'];
$custom_integer_2 = $row['custom_integer_2']; $custom_integer_2 = $row['custom_integer_2'];
// Services are an Enterprise feature. // Services are an Enterprise feature.
@ -49,19 +64,14 @@ if ($row !== false && is_array($row)) {
[$id_agente_modulo] [$id_agente_modulo]
); );
$ops = json_decode($ops_json, true); $ops = json_decode($ops_json, true);
// Erase the key of array serialize as <num>**.
// Erase the key of array serialize as <num>**
$chunks = explode('**', reset(array_keys($ops))); $chunks = explode('**', reset(array_keys($ops)));
$first_op = explode('_', $chunks[1]); $first_op = explode('_', $chunks[1]);
if (isset($first_op[1]) === true && $first_op[1] === 'avg') {
if (isset($first_op[1]) && $first_op[1] == 'avg') {
$selected = 'synthetic_avg_selected'; $selected = 'synthetic_avg_selected';
} else { } else {
$selected = 'synthetic_selected'; $selected = 'synthetic_selected';
@ -109,23 +119,28 @@ $extra_title = __('Prediction server module');
$data = []; $data = [];
$data[0] = __('Source module'); $data[0] = __('Source module');
$data[0] .= ui_print_help_icon('prediction_source_module', true); $data[0] .= ui_print_help_icon('prediction_source_module', true);
$data[1] = ''; push_table_simple($data, 'caption_module_service_synthetic_selector');
// Services and Synthetic are an Enterprise feature. // Services and Synthetic are an Enterprise feature.
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$selected]); $module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$selected]);
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) { if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
$data[1] = $module_service_synthetic_selector; $data = [];
$data[0] = $module_service_synthetic_selector;
$table_simple->colspan['module_service_synthetic_selector'][1] = 3; $table_simple->colspan['module_service_synthetic_selector'][1] = 3;
push_table_simple($data, 'module_service_synthetic_selector'); push_table_simple($data, 'module_service_synthetic_selector');
$data = [];
$data[0] = '';
} }
$data[1] = '<div id="module_data" class="w50p float-left top-1em">'; $data = [];
$data[1] .= html_print_label(__('Agent'), 'agent_name', true).'<br/>'; $data[0] = __('Agent');
$data[1] = __('Module');
$data[2] = __('Period');
$table_simple->cellclass['caption_prediction_module'][0] = 'w33p';
$table_simple->cellclass['caption_prediction_module'][1] = 'w33p';
$table_simple->cellclass['caption_prediction_module'][2] = 'w33p';
push_table_simple($data, 'caption_prediction_module');
// Get module and agent of the target prediction module $data = [];
// Get module and agent of the target prediction module.
if (empty($prediction_module) === false) { if (empty($prediction_module) === false) {
$id_agente_clean = modules_get_agentmodule_agent($prediction_module); $id_agente_clean = modules_get_agentmodule_agent($prediction_module);
$prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module); $prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module);
@ -137,7 +152,6 @@ if (empty($prediction_module) === false) {
$agent_alias = ''; $agent_alias = '';
} }
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -147,106 +161,105 @@ $params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'prediction_module'; $params['selectbox_id'] = 'prediction_module';
$params['none_module_text'] = __('Select Module'); $params['none_module_text'] = __('Select Module');
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['input_style'] = 'width: 100%;';
$params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction'; $params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction';
$data[1] .= ui_print_agent_autocomplete_input($params); $data[0] = ui_print_agent_autocomplete_input($params);
$data[1] .= '<br />'; if ($id_agente > 0) {
$data[1] .= html_print_label(__('Module'), 'prediction_module', true).'<br />'; $predictionModuleInput = html_print_select_from_sql(
if ($id_agente) { 'SELECT id_agente_modulo, nombre
$sql = 'SELECT id_agente_modulo, nombre FROM tagente_modulo
FROM tagente_modulo WHERE delete_pending = 0
WHERE delete_pending = 0 AND history_data = 1
AND history_data = 1 AND id_agente = '.$id_agente_clean.'
AND id_agente = '.$id_agente_clean.' AND id_agente_modulo <> '.$id_agente_modulo,
AND id_agente_modulo <> '.$id_agente_modulo; 'prediction_module',
$prediction_module,
$data[1] .= html_print_input( '',
[ __('Select Module'),
'type' => 'select_from_sql', 0,
'sql' => $sql, true,
'name' => 'prediction_module', false,
'selected' => $prediction_module, true,
'nothing' => __('Select Module'), false,
'nothing_value' => 0, 'width: 100%;'
'return' => true,
]
); );
} else { } else {
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>'; $predictionModuleInput = '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
} }
$data[1] .= '<br />'; $data[1] = $predictionModuleInput;
$data[1] .= html_print_label(__('Period'), 'custom_integer_2', true).'<br/>'; $data[2] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;');
$data[2] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true);
$periods[0] = __('Weekly'); $table_simple->cellclass['prediction_module'][0] = 'w33p';
$periods[1] = __('Monthly'); $table_simple->cellclass['prediction_module'][1] = 'w33p';
$periods[2] = __('Daily'); $table_simple->cellclass['prediction_module'][2] = 'w33p';
$data[1] .= html_print_select($periods, 'custom_integer_2', $custom_integer_2, '', '', 0, true);
$data[1] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true);
$data[1] .= '</div>';
$table_simple->colspan['prediction_module'][1] = 3;
push_table_simple($data, 'prediction_module'); push_table_simple($data, 'prediction_module');
$data = []; $data = [];
$data[0] = ''; $data[0] = __('Calculation type');
$data[1] = __('Future estimation');
$data[2] = __('Limit value');
$table_simple->cellclass['caption_capacity_planning'][0] = 'w33p';
$table_simple->cellclass['caption_capacity_planning'][1] = 'w33p';
$table_simple->cellclass['caption_capacity_planning'][2] = 'w33p';
push_table_simple($data, 'caption_capacity_planning');
$data[1] .= html_print_label(__('Calculation type'), 'estimation_type', true).'<br/>'; $data = [];
$data[1] .= html_print_input( $data[0] = html_print_select(
[ [
'type' => 'select', 'estimation_absolute' => __('Estimated absolute value'),
'return' => 'true', 'estimation_calculation' => __('Calculation of days to reach limit'),
'name' => 'estimation_type',
'class' => 'w250px',
'fields' => [
'estimation_absolute' => __('Estimated absolute value'),
'estimation_calculation' => __('Calculation of days to reach limit'),
],
'selected' => $estimation_type,
], ],
'div', 'estimation_type',
false $estimation_type,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
); );
$data[1] .= '<div id="estimation_interval_row">'; $data[1] = html_print_input(
$data[1] .= html_print_label(__('Future estimation'), 'estimation_interval', true).'<br/>';
$data[1] .= html_print_input(
[ [
'type' => 'interval', 'type' => 'interval',
'return' => 'true', 'return' => 'true',
'name' => 'estimation_interval', 'name' => 'estimation_interval',
'value' => $estimation_interval, 'value' => $estimation_interval,
'class' => 'w100p',
], ],
'div', 'div',
false false
); );
$data[1] .= '</div>';
$data[2] = html_print_input(
$data[1] .= '<div id="estimation_days_row">';
$data[1] .= html_print_label(__('Limit value'), 'estimation_days', true).'<br/>';
$data[1] .= html_print_input(
[ [
'type' => 'number', 'type' => 'number',
'return' => 'true', 'return' => 'true',
'id' => 'estimation_days', 'id' => 'estimation_days',
'name' => 'estimation_days', 'name' => 'estimation_days',
'value' => $estimation_interval, 'value' => $estimation_interval,
'class' => 'w100p',
] ]
); );
$data[1] .= '</div>'; $table_simple->cellclass['capacity_planning'][0] = 'w33p';
$table_simple->cellclass['capacity_planning'][1] = 'w33p';
$table_simple->cellclass['capacity_planning'][2] = 'w33p';
push_table_simple($data, 'capacity_planning'); push_table_simple($data, 'capacity_planning');
// Services are an Enterprise feature. // Services are an Enterprise feature.
$selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]); $selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]);
if ($selector_form !== ENTERPRISE_NOT_HOOK) { if ($selector_form !== ENTERPRISE_NOT_HOOK) {
$data = []; $data = [];
$data[0] = ''; $data[0] = $selector_form['caption'];
$data[1] = $selector_form; push_table_simple($data, 'caption_service_module');
$table_simple->colspan['service_module'][1] = 3; $data = [];
$data[0] = $selector_form['input'];
push_table_simple($data, 'service_module'); push_table_simple($data, 'service_module');
} }
@ -254,38 +267,31 @@ if ($selector_form !== ENTERPRISE_NOT_HOOK) {
$synthetic_module_form = enterprise_hook('get_synthetic_module_form'); $synthetic_module_form = enterprise_hook('get_synthetic_module_form');
if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) { if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
$data = []; $data = [];
$data[0] = ''; $data[0] = $synthetic_module_form;
$data[1] = $synthetic_module_form;
push_table_simple($data, 'synthetic_module'); push_table_simple($data, 'synthetic_module');
} }
$trending_module_form = enterprise_hook('get_trending_module_form', [$custom_string_1]); $trending_module_form = enterprise_hook('get_trending_module_form', [$custom_string_1]);
if ($trending_module_form !== ENTERPRISE_NOT_HOOK) { if ($trending_module_form !== ENTERPRISE_NOT_HOOK) {
$data = []; $data = [];
$data[0] = ''; $data[0] = $trending_module_form['caption'];
$data[1] .= $trending_module_form; push_table_simple($data, 'caption_trending_module');
$data = [];
$data[0] = $trending_module_form['input'];
push_table_simple($data, 'trending_module'); push_table_simple($data, 'trending_module');
} }
// Netflow modules are an Enterprise feature. // Netflow modules are an Enterprise feature.
$netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]); $netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]);
if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) { if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) {
$data = []; $data = [];
$data[0] = ''; $data[0] = '';
$data[1] = $netflow_module_form; $data[1] = $netflow_module_form;
$table_simple->colspan['netflow_module_form'][1] = 3;
push_table_simple($data, 'netflow_module'); push_table_simple($data, 'netflow_module');
} }
// Removed common useless parameter.
// Removed common useless parameter
unset($table_advanced->data[3]); unset($table_advanced->data[3]);
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,10 +1,10 @@
<?php <?php
/** /**
* Web Module Editor for Module Manager. * Web module manager editor.
* *
* @category Module manager * @category Modules
* @package Pandora FMS * @package Pandora FMS
* @subpackage Module manager * @subpackage Community
* @version 1.0.0 * @version 1.0.0
* @license See below * @license See below
* *
@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -32,9 +32,11 @@ enterprise_include_once('include/functions_policies.php');
$disabledBecauseInPolicy = false; $disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = ''; $disabledTextBecauseInPolicy = '';
$classdisabledBecauseInPolicy = ''; $classdisabledBecauseInPolicy = '';
$page = get_parameter('page', ''); $page = get_parameter('page', '');
$id_policy_module = (int) get_parameter('id_policy_module');
if (strstr($page, 'policy_modules') === false) { if (strstr($page, 'policy_modules') === false) {
if ($config['enterprise_installed']) { if ((bool) $config['enterprise_installed'] === true) {
if (policies_is_module_linked($id_agent_module) == 1) { if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1; $disabledBecauseInPolicy = 1;
} else { } else {
@ -44,7 +46,7 @@ if (strstr($page, 'policy_modules') === false) {
$disabledBecauseInPolicy = false; $disabledBecauseInPolicy = false;
} }
if ($disabledBecauseInPolicy) { if ((bool) $disabledBecauseInPolicy === true) {
$disabledTextBecauseInPolicy = 'disabled = "disabled"'; $disabledTextBecauseInPolicy = 'disabled = "disabled"';
$classdisabledBecauseInPolicy = 'readonly'; $classdisabledBecauseInPolicy = 'readonly';
} }
@ -62,45 +64,47 @@ html_print_div(
] ]
); );
if (is_int($id_agent_module) && $id_agent_module !== 0) { if (is_int($id_agent_module) === true && $id_agent_module !== 0) {
include_once $config['homedir'].'/include/ajax/web_server_module_debug.php'; include_once $config['homedir'].'/include/ajax/web_server_module_debug.php';
} }
define('ID_NETWORK_COMPONENT_TYPE', 7); define('ID_NETWORK_COMPONENT_TYPE', 7);
if (!$tcp_port && !$id_agent_module) { if (empty($tcp_port) === true && $id_agent_module !== 0) {
$tcp_port = 80; $tcp_port = 80;
} }
// plugin_server is the browser id // Plugin_server is the browser id.
if ($plugin_user == '' && !$id_agent_module) { if (empty($plugin_user) === true && $id_agent_module !== 0) {
$plugin_user = get_product_name().' / Webcheck'; $plugin_user = get_product_name().' / Webcheck';
} }
// plugin_server is the referer // Plugin_server is the referer.
if ($plugin_pass == '' && !$id_agent_module) { if (empty($plugin_pass) === true && $id_agent_module !== 0) {
$plugin_pass = 1; $plugin_pass = 1;
} }
if (empty($edit_module)) { if (empty($edit_module) === true) {
// Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else {
// TODO: Print network component if available
} }
$data = []; $data = [];
$data[0] = __('Web checks'); $data[0] = __('Web checks');
$suc_err_check = ' <span id="check_conf_suc" class="checks invisible">'.html_print_image('/images/ok.png', true).'</span>';
$suc_err_check .= ' <span id="check_conf_err" class="checks invisible">'.html_print_image('/images/error_red.png', true).'</span>';
$data[1] = $suc_err_check;
push_table_simple($data, 'header_web_checks');
$adopt = false; $adopt = false;
if (isset($id_agent_module)) { if (isset($id_agent_module) === true && $id_agent_module !== 0) {
$adopt = enterprise_hook('policies_is_module_adopt', [$id_agent_module]); $adopt = enterprise_hook('policies_is_module_adopt', [$id_agent_module]);
} }
$id_policy_module = (int) get_parameter('id_policy_module', ''); if ($id_policy_module > 0) {
if ($id_policy_module) {
$module = enterprise_hook('policies_get_module', [$id_policy_module]); $module = enterprise_hook('policies_get_module', [$id_policy_module]);
$plugin_parameter = $module['plugin_parameter']; $plugin_parameter = $module['plugin_parameter'];
} else {
$plugin_parameter = '';
} }
$plugin_parameter_split = explode('&#x0a;', $plugin_parameter); $plugin_parameter_split = explode('&#x0a;', $plugin_parameter);
@ -121,7 +125,7 @@ foreach ($plugin_parameter_split as $key => $value) {
} }
if ((bool) $adopt === false) { if ((bool) $adopt === false) {
$data[1] = html_print_textarea( $textareaPluginParameter = html_print_textarea(
'plugin_parameter', 'plugin_parameter',
15, 15,
65, 65,
@ -131,7 +135,7 @@ if ((bool) $adopt === false) {
'resizev' 'resizev'
); );
} else { } else {
$data[1] = html_print_textarea( $textareaPluginParameter = html_print_textarea(
'plugin_parameter', 'plugin_parameter',
15, 15,
65, 65,
@ -141,7 +145,9 @@ if ((bool) $adopt === false) {
); );
} }
$table_simple->colspan['web_checks'][1] = 2; $data = [];
$data[0] = $textareaPluginParameter;
push_table_simple($data, 'textarea_web_checks');
// Disable debug button if module has not started. // Disable debug button if module has not started.
if ($id_agent_module > 0 if ($id_agent_module > 0
@ -158,35 +164,43 @@ if ($id_agent_module > 0
$hintDebug = __('Debug this module once it has been initialized'); $hintDebug = __('Debug this module once it has been initialized');
} }
$suc_err_check = ' <span id="check_conf_suc" class="checks invisible">'.html_print_image('/images/ok.png', true).'</span>'; $actionButtons = html_print_button(
$suc_err_check .= ' <span id="check_conf_err" class="checks invisible">'.html_print_image('/images/error_red.png', true).'</span>';
$data[2] = html_print_button(
__('Load basic'), __('Load basic'),
'btn_loadbasic', 'btn_loadbasic',
false, false,
'', '',
'class="sub config"', [
'icon' => 'cog',
'mode' => 'mini secondary',
],
true true
).ui_print_help_tip(__('Load a basic structure on Web Checks'), true); ).ui_print_help_tip(__('Load a basic structure on Web Checks'), true);
$data[2] .= '<br><br>'.html_print_button( $actionButtons .= html_print_button(
__('Check'), __('Check'),
'btn_checkconf', 'btn_checkconf',
false, false,
'', '',
'class="sub upd"', [
'icon' => 'update',
'mode' => 'mini secondary',
],
true true
).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true).$suc_err_check; ).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true);
$data[2] .= '<br><br>'.html_print_button( $actionButtons .= html_print_button(
__('Debug'), __('Debug'),
'btn_debugModule', 'btn_debugModule',
$disableDebug, $disableDebug,
'', 'loadDebugWindow()',
'class="sub config" onClick="loadDebugWindow()"', [
'icon' => 'cog',
'mode' => 'mini secondary ',
],
true true
).ui_print_help_tip($hintDebug, true); ).ui_print_help_tip($hintDebug, true);
$data = [];
push_table_simple($data, 'web_checks'); $data[0] = $actionButtons;
push_table_simple($data, 'buttons_web_checks');
$http_checks_type = [ $http_checks_type = [
0 => 'Anyauth', 0 => 'Anyauth',

View File

@ -117,79 +117,91 @@ if ($not_found) {
$table = new StdClass(); $table = new StdClass();
$table->id = 'form_editor'; $table->id = 'form_editor';
$table->width = '98%'; $table->width = '100%';
$table->class = 'databox_color'; $table->class = 'databox filter-table-adv';
$table->head = [];
$table->size = [];
$table->size[0] = '30%';
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;'; $table->style[0] = 'width: 50%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $table->data[0][] = html_print_label_input_block(
$table->data[0][1] = html_print_input_text( __('Name'),
'name', html_print_input_text(
$name, 'name',
'', $name,
30, '',
100, 30,
true 100,
); true
$table->data[1][0] = __('Group'); ),
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups( [ 'div_class' => 'w50p' ]
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
).'</div>';
$table->data[2][0] = __('Node radius');
$table->data[2][1] = html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
); );
$table->data[3][0] = __('Description'); $table->data[1][] = html_print_label_input_block(
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true); __('Group'),
html_print_select_groups(
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[2][] = html_print_label_input_block(
__('Node radius'),
html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[3][] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
7,
25,
$description,
'',
true
)
);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">'; echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table); html_print_table($table);
echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
if ($new_empty_networkmap) { if ($new_empty_networkmap) {
html_print_input_hidden('save_empty_networkmap', 1); html_print_input_hidden('save_empty_networkmap', 1);
html_print_submit_button( $titleButton = __('Save networkmap');
__('Save networkmap'),
'crt',
false,
'class="sub next"'
);
} }
if ($edit_networkmap) { if ($edit_networkmap) {
html_print_input_hidden('id_networkmap', $id); html_print_input_hidden('id_networkmap', $id);
html_print_input_hidden('update_empty_networkmap', 1); html_print_input_hidden('update_empty_networkmap', 1);
html_print_submit_button( $titleButton = __('Update networkmap');
__('Update networkmap'),
'crt',
false,
'class="sub upd"'
);
} }
html_print_action_buttons(
html_print_submit_button(
$titleButton,
'crt',
false,
['icon' => 'next'],
true
)
);
echo '</form>'; echo '</form>';
echo '</div>';
} }

View File

@ -15,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 * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -29,8 +29,6 @@
global $config; global $config;
check_login(); check_login();
$agent_d = check_acl($config['id_user'], 0, 'AD'); $agent_d = check_acl($config['id_user'], 0, 'AD');
@ -54,23 +52,33 @@ require_once $config['homedir'].'/include/functions_cron.php';
// Buttons. // Buttons.
$buttons = [ $buttons = [
'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image( 'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image(
'images/list.png', 'images/logs@svg.svg',
true, true,
[ [
'title' => __('List'), 'title' => __('List'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>', ).'</a>',
]; ];
// Header. // Header.
ui_print_page_header( ui_print_standard_header(
__('Scheduled Downtime'), __('Scheduled Downtime'),
'images/gm_monitoring.png', 'images/gm_monitoring.png',
false, false,
'', '',
true, true,
$buttons $buttons,
[
[
'link' => '',
'label' => __('Tools'),
],
[
'link' => '',
'label' => __('Scheduled Downtime'),
],
]
); );
// Recursion group filter. // Recursion group filter.
@ -813,227 +821,7 @@ if (users_can_manage_group_all('AW') === true || $disabled) {
$return_all_group = true; $return_all_group = true;
} }
$table = new StdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
25,
40,
true,
$disabled_in_execution
);
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
$access,
$return_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</div>';
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea(
'description',
3,
35,
$description,
'',
true
);
$table->data[3][0] = __('Type').ui_print_help_tip(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
true
);
$table->data[3][1] = html_print_select(
[
'quiet' => __('Quiet'),
'disable_agents' => __('Disabled Agents'),
'disable_agent_modules' => __('Disable Modules'),
'disable_agents_alerts' => __('Disabled only Alerts'),
],
'type_downtime',
$type_downtime,
'change_type_downtime()',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
);
$table->data[4][0] = __('Execution');
$table->data[4][1] = html_print_select(
[
'once' => __('Once'),
'periodically' => __('Periodically'),
'cron' => __('Cron from/to'),
],
'type_execution',
$type_execution,
'change_type_execution();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
);
$days = array_combine(range(1, 31), range(1, 31)); $days = array_combine(range(1, 31), range(1, 31));
$table->data[5][0] = __('Configure the time').'&nbsp;';
;
$table->data[5][1] = "
<div id='once_time' style='display: none;'>
<table>
<tr>
<td>".__('From:').'</td>
<td>'.html_print_input_text('once_date_from', $once_date_from, '', 10, 10, true, $disabled_in_execution).html_print_input_text('once_time_from', $once_time_from, '', 9, 9, true, $disabled_in_execution).'</td>
</tr>
<tr>
<td>'.__('To:').'</td>
<td>'.html_print_input_text('once_date_to', $once_date_to, '', 10, 10, true).html_print_input_text('once_time_to', $once_time_to, '', 9, 9, true)."</td>
</tr>
</table>
</div>
<div id='periodically_time' style='display: none;'>
<table>
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
<tr>
<td>'.__('Type Periodicity:').'&nbsp;'.html_print_select(
[
'weekly' => __('Weekly'),
'monthly' => __('Monthly'),
],
'type_periodicity',
$type_periodicity,
'change_type_periodicity();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)."</td>
</tr>
<tr>
<td colspan='2'>
<table id='weekly_item' style='display: none;'>
<tr>
<td>".__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution).'</td>
<td>'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution).'</td>
<td>'.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution).'</td>
<td>'.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution).'</td>
<td>'.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution).'</td>
<td>'.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution).'</td>
<td>'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution)."</td>
</tr>
</table>
<table id='monthly_item' style='display: none;'>
<tr>
<td>".__('From day:').'</td>
<td>'.html_print_select(
$days,
'periodically_day_from',
$periodically_day_from,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</td>
<td>'.__('To day:').'</td>
<td>'.html_print_select(
$days,
'periodically_day_to',
$periodically_day_to,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</td>
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
</tr>
</table>
<table>
<tr>
<td>'.__('From hour:').'</td>
<td>'.html_print_input_text(
'periodically_time_from',
$periodically_time_from,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_help_tip(
__('The end time must be higher than the start time'),
true
).'</td>
<td>'.__('To hour:').'</td>
<td>'.html_print_input_text(
'periodically_time_to',
$periodically_time_to,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_help_tip(
__('The end time must be higher than the start time'),
true
).'</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="cron_time" style="display: none;">
<table class="w100p">
<tr>
<td>'.__('Cron from:').'</td>
<td>'.html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from').'</td>
</tr>
<tr>
<td>'.__('Cron to:').'</td>
<td>'.html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to').'</td>
</tr>
</table>
</div>';
if ($id_downtime > 0) {
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
} else {
echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
}
// Editor form.
html_print_table($table);
echo "<td valign=top style='width:300px;padding-left:20px;'>";
$filter_group = (int) get_parameter('filter_group', 0); $filter_group = (int) get_parameter('filter_group', 0);
@ -1074,105 +862,467 @@ if (empty($agents) || $disabled_in_execution) {
$disabled_add_button = true; $disabled_add_button = true;
} }
// Show available agents to include into downtime
$table = new StdClass(); $table = new StdClass();
$table->class = 'databox filters'; $table->class = 'databox filter-table-adv';
$table->id = 'principal_table_scheduled';
$table->width = '100%'; $table->width = '100%';
$table->size = [];
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->size[0] = '25%'; $table->data['first_title'][] = html_print_div(
$table->data[0][0] = __('Group filter');
$table->data[0][1] = html_print_select_groups(
false,
$access,
$return_all_group,
'filter_group',
$filter_group,
'',
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;margin-right:15px;'
);
$table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, '');
$table->data[1][0] = __('Available agents');
$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;');
$table->rowid[2] = 'available_modules_selection_mode';
$table->data[2][1] = html_print_select(
[ [
'common' => __('Show common modules'), 'class' => 'section_table_title',
'all' => __('Show all modules'), 'content' => __('Editor'),
], ],
'modules_selection_mode', true
'common', );
false, $table->data[0][] = html_print_label_input_block(
'', __('Name'),
'', html_print_input_text(
true, 'name',
false, $name,
true, '',
'', 25,
false, 40,
'min-width:180px;' true,
$disabled_in_execution
)
); );
$table->data[0][] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
$access,
$return_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)
);
$table->rowid[3] = 'available_modules'; $table->data[1][] = html_print_label_input_block(
$table->data[3][0] = __('Available modules:').ui_print_help_tip( __('Description'),
__('Only for type Quiet for downtimes.'), html_print_textarea(
'description',
3,
35,
$description,
'',
true
)
);
$table->data[1][] = html_print_label_input_block(
__('Type'),
html_print_select(
[
'quiet' => __('Quiet'),
'disable_agents' => __('Disabled Agents'),
'disable_agent_modules' => __('Disable Modules'),
'disable_agents_alerts' => __('Disabled only Alerts'),
],
'type_downtime',
$type_downtime,
'change_type_downtime()',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).ui_print_input_placeholder(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
true
)
);
$table->data[2][] = html_print_label_input_block(
__('Execution'),
html_print_select(
[
'once' => __('Once'),
'periodically' => __('Periodically'),
'cron' => __('Cron from/to'),
],
'type_execution',
$type_execution,
'change_type_execution();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)
);
$timeInputs = [];
$timeInputs[] = html_print_div(
[
'id' => 'once_time',
'style' => 'display: none',
'content' => html_print_div(
[
'class' => '',
'content' => html_print_input_text(
'once_date_from',
$once_date_from,
'',
10,
10,
true,
$disabled_in_execution
).html_print_input_text(
'once_time_from',
$once_time_from,
'',
9,
9,
true,
$disabled_in_execution
).'<span class="margin-lr-10 result_info_text">'.__(
'To'
).'</span>'.html_print_input_text(
'once_date_to',
$once_date_to,
'',
10,
10,
true
).html_print_input_text(
'once_time_to',
$once_time_to,
'',
9,
9,
true
),
],
true
),
],
true true
); );
$table->data[3][1] = html_print_select( $timeInputs[] = html_print_div(
[], [
'module[]', 'id' => 'periodically_time',
'', 'style' => 'display: none',
'', 'content' => html_print_div(
'', [
0, 'class' => 'filter-table-adv-manual w50p',
true, 'content' => html_print_label_input_block(
true, __('Type Periodicity'),
true, html_print_select(
'', [
false, 'weekly' => __('Weekly'),
'min-width: 250px;width: 70%;' 'monthly' => __('Monthly'),
],
'type_periodicity',
$type_periodicity,
'change_type_periodicity();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)
),
],
true
).html_print_div(
[
'id' => 'weekly_item',
'class' => '',
'content' => '<ul class="flex-row-center mrgn_top_15px mrgn_btn_15px">
<li class="flex">'.__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
</ul>',
],
true
).html_print_div(
[
'id' => 'monthly_item',
'style' => 'margin-top: 12px;',
'class' => 'filter-table-adv-manual flex-row-start w50p',
'content' => html_print_label_input_block(
__('From day'),
html_print_select(
$days,
'periodically_day_from',
$periodically_day_from,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
),
[ 'div_style' => 'flex: 50; margin-right: 5px;' ]
).html_print_label_input_block(
__('To day'),
html_print_select(
$days,
'periodically_day_to',
$periodically_day_to,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).ui_print_input_placeholder(
__('The end day must be higher than the start day'),
true
),
[ 'div_style' => 'flex: 50; margin-left: 5px;' ]
),
],
true
).html_print_div(
[
'class' => 'filter-table-adv-manual flex-row-start w50p',
'content' => html_print_label_input_block(
__('From hour'),
html_print_input_text(
'periodically_time_from',
$periodically_time_from,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_input_placeholder(
__('The start time must be lower than the end time'),
true
),
[ 'div_style' => 'flex: 50; margin-right: 5px;' ]
).html_print_label_input_block(
__('To hour'),
html_print_input_text(
'periodically_time_to',
$periodically_time_to,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_input_placeholder(
__('The end time must be higher than the start time'),
true
),
[ 'div_style' => 'flex: 50; margin-left: 5px;' ]
),
],
true
).ui_get_using_system_timezone_warning(),
],
true
);
$timeInputs[] = html_print_div(
[
'id' => 'cron_time',
'style' => 'display: none',
'content' => html_print_label_input_block(
__('Cron from'),
html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from')
).html_print_label_input_block(
__('Cron to'),
html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to')
),
],
true
);
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_label_input_block(
__('Configure the time'),
implode('', $timeInputs)
);
$table->data[4][] = html_print_div(
[
'class' => 'section_table_title',
'content' => __('Filtering'),
],
true
);
$table->data[5][] = html_print_label_input_block(
__('Group filter'),
html_print_select_groups(
false,
$access,
$return_all_group,
'filter_group',
$filter_group,
'',
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;margin-right:15px;'
)
);
$table->data[5][] = html_print_label_input_block(
__('Recursion'),
html_print_checkbox_switch(
'recursion',
1,
$recursion,
true,
false,
''
)
);
$table->colspan[6][0] = 2;
$availableModules = html_print_label_input_block(
__('Available agents'),
html_print_select(
$agents,
'id_agents[]',
-1,
'',
__('Any'),
-2,
true,
true,
true,
'',
false,
'min-width: 250px;width: 70%;'
),
[
'div_class' => 'flex-column',
'div_style' => 'flex: 33',
]
);
$availableModules .= html_print_label_input_block(
__('Selection mode'),
html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;'
),
[
'div_class' => 'available_modules_selection_mode flex-column',
'div_style' => 'flex: 33',
]
);
$availableModules .= html_print_label_input_block(
__('Available modules'),
html_print_select(
[],
'module[]',
'',
'',
'',
0,
true,
true,
true,
'',
false,
'min-width: 250px;width: 70%;'
).ui_print_input_placeholder(
__('Only for type Quiet for downtimes.'),
true
),
[
'div_class' => 'available_modules flex-column',
'div_style' => 'flex: 33',
]
);
$table->data[6][0] = html_print_div(
[
'style' => 'flex-direction: row;align-items: flex-start;',
'content' => $availableModules,
],
true
); );
// Print agent table. // Print agent table.
if ($id_downtime > 0) {
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
} else {
echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
}
html_print_table($table); html_print_table($table);
echo '<br /><br /><br />'; $buttons = '';
html_print_input_hidden('id_agent', $id_agent); html_print_input_hidden('id_agent', $id_agent);
echo '<div class="action-buttons w100p" >';
if ($id_downtime > 0) { if ($id_downtime > 0) {
html_print_input_hidden('update_downtime', 1); html_print_input_hidden('update_downtime', 1);
html_print_input_hidden('id_downtime', $id_downtime); html_print_input_hidden('id_downtime', $id_downtime);
html_print_submit_button( $buttons .= html_print_submit_button(
__('Update'), __('Update'),
'updbutton', 'updbutton',
false, false,
'class="sub upd"' ['icon' => 'update'],
true
); );
} else { } else {
html_print_input_hidden('create_downtime', 1); html_print_input_hidden('create_downtime', 1);
html_print_submit_button( $buttons .= html_print_submit_button(
__('Add'), __('Add'),
'crtbutton', 'crtbutton',
false, false,
'class="sub wand"' ['icon' => 'wand'],
true
); );
} }
echo '</div>'; html_print_action_buttons(
$buttons
);
html_print_input_hidden('all_common_modules', ''); html_print_input_hidden('all_common_modules', '');
echo '</form>'; echo '</form>';
@ -1208,11 +1358,17 @@ if (empty($downtimes_agents)) {
$table->head[2] = __('OS'); $table->head[2] = __('OS');
$table->head[3] = __('Last contact'); $table->head[3] = __('Last contact');
$table->head['count_modules'] = __('Modules'); $table->head['count_modules'] = __('Modules');
$table->align = [];
$table->align[0] = 'center';
$table->align[1] = 'center';
$table->align[2] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
if (!$running) { if (!$running) {
$table->head[5] = __('Actions'); $table->head[5] = __('Actions');
$table->align[5] = 'center'; $table->align[5] = 'right';
$table->size[5] = '5%'; $table->size[5] = '10%';
} }
foreach ($downtimes_agents as $downtime_agent) { foreach ($downtimes_agents as $downtime_agent) {
@ -1232,7 +1388,13 @@ if (empty($downtimes_agents)) {
WHERE id_grupo = '.$downtime_agent['id_grupo'] WHERE id_grupo = '.$downtime_agent['id_grupo']
); );
$data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); $data[2] = html_print_div(
[
'class' => 'main_menu_icon invert_filter',
'content' => ui_print_os_icon($downtime_agent['id_os'], false, true),
],
true
);
$data[3] = $downtime_agent['ultimo_contacto']; $data[3] = $downtime_agent['ultimo_contacto'];
@ -1251,10 +1413,10 @@ if (empty($downtimes_agents)) {
if (!$running) { if (!$running) {
$data[5] = ''; $data[5] = '';
if ($type_downtime !== 'disable_agents') { if ($type_downtime !== 'disable_agents') {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/edit.svg', true, ['alt' => __('Edit'), 'class' => 'main_menu_icon invert_filter']).'</a>';
} }
$data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'class' => 'main_menu_icon invert_filter']).'</a>';
} }
$table->data['agent_'.$downtime_agent['id_agente']] = $data; $table->data['agent_'.$downtime_agent['id_agente']] = $data;
@ -1263,17 +1425,7 @@ if (empty($downtimes_agents)) {
html_print_table($table); html_print_table($table);
} }
$table = new stdClass(); ui_print_spinner('Loading');
$table->id = 'loading';
$table->width = '100%';
$table->colspan['loading'][0] = '6';
$table->style[0] = 'text-align: center;';
$table->data = [];
$table->data['loading'] = [];
$table->data['loading'][0] = html_print_image('images/spinner.gif', true);
echo "<div class='invisible'>";
html_print_table($table);
echo '</div>';
$table = new stdClass(); $table = new stdClass();
$table->id = 'editor'; $table->id = 'editor';
@ -1300,7 +1452,7 @@ $table->data['module'][1] = "
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete" <td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;" onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
href="">'.html_print_image( href="">'.html_print_image(
'images/cross.png', 'images/delete.svg',
true, true,
[ [
'border' => '0', 'border' => '0',
@ -1577,13 +1729,13 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
switch ($("#type_downtime").val()) { switch ($("#type_downtime").val()) {
case 'disable_agents_alerts': case 'disable_agents_alerts':
case 'disable_agents': case 'disable_agents':
$("#available_modules").hide(); $(".available_modules").hide();
$("#available_modules_selection_mode").hide(); $(".available_modules_selection_mode").hide();
break; break;
case 'quiet': case 'quiet':
case 'disable_agent_modules': case 'disable_agent_modules':
$("#available_modules_selection_mode").show(); $(".available_modules_selection_mode").show();
$("#available_modules").show(); $(".available_modules").show();
break; break;
} }
} }

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 * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -89,7 +89,7 @@ if (is_ajax() === true) {
[ [
'id' => 'agent_modules_affected_planned_downtime', 'id' => 'agent_modules_affected_planned_downtime',
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 100%', 'style' => 'width: 99%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'godmode/agentes/planned_downtime.list', 'ajax_url' => 'godmode/agentes/planned_downtime.list',
@ -103,6 +103,7 @@ if (is_ajax() === true) {
], ],
'search_button_class' => 'sub filter float-right', 'search_button_class' => 'sub filter float-right',
'form' => [ 'form' => [
'class' => 'filter-table-adv',
'inputs' => [ 'inputs' => [
[ [
'label' => __('Agents'), 'label' => __('Agents'),
@ -207,13 +208,23 @@ if ($migrate_malformed === true) {
} }
// Header. // Header.
ui_print_page_header( ui_print_standard_header(
__('Scheduled Downtime'), __('Scheduled Downtime'),
'images/gm_monitoring.png', 'images/gm_monitoring.png',
false, false,
'', '',
true, true,
'' [],
[
[
'link' => '',
'label' => __('Tools'),
],
[
'link' => '',
'label' => __('Scheduled Downtime'),
],
],
); );
$id_downtime = (int) get_parameter('id_downtime', 0); $id_downtime = (int) get_parameter('id_downtime', 0);
@ -308,34 +319,8 @@ $filter_params['module_name'] = $module_name;
$filter_params_str = http_build_query($filter_params); $filter_params_str = http_build_query($filter_params);
// Table filter. // From/To inputs.
$table_form = new StdClass(); $date_inputs = html_print_input_text(
$table_form->class = 'databox filters';
$table_form->width = '100%';
$table_form->rowstyle = [];
$table_form->cellstyle[0] = ['width: 100px;'];
$table_form->cellstyle[1] = ['width: 100px;'];
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
$table_form->cellstyle[2] = ['width: 100px;'];
$table_form->cellstyle[3] = ['text-align: right;'];
$table_form->colspan[3][0] = 3;
$table_form->data = [];
$row = [];
// Search text.
$row[] = __('Search');
$row[] = html_print_input_text(
'search_text',
$search_text,
'',
50,
250,
true
);
// Dates.
$date_inputs = __('From').'&nbsp;'.html_print_input_text(
'date_from', 'date_from',
$date_from, $date_from,
'', '',
@ -343,8 +328,8 @@ $date_inputs = __('From').'&nbsp;'.html_print_input_text(
10, 10,
true true
); );
$date_inputs .= '&nbsp;&nbsp;'; $date_inputs .= '&nbsp;'.__('To').'&nbsp;';
$date_inputs .= __('To').'&nbsp;'.html_print_input_text( $date_inputs .= html_print_input_text(
'date_to', 'date_to',
$date_to, $date_to,
'', '',
@ -352,11 +337,6 @@ $date_inputs .= __('To').'&nbsp;'.html_print_input_text(
10, 10,
true true
); );
$row[] = $date_inputs;
$table_form->data[] = $row;
$row = [];
// Execution type. // Execution type.
$execution_type_fields = [ $execution_type_fields = [
@ -364,29 +344,6 @@ $execution_type_fields = [
'periodically' => __('Periodically'), 'periodically' => __('Periodically'),
'cron' => __('Cron'), 'cron' => __('Cron'),
]; ];
$row[] = __('Execution type');
$row[] = html_print_select(
$execution_type_fields,
'execution_type',
$execution_type,
'',
__('Any'),
'',
true,
false,
false
);
// Show past downtimes.
$row[] = __('Show past downtimes').'&nbsp;&nbsp;&nbsp;&nbsp;'.html_print_switch(
[
'name' => 'archived',
'value' => $show_archived,
]
);
$table_form->data[] = $row;
$row = [];
// Agent. // Agent.
$params = []; $params = [];
@ -397,33 +354,89 @@ $params['return'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id; $params['hidden_input_idagent_value'] = $agent_id;
$row[] = __('Agent');
$row[] = ui_print_agent_autocomplete_input($params);
// Module. // Table filter.
$row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules( $table_form = new stdClass();
'module_name', $table_form->class = 'filter-table-adv';
$module_name, $table_form->id = 'filter_scheduled_downtime';
false, $table_form->width = '100%';
true, $table_form->rowstyle = [];
'', $table_form->cellstyle[0] = ['width: 100px;'];
[], $table_form->cellstyle[1] = ['width: 100px;'];
true $table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
); $table_form->cellstyle[2] = ['width: 100px;'];
$table_form->cellstyle[3] = ['text-align: right;'];
$table_form->data[] = $row; $table_form->data = [];
// Search text.
$row = []; $table_form->data[0][] = html_print_label_input_block(
$row[] = html_print_submit_button(
__('Search'), __('Search'),
'search', html_print_input_text(
false, 'search_text',
'class="sub search"', $search_text,
true '',
50,
250,
true
)
);
// From / To.
$table_form->data[0][] = html_print_label_input_block(
__('Between dates'),
html_print_div(
[
'class' => 'flex-content-left',
'content' => $date_inputs,
],
true
)
);
// Show past downtimes.
$table_form->data[0][] = html_print_label_input_block(
__('Show past downtimes'),
html_print_switch(
[
'name' => 'archived',
'value' => $show_archived,
]
)
);
// Execution type.
$table_form->data[1][] = html_print_label_input_block(
__('Execution type'),
html_print_select(
$execution_type_fields,
'execution_type',
$execution_type,
'',
__('Any'),
'',
true,
false,
false
)
);
$table_form->data[1][] = html_print_label_input_block(
__('Agent'),
ui_print_agent_autocomplete_input($params)
);
$table_form->data[1][] = html_print_label_input_block(
__('Module'),
html_print_autocomplete_modules(
'module_name',
$module_name,
false,
true,
'',
[],
true,
0,
30,
true
)
); );
$table_form->data[] = $row;
// End of table filter. // End of table filter.
// Useful to know if the user has done a form filtering. // Useful to know if the user has done a form filtering.
$filter_performed = false; $filter_performed = false;
@ -626,35 +639,86 @@ if ($downtimes === false && $filter_performed === false) {
// No downtimes cause the user performed a search. // No downtimes cause the user performed a search.
// Filter form. // Filter form.
echo '<form method="post" action="'.$url_list.'">'; echo '<form method="post" action="'.$url_list.'">';
html_print_table($table_form); $outputTable = html_print_table($table_form, true);
$outputTable .= html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button(
__('Filter'),
'search',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
ui_toggle(
$outputTable,
'<span class="subsection_header_title">'.__('Filters').'</span>',
__('Filters'),
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
echo '</form>'; echo '</form>';
// Info message. // Info message.
echo '<div class="nf">'.__('No scheduled downtime').'</div>'; ui_print_info_message(__('No scheduled downtime'));
echo '<div class="action-buttons w100p" >';
// Create button. // Create button.
if ($write_permisson === true) { if ($write_permisson === true) {
echo '&nbsp;';
echo '<form method="post" class="display_in" action="'.$url_editor.'">'; echo '<form method="post" class="display_in" action="'.$url_editor.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); html_print_action_buttons(
html_print_submit_button(
__('Create'),
'create',
false,
['icon' => 'next'],
true
)
);
echo '</form>'; echo '</form>';
} }
echo '</div>';
} else { } else {
// Has downtimes. // Has downtimes.
echo '<form method="post" action="'.$url_list.'">'; echo '<form method="post" action="'.$url_list.'">';
html_print_table($table_form); $outputTable = html_print_table($table_form, true);
$outputTable .= html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button(
__('Search'),
'search',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
ui_toggle(
$outputTable,
'<span class="subsection_header_title">'.__('Filters').'</span>',
__('Filters'),
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
echo '</form>'; echo '</form>';
ui_pagination(
$downtimes_number,
$url_list.'&'.$filter_params_str,
$offset
);
// User groups with AR, AD or AW permission. // User groups with AR, AD or AW permission.
$groupsAD = users_get_groups($config['id_user'], $access); $groupsAD = users_get_groups($config['id_user'], $access);
$groupsAD = array_keys($groupsAD); $groupsAD = array_keys($groupsAD);
@ -753,17 +817,17 @@ if ($downtimes === false && $filter_performed === false) {
$settings = [ $settings = [
'url' => ui_get_full_url('ajax.php', false, false, false), 'url' => ui_get_full_url('ajax.php', false, false, false),
'loadingText' => __('Loading, this operation might take several minutes...'), 'loadingText' => __('Loading, this operation might take several minutes...'),
'title' => __('Agents / Modules affected'), 'title' => __('Elements affected'),
'id' => $downtime['id'], 'id' => $downtime['id'],
]; ];
$data['agents_modules'] = '<a href="#" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>'; $data['agents_modules'] = '<a href="#" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
$data['agents_modules'] .= html_print_image( $data['agents_modules'] .= html_print_image(
'images/search_big.png', 'images/details.svg',
true, true,
[ [
'title' => __('Agents and modules affected'), 'title' => __('Agents and modules affected'),
'style' => 'width:22px; height: 22px;', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data['agents_modules'] .= '</a>'; $data['agents_modules'] .= '</a>';
@ -780,15 +844,21 @@ if ($downtimes === false && $filter_performed === false) {
$url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
$data['stop'] = '<a href="'.$url_list_params.'">'; $data['stop'] = '<a href="'.$url_list_params.'">';
$data['stop'] .= html_print_image( $data['stop'] .= html_print_image(
'images/cancel.png', 'images/fail@svg.svg',
true, true,
['title' => __('Stop downtime')] [
'title' => __('Stop downtime'),
'class' => 'main_menu_icon invert_filter',
]
); );
} else { } else {
$data['stop'] = html_print_image( $data['stop'] = html_print_image(
'images/cancel.png', 'images/fail@svg.svg',
true, true,
['title' => __('Stop downtime')] [
'title' => __('Stop downtime'),
'class' => 'main_menu_icon invert_filter',
]
); );
} }
} else { } else {
@ -803,11 +873,11 @@ if ($downtimes === false && $filter_performed === false) {
// Copy. // Copy.
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">'; $data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
$data['copy'] .= html_print_image( $data['copy'] .= html_print_image(
'images/copy.png', 'images/copy.svg',
true, true,
[ [
'title' => __('Copy'), 'title' => __('Copy'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data['copy'] .= '</a>'; $data['copy'] .= '</a>';
@ -815,11 +885,11 @@ if ($downtimes === false && $filter_performed === false) {
// Edit. // Edit.
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">'; $data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
$data['edit'] .= html_print_image( $data['edit'] .= html_print_image(
'images/config.png', 'images/configuration@svg.svg',
true, true,
[ [
'title' => __('Update'), 'title' => __('Update'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data['edit'] .= '</a>'; $data['edit'] .= '</a>';
@ -828,11 +898,11 @@ if ($downtimes === false && $filter_performed === false) {
$url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
$data['delete'] = '<a id="delete_downtime" href="'.$url_delete.'">'; $data['delete'] = '<a id="delete_downtime" href="'.$url_delete.'">';
$data['delete'] .= html_print_image( $data['delete'] .= html_print_image(
'images/cross.png', 'images/delete.svg',
true, true,
[ [
'title' => __('Delete'), 'title' => __('Delete'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data['delete'] .= '</a>'; $data['delete'] .= '</a>';
@ -849,22 +919,22 @@ if ($downtimes === false && $filter_performed === false) {
// Copy. // Copy.
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">'; $data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
$data['copy'] .= html_print_image( $data['copy'] .= html_print_image(
'images/copy.png', 'images/copy.svg',
true, true,
[ [
'title' => __('Copy'), 'title' => __('Copy'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data['copy'] .= '</a>'; $data['copy'] .= '</a>';
// Edit. // Edit.
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">'; $data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
$data['edit'] .= html_print_image( $data['edit'] .= html_print_image(
'images/config.png', 'images/configuration@svg.svg',
true, true,
[ [
'title' => __('Update'), 'title' => __('Update'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data['edit'] .= '</a>'; $data['edit'] .= '</a>';
@ -901,44 +971,47 @@ if ($downtimes === false && $filter_performed === false) {
} }
html_print_table($table); html_print_table($table);
ui_pagination( $tablePagination = ui_pagination(
$downtimes_number, $downtimes_number,
$url_list.'&'.$filter_params_str, $url_list.'&'.$filter_params_str,
$offset, $offset,
0, 0,
false,
'offset',
true, true,
'pagination-bottom' 'offset',
false
); );
echo '<div class="action-buttons" style="width: '.$table->width.'">'; $actionsButtons = '';
// CSV export button.
echo '<div class="display_in">';
html_print_button(
__('Export to CSV'),
'csv_export',
false,
'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"'
);
echo '</div>';
// Create button. // Create button.
if ($write_permisson === true) { if ($write_permisson === true) {
echo '&nbsp;'; $actionsButtons .= '<form method="post" action="'.$url_editor.'" class="display_in" >';
echo '<form method="post" action="'.$url_editor.'" class="display_in" >'; $actionsButtons .= html_print_submit_button(
html_print_submit_button(
__('Create'), __('Create'),
'create', 'create',
false, false,
'class="sub next"' ['icon' => 'next'],
true
); );
echo '</form>'; $actionsButtons .= '</form>';
} }
echo '</div>'; // CSV export button.
$actionsButtons .= html_print_button(
__('Export to CSV'),
'csv_export',
false,
'blockResubmit($(this)); location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
[
'icon' => 'load',
'mode' => 'secondary',
],
true
);
html_print_action_buttons(
$actionsButtons,
[ 'right_content' => $tablePagination ]
);
} }
ui_require_jquery_file( ui_require_jquery_file(

View File

@ -122,8 +122,6 @@ if ($fields_selected[0] != '') {
} }
} }
echo '<h3>'.__('Show monitor detail fields').'</h3>';
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
@ -161,6 +159,12 @@ foreach ($fields_available as $key => $available) {
} }
} }
// General title.
$generalTitleContent = [];
$generalTitleContent[] = html_print_div([ 'style' => 'width: 10px; flex: 0 0 auto; margin-right: 5px;}', 'class' => 'section_table_title_line' ], true);
$generalTitleContent[] = html_print_div([ 'class' => 'section_table_title', 'content' => __('Show monitor detail fields')], true);
$titledata[0] = html_print_div(['class' => 'flex-row-center', 'content' => implode('', $generalTitleContent) ], true);
$table->data['general_title'] = $titledata;
$table->data[0][0] = '<b>'.__('Fields available').'</b>'; $table->data[0][0] = '<b>'.__('Fields available').'</b>';
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px'); $table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
$table->data[1][1] = '<a href="javascript:">'.html_print_image( $table->data[1][1] = '<a href="javascript:">'.html_print_image(
@ -202,10 +206,18 @@ $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'].'">'; 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); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; html_print_action_buttons(
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"'); html_print_submit_button(
__('Update'),
'update_button',
false,
[ 'icon' => 'update' ],
true
)
);
echo '</form>'; echo '</form>';
echo '</div>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -36,10 +36,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'LM')) { if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -70,12 +66,19 @@ if (check_acl_restricted_all($config['id_user'], 0, 'LM')) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Alert actions'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Alert actions'),
],
]
); );
} }
@ -234,21 +237,25 @@ $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='
// Filter table. // Filter table.
$table_filter = new stdClass(); $table_filter = new stdClass();
$table_filter->width = '100%'; $table_filter->width = '100%';
$table_filter->class = 'databox filters'; $table_filter->class = 'databox filters no_border filter-table-adv';
$table_filter->style = []; $table_filter->style = [];
$table_filter->style[0] = 'font-weight: bold'; $table_filter->style[0] = 'width: 33%';
$table_filter->style[2] = 'font-weight: bold'; $table_filter->style[1] = 'width: 33%';
$table_filter->style[4] = 'font-weight: bold'; $table_filter->style[2] = 'width: 33%';
$table_filter->data = []; $table_filter->data = [];
$table_filter->colspan = [];
$table_filter->colspan[1][0] = 3;
$table_filter->data[0][0] = __('Search'); $table_filter->data[0][0] = html_print_label_input_block(
$table_filter->data[0][1] = html_print_input_text( __('Search'),
'search_string', html_print_input_text(
$search_string, 'search_string',
'', $search_string,
25, '',
255, 25,
true 255,
true
)
); );
$return_all_group = false; $return_all_group = false;
@ -257,19 +264,22 @@ if (users_can_manage_group_all('LM') === true) {
$return_all_group = true; $return_all_group = true;
} }
$table_filter->data[0][2] = __('Group');
$table_filter->data[0][3] = html_print_select_groups( $table_filter->data[0][1] = html_print_label_input_block(
$config['id_user'], __('Group'),
'LM', html_print_select_groups(
$return_all_group, $config['id_user'],
'group_search', 'LM',
$group_search, $return_all_group,
'', 'group_search',
'', $group_search,
0, '',
true '',
0,
true
)
); );
$table_filter->data[0][4] = __('Command');
$commands_sql = db_get_all_rows_filter( $commands_sql = db_get_all_rows_filter(
'talert_commands', 'talert_commands',
['id_group' => array_keys(users_get_groups(false, 'LW'))], ['id_group' => array_keys(users_get_groups(false, 'LW'))],
@ -283,39 +293,54 @@ $commands_sql = db_get_all_rows_filter(
); );
$commands = db_get_all_rows_sql($commands_sql); $commands = db_get_all_rows_sql($commands_sql);
$table_filter->data[0][5] = html_print_select(
index_array($commands, 'id', 'name'), $table_filter->data[0][2] = html_print_label_input_block(
'id_command_search', __('Command'),
$id_command_search, html_print_select(
'', index_array($commands, 'id', 'name'),
__('None'), 'id_command_search',
0, $id_command_search,
true, '',
false, __('None'),
true, 0,
'', true,
false, false,
'width:150px' true,
'',
false,
'width:100%'
)
); );
$table_filter->data[0][6] = '<div class="action-buttons">';
$table_filter->data[0][6] .= html_print_submit_button( $table_filter->data[1][0] = '<div class="float-right">';
$table_filter->data[1][0] .= html_print_submit_button(
__('Search'), __('Search'),
'', '',
false, false,
'class="sub search"', [
'icon' => 'search',
'class' => 'mini',
],
true true
); );
$table_filter->data[0][5] .= '</div>'; $table_filter->data[1][0] .= '</div>';
$show_table_filter = '<form method="post" action="'.$url.'">'; $show_table_filter = '<form method="post" action="'.$url.'">';
$show_table_filter .= html_print_table($table_filter, true); $show_table_filter .= ui_toggle(
html_print_table($table_filter, true),
'<span class="subsection_header_title">'.__('Search').'</span>',
__('Search'),
'search',
true,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
$show_table_filter .= '</form>'; $show_table_filter .= '</form>';
if (is_metaconsole()) {
ui_toggle($show_table_filter, __('Show Options')); echo $show_table_filter;
} else {
echo $show_table_filter;
}
$table = new stdClass(); $table = new stdClass();
@ -416,8 +441,8 @@ foreach ($actions as $action) {
&& check_acl($config['id_user'], $action['id_group'], 'LM') && check_acl($config['id_user'], $action['id_group'], 'LM')
) { ) {
$table->cellclass[] = [ $table->cellclass[] = [
3 => 'action_buttons', 3 => 'table_action_buttons',
4 => 'action_buttons', 4 => 'table_action_buttons',
]; ];
$id_action = $action['id']; $id_action = $action['id'];
@ -428,11 +453,14 @@ foreach ($actions as $action) {
$data[3] .= html_print_input_hidden('id', $id_action, true); $data[3] .= html_print_input_hidden('id', $id_action, true);
$data[3] .= html_print_input_image( $data[3] .= html_print_input_image(
'dup', 'dup',
'images/copy.png', 'images/copy.svg',
1, 1,
'', '',
true, true,
['title' => __('Duplicate')] [
'title' => __('Duplicate'),
'class' => 'main_menu_icon invert_filter',
]
); );
$data[3] .= '</form> '; $data[3] .= '</form> ';
@ -442,11 +470,14 @@ foreach ($actions as $action) {
$data[4] .= html_print_input_hidden('id', $id_action, true); $data[4] .= html_print_input_hidden('id', $id_action, true);
$data[4] .= html_print_input_image( $data[4] .= html_print_input_image(
'del', 'del',
'images/cross.png', 'images/delete.svg',
1, 1,
'', '',
true, true,
['title' => __('Delete')] [
'title' => __('Delete'),
'class' => 'main_menu_icon invert_filter',
]
); );
$data[4] .= '</form> '; $data[4] .= '</form> ';
} else { } else {
@ -457,10 +488,10 @@ foreach ($actions as $action) {
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_actions, $url); $pagination = '';
if (isset($data)) { if (isset($data)) {
html_print_table($table); html_print_table($table);
ui_pagination($total_actions, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); $pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', false, '');
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
} }
@ -468,10 +499,9 @@ if (isset($data)) {
if (is_management_allowed() === true) { if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); $button = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
html_print_input_hidden('create_alert', 1); html_print_input_hidden('create_alert', 1);
html_print_action_buttons($button, ['right_content' => $pagination]);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
} }
enterprise_hook('close_meta_frame');

View File

@ -171,10 +171,10 @@ if (is_ajax()) {
$ffield = $editor_type_chkbx; $ffield = $editor_type_chkbx;
$ffield .= html_print_textarea( $ffield .= html_print_textarea(
'field'.$i.'_value', 'field'.$i.'_value',
1, 5,
1, 1,
'', '',
'class="fields"', 'class="fields w100p"',
true, true,
'', '',
$is_management_allowed $is_management_allowed
@ -208,7 +208,7 @@ if (is_ajax()) {
$rfield = $editor_type_chkbx; $rfield = $editor_type_chkbx;
$rfield .= html_print_textarea( $rfield .= html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
1, 5,
1, 1,
'', '',
'class="fields_recovery"', 'class="fields_recovery"',
@ -307,7 +307,8 @@ if (is_ajax()) {
false, false,
false, false,
'fields', 'fields',
$is_management_allowed $is_management_allowed,
'width: 100%;'
); );
$rfield .= html_print_select( $rfield .= html_print_select(
@ -321,7 +322,8 @@ if (is_ajax()) {
false, false,
false, false,
'fields', 'fields',
$is_management_allowed $is_management_allowed,
'width: 100%;'
); );
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); $ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
@ -329,7 +331,7 @@ if (is_ajax()) {
$ffield .= html_print_textarea( $ffield .= html_print_textarea(
'field'.$i.'_value[]', 'field'.$i.'_value[]',
1, 5,
1, 1,
'', '',
'style="min-height:40px; '.$style.'" class="fields"', 'style="min-height:40px; '.$style.'" class="fields"',
@ -341,7 +343,7 @@ if (is_ajax()) {
$rfield .= html_print_textarea( $rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]', 'field'.$i.'_recovery_value[]',
1, 5,
1, 1,
'', '',
'style="min-height:40px; '.$style.'" class="fields_recovery', 'style="min-height:40px; '.$style.'" class="fields_recovery',
@ -484,20 +486,20 @@ if (is_ajax()) {
} else { } else {
$ffield = html_print_textarea( $ffield = html_print_textarea(
'field'.$i.'_value', 'field'.$i.'_value',
1, 5,
1, 1,
$fv[0], $fv[0],
'style="'.$style.'" class="fields min-height-40px"', 'style="'.$style.'" class="fields min-height-40px w100p"',
true, true,
'', '',
$is_management_allowed $is_management_allowed
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
1, 5,
1, 1,
$fv[0], $fv[0],
'style="'.$style.'" class="fields_recovery min-height-40px', 'style="'.$style.'" class="fields_recovery min-height-40px w100p',
true, true,
'', '',
$is_management_allowed $is_management_allowed
@ -507,20 +509,20 @@ if (is_ajax()) {
} else { } else {
$ffield = html_print_textarea( $ffield = html_print_textarea(
'field'.$i.'_value', 'field'.$i.'_value',
1, 5,
1, 1,
'', '',
'style="'.$style.'" class="fields min-height-40px"', 'style="'.$style.'" class="fields min-height-40px w100p"',
true, true,
'', '',
$is_management_allowed $is_management_allowed
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
1, 5,
1, 1,
'', '',
'style="'.$style.'" class="fields_recovery min-height-40px"', 'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
true, true,
'', '',
$is_management_allowed $is_management_allowed
@ -533,7 +535,7 @@ if (is_ajax()) {
$fields_rows[$i] = ''; $fields_rows[$i] = '';
} else { } else {
$fields_rows[$i] = '<tr id="table_macros-field'.$i.'" class="datos">'; $fields_rows[$i] = '<tr id="table_macros-field'.$i.'" class="datos">';
$fields_rows[$i] .= '<td class="datos bolder w20p">'.$fdesc.'</td>'; $fields_rows[$i] .= '<td class="datos bolder w20p" style="font-size: 13px;">'.$fdesc.'</td>';
$fields_rows[$i] .= '<td class="datos">'.$ffield.'</td>'; $fields_rows[$i] .= '<td class="datos">'.$ffield.'</td>';
if ($get_recovery_fields) { if ($get_recovery_fields) {
$fields_rows[$i] .= '<td class="datos recovery_col">'.$rfield.'</td>'; $fields_rows[$i] .= '<td class="datos recovery_col">'.$rfield.'</td>';
@ -566,8 +568,6 @@ tyle='display:none;'>";
echo '</div>'; echo '</div>';
} }
enterprise_hook('open_meta_frame');
if ($update_command) { if ($update_command) {
include_once 'configure_alert_command.php'; include_once 'configure_alert_command.php';
return; return;
@ -577,12 +577,19 @@ if ($update_command) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Alert commands'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Alert commands'),
],
]
); );
} }
@ -794,17 +801,18 @@ foreach ($commands as $command) {
io_safe_output($command['description']) io_safe_output($command['description'])
); );
$data['action'] = ''; $data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons'; $table->cellclass[]['action'] = 'table_action_buttons';
$offset_delete = ($offset >= ($total_commands - 1)) ? ($offset - $limit) : $offset; $offset_delete = ($offset >= ($total_commands - 1)) ? ($offset - $limit) : $offset;
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group. // (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) { if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (is_user_admin($config['id_user']) === true) { if (is_user_admin($config['id_user']) === true) {
$data['action'] = '<span class="inline_flex">'; $data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
$data['action'] .= '</span>'; $data['action'] .= '</span>';
} }
} }
@ -812,10 +820,9 @@ foreach ($commands as $command) {
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_commands, $url);
if (isset($data) === true && count($table->data) > 0) { if (isset($data) === true && count($table->data) > 0) {
html_print_table($table); html_print_table($table);
ui_pagination($total_commands, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); $pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, '');
} else { } else {
ui_print_info_message( ui_print_info_message(
[ [
@ -827,16 +834,19 @@ if (isset($data) === true && count($table->data) > 0) {
// Commands can only be created by the super administrator. // Commands can only be created by the super administrator.
if (users_is_admin() === true) { if (users_is_admin() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); $buttonSubmit = html_print_submit_button(
__('Create'),
'create',
false,
['icon' => 'wand'],
true
);
html_print_input_hidden('create_alert', 1); html_print_input_hidden('create_alert', 1);
html_print_action_buttons($buttonSubmit, ['right_content' => $pagination]);
echo '</form>'; echo '</form>';
echo '</div>';
} }
enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -32,29 +32,16 @@ $pure = get_parameter('pure', 0);
$table = new stdClass(); $table = new stdClass();
$table->id = 'add_alert_table'; $table->id = 'add_alert_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%'; $table->width = '100%';
$table->head = []; $table->head = [];
$table->data = []; $table->data = [];
$table->size = []; $table->size = [];
$table->size = []; $table->style[0] = 'width: 50%';
$table->style[0] = 'font-weight: bold;'; $table->style[1] = 'width: 50%';
$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
$table->style[2] = 'font-weight: bold;';
$table->style[3] = 'font-weight: bold;';
// This is because if this view is reused after list alert view then
// styles in the previous view can affect this table.
$table->rowstyle[0] = '';
$table->rowstyle[1] = '';
$table->rowstyle[2] = '';
$table->rowstyle[3] = '';
// Add an agent selector // Add an agent selector
if (! $id_agente) { if (! $id_agente) {
$table->data['agent'][0] = __('Agent');
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -64,36 +51,37 @@ if (! $id_agente) {
$params['metaconsole_enabled'] = false; $params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params); $table->data[0][0] = html_print_label_input_block(
__('Agent'),
ui_print_agent_autocomplete_input($params)
);
} }
$table->data[0][0] = __('Module');
$modules = []; $modules = [];
if ($id_agente) { if ($id_agente) {
$modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]); $modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]);
} }
$table->data[0][1] = html_print_select( $table->data[0][1] = html_print_label_input_block(
$modules, __('Module'),
'id_agent_module', html_print_select(
0, $modules,
true, 'id_agent_module',
__('Select'), 0,
0, true,
true, __('Select'),
false, 0,
true, true,
'', false,
($id_agente == 0), true,
'min-width: 250px;margin-right: 0.5em;' 'w100p',
($id_agente == 0),
'width: 100%;'
).'<span id="latest_value" class="invisible">'.__('Latest value').':
<span id="value">&nbsp;</span></span>
<span id="module_loading" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>'
); );
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
$table->data[0][1] .= '<span id="value">&nbsp;</span></span>';
$table->data[0][1] .= ' <span id="module_loading" class="invisible">';
$table->data[0][1] .= html_print_image('images/spinner.gif', true).'</span>';
$table->data[1][0] = __('Actions');
$groups_user = users_get_groups($config['id_user']); $groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) { if (!empty($groups_user)) {
@ -109,36 +97,36 @@ if (!empty($groups_user)) {
$actions = db_get_all_rows_sql($sql); $actions = db_get_all_rows_sql($sql);
} }
$table->data[1][1] = html_print_select( if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
index_array($actions, 'id', 'name'), $create_action = html_print_button(
'action_select', __('Create Action'),
'', '',
'', false,
__('Default action'), 'window.location.assign("index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'")',
'0', [ 'mode' => 'link' ],
true, true
'', );
true,
'',
false,
'min-width: 250px;'
);
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table->data[1][1] .= __('Number of alerts match from').' ';
$table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table->data[1][1] .= ' '.__('to').' ';
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table->data[1][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table->data[1][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']);
$table->data[1][1] .= '<span class="mrgn_lft_05em">'.__('Create Action').'</span>';
$table->data[1][1] .= '</a>';
} }
$table->data[2][0] = __('Template'); $table->data[1][0] = html_print_label_input_block(
$own_info = get_user_info($config['id_user']); __('Actions'),
html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
false,
true,
'w100p',
false,
'width: 100%;'
).'<span id="advanced_action" class="advanced_actions invisible"><br>'.__('Number of alerts match from').' '.html_print_input_text('fires_min', '', '', 4, 10, true).' '.__('to').' '.html_print_input_text('fires_max', '', '', 4, 10, true).'</span>'.$create_action
);
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin']) { if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(false, ['id', 'name']); $templates = alerts_get_alert_templates(false, ['id', 'name']);
} else { } else {
@ -148,7 +136,20 @@ if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']); $templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
} }
$table->data[2][1] = html_print_select( if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$create_template = html_print_button(
__('Create Template'),
'',
false,
'window.location.assign("index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'")',
[ 'mode' => 'link' ],
true
);
}
$table->data[1][1] = html_print_label_input_block(
__('Template'),
html_print_select(
index_array($templates, 'id', 'name'), index_array($templates, 'id', 'name'),
'template', 'template',
'', '',
@ -158,20 +159,15 @@ if ($own_info['is_admin']) {
true, true,
false, false,
true, true,
'', 'w100p',
false, false,
'width: 250px;' 'width: 100%;'
); ).' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>'.$create_template
$table->data[2][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>'; );
if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
$table->data[2][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']);
$table->data[2][1] .= '<span class=""mrgn_lft_05em>'.__('Create Template').'</span>';
$table->data[2][1] .= '</a>';
}
$table->data[3][0] = __('Threshold'); $table->data[2][0] = html_print_label_input_block(
$table->data[3][1] = html_print_extended_select_for_time( __('Threshold'),
html_print_extended_select_for_time(
'module_action_threshold', 'module_action_threshold',
0, 0,
'', '',
@ -181,38 +177,58 @@ if ($own_info['is_admin']) {
true, true,
false, false,
true, true,
'', 'w100p',
false, false,
false, false,
'', '',
false, false,
true true
)
);
if (isset($step) === false) {
echo '<form class="add_alert_form max_floating_element_size" method="post">';
html_print_table($table);
}
if (isset($step) === false) {
$output = '';
if ($id_cluster) {
$actionButtons .= html_print_button(
__('Finish and view cluster'),
'store',
false,
'window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");',
[
'icon' => 'update',
'mode' => 'secondary',
],
true
);
}
$actionButtons .= html_print_submit_button(
__('Add alert'),
'add',
false,
[ 'icon' => 'wand' ],
true
); );
if (!isset($step)) { html_print_action_buttons($actionButtons, ['right_content' => $pagination]);
echo '<form class="add_alert_form" method="post">';
html_print_table($table);
}
echo '<div class="action-buttons" style="width: '.$table->width.'">'; html_print_input_hidden('create_alert', 1);
echo '</form>';
}
if (!isset($step)) { ui_require_css_file('cluetip', 'include/styles/js/');
if ($id_cluster) { ui_require_jquery_file('validate');
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button name='store' class='sub upd right mrgn_lft_20px' value='".__('Finish and view cluster')."'>"; ui_require_jquery_file('cluetip');
} ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('bgiframe');
html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"'); ?>
html_print_input_hidden('create_alert', 1);
echo '</div></form>';
}
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('validate');
ui_require_jquery_file('cluetip');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('bgiframe');
?>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {

View File

@ -61,11 +61,13 @@ if ($id_agente) {
// Table for filter controls. // Table for filter controls.
$form_filter = '<form method="post" action="index.php?sec='.$sec.'&amp;sec2='.$sec2.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure='.$config['pure'].'">'; $form_filter = '<form method="post" action="index.php?sec='.$sec.'&amp;sec2='.$sec2.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure='.$config['pure'].'">';
$form_filter .= "<input type='hidden' name='search' value='1' />"; $form_filter .= "<input type='hidden' name='search' value='1' />";
$form_filter .= '<table cellpadding="0" cellspacing="0" class="databox filters w100p">'; $form_filter .= '<table cellpadding="0" cellspacing="0" class="databox filters w100p filter-table-adv">';
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td class='bolder''>".__('Template name').'</td><td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= html_print_input_text('template_name', $templateName, '', 12, 255, true); __('Template name'),
$form_filter .= '</td>'; html_print_input_text('template_name', $templateName, '', 12, 255, true)
).'</td>';
$temp = agents_get_agents(); $temp = agents_get_agents();
$arrayAgents = []; $arrayAgents = [];
@ -76,8 +78,6 @@ if ($temp !== false) {
} }
} }
$form_filter .= "<td class='bolder''>".__('Agents').'</td><td>';
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -91,14 +91,19 @@ $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id; $params['hidden_input_idagent_value'] = $agent_id;
$form_filter .= ui_print_agent_autocomplete_input($params);
$form_filter .= '</td>'; $form_filter .= '</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Agents'),
ui_print_agent_autocomplete_input($params)
).'</td>';
$form_filter .= "<td class='bolder''>".__('Module name').'</td><td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= html_print_input_text('module_name', $moduleName, '', 12, 255, true); __('Module name'),
$form_filter .= '</td>'; html_print_input_text('module_name', $moduleName, '', 12, 255, true)
).'</td>';
$form_filter .= '</tr>'; $form_filter .= '</tr>';
$all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); $all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
@ -127,19 +132,37 @@ if (is_array($temp) === true) {
} }
} }
$form_filter .= "<td class='bolder''>".__('Actions').'</td><td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%'); __('Actions'),
$form_filter .= '</td>'; html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%')
$form_filter .= "<td class='bolder''>".__('Field content').'</td><td>'; ).'</td>';
$form_filter .= html_print_input_text('field_content', $fieldContent, '', 12, 255, true);
$form_filter .= '</td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= "<td class='bolder''>".__('Priority').'</td><td>'; __('Field content'),
$form_filter .= html_print_select(get_priorities(), 'priority', $priority, '', __('All'), -1, true); html_print_input_text('field_content', $fieldContent, '', 12, 255, true)
$form_filter .= "</td class='bolder''>"; ).'</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Priority'),
html_print_select(
get_priorities(),
'priority',
$priority,
'',
__('All'),
-1,
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$form_filter .= '</tr>'; $form_filter .= '</tr>';
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td class='bolder'>".__('Status').'</td><td>';
$ed_list = []; $ed_list = [];
$alert_status_filter = []; $alert_status_filter = [];
$alert_status_filter['all_enabled'] = __('All (Enabled)'); $alert_status_filter['all_enabled'] = __('All (Enabled)');
@ -147,14 +170,45 @@ $alert_status_filter['all'] = __('All');
$alert_status_filter['fired'] = __('Fired'); $alert_status_filter['fired'] = __('Fired');
$alert_status_filter['notfired'] = __('Not fired'); $alert_status_filter['notfired'] = __('Not fired');
$alert_status_filter['disabled'] = __('Disabled'); $alert_status_filter['disabled'] = __('Disabled');
$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true); $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= "</td><td class='bolder'>".__('Standby').'</td><td>'; __('Status'),
html_print_select(
$alert_status_filter,
'status_alert',
$status_alert,
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$sb_list = []; $sb_list = [];
$sb_list[1] = __('Standby on'); $sb_list[1] = __('Standby on');
$sb_list[0] = __('Standby off'); $sb_list[0] = __('Standby off');
$form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true); $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= '</td>'; __('Standby'),
$form_filter .= "</td><td class='bolder''>".__('Group').'</td><td>'; html_print_select(
$sb_list,
'standby',
$standby,
'',
__('All'),
-1,
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) { if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = false; $return_all_group = false;
@ -162,20 +216,35 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$return_all_group = true; $return_all_group = true;
} }
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false); $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= '</td></tr>'; __('Group'),
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false)
).'</td>';
$form_filter .= '</tr>';
$updateButton = html_print_submit_button(
__('Update'),
'',
false,
[
'icon' => 'update',
'mode' => 'mini',
],
true
);
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td colspan='6' align='right'>"; $form_filter .= "<td colspan='6' align='right'>";
$form_filter .= html_print_submit_button(__('Update'), '', false, 'class="sub upd"', true); $form_filter .= $updateButton;
$form_filter .= '</td>'; $form_filter .= '</td>';
$form_filter .= '</tr>'; $form_filter .= '</tr>';
$form_filter .= '</table>'; $form_filter .= '</table>';
} else { } else {
$form_filter .= '</table>'; $form_filter .= '</table>';
$form_filter .= "<div class='right height_100p'>"; $form_filter .= "<div class='right height_100p'>";
$form_filter .= html_print_submit_button(__('Update'), '', false, 'class="sub upd"', true); $form_filter .= $updateButton;
$form_filter .= '</div>'; $form_filter .= '</div>';
} }
@ -185,7 +254,17 @@ if (is_metaconsole() === true) {
} }
if (!$id_cluster) { if (!$id_cluster) {
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)')); ui_toggle(
$form_filter,
'<span class="subsection_header_title">'.__('Alert control filter').'</span>',
__('Toggle filter(s)'),
'update',
true,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
} else { } else {
unset($form_filter); unset($form_filter);
} }
@ -427,12 +506,6 @@ switch ($sortField) {
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert; $form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort; $sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params);
} else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params);
}
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$simple_alerts = agents_get_alerts_simple( $simple_alerts = agents_get_alerts_simple(
(empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
@ -514,8 +587,7 @@ $table_alert_list->cellstyle = [];
$table_alert_list->data = []; $table_alert_list->data = [];
$url .= $sort_params; // $url .= $sort_params;
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
@ -580,7 +652,7 @@ foreach ($simple_alerts as $alert) {
} }
$module_name = modules_get_agentmodule_name($alert['id_agent_module']); $module_name = modules_get_agentmodule_name($alert['id_agent_module']);
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;').'<br>'; $data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;');
$data[1] = ui_print_status_image($status, $title, true); $data[1] = ui_print_status_image($status, $title, true);
@ -600,7 +672,7 @@ foreach ($simple_alerts as $alert) {
'[&hellip;]', '[&hellip;]',
'' ''
); );
$data[2] .= ' <a class="template_details" $data[2] .= ' <a class="template_details patatas"
href="'.ui_get_full_url(false, false, false, false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">'; href="'.ui_get_full_url(false, false, false, false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">';
$data[2] .= html_print_image( $data[2] .= html_print_image(
'images/zoom.png', 'images/zoom.png',
@ -679,7 +751,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<form method="post" action="'.$url.'" class="delete_link display_in">'; $data[3] .= '<form method="post" action="'.$url.'" class="delete_link display_in">';
$data[3] .= html_print_input_image( $data[3] .= html_print_input_image(
'delete', 'delete',
'images/cross.png', 'images/delete.svg',
1, 1,
'padding:0px; margin-left:5px; margin-right:5px;', 'padding:0px; margin-left:5px; margin-right:5px;',
true, true,
@ -694,7 +766,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '</form>'; $data[3] .= '</form>';
$data[3] .= html_print_input_image( $data[3] .= html_print_input_image(
'update_action', 'update_action',
'images/config.png', 'images/edit.svg',
1, 1,
'padding:0px;', 'padding:0px;',
true, true,
@ -731,67 +803,73 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible">'; $data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post" style="height:85%;">'; $data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post" style="height:85%;">';
$data[3] .= '<table class="w100p bg_color222">'; $data[3] .= '<table class="w100p bg_color222 filter-table-adv">';
$data[3] .= html_print_input_hidden('add_action', 1, true); $data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true); $data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
if (! $id_agente) { if (! $id_agente) {
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">'; $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= __('Agent'); __('Agent'),
$data[3] .= '</td>'; ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]')
$data[3] .= '<td class="datos">'; ).'</td>';
$data[3] .= ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]'); $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= '</td>'; __('Module'),
ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]')
).'</td>';
$data[3] .= '</tr>'; $data[3] .= '</tr>';
} }
$data[3] .= '<tr class="datos">';
$data[3] .= '<td class="datos bolder pdd_6px font_10pt">';
$data[3] .= __('Module');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]');
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">'; $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= __('Action'); __('Action'),
$data[3] .= '</td>'; html_print_select(
$data[3] .= '<td class="datos2">'; $actions,
$data[3] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:95%'); 'action_select',
$data[3] .= '</td>'; '',
$data[3] .= '</tr>'; '',
$data[3] .= '<tr class="datos">'; __('None'),
$data[3] .= '<td class="datos bolder pdd_6px font_10pt">'; 0,
$data[3] .= __('Number of alerts match from'); true,
$data[3] .= '</td>'; false,
$data[3] .= '<td class="datos">'; true,
$data[3] .= html_print_input_text( '',
false,
'width:100%'
)
).'</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Number of alerts match from'),
'<div class="inline">'.html_print_input_text(
'fires_min', 'fires_min',
0, 0,
'', '',
4, 4,
10, 10,
true true,
); false,
$data[3] .= ' '.__('to').' '; false,
$data[3] .= html_print_input_text( '',
'w40p'
).' '.__('to').' '.html_print_input_text(
'fires_max', 'fires_max',
0, 0,
'', '',
4, 4,
10, 10,
true true,
); false,
$data[3] .= '</td>'; false,
'',
'w40p'
).'</div>'
).'</td>';
$data[3] .= '</tr>'; $data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">'; $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= __('Threshold'); __('Threshold'),
$data[3] .= '</td>'; html_print_extended_select_for_time(
$data[3] .= '<td class="datos2">';
$data[3] .= html_print_extended_select_for_time(
'module_action_threshold', 'module_action_threshold',
0, 0,
'', '',
@ -807,15 +885,18 @@ foreach ($simple_alerts as $alert) {
'', '',
false, false,
true true
); )
$data[3] .= '</td>'; ).'</td>';
$data[3] .= '</tr>'; $data[3] .= '</tr>';
$data[3] .= '</table>'; $data[3] .= '</table>';
$data[3] .= html_print_submit_button( $data[3] .= html_print_submit_button(
__('Add'), __('Add'),
'addbutton', 'addbutton',
false, false,
['class' => 'sub next right'], [
'icon' => 'next',
'class' => 'mini float-right',
],
true true
); );
$data[3] .= '</form>'; $data[3] .= '</form>';
@ -823,8 +904,8 @@ foreach ($simple_alerts as $alert) {
} }
$table_alert_list->cellclass[] = [ $table_alert_list->cellclass[] = [
1 => 'action_buttons', 1 => 'table_action_buttons',
4 => 'action_buttons', 4 => 'table_action_buttons',
]; ];
$data[4] = '<form class="disable_alert_form display_in" action="'.$url.'" method="post" >'; $data[4] = '<form class="disable_alert_form display_in" action="'.$url.'" method="post" >';
if ($alert['disabled']) { if ($alert['disabled']) {
@ -834,7 +915,7 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px', 'padding:0px',
true, true,
['class' => 'filter_none'] ['class' => 'filter_none main_menu_icon']
); );
$data[4] .= html_print_input_hidden('enable_alert', 1, true); $data[4] .= html_print_input_hidden('enable_alert', 1, true);
} else { } else {
@ -843,7 +924,8 @@ foreach ($simple_alerts as $alert) {
'images/lightbulb.png', 'images/lightbulb.png',
1, 1,
'padding:0px;', 'padding:0px;',
true true,
['class' => 'main_menu_icon']
); );
$data[4] .= html_print_input_hidden('disable_alert', 1, true); $data[4] .= html_print_input_hidden('disable_alert', 1, true);
} }
@ -861,7 +943,7 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px;', 'padding:0px;',
true, true,
['class' => 'invert_filter'] ['class' => 'invert_filter main_menu_icon']
); );
$data[4] .= html_print_input_hidden('standbyon_alert', 1, true); $data[4] .= html_print_input_hidden('standbyon_alert', 1, true);
} else { } else {
@ -871,7 +953,7 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px;', 'padding:0px;',
true, true,
['class' => 'invert_filter'] ['class' => 'invert_filter main_menu_icon']
); );
$data[4] .= html_print_input_hidden('standbyoff_alert', 1, true); $data[4] .= html_print_input_hidden('standbyoff_alert', 1, true);
} }
@ -911,19 +993,37 @@ foreach ($simple_alerts as $alert) {
true, true,
[ [
'title' => __('Add action'), 'title' => __('Add action'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
); );
} else { } else {
if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') { if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') {
$data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">'; $data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">';
$data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']); $data[4] .= html_print_image(
'images/plus-black.svg',
true,
[
'title' => __('Add action'),
'class' => 'invert_filter main_menu_icon',
'style' => 'margin-bottom: 12px;',
]
);
$data[4] .= '</a>'; $data[4] .= '</a>';
} }
} }
} }
$data[4] .= html_print_input_image('delete', 'images/cross.png', 1, '', true, ['title' => __('Delete'), 'class' => 'invert_filter']); $data[4] .= html_print_input_image(
'delete',
'images/delete.svg',
1,
'',
true,
[
'title' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('delete_alert', 1, true); $data[4] .= html_print_input_hidden('delete_alert', 1, true);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[4] .= '</form>'; $data[4] .= '</form>';
@ -931,7 +1031,17 @@ foreach ($simple_alerts as $alert) {
if ($is_cluster) { if ($is_cluster) {
$data[4] .= '<form class="view_alert_form display_in" method="post">'; $data[4] .= '<form class="view_alert_form display_in" method="post">';
$data[4] .= html_print_input_image('update', 'images/builder.png', 1, '', true, ['title' => __('Update'), 'class' => 'invert_filter']); $data[4] .= html_print_input_image(
'update',
'images/builder.png',
1,
'',
true,
[
'title' => __('Update'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('upd_alert', 1, true); $data[4] .= html_print_input_hidden('upd_alert', 1, true);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
@ -941,7 +1051,17 @@ foreach ($simple_alerts as $alert) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$data[4] .= '<form class="view_alert_form display_in" method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">'; $data[4] .= '<form class="view_alert_form display_in" method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">';
$data[4] .= html_print_input_image('view_alert', 'images/operation.png', 1, '', true, ['title' => __('View alert advanced details'), 'class' => 'invert_filter']); $data[4] .= html_print_input_image(
'view_alert',
'images/details.svg',
1,
'',
true,
[
'title' => __('View alert advanced details'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[4] .= '</form>'; $data[4] .= '</form>';
} }
@ -949,12 +1069,13 @@ foreach ($simple_alerts as $alert) {
array_push($table_alert_list->data, $data); array_push($table_alert_list->data, $data);
} }
$pagination = '';
if (isset($data)) { if (isset($data)) {
html_print_table($table_alert_list); html_print_table($table_alert_list);
if ($id_agente) { if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); $pagination .= ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, true, 'offset', false, '');
} else { } else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); $pagination .= ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, true, 'offset', false, '');
} }
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]);
@ -970,11 +1091,16 @@ if (isset($dont_display_alert_create_bttn)) {
} }
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) { if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
echo '<div class="action-buttons" style="width: '.$table_alert_list->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'crtbtn', false, 'class="sub next"'); $actionButtons = html_print_submit_button(
__('Create'),
'crtbtn',
false,
['icon' => 'next'],
true
);
html_print_action_buttons($actionButtons, ['right_content' => $pagination]);
echo '</form>'; echo '</form>';
echo '</div>';
} }
ui_require_css_file('cluetip', 'include/styles/js/'); ui_require_css_file('cluetip', 'include/styles/js/');
@ -1154,7 +1280,7 @@ function show_add_action(id_alert) {
dropdownParent: $("#add_action-div-" + id_alert) dropdownParent: $("#add_action-div-" + id_alert)
}); });
}, },
width: 600, width: 665,
height: 300 height: 300
}) })
.show (); .show ();

View File

@ -476,6 +476,70 @@ if ($standbyoff_alert) {
); );
} }
$searchFlag = true;
if (is_metaconsole() === false) {
// The tabs will be shown only with manage alerts permissions
if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LM')) {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'">'.html_print_image('images/load@svg.svg', true, ['title' => __('List alerts'), 'class' => 'main_menu_icon invert_filter']).'</a>',
],
'builder' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'.html_print_image('images/edit.svg', true, ['title' => __('Builder alert'), 'class' => 'main_menu_icon invert_filter']).'</a>',
],
];
$buttons[$tab]['active'] = true;
} else {
$buttons = '';
}
if ($tab === 'list') {
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Manage alerts'),
],
[
'link' => '',
'label' => __('List'),
],
]
);
} else {
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Manage alerts'),
],
[
'link' => '',
'label' => __('Create'),
],
]
);
}
} else {
alerts_meta_print_header();
}
if ($id_agente) { if ($id_agente) {
$agents = [$id_agente => agents_get_name($id_agente)]; $agents = [$id_agente => agents_get_name($id_agente)];
@ -494,64 +558,35 @@ if ($id_agente) {
} }
return; return;
} else { }
$searchFlag = true;
if (!is_metaconsole()) { echo $messageAction;
// The tabs will be shown only with manage alerts permissions
if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LM')) { switch ($tab) {
$buttons = [ case 'list':
'list' => [ if ($group == 0) {
'active' => false, $groups = users_get_groups();
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List alerts'), 'class' => 'invert_filter']).'</a>', } else {
], $groups = [0 => __('All')];
'builder' => [ }
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'.html_print_image('images/pencil.png', true, ['title' => __('Builder alert'), 'class' => 'invert_filter']).'</a>', $agents = agents_get_group_agents(array_keys($groups), false, 'none', true);
],
]; include_once $config['homedir'].'/godmode/alerts/alert_list.list.php';
$buttons[$tab]['active'] = true; return;
} else {
$buttons = ''; break;
} case 'builder':
if ($group == 0) {
if ($tab == 'list') { $groups = users_get_groups();
ui_print_page_header(__('Alerts').' &raquo; '.__('Manage alerts').' &raquo; '.__('List'), 'images/gm_alerts.png', false, '', true, $buttons); } else {
} else { $groups = [0 => __('All')];
ui_print_page_header(__('Alerts').' &raquo; '.__('Manage alerts').' &raquo; '.__('Create'), 'images/gm_alerts.png', false, '', true, $buttons); }
}
} else { include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
alerts_meta_print_header();
} return;
echo $messageAction; break;
switch ($tab) {
case 'list':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
$agents = agents_get_group_agents(array_keys($groups), false, 'none', true);
include_once $config['homedir'].'/godmode/alerts/alert_list.list.php';
return;
break;
case 'builder':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
return;
break;
}
} }

View File

@ -21,8 +21,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (is_ajax()) { if (is_ajax()) {
$get_template_tooltip = (bool) get_parameter('get_template_tooltip'); $get_template_tooltip = (bool) get_parameter('get_template_tooltip');
@ -124,15 +122,22 @@ $sec = (is_metaconsole() === true) ? 'advanced' : 'galertas';
// case delete_templete action is performed. // case delete_templete action is performed.
if (!$delete_template) { if (!$delete_template) {
// Header. // Header.
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Alert templates'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Alert templates'),
],
]
); );
} }
} }
@ -285,7 +290,7 @@ $url = ui_get_url_refresh(
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$table->cellspacing = 0; $table->cellspacing = 0;
$table->cellpadding = 0; $table->cellpadding = 0;
@ -295,51 +300,70 @@ $table->data = [];
$table->head = []; $table->head = [];
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'width: 50%;';
$table->style[2] = 'font-weight: bold'; $table->style[1] = 'width: 50%;';
$table->data[0][0] = html_print_label_input_block(
__('Type'),
html_print_select(
alerts_get_alert_templates_types(),
'search_type',
$search_type,
'',
__('All'),
'',
true,
false,
false,
'w100p',
false,
'width: 100%;'
)
);
$table->data[0][0] = __('Type'); $table->data[0][1] = html_print_label_input_block(
$table->data[0][1] = html_print_select( __('Search'),
alerts_get_alert_templates_types(), html_print_input_text(
'search_type', 'search_string',
$search_type, $search_string,
'', '',
__('All'), 25,
'', 255,
true, true,
false, false,
false false,
'',
'w100p'
)
); );
$table->data[0][2] = __('Search');
$table->data[0][3] = html_print_input_text( $table->data[1][0] = '&nbsp;';
'search_string', $table->data[1][1] = html_print_submit_button(
$search_string,
'',
25,
255,
true
);
$table->data[0][4] = '<div class="action-buttons">';
$table->data[0][4] .= html_print_submit_button(
__('Search'), __('Search'),
'', '',
false, false,
'class="sub search"', [
'class' => 'float-right',
'icon' => 'search',
],
true true
); );
$table->data[0][4] .= '</div>';
if (is_metaconsole() === true) { $filter = '<form class="" method="post" action="'.$url.'">';
$filter = '<form class="" method="post" action="'.$url.'">'; $filter .= html_print_table($table, true);
$filter .= html_print_table($table, true); $filter .= '</form>';
$filter .= '</form>'; ui_toggle(
ui_toggle($filter, __('Show Options')); $filter,
} else { '<span class="subsection_header_title">'.__('Show Options').'</span>',
echo '<form method="post" action="'.$url.'">'; __('Show Options'),
html_print_table($table); 'update',
echo '</form>'; true,
} false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
unset($table); unset($table);
@ -420,17 +444,20 @@ foreach ($templates as $template) {
if (is_management_allowed() === true if (is_management_allowed() === true
&& check_acl($config['id_user'], $template['id_group'], 'LM') && check_acl($config['id_user'], $template['id_group'], 'LM')
) { ) {
$table->cellclass[][4] = 'action_buttons'; $table->cellclass[][4] = 'table_action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'&offset='.$offset.'" class="float-left inline_line">'; $data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'&offset='.$offset.'" class="float-left inline_line">';
$data[4] .= html_print_input_hidden('duplicate_template', 1, true); $data[4] .= html_print_input_hidden('duplicate_template', 1, true);
$data[4] .= html_print_input_hidden('source_id', $template['id'], true); $data[4] .= html_print_input_hidden('source_id', $template['id'], true);
$data[4] .= html_print_input_image( $data[4] .= html_print_input_image(
'dup', 'dup',
'images/copy.png', 'images/copy.svg',
1, 1,
'', '',
true, true,
['title' => __('Duplicate')] [
'title' => __('Duplicate'),
'class' => 'main_menu_icon',
]
); );
$data[4] .= '</form> '; $data[4] .= '</form> ';
@ -440,11 +467,14 @@ foreach ($templates as $template) {
$data[4] .= html_print_input_hidden('id', $template['id'], true); $data[4] .= html_print_input_hidden('id', $template['id'], true);
$data[4] .= html_print_input_image( $data[4] .= html_print_input_image(
'del', 'del',
'images/cross.png', 'images/delete.svg',
1, 1,
'', '',
true, true,
['title' => __('Delete')] [
'title' => __('Delete'),
'class' => 'main_menu_icon',
]
); );
$data[4] .= '</form> '; $data[4] .= '</form> ';
} }
@ -455,18 +485,18 @@ foreach ($templates as $template) {
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_templates, $url); $pagination = '';
if (isset($data) === true) { if (isset($data) === true) {
html_print_table($table); html_print_table($table);
ui_pagination( $pagination = ui_pagination(
$total_templates, $total_templates,
$url, $url,
0, 0,
0, 0,
false,
'offset',
true, true,
'pagination-bottom' 'offset',
false,
''
); );
} else { } else {
ui_print_info_message( ui_print_info_message(
@ -477,13 +507,15 @@ if (isset($data) === true) {
); );
} }
$buttons = '';
if (is_management_allowed() === true) { if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); $buttons = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
html_print_input_hidden('create_alert', 1); $buttons .= html_print_input_hidden('create_alert', 1);
html_print_action_buttons($buttons, ['right_content' => $pagination]);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
} else {
html_print_action_buttons($buttons, ['right_content' => $pagination]);
} }
enterprise_hook('close_meta_frame');

View File

@ -48,8 +48,6 @@ if (is_ajax()) {
} }
} }
enterprise_hook('open_meta_frame');
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
@ -70,12 +68,19 @@ if ($al_action !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert action'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'alert_config', '',
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert action'),
],
]
); );
} }
} else { } else {
@ -83,12 +88,19 @@ if ($al_action !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert action'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'alert_config', '',
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert action'),
],
]
); );
} }
@ -160,43 +172,34 @@ html_print_div(
$table = new stdClass(); $table = new stdClass();
$table->id = 'table_macros'; $table->id = 'table_macros';
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
if (defined('METACONSOLE')) {
if ($id) {
$table->head[0] = __('Update Action');
} else {
$table->head[0] = __('Create Action');
}
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold';
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text( $table->data[0][0] = html_print_label_input_block(
'name', __('Name'),
$name, html_print_input_text(
'', 'name',
35, $name,
255, '',
true, 35,
false, 255,
false, true,
'', false,
'', false,
'', '',
'', '',
false, '',
'', '',
'', false,
'', '',
(!$is_management_allowed | $disabled) '',
'',
(!$is_management_allowed | $disabled)
)
); );
if (io_safe_output($name) == 'Monitoring Event') { if (io_safe_output($name) == 'Monitoring Event') {
@ -207,34 +210,30 @@ if (io_safe_output($name) == 'Monitoring Event') {
); );
} }
$table->colspan[0][1] = 2;
$table->data[1][0] = __('Group');
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
$return_all_group = false; $return_all_group = false;
if (users_can_manage_group_all('LW') === true || $disabled) { if (users_can_manage_group_all('LW') === true || $disabled) {
$return_all_group = true; $return_all_group = true;
} }
$table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups( $table->data[0][1] = html_print_label_input_block(
false, __('Group'),
'LW', html_print_select_groups(
$return_all_group, false,
'group', 'LW',
$group, $return_all_group,
'', 'group',
'', $group,
0, '',
true, '',
false, 0,
true, true,
'', false,
(!$is_management_allowed | $disabled) true,
).'</div>'; 'w100p',
$table->colspan[1][1] = 2; (!$is_management_allowed | $disabled)
)
);
$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Integria IMS Ticket')); $create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Integria IMS Ticket'));
@ -244,7 +243,6 @@ if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_comm
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id; $sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
} }
$table->data[2][0] = __('Command');
$commands_sql = db_get_all_rows_filter( $commands_sql = db_get_all_rows_filter(
'talert_commands', 'talert_commands',
'id_group IN ('.implode(',', array_keys(users_get_groups(false, 'LW'))).')'.$sql_exclude_command_id, 'id_group IN ('.implode(',', array_keys(users_get_groups(false, 'LW'))).')'.$sql_exclude_command_id,
@ -256,114 +254,149 @@ $commands_sql = db_get_all_rows_filter(
false, false,
true true
); );
$table->data[2][1] = html_print_select_from_sql(
$commands_sql, $create_command = ' ';
'id_command',
$id_command,
'',
'',
0,
true,
false,
false,
(!$is_management_allowed | $disabled)
);
$table->data[2][1] .= ' ';
if ($is_management_allowed === true if ($is_management_allowed === true
&& check_acl($config['id_user'], 0, 'PM') && !$disabled && check_acl($config['id_user'], 0, 'PM') && !$disabled
) { ) {
$table->data[2][1] .= __('Create Command'); $create_command .= __('Create Command');
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">'; $create_command .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
$table->data[2][1] .= html_print_image('images/add.png', true); $create_command .= html_print_image('images/add.png', true);
$table->data[2][1] .= '</a>'; $create_command .= '</a>';
} }
$table->data[2][1] .= '<div id="command_description" ></div>'; $create_command .= '<div id="command_description" ></div>';
$table->colspan[2][1] = 2;
$table->data[3][0] = __('Threshold'); $table->data[1][0] = html_print_label_input_block(
$table->data[3][1] = html_print_extended_select_for_time( __('Command'),
'action_threshold', html_print_select_from_sql(
$action_threshold, $commands_sql,
'', 'id_command',
'', $id_command,
'', '',
false, '',
true, 0,
false, true,
true, false,
'', false,
(!$is_management_allowed | $disabled), (!$is_management_allowed | $disabled)
false, ).$create_command
'',
false,
true
); );
$table->colspan[3][1] = 2;
$table->data[4][0] = ''; $table->data[1][1] = html_print_label_input_block(
$table->data[4][1] = __('Firing'); __('Threshold'),
$table->data[4][2] = __('Recovery'); html_print_extended_select_for_time(
$table->cellstyle[4][1] = 'font-weight: bold;'; 'action_threshold',
$table->cellstyle[4][2] = 'font-weight: bold;'; $action_threshold,
'',
$table->data[5][0] = __('Command preview'); '',
$table->data[5][1] = html_print_textarea( '',
'command_preview', false,
5, true,
30, false,
'', true,
'disabled="disabled"', 'w100p',
true (!$is_management_allowed | $disabled),
false,
'',
false,
true
)
); );
$table->data[5][2] = html_print_textarea(
'command_recovery_preview', $table_macros = new stdClass();
5, $table_macros->id = 'table_macros';
30, $table_macros->width = '100%';
$table_macros->class = 'databox filters filter-table-adv';
$table_macros->style = [];
$table_macros->size = [];
$table_macros->size[0] = '20%';
$table_macros->size[1] = '40%';
$table_macros->size[2] = '40%';
$table_macros->data = [];
$table_macros->data[0][0] = '';
$table_macros->data[0][1] = html_print_label_input_block(
__('Triggering'),
''
);
$table_macros->data[0][2] = html_print_label_input_block(
__('Recovery'),
''
);
$table_macros->data[1][0] = html_print_label_input_block(
__('Command preview'),
''
);
$table_macros->data[1][1] = html_print_label_input_block(
'', '',
'disabled="disabled"', html_print_textarea(
true 'command_preview',
5,
30,
'',
'disabled="disabled"',
true
)
);
$table_macros->data[1][2] = html_print_label_input_block(
'',
html_print_textarea(
'command_recovery_preview',
5,
30,
'',
'disabled="disabled"',
true
)
); );
// Selector will work only with Integria activated. // Selector will work only with Integria activated.
$integriaIdName = 'integria_wu'; $integriaIdName = 'integria_wu';
$table->data[$integriaIdName][0] = __('Create workunit on recovery').ui_print_help_tip( $table_macros->colspan[$integriaIdName][0] = 3;
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), $table_macros->data[$integriaIdName][0] = html_print_label_input_block(
true __('Create workunit on recovery').ui_print_help_tip(
); __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
$table->data[$integriaIdName][1] = html_print_checkbox_switch_extended( true
'create_wu_integria', ),
1, html_print_checkbox_switch_extended(
$create_wu_integria, 'create_wu_integria',
false, 1,
'', $create_wu_integria,
$disabled_attr, false,
true '',
$disabled_attr,
true
)
); );
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = html_print_image( $table_macros->data['field'.$i][0] = html_print_image(
'images/spinner.gif', 'images/spinner.gif',
true true
); );
$table->data['field'.$i][1] = html_print_image( $table_macros->data['field'.$i][1] = html_print_image(
'images/spinner.gif', 'images/spinner.gif',
true true
); );
$table->data['field'.$i][2] = html_print_image( $table_macros->data['field'.$i][2] = html_print_image(
'images/spinner.gif', 'images/spinner.gif',
true true
); );
// Store the value in a hidden to keep it on first execution // Store the value in a hidden to keep it on first execution
$table->data['field'.$i][1] .= html_print_input_hidden( $table_macros->data['field'.$i][1] .= html_print_input_hidden(
'field'.$i.'_value', 'field'.$i.'_value',
(!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '', (!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '',
true, true,
'', '',
$disabled_attr $disabled_attr
); );
$table->data['field'.$i][2] .= html_print_input_hidden( $table_macros->data['field'.$i][2] .= html_print_input_hidden(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
(!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '', (!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '',
true, true,
@ -374,46 +407,55 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'&offset='.$offset.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'&offset='.$offset.'" class="max_floating_element_size">';
$table_html = html_print_table($table, true); $table_html = html_print_table($table, true);
$table_html_macros = html_print_table($table_macros, true);
$backButton = '';
$submitButton = '';
echo $table_html; echo $table_html;
echo $table_html_macros;
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) { if ($id) {
html_print_input_hidden('id', $id); html_print_input_hidden('id', $id);
if (!$disabled) { if (!$disabled) {
html_print_input_hidden('update_action', 1); html_print_input_hidden('update_action', 1);
html_print_submit_button( $submitButton = html_print_submit_button(
__('Update'), __('Update'),
'create', 'create',
false, false,
'class="sub upd"' ['icon' => 'wand'],
true
); );
} else { } else {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; $backButton = html_print_button(
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions">'; __('Back'),
html_print_submit_button(__('Back'), 'back', false, 'class="sub upd"'); 'back',
echo '</form>'; false,
echo '</div>'; "window.location.href = 'index.php?sec=galertas&sec2=godmode/alerts/alert_actions'",
[
'icon' => 'back',
'class' => 'secondary',
],
true
);
} }
} else { } else {
html_print_input_hidden('create_action', 1); html_print_input_hidden('create_action', 1);
html_print_submit_button( $submitButton = html_print_submit_button(
__('Create'), __('Create'),
'create', 'create',
false, false,
'class="sub wand"' ['icon' => 'wand'],
true
); );
} }
echo '</div>'; html_print_action_buttons($submitButton.$backButton);
} }
echo '</form>'; echo '</form>';
enterprise_hook('close_meta_frame');
ui_require_javascript_file('pandora_alerts'); ui_require_javascript_file('pandora_alerts');
ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/'); ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
?> ?>

View File

@ -36,8 +36,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -56,12 +54,19 @@ $alert = [];
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert command'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert command'),
],
]
); );
} }
@ -201,112 +206,23 @@ if ($is_management_allowed === false) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
if (is_metaconsole() === true) {
$table->head[0] = ($id) ? __('Update Command') : __('Create Command');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->style = []; $table->style = [];
if (is_metaconsole() === false) {
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold';
}
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '45%';
$table->size[1] = '45%';
$table->size[2] = '10%';
$table->data = []; $table->data = [];
$table->colspan['name'][1] = 3; $table->data[0][0] = html_print_label_input_block(
$table->data['name'][0] = __('Name'); __('Name'),
$table->data['name'][2] = html_print_input_text( html_print_input_text(
'name', 'name',
$name, $name,
'',
35,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
!$is_management_allowed
);
$table->colspan['command'][1] = 3;
$table->data['command'][0] = __('Command');
$table->data['command'][1] = html_print_textarea(
'command',
8,
30,
$command,
'',
true,
'',
!$is_management_allowed
);
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
$return_all_group = true;
}
$table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group');
$table->data['group'][1] = '<div class="w250px inline">'.html_print_select_groups(
false,
'LM',
$return_all_group,
'id_group',
$id_group,
false,
'',
0,
true,
false,
true,
'',
!$is_management_allowed
).'</div>';
$table->colspan['description'][1] = 3;
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true,
'',
!$is_management_allowed
);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
if (empty($fields_descriptions) === false) {
$field_description = $fields_descriptions[($i - 1)];
} else {
$field_description = '';
}
$table->data['field'.$i][1] = html_print_input_text(
'field'.$i.'_description',
$field_description,
'', '',
30, 35,
255, 255,
true, true,
false, false,
@ -320,12 +236,91 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
'', '',
'', '',
!$is_management_allowed !$is_management_allowed
); )
);
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i); if (users_can_manage_group_all('LM') === true) {
$table->data['field'.$i][2] .= ui_print_help_tip( $return_all_group = true;
__('value1,tag1;value2,tag2;value3,tag3'), }
true
$table->data[0][1] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'LM',
$return_all_group,
'id_group',
$id_group,
false,
'',
0,
true,
false,
true,
'',
!$is_management_allowed
)
);
$table->data[1][0] = html_print_label_input_block(
__('Command'),
html_print_textarea(
'command',
8,
30,
$command,
'',
true,
'',
!$is_management_allowed
)
);
$return_all_group = false;
$table->data[1][1] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
8,
30,
$description,
'',
true,
'',
!$is_management_allowed
)
);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (empty($fields_descriptions) === false) {
$field_description = $fields_descriptions[($i - 1)];
} else {
$field_description = '';
}
$table->data['field'.$i][0] = html_print_label_input_block(
sprintf(__('Field %s description'), $i),
html_print_input_text(
'field'.$i.'_description',
$field_description,
'',
30,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
!$is_management_allowed
)
); );
if (empty($fields_values) === false) { if (empty($fields_values) === false) {
@ -340,59 +335,76 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$selected = false; $selected = false;
} }
$table->data['field'.$i][3] = html_print_input_text( $table->data['field'.$i][1] = html_print_label_input_block(
'field'.$i.'_values', sprintf(__('Field %s values'), $i).ui_print_help_tip(
$field_values, __('value1,tag1;value2,tag2;value3,tag3'),
'', true
55, ),
1000, html_print_input_text(
true, 'field'.$i.'_values',
false, $field_values,
false, '',
'', 55,
'field_value', 1000,
'', true,
'', false,
false, false,
'', '',
'', 'field_value',
'', '',
!$is_management_allowed '',
false,
'',
'',
'',
!$is_management_allowed
)
); );
$table->data['field'.$i][4] = __('Hide'); $table->data['field'.$i][2] = html_print_label_input_block(
__('Hide'),
$table->data['field'.$i][5] = html_print_checkbox_extended( html_print_checkbox_extended(
'field'.$i.'_hide', 'field'.$i.'_hide',
1, 1,
$selected, $selected,
!$is_management_allowed, !$is_management_allowed,
'cursor: \'pointer\'', 'cursor: \'pointer\'',
'class="hide_inputs"', 'class="hide_inputs"',
true true
)
); );
} }
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'" class="max_floating_element_size">';
html_print_table($table); html_print_table($table);
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) { if ($id) {
html_print_input_hidden('id', $id); html_print_input_hidden('id', $id);
html_print_input_hidden('update_command', 1); html_print_input_hidden('update_command', 1);
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"'); $buttonSubmit = html_print_submit_button(
__('Update'),
'create',
false,
['icon' => 'wand'],
true
);
} else { } else {
html_print_input_hidden('create_command', 1); html_print_input_hidden('create_command', 1);
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"'); $buttonSubmit = html_print_submit_button(
__('Create'),
'create',
false,
['icon' => 'wand'],
true
);
} }
echo '</div>'; html_print_action_buttons($buttonSubmit);
} }
echo '</form>'; echo '</form>';
enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -37,10 +37,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login(); check_login();
if (is_metaconsole() === true) {
enterprise_hook('open_meta_frame');
}
if (! check_acl($config['id_user'], 0, 'LM')) { if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -95,12 +91,19 @@ if ($a_template !== false) {
$help_header = ''; $help_header = '';
} }
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts'),
'', 'images/gm_alerts.png',
false, false,
$help_header, $help_header,
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
); );
} }
} else { } else {
@ -119,12 +122,19 @@ if ($a_template !== false) {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'conf_alert_template', 'conf_alert_template',
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
); );
} }
} else { } else {
@ -151,12 +161,19 @@ if ($a_template !== false) {
$help_header = ''; $help_header = '';
} }
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
$help_header, $help_header,
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
); );
} }
} }
@ -602,27 +619,22 @@ print_alert_template_steps($step, $id);
$table = new stdClass(); $table = new stdClass();
$table->id = 'template'; $table->id = 'template';
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters w100p filter-table-adv';
if (is_metaconsole() === true) {
$table->head[0] = __('Create Template');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '50%';
$table->size[2] = '20%'; $table->size[2] = '50%';
$table->colspan = [];
$table->colspan[1][0] = 2;
if ($step == 2) { if ($step == 2) {
if (!isset($show_matches)) { if (!isset($show_matches)) {
$show_matches = false; $show_matches = false;
} }
$table->data[0][0] = __('Use special days list');
$data_special_days = Calendar::calendars( $data_special_days = Calendar::calendars(
// Fields. // Fields.
[ '`talert_calendar`.*' ], [ '`talert_calendar`.*' ],
@ -641,121 +653,154 @@ if ($step == 2) {
// Reduce to a select. // Reduce to a select.
true true
); );
$table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_select( __('Use special days list'),
$data_special_days, html_print_select(
'special_day', $data_special_days,
$special_day, 'special_day',
'', $special_day,
__('None'), '',
0, __('None'),
true, 0,
false, true,
false, false,
'', false,
(!$is_management_allowed | $disabled) 'w100p',
(!$is_management_allowed | $disabled),
'width: 100%'
)
); );
$table->data[0][1] = '&nbsp;';
// Firing conditions and events. // Firing conditions and events.
$table->colspan = []; $table->data[1][0] = html_print_label_input_block(
$table->data[1][0] = __('Schedule'); __('Schedule'),
$table->colspan[1][1] = 3; ui_print_warning_message(
$table->data[1][1] = ui_print_warning_message( [
[ 'message' => __('No alert has been scheduled yet'),
'message' => __('No alert has been scheduled yet'), 'force_style' => 'display:none;',
'force_style' => 'display:none;', 'force_class' => 'alert_schedule',
'force_class' => 'alert_schedule', ],
], '',
'', true
true ).'<div id="calendar_map" style="width: 90%;"></div>'.html_print_input_hidden('schedule', $schedule, true)
);
$table->data[1][1] .= '<div id="calendar_map" style="width: 90%;"></div>';
$table->data[1][1] .= html_print_input_hidden('schedule', $schedule, true);
$table->colspan['threshold'][1] = 3;
$table->data['threshold'][0] = __('Time threshold');
$table->data['threshold'][1] = html_print_extended_select_for_time(
'threshold',
$threshold,
'',
'',
'',
false,
true,
false,
true,
'',
(!$is_management_allowed | $disabled)
); );
$table->data[4][0] = __('Min. number of alerts'); $table->data[2][0] = html_print_label_input_block(
$table->data[4][1] = html_print_input_text( __('Time threshold'),
'min_alerts', html_print_extended_select_for_time(
$min_alerts, 'threshold',
'', $threshold,
5, '',
7, '',
true, '',
false, false,
false, true,
'', false,
'', true,
'', 'w100p',
'', (!$is_management_allowed | $disabled)
false, )
'',
'',
'',
(!$is_management_allowed | $disabled)
); );
$table->data[4][2] = __('Reset counter for non-sustained alerts'); $table->data[2][1] = html_print_label_input_block(
$table->data[4][2] .= ui_print_help_tip( __('Default action').ui_print_help_tip(
__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'), __('Unless they\'re left blank, the fields from the action will override those set on the template.'),
true true
); ),
$table->data[4][3] = html_print_checkbox( html_print_select_from_sql(
'min_alerts_reset_counter', $sql_query,
1, 'default_action',
$min_alerts_reset_counter, $default_action,
true, '',
(!$is_management_allowed | $disabled), __('None'),
'', 0,
false, true,
($create_template == 1) ? 'checked=checked' : '' false,
false,
(!$is_management_allowed | $disabled),
false,
false,
0,
'w100p'
)
); );
$table->data[5][0] = __('Max. number of alerts'); $table->data[3][0] = html_print_label_input_block(
$table->data[5][1] = html_print_input_text( __('Min. number of alerts'),
'max_alerts', html_print_input_text(
$max_alerts, 'min_alerts',
'', $min_alerts,
5, '',
7, 5,
true, 7,
false, true,
false, false,
'', false,
'', '',
'', 'w100p',
'', '',
false, '',
'', false,
'', '',
'', '',
(!$is_management_allowed | $disabled) '',
(!$is_management_allowed | $disabled)
)
); );
$table->data[5][2] = __('Disable event'); $table->data[3][1] = html_print_label_input_block(
$table->data[5][3] = html_print_checkbox( __('Reset counter for non-sustained alerts').ui_print_help_tip(
'disable_event', __('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'),
1, true
$disable_event, ),
true, html_print_checkbox(
(!$is_management_allowed | $disabled) 'min_alerts_reset_counter',
1,
$min_alerts_reset_counter,
true,
(!$is_management_allowed | $disabled),
'',
false,
($create_template == 1) ? 'checked=checked' : ''
)
);
$table->data[4][0] = html_print_label_input_block(
__('Max. number of alerts'),
html_print_input_text(
'max_alerts',
$max_alerts,
'',
5,
7,
true,
false,
false,
'',
'w100p',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[4][1] = html_print_label_input_block(
__('Disable event'),
html_print_checkbox(
'disable_event',
1,
$disable_event,
true,
(!$is_management_allowed | $disabled)
)
); );
$table->data[6][0] = __('Default action');
$usr_groups = implode( $usr_groups = implode(
',', ',',
array_keys(users_get_groups($config['id_user'], 'LM', true)) array_keys(users_get_groups($config['id_user'], 'LM', true))
@ -769,123 +814,98 @@ if ($step == 2) {
$usr_groups $usr_groups
); );
$table->data[6][1] = html_print_select_from_sql( $table->data[5][0] = html_print_label_input_block(
$sql_query, __('Condition type'),
'default_action', html_print_select(
$default_action, alerts_get_alert_templates_types(),
'', 'type',
__('None'), $type,
0, '',
true, __('None'),
false, 0,
false, true,
(!$is_management_allowed | $disabled), false,
false, false,
false, 'w100p',
0 (!$is_management_allowed | $disabled)
); ).'<span id="matches_value" '.(($show_matches) ? '' : 'class="invisible"').'>'.'&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true).html_print_label(
$table->data[6][1] .= ui_print_help_tip( __('Trigger when matches the value'),
__('Unless they\'re left blank, the fields from the action will override those set on the template.'), 'checkbox-matches_value',
true true
).'</span>'
); );
$table->data[7][0] = __('Condition type'); $table->data['value'][1] = html_print_label_input_block(
$table->data[7][1] = html_print_select( __('Value'),
alerts_get_alert_templates_types(), html_print_input_text(
'type', 'value',
$type, $value,
'', '',
__('None'), 35,
0, 255,
true, true
false, ).'&nbsp;<span id="regex_ok">'.html_print_image(
false, 'images/suc.png',
'', true,
(!$is_management_allowed | $disabled) [
'style' => 'display:none',
'id' => 'regex_good',
'title' => __('The regular expression is valid'),
'width' => '20px',
]
).html_print_image(
'images/err.png',
true,
[
'style' => 'display:none',
'id' => 'regex_bad',
'title' => __('The regular expression is not valid'),
'width' => '20px',
]
).'</span>'
); );
$table->data[7][1] .= '<span id="matches_value" '.(($show_matches) ? '' : 'class="invisible"').'>';
$table->data[7][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
$table->data[7][1] .= html_print_label(
__('Trigger when matches the value'),
'checkbox-matches_value',
true
);
$table->data[7][1] .= '</span>';
$table->colspan[7][1] = 3;
$table->data['value'][0] = __('Value');
$table->data['value'][1] = html_print_input_text(
'value',
$value,
'',
35,
255,
true
);
$table->data['value'][1] .= '&nbsp;<span id="regex_ok">';
$table->data['value'][1] .= html_print_image(
'images/suc.png',
true,
[
'style' => 'display:none',
'id' => 'regex_good',
'title' => __('The regular expression is valid'),
'width' => '20px',
]
);
$table->data['value'][1] .= html_print_image(
'images/err.png',
true,
[
'style' => 'display:none',
'id' => 'regex_bad',
'title' => __('The regular expression is not valid'),
'width' => '20px',
]
);
$table->data['value'][1] .= '</span>';
$table->colspan['value'][1] = 3;
// Min first, then max, that's more logical. // Min first, then max, that's more logical.
$table->data['min'][0] = __('Min.'); $table->data['min'][0] = html_print_label_input_block(
$table->data['min'][1] = html_print_input_text( __('Min.'),
'min', html_print_input_text(
$min, 'min',
'', $min,
5, '',
255, 5,
true, 255,
$disabled true,
$disabled
)
); );
$table->colspan['min'][1] = 3;
$table->data['max'][0] = __('Max.'); $table->data['max'][1] = html_print_label_input_block(
$table->data['max'][1] = html_print_input_text( __('Max.'),
'max', html_print_input_text(
$max, 'max',
'', $max,
5, '',
255, 5,
true, 255,
$disabled true,
$disabled
)
); );
$table->colspan['max'][1] = 3;
$table->data['example'][1] = ui_print_alert_template_example( $table->data['example'][0] = ui_print_alert_template_example(
$id, $id,
true, true,
false false
); );
$table->colspan['example'][1] = 4;
} else if ($step == 3) { } else if ($step == 3) {
$table->style[0] = 'font-weight: bold; vertical-align: middle'; $table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->style[1] = 'font-weight: bold; vertical-align: top'; $table->style[2] = 'font-weight: bold; vertical-align: top;';
$table->style[2] = 'font-weight: bold; vertical-align: top';
$table->size = []; $table->size = [];
$table->size[0] = '10%'; $table->size[1] = '50%';
$table->size[1] = '45%'; $table->size[2] = '50%';
$table->size[2] = '45%'; $table->colspan[0][0] = 2;
$table->class = 'databox filters w100p filter-table-adv alert-template-fields';
// Alert recover. // Alert recover.
if (! $recovery_notify) { if (! $recovery_notify) {
$table->cellstyle['label_fields'][2] = 'display:none;'; $table->cellstyle['label_fields'][2] = 'display:none;';
@ -894,29 +914,29 @@ if ($step == 2) {
} }
} }
$table->data[0][0] = __('Alert recovery');
$values = [ $values = [
false => __('Disabled'), false => __('Disabled'),
true => __('Enabled'), true => __('Enabled'),
]; ];
$table->data[0][1] = html_print_select( $table->data[0][0] = html_print_label_input_block(
$values, __('Alert recovery'),
'recovery_notify', html_print_select(
$recovery_notify, $values,
'', 'recovery_notify',
'', $recovery_notify,
'', '',
true, '',
false, '',
false, true,
'', false,
(!$is_management_allowed | $disabled) false,
'w25p',
(!$is_management_allowed | $disabled)
)
); );
$table->colspan[0][1] = 2;
$table->data['label_fields'][0] = ''; $table->data['label_fields'][1] = '<span class"center">'.__('Firing fields').'</span>';
$table->data['label_fields'][1] = __('Firing fields'); $table->data['label_fields'][2] = '<span class"center">'.__('Recovery fields').'</span>';
$table->data['label_fields'][2] = __('Recovery fields');
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (isset($template[$name]) === true) { if (isset($template[$name]) === true) {
@ -925,99 +945,106 @@ if ($step == 2) {
$value = ''; $value = '';
} }
$table->data['field'.$i][0] = sprintf(__('Field %s'), $i); // $table->data['field'.$i][0] = sprintf(__('Field %s'), $i);
// TinyMCE. // TinyMCE.
// triggering fields. // triggering fields.
// Basic. // Basic.
$table->data['field'.$i][1] = '<div id="command_div"><b><small>'; $col1 = '<div id="command_div"><b><small>';
$table->data['field'.$i][1] .= __('Basic').'&nbsp;&nbsp;'; $col1 .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended( $col1 .= html_print_radio_button_extended(
'editor_type_value_'.$i, 'editor_type_value_'.$i,
0, 0,
'', '',
false, false,
(!$is_management_allowed | $disabled), (!$is_management_allowed | $disabled),
"removeTinyMCE('textarea_field".$i."')", "removeTinyMCE('textarea_field".$i."')",
'', 'style="height: 15px !important;"',
true true
); );
// Advanced. // Advanced.
$table->data['field'.$i][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $col1 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][1] .= __('Advanced').'&nbsp;&nbsp;'; $col1 .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended( $col1 .= html_print_radio_button_extended(
'editor_type_value_'.$i, 'editor_type_value_'.$i,
0, 0,
'', '',
true, true,
(!$is_management_allowed | $disabled), (!$is_management_allowed | $disabled),
"addTinyMCE('textarea_field".$i."')", "addTinyMCE('textarea_field".$i."')",
'', 'style="height: 15px !important;"',
true true
); );
$table->data['field'.$i][1] .= '</small></b></div>'; $col1 .= '</small></b></div>';
// Texarea. // Texarea.
$table->data['field'.$i][1] .= html_print_textarea( $col1 .= html_print_textarea(
'field'.$i, 'field'.$i,
1, 1,
1, 1,
isset($fields[$i]) ? $fields[$i] : '', isset($fields[$i]) ? $fields[$i] : '',
'class="fields" min-height-40px', 'class="fields w100p" style="min-height: 100px !important;"',
true, true,
'', '',
(!$is_management_allowed | $disabled) (!$is_management_allowed | $disabled)
); );
$table->data['field'.$i][1] = html_print_label_input_block(
sprintf(__('Field %s'), $i),
$col1
);
// Recovery. // Recovery.
// Basic. // Basic.
$table->data['field'.$i][2] = '<div id="command_div"><b><small>'; $col2 = '<div id="command_div"><b><small>';
$table->data['field'.$i][2] .= __('Basic').'&nbsp;&nbsp;'; $col2 .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended( $col2 .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i, 'editor_type_recovery_value_'.$i,
0, 0,
'', '',
false, false,
(!$is_management_allowed | $disabled), (!$is_management_allowed | $disabled),
"removeTinyMCE('textarea_field".$i."_recovery')", "removeTinyMCE('textarea_field".$i."_recovery')",
'', 'style="height: 15px !important;"',
true true
); );
// Advanced. // Advanced.
$table->data['field'.$i][2] .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $col2 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][2] .= __('Advanced').'&nbsp;&nbsp;'; $col2 .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended( $col2 .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i, 'editor_type_recovery_value_'.$i,
0, 0,
'', '',
true, true,
(!$is_management_allowed | $disabled), (!$is_management_allowed | $disabled),
"addTinyMCE('textarea_field".$i."_recovery')", "addTinyMCE('textarea_field".$i."_recovery')",
'', 'style="height: 15px !important;"',
true true
); );
$table->data['field'.$i][2] .= '</small></b></div>'; $col2 .= '</small></b></div>';
// Texarea. // Texarea.
$table->data['field'.$i][2] .= html_print_textarea( $col2 .= html_print_textarea(
'field'.$i.'_recovery', 'field'.$i.'_recovery',
1, 1,
1, 1,
isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', isset($fields_recovery[$i]) ? $fields_recovery[$i] : '',
'class="fields min-height-40px"', 'class="fields w100p" style="min-height: 100px !important;"',
true, true,
'', '',
(!$is_management_allowed | $disabled) (!$is_management_allowed | $disabled)
); );
$table->data['field'.$i][2] = html_print_label_input_block(
'&nbsp;',
$col2
);
} }
} else { } else {
// Step 1 by default. // Step 1 by default.
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '50%';
$table->size[1] = '50%';
$table->colspan = [];
$table->colspan[1][0] = 2;
$table->data = []; $table->data = [];
$table->rowstyle = [];
$table->rowstyle['value'] = 'display: none';
$table->rowstyle['max'] = 'display: none';
$table->rowstyle['min'] = 'display: none';
$show_matches = false; $show_matches = false;
switch ($type) { switch ($type) {
@ -1049,29 +1076,29 @@ if ($step == 2) {
break; break;
} }
$table->data[0][0] = __('Name'); $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_input_text( __('Name'),
'name', html_print_input_text(
$name, 'name',
'', $name,
35, '',
255, 35,
true, 255,
false, true,
false, false,
'', false,
'', '',
'', '',
'', '',
false, '',
'', false,
'', '',
'', '',
(!$is_management_allowed | $disabled) '',
(!$is_management_allowed | $disabled)
)
); );
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Group');
$groups = users_get_groups(); $groups = users_get_groups();
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
@ -1085,59 +1112,76 @@ if ($step == 2) {
} }
} }
$table->data[0][1] .= '&nbsp;'; $table->data[0][1] = html_print_label_input_block(
$table->data[0][1] .= '<div class="w250px inline">'.html_print_select_groups( __('Group'),
false, html_print_select_groups(
'AR', false,
$return_all_group, 'AR',
'id_group', $return_all_group,
$id_group, 'id_group',
'', $id_group,
'', '',
0, '',
true, 0,
false, true,
true, false,
'', true,
(!$is_management_allowed | $disabled) '',
).'</div>'; (!$is_management_allowed | $disabled)
)
$table->data[1][0] = __('Description');
$table->data[1][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true,
'',
(!$is_management_allowed | $disabled)
); );
$table->data[2][0] = __('Priority'); $table->data[1][0] = html_print_label_input_block(
$table->data[2][1] = html_print_select( __('Description'),
get_priorities(), html_print_textarea(
'priority', 'description',
$priority, 10,
'', 30,
0, $description,
0, '',
true, true,
false, '',
false, (!$is_management_allowed | $disabled)
'', )
(!$is_management_allowed | $disabled) );
$table->data[2][0] = html_print_label_input_block(
__('Priority'),
html_print_select(
get_priorities(),
'priority',
$priority,
'',
0,
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
)
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$table->data[3][0] = __('Wizard level');
$wizard_levels = [ $wizard_levels = [
'nowizard' => __('No wizard'), 'nowizard' => __('No wizard'),
'basic' => __('Basic'), 'basic' => __('Basic'),
'advanced' => __('Advanced'), 'advanced' => __('Advanced'),
]; ];
$table->data[3][1] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false); $table->data[2][1] = html_print_label_input_block(
__('Wizard level'),
html_print_select(
$wizard_levels,
'wizard_level',
$wizard_level,
'',
'',
-1,
true,
false,
false
)
);
} else { } else {
$table->data[2][1] .= html_print_input_hidden('wizard_level', $wizard_level, true); $table->data[2][1] .= html_print_input_hidden('wizard_level', $wizard_level, true);
} }
@ -1150,9 +1194,9 @@ if ($step == 2) {
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
// If it's the last step it will redirect to template lists. // If it's the last step it will redirect to template lists.
if ($step >= LAST_STEP) { if ($step >= LAST_STEP) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">'; echo '<form class="max_floating_element_size" method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">';
} else { } else {
echo '<form method="post">'; echo '<form class="max_floating_element_size" method="post">';
} }
html_print_table($table); html_print_table($table);
@ -1168,41 +1212,46 @@ if ($id) {
if (!$disabled) { if (!$disabled) {
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
if ($step >= LAST_STEP) { if ($step >= LAST_STEP) {
html_print_submit_button( $actionButtons = html_print_submit_button(
__('Finish'), __('Finish'),
'finish', 'finish',
false, false,
'class="sub upd"' ['icon' => 'wand'],
true
); );
} else { } else {
html_print_input_hidden('step', ($step + 1)); html_print_input_hidden('step', ($step + 1));
if ($step == 2) { if ($step == 2) {
// Javascript onsubmit to avoid min = 0 and max = 0. // Javascript onsubmit to avoid min = 0 and max = 0.
html_print_submit_button( $actionButtons = html_print_submit_button(
__('Next'), __('Next'),
'next', 'next',
false, false,
'class="sub next" onclick="return check_fields_step2();"' [
'class' => 'submitButton',
'onclick' => 'return check_fields_step2();',
'icon' => 'next',
],
true
); );
} else { } else {
html_print_submit_button( $actionButtons = html_print_submit_button(
__('Next'), __('Next'),
'next', 'next',
false, false,
'class="sub next"' ['icon' => 'next'],
true
); );
} }
} }
} }
html_print_action_buttons($actionButtons, ['type' => 'form_action']);
} }
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
if (is_metaconsole() === true) {
enterprise_hook('close_meta_frame');
}
ui_require_javascript_file('pandora_alerts'); ui_require_javascript_file('pandora_alerts');
ui_include_time_picker(); ui_include_time_picker();
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -32,8 +32,6 @@ global $config;
// Check login and ACLs. // Check login and ACLs.
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) { if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -52,45 +50,42 @@ $search = (int) get_parameter('search_category', 0);
$category_name = (string) get_parameter('category_name', ''); $category_name = (string) get_parameter('category_name', '');
$tab = (string) get_parameter('tab', 'list'); $tab = (string) get_parameter('tab', 'list');
if (is_metaconsole() === true) { $sec = (is_metaconsole() === true) ? 'advanced' : 'galertas';
$buttons = [
'list' => [ $buttons = [
'active' => false, 'list' => [
'text' => '<a href="index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image( 'active' => false,
'images/list.png', 'text' => '<a href="index.php?sec='.$sec.'&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image(
true, 'images/logs@svg.svg',
[ true,
'title' => __('List categories'), [
'class' => 'invert_filter', 'title' => __('List categories'),
] 'class' => 'main_menu_icon invert_filter',
).'</a>', ]
], ).'</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>',
],
];
}
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
// Header. ui_print_standard_header(
if (is_metaconsole() === true) { __('Categories configuration'),
ui_meta_print_header(__('Categories configuration'), __('List'), $buttons); 'images/gm_modules.png',
} else { false,
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons); '',
} true,
$buttons,
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Module categories'),
],
]
);
$is_management_allowed = true; $is_management_allowed = true;
if (is_management_allowed() === false) { if (is_management_allowed() === false) {
@ -152,11 +147,7 @@ $rowPair = true;
$iterator = 0; $iterator = 0;
if (empty($result) === false) { if (empty($result) === false) {
// Prepare pagination.
ui_pagination($total_categories, $url);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
$table->data = []; $table->data = [];
@ -185,14 +176,20 @@ if (empty($result) === false) {
if (is_metaconsole() === true) { 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[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( $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, true,
['title' => 'Edit'] [
'title' => __('Edit'),
'class' => 'main_menu_icon invert_filter',
]
).'</a>&nbsp;&nbsp;'; ).'</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( $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, true,
['title' => 'Delete'] [
'title' => __('Delete'),
'class' => 'main_menu_icon invert_filter',
]
).'</a>'; ).'</a>';
} else { } else {
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
@ -202,17 +199,40 @@ if (empty($result) === false) {
} }
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$table->cellclass[][1] = 'action_buttons'; $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( $tableActionButtonsContent = [];
'images/config.png', $tableActionButtonsContent[] = html_print_anchor(
true, [
['title' => 'Edit'] 'href' => 'index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category='.$category['id'].'&pure='.(int) $config['pure'],
).'</a>'; 'content' => html_print_image(
$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/edit.svg',
'images/cross.png', true,
true, [
['title' => 'Delete'] 'title' => __('Edit'),
).'</a>'; 'class' => 'main_menu_icon invert_filter',
]
),
],
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 invert_filter',
]
),
],
true
);
$data[1] = implode('', $tableActionButtonsContent);
} }
} }
@ -220,7 +240,7 @@ if (empty($result) === false) {
} }
html_print_table($table); 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 { } else {
// No categories available or selected. // No categories available or selected.
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]); ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
@ -228,17 +248,25 @@ if (empty($result) === false) {
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
// Form to add new categories or search categories. // Form to add new categories or search categories.
echo "<div class='w100p right_align'>"; $sec = (is_metaconsole() === true) ? 'advanced' : 'gmodules';
if (is_metaconsole() === true) {
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">'; echo '<form method="post" action="index.php?sec='.$sec.'&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'].'">';
}
html_print_input_hidden('create_category', '1', true); html_print_input_hidden('create_category', '1', true);
html_print_submit_button(__('Create category'), 'create_button', false, 'class="sub next"');
echo '</form>';
echo '</div>';
enterprise_hook('close_meta_frame'); html_print_action_buttons(
html_print_submit_button(
__('Create category'),
'create_button',
false,
[ 'icon' => 'next' ],
true
),
[
'type' => 'form_action',
'right_content' => $tablePagination,
]
);
echo '</form>';
} }

View File

@ -1,21 +1,34 @@
<?php <?php
/**
* Edit Category.
*
* @category Category
* @package Pandora FMS
* @subpackage Community
* @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 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.
check_login(); check_login();
enterprise_hook('open_meta_frame'); // Include functions code.
// Include functions code
require_once $config['homedir'].'/include/functions_categories.php'; require_once $config['homedir'].'/include/functions_categories.php';
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
@ -35,44 +48,55 @@ $update_category = (int) get_parameter('update_category', 0);
$create_category = (int) get_parameter('create_category', 0); $create_category = (int) get_parameter('create_category', 0);
$name_category = (string) get_parameter('name_category', ''); $name_category = (string) get_parameter('name_category', '');
$tab = (string) get_parameter('tab', 'list'); $tab = (string) get_parameter('tab', 'list');
// Main URL.
$mainUrl = 'index.php?sec=gagente&sec2=godmode/category/category';
$sec = (is_metaconsole() === true) ? 'advanced' : 'gmodules';
if (defined('METACONSOLE')) { $buttons = [
$buttons = [ 'list' => [
'list' => [ 'active' => false,
'active' => false, 'text' => html_print_anchor(
'text' => '<a href="index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'].'">'.html_print_image( [
'images/list.png', 'href' => 'index.php?sec='.$sec.'&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure'],
true, 'content' => html_print_image(
[ 'images/logs@svg.svg',
'title' => __('List categories'), true,
'class' => 'invert_filter', [
] 'title' => __('List categories'),
).'</a>', 'class' => 'main_menu_icon invert_filter',
], ]
]; ),
} else { ],
$buttons = [ true
'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[$tab]['active'] = false; $buttons[$tab]['active'] = false;
// Header // Header.
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons); ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
} else { } 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'),
],
]
);
} }
@ -136,7 +160,7 @@ if ($create_category) {
// Form fields are filled here // Form fields are filled here
// Get results when update action is performed. // 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]); $result_category = db_get_row_filter('tcategory', ['id' => $id_category]);
$name_category = $result_category['name']; $name_category = $result_category['name'];
} //end if } //end if
@ -144,76 +168,58 @@ else {
$name_category = ''; $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 $table = new stdClass();
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->id = 'edit_catagory_table';
$table->class = 'databox';
if (!defined('METACONSOLE')) { $table->head = [];
echo '<div align=left class="pandora_form w100p">'; if (is_metaconsole() === true) {
} else { if ($action === 'update') {
echo '<div align=left class="pandora_form w100p">'; $table->head[0] = __('Update category');
} } else if ($action === 'new') {
$table->head[0] = __('Create category');
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>';
} }
} }
echo '<tr>'; $table->data = [];
echo "<td class='bolder'>";
html_print_label(__('Name'), 'name'); $table->data[0][0] = __('Name');
echo '</td>'; $table->data[1][0] = html_print_input_text('name_category', $name_category, '', 50, 255, true);
echo '<td>';
html_print_input_text('name_category', $name_category);
echo '</td>';
echo '</tr>';
echo '</table>'; html_print_table($table);
echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>"; if ($action === 'update') {
echo '<tr>';
echo '<td align=right>';
if ($action == 'update') {
html_print_input_hidden('update_category', 1); html_print_input_hidden('update_category', 1);
html_print_submit_button( $buttonCaption = __('Update');
__('Update'), $buttonName = 'update_button';
'update_button', $buttonIcon = 'update';
false, } else if ($action === 'new') {
'class="sub next"'
);
}
if ($action == 'new') {
html_print_input_hidden('create_category', 1); html_print_input_hidden('create_category', 1);
html_print_submit_button( $buttonCaption = __('Create');
__('Create'), $buttonName = 'create_button';
'create_button', $buttonIcon = 'next';
false,
'class="sub next"'
);
} }
echo '</td>'; $actionButtons = [];
echo '</tr>'; $actionButtons[] = html_print_submit_button(
echo '</table>'; $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>'; echo '</form>';
enterprise_hook('close_meta_frame');

View File

@ -81,9 +81,7 @@ $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->size = []; $table->size = [];
// ~ $table->size[0] = '20%';
$table->size[1] = '10px'; $table->size[1] = '10px';
// ~ $table->size[2] = '20%';
$table->style[0] = 'text-align:center;'; $table->style[0] = 'text-align:center;';
$table->style[2] = 'text-align:center;'; $table->style[2] = 'text-align:center;';
@ -129,19 +127,21 @@ foreach ($fields_available as $key => $available) {
$table->data[0][0] = '<b>'.__('Fields available').'</b>'; $table->data[0][0] = '<b>'.__('Fields available').'</b>';
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px'); $table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
$table->data[1][1] = '<a href="javascript:">'.html_print_image( $table->data[1][1] = '<a href="javascript:">'.html_print_image(
'images/darrowright_green.png', 'images/arrow@svg.svg',
true, true,
[ [
'id' => 'right', 'id' => 'right',
'title' => __('Add fields to select'), 'title' => __('Add fields to select'),
'style' => 'rotate: 180deg; width: 40px',
] ]
).'</a>'; ).'</a>';
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image( $table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
'images/darrowleft_green.png', 'images/arrow@svg.svg',
true, true,
[ [
'id' => 'left', 'id' => 'left',
'title' => __('Delete fields to select'), 'title' => __('Delete fields to select'),
'style' => 'width: 40px',
] ]
).'</a>'; ).'</a>';
@ -184,10 +184,17 @@ $table->data[1][2] .= '</div></div>';
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=fields&amp;pure='.$config['pure'].'">'; echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=fields&amp;pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; html_print_action_buttons(
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"'); html_print_submit_button(
__('Update'),
'upd_button',
false,
[ 'icon' => 'update' ],
true
),
[ 'type' => 'form_action' ]
);
echo '</form>'; echo '</form>';
echo '</div>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -234,7 +241,7 @@ $(document).ready (function () {
} }
}); });
$("#submit-upd_button").click(function () { $("#button-upd_button").click(function () {
$("#fields_selected").find("option[value='0']").remove(); $("#fields_selected").find("option[value='0']").remove();
$('#fields_selected option').map(function() { $('#fields_selected option').map(function() {
$(this).prop('selected', true); $(this).prop('selected', true);

View File

@ -262,33 +262,37 @@ if ($create) {
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '1366px';
// $table->width = '100%';
$table->border = 0; $table->border = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->cellpadding = 0; $table->cellpadding = 0;
$table->class = 'databox filters'; $table->size[0] = '50%';
$table->size[1] = '50%';
$table->class = 'databox filters events-filters-create pdd_10px';
$table->style[0] = 'vertical-align: top;'; $table->style[0] = 'vertical-align: top;';
$table->rowspan = [];
$table->rowspan[3][0] = 2;
$table->valign[1] = 'top'; $table->valign[1] = 'top';
if (is_metaconsole()) {
if ($id) {
$table->head[0] = __('Update Filter');
} else {
$table->head[0] = __('Create Filter');
}
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
$table->style[0] = '';
$table->valign[1] = '';
}
$table->data = []; $table->data = [];
$table->data[0][0] = '<b>'.__('Filter name').'</b>';
$table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true);
$table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); $table->data[0][0] = html_print_label_input_block(
__('Filter name'),
html_print_input_text(
'id_name',
$id_name,
false,
20,
80,
true,
false,
false,
'',
'w100p'
)
);
$returnAllGroup = users_can_manage_group_all(); $returnAllGroup = users_can_manage_group_all();
// If the user can't manage All group but the filter is for All group, the user should see All group in the select. // If the user can't manage All group but the filter is for All group, the user should see All group in the select.
@ -296,115 +300,135 @@ if ($returnAllGroup === false && $id_group_filter == 0) {
$returnAllGroup = true; $returnAllGroup = true;
} }
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups( $table->data[0][1] = html_print_label_input_block(
$config['id_user'], __('Save in group').ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true),
$access, '<div class="w100p">'.html_print_select_groups(
$returnAllGroup, $config['id_user'],
'id_group_filter', $access,
$id_group_filter, $returnAllGroup,
'', 'id_group_filter',
'', $id_group_filter,
-1, '',
true, '',
false, -1,
false, true,
'', false,
false, false,
'', '',
false, false,
false, '',
'id_grupo', false,
$strict_user false,
).'</div>'; 'id_grupo',
$strict_user
).'</div>'
);
$return_all_group = false; $return_all_group = false;
if (users_can_manage_group_all('AR') === true) { if (users_can_manage_group_all('AR') === true) {
$return_all_group = true; $return_all_group = true;
} }
$table->data[2][0] = '<b>'.__('Group').'</b>';
$display_all_group = (users_is_admin() || users_can_manage_group_all('AR')); $display_all_group = (users_is_admin() || users_can_manage_group_all('AR'));
$table->data[2][1] = '<div class="w250px">'.html_print_select_groups( $table->data[2][0] = html_print_label_input_block(
$config['id_user'], __('Group'),
'AR', '<div class="w100p">'.html_print_select_groups(
$return_all_group, $config['id_user'],
'id_group', 'AR',
$id_group, $return_all_group,
'', 'id_group',
'', $id_group,
'', '',
true '',
).'</div>'; '',
true
).'</div>'
);
$types = get_event_types(); $types = get_event_types();
// Expand standard array to add not_normal (not exist in the array, used only for searches) // Expand standard array to add not_normal (not exist in the array, used only for searches)
$types['not_normal'] = __('Not normal'); $types['not_normal'] = __('Not normal');
$table->data[2][1] = html_print_label_input_block(
$table->data[3][0] = '<b>'.__('Event type').'</b>'; __('Event type'),
$table->data[3][1] = html_print_select( '<div class="w100p">'.html_print_select(
$types, $types,
'event_type', 'event_type',
$event_type, $event_type,
'', '',
__('All'), __('All'),
'', '',
true true,
false,
false,
'w100p'
).'</div>'
); );
if (empty($severity) && $severity !== '0') { if (empty($severity) && $severity !== '0') {
$severity = -1; $severity = -1;
} }
$table->data[4][0] = '<b>'.__('Severity').'</b>'; $table->data[3][0] = html_print_label_input_block(
$table->data[4][1] = html_print_select( __('Severity'),
get_priorities(), html_print_select(
'severity[]', get_priorities(),
$severity, 'severity[]',
'', $severity,
__('All'), '',
-1, __('All'),
true, -1,
true, true,
true, true,
'', true,
false, '',
'width: 175px' false,
'width: 100%'
)
); );
$fields = events_get_all_status(); $fields = events_get_all_status();
$table->data[3][1] = html_print_label_input_block(
$table->data[5][0] = '<b>'.__('Event status').'</b>'; __('Event status'),
$table->data[5][1] = html_print_select( html_print_select(
$fields, $fields,
'status', 'status',
$status, $status,
'', '',
'', '',
'', '',
true true,
false,
true,
'',
false,
'width: 100%'
)
); );
$table->data[6][0] = '<b>'.__('Free search').'</b>'; $table->data[4][1] = html_print_label_input_block(
$table->data[6][1] = html_print_input_text( __('Free search'),
'search', '<div class="flex_center">'.html_print_input_text(
$search, 'search',
'', $search,
15, '',
255, 15,
true 255,
); true,
$table->data[6][1] .= ' '.html_print_checkbox_switch( false,
'not_search', false,
$not_search, '',
$not_search, 'w96p mrgn_right_15px'
true, ).' '.html_print_checkbox_switch(
false, 'not_search',
'checked_slide_events(this);', $not_search,
true $not_search,
true,
false,
'checked_slide_events(this);',
true
).'</div>'
); );
$table->data[7][0] = '<b>'.__('Agent search').'</b>';
$params = []; $params = [];
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'text_agent'; $params['input_name'] = 'text_agent';
@ -419,39 +443,48 @@ if (is_metaconsole()) {
$params['hidden_input_idagent_value'] = $id_agent; $params['hidden_input_idagent_value'] = $id_agent;
} }
$table->data[7][1] = ui_print_agent_autocomplete_input($params); $table->data[5][0] = html_print_label_input_block(
__('Agent search'),
'<div class="w100p">'.ui_print_agent_autocomplete_input($params).'</div>'
);
$lpagination[25] = 25; $lpagination[25] = 25;
$lpagination[50] = 50; $lpagination[50] = 50;
$lpagination[100] = 100; $lpagination[100] = 100;
$lpagination[200] = 200; $lpagination[200] = 200;
$lpagination[500] = 500; $lpagination[500] = 500;
$table->data[8][0] = '<b>'.__('Block size for pagination').'</b>'; $table->data[5][1] = html_print_label_input_block(
$table->data[8][1] = html_print_select( __('Block size for pagination'),
$lpagination, '<div class="w100p">'.html_print_select(
'pagination', $lpagination,
$pagination, 'pagination',
'', $pagination,
__('Default'), '',
$config['block_size'], __('Default'),
true $config['block_size'],
true,
false,
true,
'',
false,
'width: 100%'
).'</div>'
); );
$table->data[9][0] = '<b>'.__('Max. hours old').'</b>'; $table->data[6][0] = html_print_label_input_block(
$table->data[9][1] = html_print_input_text( __('Max. hours old'),
'event_view_hr', '<div class="w100p">'.html_print_input_text(
$event_view_hr, 'event_view_hr',
'', $event_view_hr,
5, '',
255, 5,
true 255,
); true,
false,
$table->data[10][0] = '<b>'.__('User ack.').'</b>'; false,
$table->data[10][0] .= ' '; '',
$table->data[10][0] .= ui_print_help_tip( 'w100p'
__('Choose between the users who have validated an event. '), ).'</div>'
true
); );
if ($strict_user) { if ($strict_user) {
@ -464,49 +497,96 @@ if ($strict_user) {
); );
} }
$table->data[10][1] = html_print_select( $table->data[6][1] = html_print_label_input_block(
$users, __('User ack.').' '.ui_print_help_tip(
'id_user_ack', __('Choose between the users who have validated an event. '),
$id_user_ack, true
'', ),
__('Any'), '<div class="w100p">'.html_print_select(
0, $users,
true 'id_user_ack',
$id_user_ack,
'',
__('Any'),
0,
true,
false,
true,
'w100p'
).'</div>'
); );
$table->data[11][0] = '<b>'.__('Owner.').'</b>'; $table->data[7][0] = html_print_label_input_block(
$table->data[11][1] = html_print_select( __('Owner.'),
$users, '<div class="w100p">'.html_print_select(
'owner_user', $users,
$owner_user, 'owner_user',
'', $owner_user,
__('Any'), '',
0, __('Any'),
true 0,
true,
false,
true,
'w100p'
).'</div>'
); );
$repeated_sel = [ $repeated_sel = [
EVENT_GROUP_REP_ALL => __('All events'), EVENT_GROUP_REP_ALL => __('All events'),
EVENT_GROUP_REP_EVENTS => __('Group events'), EVENT_GROUP_REP_EVENTS => __('Group events'),
EVENT_GROUP_REP_AGENTS => __('Group agents'), EVENT_GROUP_REP_AGENTS => __('Group agents'),
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'), EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
]; ];
$table->data[12][0] = '<b>'.__('Repeated').'</b>';
$table->data[12][1] = html_print_select( $table->data[7][1] = html_print_label_input_block(
$repeated_sel, __('Repeated'),
'group_rep', '<div class="w100p">'.html_print_select(
$group_rep, $repeated_sel,
'', 'group_rep',
'', $group_rep,
'', '',
true '',
'',
true,
false,
true,
'w100p'
).'</div>'
); );
$table->data[13][0] = '<b>'.__('Date from').'</b>'; $date_from = html_print_label_input_block(
$table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); __('Date from'),
'<div class="w100p">'.html_print_input_text(
'date_to',
$date_to,
'',
15,
10,
true,
false,
false,
'',
'w100p'
).'</div>'
);
$table->data[14][0] = '<b>'.__('Date to').'</b>'; $date_to = html_print_label_input_block(
$table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); __('Date from'),
'<div class="w100p">'.html_print_input_text(
'date_to',
$date_to,
'',
15,
10,
true,
false,
false,
'',
'w100p'
).'</div>'
);
$table->data[8][0] = '<div class="flex-row">'.$date_from.$date_to.'</div>';
$tag_with = json_decode($tag_with_json_clean, true); $tag_with = json_decode($tag_with_json_clean, true);
if (empty($tag_with)) { if (empty($tag_with)) {
@ -545,176 +625,272 @@ $remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without); $add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp); $remove_without_tag_disabled = empty($tag_without_temp);
$table->colspan[15][0] = '2'; $table->data[8][0] = html_print_label_input_block(
$table->data[15][0] = '<b>'.__('Events with following tags').'</b>'; __('Events with following tags'),
$table->data[16][0] = html_print_select( '<div class="w100p">'.html_print_select(
$tags_select_with, $tags_select_with,
'select_with', 'select_with',
'', '',
'', '',
'', '',
0, 0,
true, true,
false, false,
true, true,
'', 'w100p'
false, ).'</div>'
'width: 220px;'
);
$table->data[16][1] = html_print_button(
__('Add'),
'add_whith',
$add_with_tag_disabled,
'',
'class="add sub"',
true
); );
$table->data[17][0] = html_print_select( $table->data[8][1] = html_print_label_input_block(
$tag_with_temp, '&nbsp;',
'tag_with_temp', '<div class="w100p">'.html_print_button(
[], __('Add'),
'', 'add_whith',
'', $add_with_tag_disabled,
0, '',
true, ['class' => 'submitButton mini'],
true, true
true, ).'</div>'
'',
false,
'width: 220px; height: 50px;'
); );
$table->data[17][0] .= html_print_input_hidden(
$table->data[9][0] = html_print_label_input_block(
'',
'<div class="w100p no-margin-top">'.html_print_select(
$tag_with_temp,
'tag_with_temp',
[],
'',
'',
0,
true,
true,
true,
'',
false,
'width: 100%; height: 50px;'
).'</div>'
).html_print_input_hidden(
'tag_with', 'tag_with',
$tag_with_base64, $tag_with_base64,
true true
); );
$table->data[17][1] = html_print_button(
__('Remove'), $table->data[9][1] = html_print_label_input_block(
'remove_whith', '&nbsp;',
$remove_with_tag_disabled, '<div class="w100p">'.html_print_button(
'', __('Remove'),
'class="delete sub"', 'remove_whith',
true false,
'',
[
'mode' => 'link',
'class' => 'submitButton',
],
true
).'</div>'
); );
$table->colspan[18][0] = '2'; $table->data[10][0] = html_print_label_input_block(
$table->data[18][0] = '<b>'.__('Events without following tags').'</b>'; __('Events without following tags'),
$table->data[19][0] = html_print_select( '<div class="w100p">'.html_print_select(
$tags_select_without, $tags_select_without,
'select_without', 'select_without',
'', '',
'', '',
'', '',
0, 0,
true, true,
false, false,
true, true,
'', 'w100p'
false, ).'</div>'
'width: 220px;'
);
$table->data[19][1] = html_print_button(
__('Add'),
'add_whithout',
$add_without_tag_disabled,
'',
'class="add sub"',
true
); );
$table->data[20][0] = html_print_select( $table->data[10][1] = html_print_label_input_block(
$tag_without_temp, '&nbsp;',
'tag_without_temp', '<div class="w100p">'.html_print_button(
[], __('Add'),
'', 'add_whithout',
'', $add_without_tag_disabled,
0, '',
true, ['class' => 'submitButton mini'],
true, true
true, ).'</div>'
'',
false,
'width: 220px; height: 50px;'
); );
$table->data[20][0] .= html_print_input_hidden(
$table->data[11][0] = html_print_label_input_block(
'',
'<div class="w100p no-margin-top">'.html_print_select(
$tag_without_temp,
'tag_without_temp',
[],
'',
'',
0,
true,
true,
true,
'',
false,
'width: 100%; height: 50px;'
).'</div>'
).html_print_input_hidden(
'tag_without', 'tag_without',
$tag_without_base64, $tag_without_base64,
true true
); );
$table->data[20][1] = html_print_button(
__('Remove'), $table->data[11][1] = html_print_label_input_block(
'remove_whithout', '&nbsp;',
$remove_without_tag_disabled, '<div class="w100p">'.html_print_button(
'', __('Remove'),
'class="delete sub"', 'remove_whithout',
true false,
'',
[
'mode' => 'link',
'class' => 'submitButton',
],
true
).'</div>'
); );
$table->data[21][0] = '<b>'.__('Alert events').'</b>'; $table->data[12][0] = html_print_label_input_block(
$table->data[21][1] = html_print_select( __('Alert events'),
[ '<div class="w100p">'.html_print_select(
'-1' => __('All'), [
'0' => __('Filter alert events'), '-1' => __('All'),
'1' => __('Only alert events'), '0' => __('Filter alert events'),
], '1' => __('Only alert events'),
'filter_only_alert', ],
$filter_only_alert, 'filter_only_alert',
'', $filter_only_alert,
'', '',
'', '',
true '',
true,
false,
true,
'w100p'
).'</div>'
); );
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->data[22][0] = '<b>'.__('Module search').'</b>'; $table->data[12][1] = html_print_label_input_block(
$table->data[22][1] .= html_print_autocomplete_modules( __('Module search'),
'module_search', '<div class="w100p module-search">'.html_print_autocomplete_modules(
$text_module, 'module_search',
false, $text_module,
true, false,
'', true,
[], '',
true, [],
$id_agent_module true,
$id_agent_module
).'</div>'
); );
} else {
$table->data[12][1] = '';
} }
$table->data[23][0] = '<b>'.__('Source').'</b>'; $table->data[13][0] = html_print_label_input_block(
$table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true); __('Source'),
'<div class="w100p">'.html_print_input_text(
$table->data[24][0] = '<b>'.__('Extra ID').'</b>'; 'source',
$table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); $source,
$table->data[25][0] = '<b>'.__('Comment').'</b>';
$table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
$table->data[26][0] = '<b>'.__('Custom data filter type').'</b>';
$table->data[26][1] = html_print_select(
[
'0' => __('Filter custom data by name field'),
'1' => __('Filter custom data by value field'),
],
'custom_data_filter_type',
$custom_data_filter_type,
'',
false,
'',
true
);
$table->data[27][0] = '<b>'.__('Custom data').'</b>';
$table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true);
if (is_metaconsole()) {
$table->data[28][0] = '<b>'.__('Id souce event').'</b>';
$table->data[28][1] = html_print_input_text(
'id_source_event',
$id_source_event,
'', '',
35, 35,
255, 255,
true true,
false,
false,
'',
'w100p'
).'</div>'
);
$table->data[13][1] = html_print_label_input_block(
__('Extra ID'),
'<div class="w100p">'.html_print_input_text(
'id_extra',
$id_extra,
'',
11,
255,
true,
false,
false,
'',
'w100p'
).'</div>'
);
$table->data[14][0] = html_print_label_input_block(
__('Comment'),
'<div class="w100p">'.html_print_input_text(
'user_comment',
$user_comment,
'',
35,
255,
true,
false,
false,
'',
'w100p'
).'</div>'
);
$table->data[14][1] = html_print_label_input_block(
__('Custom data filter type'),
'<div class="w100p">'.html_print_select(
[
'0' => __('Filter custom data by name field'),
'1' => __('Filter custom data by value field'),
],
'custom_data_filter_type',
$custom_data_filter_type,
'',
false,
'',
true,
false,
true,
'w100p'
).'</div>'
);
$table->data[15][0] = html_print_label_input_block(
__('Custom data'),
'<div class="w100p">'.html_print_input_text(
'custom_data',
$custom_data,
'',
35,
255,
true,
false,
false,
'',
'w100p'
).'</div>'
);
if (is_metaconsole()) {
$table->data[15][1] = html_print_label_input_block(
__('Id souce event'),
'<div class="w100p">'.html_print_input_text(
'id_source_event',
$id_source_event,
'',
35,
255,
true,
false,
false,
'',
'w100p'
).'</div>'
); );
} }
@ -750,20 +926,20 @@ if (is_metaconsole() === true) {
} }
} }
$table->data[29][0] = '<b>'.__('Server').'</b>'; $table->data[16][0] = html_print_label_input_block(
$table->data[29][1] = html_print_select( __('Server'),
$servers, '<div class="w100p">'.html_print_select(
'server_id[]', $servers,
$server_id, 'server_id[]',
'', $server_id,
'', '',
0, '',
true, 0,
true, true,
true, true,
'', true,
false, 'w100p'
'height: 60px;' ).'</div>'
); );
} }
@ -775,12 +951,14 @@ echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) { if ($id) {
html_print_input_hidden('update', 1); html_print_input_hidden('update', 1);
html_print_input_hidden('id', $id); html_print_input_hidden('id', $id);
html_print_submit_button(__('Update'), 'crt', false, 'class="sub upd"'); $actionButtons = html_print_submit_button(__('Update'), 'crt', false, ['icon' => 'update'], true);
} else { } else {
html_print_input_hidden('create', 1); html_print_input_hidden('create', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub wand"'); $actionButtons = html_print_submit_button(__('Create'), 'crt', false, ['icon' => 'wand'], true);
} }
html_print_action_buttons($actionButtons, ['type' => 'form_action']);
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';

View File

@ -184,9 +184,9 @@ foreach ($filters as $filter) {
if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EW') if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EW')
|| check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EM') || check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EM')
) { ) {
$table->cellclass[][6] = 'action_buttons'; $table->cellclass[][6] = 'table_action_buttons';
$data[6] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter'].'&offset=0&pure='.$config['pure']."'>".html_print_image( $data[6] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter'].'&offset=0&pure='.$config['pure']."'>".html_print_image(
'images/cross.png', 'images/delete.svg',
true, true,
[ [
'title' => __('Delete'), 'title' => __('Delete'),
@ -198,37 +198,57 @@ foreach ($filters as $filter) {
array_push($table->data, $data); array_push($table->data, $data);
} }
if (isset($data)) { if (isset($data)) {
echo "<form method='post' action='index.php?sec=geventos&sec2=godmode/events/events&amp;pure=".$config['pure']."'>"; echo "<form id='form-delete-filters' method='post' action='index.php?sec=geventos&sec2=godmode/events/events&amp;pure=".$config['pure']."'>";
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
html_print_table($table); html_print_table($table);
if (!is_metaconsole()) { if (is_metaconsole() === true) {
echo "<div class='pdd_b_20px right'>";
} else {
echo "<div class='right'>"; echo "<div class='right'>";
} }
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); if (is_metaconsole() === true) {
echo '</div>'; echo '</div>';
}
echo '</form>'; echo '</form>';
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined filters') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined filters') ]);
} }
if (!defined('METACONSOLE')) {
echo "<div class='pdd_b_20px right w100p'>";
} else {
echo "<div class='right'>";
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&amp;pure='.$config['pure'].'">'; $submitButtons = '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&amp;pure='.$config['pure'].'">';
html_print_submit_button(__('Create filter'), 'crt', false, 'class="sub wand"'); $submitButtons .= html_print_submit_button(
echo '</form>'; __('Create filter'),
echo '</div>'; 'crt',
false,
[
'icon' => 'wand',
'class' => 'mrgn_lft_15px',
],
true
);
$submitButtons .= '</form>';
$submitButtons .= html_print_submit_button(
__('Delete'),
'delete_btn',
false,
[
'icon' => 'delete',
'class' => 'secondary',
'id' => 'delete-event-filters',
],
true
);
html_print_action_buttons(
$submitButtons
);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){ $('[id^=checkbox-delete_multiple]').change(function(){
@ -243,13 +263,17 @@ echo '</div>';
$('[id^=checkbox-all_delete]').change(function(){ $('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) { if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected'); $('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true); $("[id^=checkbox-delete_multiple]").prop("checked", true);
} }
else{ else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected'); $('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false); $("[id^=checkbox-delete_multiple]").prop("checked", false);
} }
}); });
$('#button-delete_btn').click(function (e) {
$('#form-delete-filters').submit();
});
}); });

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Event responses editor view.
*
* @category Events
* @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 // Load global vars.
// ==================================================
// 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.
global $config; global $config;
check_login(); check_login();
@ -66,35 +82,32 @@ if ($event_response_id > 0) {
} }
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->styleTable = 'margin: 10px 10px 10px';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->cellspacing = 0;
if (is_metaconsole()) { $table->cellpadding = 0;
$table->head[0] = __('Edit event responses'); $table->size[0] = '50%';
$table->head_colspan[0] = 5; $table->size[1] = '50%';
$table->headstyle[0] = 'text-align: center';
}
$table->size = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->data = []; $table->data = [];
$data = []; $data = [];
$data[0] = __('Name');
$data[1] = html_print_input_text( $data[0] = html_print_label_input_block(
'name', __('Name'),
$event_response['name'], '<div class="w100p margin-top-10">'.html_print_input_text(
'', 'name',
50, $event_response['name'],
255, '',
true, false,
false, 255,
true true,
false,
true,
'',
'w100p'
).html_print_input_hidden('id_response', $event_response['id'], true).'</div>'
); );
$data[1] .= html_print_input_hidden('id_response', $event_response['id'], true);
$return_all_group = false; $return_all_group = false;
@ -102,32 +115,64 @@ if (users_can_manage_group_all('PM') === true) {
$return_all_group = true; $return_all_group = true;
} }
$data[2] = __('Group');
$data[3] = html_print_select_groups(false, 'PM', $return_all_group, 'id_group', $event_response['id_group'], '', '', '', true); $data[1] = html_print_label_input_block(
__('Group'),
'<div class="w100p margin-top-10">'.html_print_select_groups(
false,
'PM',
$return_all_group,
'id_group',
$event_response['id_group'],
'',
'',
'',
true,
false,
false,
'w100p'
).'</div>'
);
$table->data[0] = $data; $table->data[0] = $data;
$data = []; $data = [];
$table->colspan[1][1] = 3; $table->colspan[1][0] = 2;
$data[0] = __('Description'); $data[0] = html_print_label_input_block(
$data[1] = html_print_textarea( __('Description'),
'description', '<div class="w100p margin-top-10">'.html_print_textarea(
5, 'description',
40, 5,
$event_response['description'], 1,
'class="'.$class_description.'"', $event_response['description'],
true 'class="'.$class_description.' w100p"',
true,
'w100p'
).'</div>'
); );
$table->data[1] = $data; $table->data[1] = $data;
$data = []; $data = [];
$data[0] = __('Location').ui_print_help_tip(__('For Command type Modal Window mode is enforced'), true);
$locations = [ $locations = [
__('Modal window'), __('Modal window'),
__('New window'), __('New window'),
]; ];
$data[1] = html_print_select($locations, 'new_window', $event_response['new_window'], '', '', '', true); $data[0] = html_print_label_input_block(
__('Location').ui_print_help_tip(__('For Command type Modal Window mode is enforced'), true),
'<div class="w100p margin-top-10">'.html_print_select(
$locations,
'new_window',
$event_response['new_window'],
'',
'',
'',
true,
false,
true,
'w100p'
).'</div>'
);
$data[2] = '<span class="size">'.__('Size').'</span>'; $data[1] = '<span class="size">'.__('Size').'</span>';
if ($event_response['modal_width'] == 0) { if ($event_response['modal_width'] == 0) {
$event_response['modal_width'] = 620; $event_response['modal_width'] = 620;
} }
@ -136,40 +181,88 @@ if ($event_response['modal_height'] == 0) {
$event_response['modal_height'] = 500; $event_response['modal_height'] = 500;
} }
$data[3] = '<span class="size">'.__('Width').' (px) </span>'; $data[1] = '<div class="flex flex-space-around">';
$data[3] .= '<span class="size">'.html_print_input_text('modal_width', $event_response['modal_width'], '', 4, 5, true).'</span>'; $data[1] .= html_print_label_input_block(
$data[3] .= '<span class="size">'.__('Height').' (px) </span>'; __('Width').' (px) ',
$data[3] .= '<span class="size">'.html_print_input_text('modal_height', $event_response['modal_height'], '', 4, 5, true).'</span>'; '<div class="w100p margin-top-10">'.html_print_input_text(
'modal_width',
$event_response['modal_width'],
'',
4,
5,
true
).'</div>',
['div_class' => 'mgn_tp_0_imp']
);
$data[1] .= html_print_label_input_block(
__('Height').' (px) ',
'<div class="w100p margin-top-10">'.html_print_input_text(
'modal_height',
$event_response['modal_height'],
'',
4,
5,
true
).'</div>'
);
$data[1] .= '</div>';
$table->data[2] = $data; $table->data[2] = $data;
$data = []; $data = [];
$data[0] = __('Parameters'); $data[0] = html_print_label_input_block(
$data[1] = html_print_input_text( __('Parameters'),
'params', '<div class="w100p margin-top-10">'.html_print_input_text(
$event_response['params'], 'params',
'', $event_response['params'],
50, '',
255, 50,
true 255,
true,
false,
false,
'',
'w100p'
).'</div>'
); );
$types = [ $types = [
'url' => __('URL'), 'url' => __('URL'),
'command' => __('Command'), 'command' => __('Command'),
]; ];
$data[2] = __('Type');
$data[3] = html_print_select($types, 'type', $event_response['type'], '', '', '', true); $data[1] = html_print_label_input_block(
__('Type'),
'<div class="w100p margin-top-10">'.html_print_select(
$types,
'type',
$event_response['type'],
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
).'</div>'
);
$table->data[3] = $data; $table->data[3] = $data;
$data = []; $data = [];
$data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" class="labels invisible">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true); $table->colspan[4][0] = 2;
$data[1] = html_print_textarea( $data[0] = html_print_label_input_block(
'target', __('Command').'<span id="url_label" class="labels invisible">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true),
3, '<div class="w100p margin-top-10">'.html_print_textarea(
1, 'target',
$event_response['target'], 3,
'class="mh_initial"', 1,
true $event_response['target'],
'class="mh_initial w100p"',
true
).'</div>'
); );
$table->data[4] = $data;
$servers_to_exec = []; $servers_to_exec = [];
$servers_to_exec[0] = __('Local console'); $servers_to_exec[0] = __('Local console');
@ -189,45 +282,70 @@ if (enterprise_installed()) {
} }
} }
$data[2] = '<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>';
$data[3] = '<div id="server_to_exec_value" class="invisible" >'.html_print_select($servers_to_exec, 'server_to_exec', $event_response['server_to_exec'], '', '', '', true).'</div>';
$table->data[4] = $data;
$data = []; $data = [];
$data[0] = '<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'); $data[0] = html_print_label_input_block(
$data[1] = '<div id="command_timeout_value" class="invisible">'.html_print_input_text('command_timeout', $event_response['command_timeout'], '', 4, 5, true); '<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>',
'<div id="server_to_exec_value" class="invisible" >'.html_print_select(
$servers_to_exec,
'server_to_exec',
$event_response['server_to_exec'],
'',
'',
'',
true
).'</div>'
);
$data[1] = html_print_label_input_block(
'<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'),
'<div id="command_timeout_value" class="invisible">'.html_print_input_text(
'command_timeout',
$event_response['command_timeout'],
'',
4,
5,
true
)
);
$table->data[5] = $data; $table->data[5] = $data;
$data = []; $data = [];
$data[0] = __('Display command').ui_print_help_tip(__('If enabled the command will be displayed to any user that can execute this event response'), true); $data[0] = html_print_label_input_block(
$data[1] = html_print_checkbox_switch( __('Display command').ui_print_help_tip(__('If enabled the command will be displayed to any user that can execute this event response'), true),
'display_command', '<div class="w100p margin-top-10">'.html_print_checkbox_switch(
1, 'display_command',
$event_response['display_command'], 1,
true $event_response['display_command'],
true
).'</div>'
); );
$table->data[6] = $data; $table->data[6] = $data;
if ($event_response_id == 0) { if ((int) $event_response_id === 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">'; $actionUrl = 'index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'];
html_print_table($table); $buttonCaption = __('Create');
echo '<div class="w100p right_align">'; $buttonName = 'create_response_button';
html_print_submit_button(__('Create'), 'create_response_button', false, ['class' => 'sub next']);
echo '</div>';
echo '</form>';
} else { } else {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">'; $actionUrl = 'index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'];
html_print_table($table); $buttonCaption = __('Update');
echo '<div class="w100p right_align">'; $buttonName = 'update_response_button';
html_print_submit_button(__('Update'), 'update_response_button', false, ['class' => 'sub next']);
echo '</div>';
echo '</form>';
} }
echo '<form method="POST" action="'.$actionUrl.'">';
html_print_table($table);
html_print_action_buttons(
html_print_submit_button(
$buttonCaption,
$buttonName,
false,
['icon' => 'wand'],
true
),
[ 'type' => 'form_action']
);
echo '</form>';
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Event responses list view.
*
* @category Events
* @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 // Load global vars.
// ==================================================
// 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.
global $config; global $config;
require_once $config['homedir'].'/include/functions_event_responses.php'; require_once $config['homedir'].'/include/functions_event_responses.php';
@ -35,8 +51,8 @@ if (empty($event_responses)) {
} }
$table = new stdClass(); $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
$table->styleTable = 'margin: 10px 10px 0';
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
@ -63,36 +79,51 @@ foreach ($event_responses as $response) {
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>'; $data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>';
$data[1] = $response['description']; $data[1] = $response['description'];
$data[2] = ui_print_group_icon($response['id_group'], true); $data[2] = ui_print_group_icon($response['id_group'], true);
$table->cellclass[][3] = 'action_buttons'; $table->cellclass[][3] = 'table_action_buttons';
$data[3] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&action=delete_response&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.html_print_image( $data[3] = html_print_anchor(
'images/cross.png',
true,
[ [
'title' => __('Delete'), 'href' => 'index.php?sec=geventos&sec2=godmode/events/events&section=responses&action=delete_response&id_response='.$response['id'].'&amp;pure='.$config['pure'],
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/delete.svg',
).'</a>'; true,
$data[3] .= '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.html_print_image( [
'images/pencil.png', 'title' => __('Delete'),
true, 'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
$data[3] .= html_print_anchor(
[ [
'title' => __('Edit'), 'href' => 'index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'],
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/edit.svg',
).'</a>'; true,
[
'title' => __('Edit'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
$table->data[] = $data; $table->data[] = $data;
} }
html_print_table($table); html_print_table($table);
echo '<div class="w100p right_align">';
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">';
html_print_submit_button( html_print_action_buttons(
__('Create response'), html_print_submit_button(
'create_response_button', __('Create response'),
false, 'create_response_button',
['class' => 'sub next'] false,
['icon' => 'wand'],
true
),
['type' => 'form_action']
); );
echo '</form>'; echo '</form>';
echo '</div>';

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Event responses view handler.
*
* @category Events
* @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 // Load global vars.
// ==================================================
// 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.
global $config; global $config;
require_once $config['homedir'].'/include/functions_event_responses.php'; require_once $config['homedir'].'/include/functions_event_responses.php';

View File

@ -1,22 +1,37 @@
<?php <?php
/**
* Event configuration.
*
* @category Events
* @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 // Load global vars.
// ==================================================
// 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; global $config;
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM') && ! check_acl($config['id_user'], 0, 'PM')) { if (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM') && ! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit( db_pandora_audit(
@ -35,11 +50,11 @@ if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, '
$buttons['view'] = [ $buttons['view'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'">'.html_print_image( 'text' => '<a href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'">'.html_print_image(
'images/events_list.png', 'images/event.svg',
true, true,
[ [
'title' => __('Event list'), 'title' => __('Event list'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
).'</a>', ).'</a>',
'operation' => true, 'operation' => true,
@ -48,11 +63,11 @@ if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, '
$buttons['filter'] = [ $buttons['filter'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=filter&amp;pure='.$config['pure'].'">'.html_print_image( 'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=filter&amp;pure='.$config['pure'].'">'.html_print_image(
'images/filter_mc.png', 'images/filters@svg.svg',
true, true,
[ [
'title' => __('Filter list'), 'title' => __('Filter list'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
).'</a>', ).'</a>',
]; ];
@ -62,11 +77,11 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$buttons['responses'] = [ $buttons['responses'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=responses&amp;pure='.$config['pure'].'">'.html_print_image( 'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=responses&amp;pure='.$config['pure'].'">'.html_print_image(
'images/event_responses.png', 'images/responses.svg',
true, true,
[ [
'title' => __('Event responses'), 'title' => __('Event responses'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
).'</a>', ).'</a>',
]; ];
@ -74,11 +89,11 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$buttons['fields'] = [ $buttons['fields'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image( 'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image(
'images/custom_columns.png', 'images/edit_columns@svg.svg',
true, true,
[ [
'title' => __('Custom columns'), 'title' => __('Custom columns'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
).'</a>', ).'</a>',
]; ];
@ -110,28 +125,25 @@ switch ($section) {
break; break;
} }
if (is_metaconsole() === false) { ui_print_standard_header(
ui_print_standard_header( $subpage,
$subpage, 'images/gm_events.png',
'images/gm_events.png', false,
false, '',
'', true,
true, (array) $buttons,
(array) $buttons, [
[ [
[ 'link' => '',
'link' => '', 'label' => __('Configuration'),
'label' => __('Configuration'), ],
], [
[ 'link' => '',
'link' => '', 'label' => __('Events'),
'label' => __('Events'), ],
], ]
] );
);
} else {
ui_meta_print_header(__('Manage events').$subpage, '', $buttons);
}
require_once $config['homedir'].'/include/functions_events.php'; require_once $config['homedir'].'/include/functions_events.php';
@ -153,5 +165,3 @@ switch ($section) {
include_once $config['homedir'].'/godmode/events/event_responses.php'; include_once $config['homedir'].'/godmode/events/event_responses.php';
break; break;
} }
enterprise_hook('close_meta_frame');

View File

@ -24,8 +24,29 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
exit; exit;
} }
// Header // Header.
ui_print_page_header(__('Extensions').' &raquo; '.__('Defined extensions'), 'images/extensions.png', false, '', true, ''); ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('Defined extensions'),
],
]
);
if (count($config['extensions']) == 0) { if (count($config['extensions']) == 0) {
$extensions = extensions_get_extension_info(); $extensions = extensions_get_extension_info();
@ -132,7 +153,7 @@ if ($disabled != '') {
$extensions = extensions_get_extension_info(); $extensions = extensions_get_extension_info();
$table = new StdClass; $table = new StdClass;
$table->width = '98%'; $table->width = '100%';
$table->head = []; $table->head = [];
$table->head[] = __('File'); $table->head[] = __('File');
@ -146,7 +167,7 @@ $table->head[] = __('Login Function');
$table->head[] = __('Agent operation tab'); $table->head[] = __('Agent operation tab');
$table->head[] = __('Agent godmode tab'); $table->head[] = __('Agent godmode tab');
$table->head[] = __('Operation'); $table->head[] = __('Operation');
$table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
$table->align = []; $table->align = [];
@ -252,11 +273,42 @@ foreach ($extensions as $file => $extension) {
// Avoid to delete or disabled update_manager // Avoid to delete or disabled update_manager
if ($file != 'update_manager.php') { if ($file != 'update_manager.php') {
$table->cellclass[][10] = 'action_buttons'; $table->cellclass[][10] = 'table_action_buttons';
if (!$extension['enabled']) { if (!$extension['enabled']) {
$data[] = '<a title="'.__('Delete').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file.'" class="mn">'.html_print_image('images/cross.disabled.png', true, ['class' => 'filter_none']).'</a>'.' <a title="'.__('Enable').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file.'" class="mn">'.html_print_image('images/lightbulb_off.png', true, ['class' => 'filter_none']).'</a>'; $data[] = html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file,
'image' => 'images/cross.disabled.png',
'title' => __('Delete'),
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
],
true
).html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file,
'image' => 'images/lightbulb_off.png',
'title' => __('Delete'),
],
true
);
} else { } else {
$data[] = '<a title="'.__('Delete').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file.'" class="mn">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>'.' <a title="'.__('Disable').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&disabled='.$file.'" class="mn">'.html_print_image('images/lightbulb.png', true).'</a>'; $data[] = html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file,
'image' => 'images/delete.svg',
'class' => 'main_menu_icon invert_filter',
'title' => __('Delete'),
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
],
true
).html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&disabled='.$file,
'image' => 'images/lightbulb.png',
'title' => __('Delete'),
],
true
);
} }
} else { } else {
$data[] = ''; $data[] = '';

View File

@ -698,7 +698,7 @@ echo '</form>';
<td><a id="delete_row" href="none"> <td><a id="delete_row" href="none">
<?php <?php
html_print_image( html_print_image(
'images/cross.png', 'images/delete.svg',
false, false,
[ [
'alt' => '', 'alt' => '',
@ -1005,7 +1005,7 @@ function getAgentRow (layerId, agentId, agentAlias) {
var $deleteCol = $("<td />"); var $deleteCol = $("<td />");
var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>"); var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>");
var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/cross.png', false, ['class' => 'invert_filter']); ?> </a>'); var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/delete.svg', false, ['class' => 'invert_filter']); ?> </a>');
$removeBtn.click(function (event) { $removeBtn.click(function (event) {
var $layerRow = $("tr#layer_row_" + layerId); var $layerRow = $("tr#layer_row_" + layerId);
@ -1061,7 +1061,7 @@ function getGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
+ "<i>" + agentAlias + "</i>" + "<i>" + agentAlias + "</i>"
+ ")" + ")"
+ "</span>"); + "</span>");
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?></a>'); var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images/delete.svg', true, ['class' => 'invert_filter']); ?></a>');
$removeBtn.click(function (event) { $removeBtn.click(function (event) {
var $layerRow = $("tr#layer_row_" + layerId); var $layerRow = $("tr#layer_row_" + layerId);
@ -1139,8 +1139,8 @@ function getLayerRow (layerId, layerData) {
var $layerName = $("<span class=\"layer_name\">" + layerData.name + "</span>"); var $layerName = $("<span class=\"layer_name\">" + layerData.name + "</span>");
var $sortUpBtn = $("<a class=\"up_arrow\" href=\"javascript:;\" />"); var $sortUpBtn = $("<a class=\"up_arrow\" href=\"javascript:;\" />");
var $sortDownBtn = $("<a class=\"down_arrow\" href=\"javascript:;\" />"); var $sortDownBtn = $("<a class=\"down_arrow\" href=\"javascript:;\" />");
var $editBtn = $('<a class="edit_layer" href="javascript:;"><?php echo html_print_image('images/config.png', true, ['class' => 'invert_filter']); ?></a>'); var $editBtn = $('<a class="edit_layer" href="javascript:;"><?php echo html_print_image('images/edit.svg', true, ['class' => 'invert_filter']); ?></a>');
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?></a>'); var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images/delete.svg', true, ['class' => 'invert_filter']); ?></a>');
$sortUpBtn.click(moveLayerRowUpOnClick); $sortUpBtn.click(moveLayerRowUpOnClick);
$sortDownBtn.click(moveLayerRowDownOnClick); $sortDownBtn.click(moveLayerRowDownOnClick);

View File

@ -31,8 +31,6 @@ global $config;
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -47,66 +45,54 @@ require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('meta/include/functions_agents_meta.php'); enterprise_include_once('meta/include/functions_agents_meta.php');
// Default values. // Default values.
$icon = '';
$name = '';
$id_parent = 0;
$group_pass = '';
$alerts_disabled = 0;
$custom_id = '';
$propagate = 0;
$skin = 0;
$contact = '';
$other = '';
$description = '';
$max_agents = 0;
$create_group = (bool) get_parameter('create_group'); $create_group = (bool) get_parameter('create_group');
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$acl_parent = true;
if ($id_group) { if ($id_group > 0) {
$group = db_get_row('tgrupo', 'id_grupo', $id_group); $group = db_get_row('tgrupo', 'id_grupo', $id_group);
if ($group) { if ($group !== false) {
$icon = $group['icon'];
$name = $group['nombre']; $name = $group['nombre'];
if (empty($group['icon'])) { $id_parent = $group['parent'];
$icon = false;
} else {
$icon = $group['icon'].'.png';
}
$group_pass = io_safe_output($group['password']); $group_pass = io_safe_output($group['password']);
$alerts_disabled = $group['disabled']; $alerts_disabled = $group['disabled'];
$id_parent = $group['parent'];
$custom_id = $group['custom_id']; $custom_id = $group['custom_id'];
$propagate = $group['propagate']; $propagate = $group['propagate'];
$skin = $group['id_skin']; $skin = $group['id_skin'];
$description = $group['description'];
$contact = $group['contact']; $contact = $group['contact'];
$other = $group['other']; $other = $group['other'];
$description = $group['description'];
$max_agents = $group['max_agents']; $max_agents = $group['max_agents'];
} else { } else {
ui_print_error_message(__('There was a problem loading group')); db_pandora_audit(
echo '</table>'; AUDIT_LOG_SYSTEM,
echo '</div>'; 'There was a problem loading group in configure agent group.'
echo '<div id="both">&nbsp;</div>'; );
echo '</div>'; include 'general/noaccess.php';
echo '<div id="foot">';
include 'general/footer.php';
echo '</div>';
echo '</div>';
exit; exit;
} }
} else {
// Set default values.
$icon = '';
$name = '';
$id_parent = 0;
$group_pass = '';
$alerts_disabled = 0;
$custom_id = '';
$propagate = 0;
$skin = 0;
$contact = '';
$other = '';
$description = '';
$max_agents = 0;
} }
// Header // Header.
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
agents_meta_print_header(); agents_meta_print_header();
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
if ($id_group) { $title_in_header = ($id_group > 0) ? __('Update group') : __('Create group');
$title_in_header = __('Update group');
} else {
$title_in_header = __('Create group');
}
// Header. // Header.
ui_print_standard_header( ui_print_standard_header(
@ -130,55 +116,51 @@ if (is_metaconsole() === true) {
$sec = 'gagente'; $sec = 'gagente';
} }
// Data before table.
$files = list_files('images/', '@groups.svg', 1, 0);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filter-table-adv';
if (defined('METACONSOLE')) { $table->size = [];
if ($id_group) { $table->size[0] = '50%';
$table->head[0] = __('Update Group'); $table->size[1] = '50%';
} else {
$table->head[0] = __('Create Group');
}
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->style[0] = 'font-weight: bold';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
$table->data[1][0] = __('Icon'); $table->data[0][0] = html_print_label_input_block(
$files = list_files('images/groups_small/', 'png', 1, 0); __('Name'),
foreach ($files as $key => $f) { html_print_input_text('name', $name, '', 35, 100, true)
// Remove from the list the non-desired .png files );
if (strpos($f, '.bad.png') !== false || strpos($f, '.default.png') !== false || strpos($f, '.ok.png') !== false || strpos($f, '.warning.png') !== false) {
unset($files[$key]); $input_icon = html_print_select($files, 'icon', $icon, '', 'None', '', true, false, true, '', false, 'width: 100%;');
} $input_icon .= ' <span id="icon_preview" class="mrgn_lft_05em">';
if (empty($icon) === false) {
$input_icon .= html_print_image('images/'.$icon, true);
} }
$table->data[1][1] = html_print_select($files, 'icon', $icon, '', 'None', '', true); $input_icon .= '</span>';
$table->data[1][1] .= ' <span id="icon_preview">';
if ($icon) {
$table->data[1][1] .= html_print_image('images/groups_small/'.$icon, true);
}
$table->data[1][1] .= '</span>'; $table->data[0][1] = html_print_label_input_block(
__('Icon'),
html_print_div(
[
'class' => 'flex-content-left ',
'content' => $input_icon,
],
true
)
);
$table->data[2][0] = __('Parent'); if ($id_group > 0) {
$acl_parent = true;
if ($id_group) {
// The user can access to the parent, but she want to edit the group. // The user can access to the parent, but she want to edit the group.
if (!check_acl($config['id_user'], $id_parent, 'AR')) { if ((bool) check_acl($config['id_user'], $id_parent, 'AR') === false) {
$acl_parent = false; $acl_parent = false;
$table->data[2][1] = __('You have not access to the parent.').html_print_input_hidden('id_parent', $id_parent, true); $input_parent = __('You have not access to the parent.').html_print_input_hidden('id_parent', $id_parent, true);
} else { } else {
$table->data[2][1] = '<div class="w250px inline">'; $input_parent = '<div class="w250px inline">';
$table->data[2][1] .= html_print_select_groups( $input_parent .= html_print_select_groups(
false, false,
'AR', 'AR',
false, false,
@ -196,11 +178,11 @@ if ($id_group) {
false, false,
$id_group $id_group
); );
$table->data[2][1] .= '</div>'; $input_parent .= '</div>';
} }
} else { } else {
$table->data[2][1] = '<div class="w250px inline">'; $input_parent = '<div class="w250px inline">';
$table->data[2][1] .= html_print_input( $input_parent .= html_print_input(
[ [
'type' => 'select_groups', 'type' => 'select_groups',
'name' => 'id_parent', 'name' => 'id_parent',
@ -211,78 +193,111 @@ if ($id_group) {
'nothing_value' => -1, 'nothing_value' => -1,
] ]
); );
$table->data[2][1] .= '</div>'; $input_parent .= '</div>';
} }
if ($acl_parent) { if ($acl_parent === true) {
$table->data[2][1] .= ' <span id="parent_preview">'; $input_parent .= ' <span id="parent_preview" class="mrgn_lft_05em">';
$table->data[2][1] .= html_print_image('images/groups_small/'.( $id_parent != 0 ? groups_get_icon($id_parent) : 'without_group').'.png', true); $input_parent .= html_print_image('images/'.(($id_parent !== 0) ? groups_get_icon($id_parent) : 'unknown@groups.svg'), true);
$table->data[2][1] .= '</span>'; $input_parent .= '</span>';
} }
$i = 3; $table->data[1][0] = html_print_label_input_block(
if ($config['enterprise_installed']) { __('Parent'),
$i = 4; html_print_div(
$table->data[3][0] = __('Group Password'); [
$table->data[3][1] = html_print_input_password('group_pass', $group_pass, '', 16, 255, true); 'class' => 'flex-content-left ',
'content' => $input_parent,
],
true
)
);
if ((bool) $config['enterprise_installed'] === true) {
$table->data[1][1] .= html_print_label_input_block(
__('Group Password'),
html_print_input_password('group_pass', $group_pass, '', 16, 255, true)
);
} }
$table->data[$i][0] = __('Alerts').ui_print_help_tip(__('Enable alert use in this group.'), true); $table->data[2][0] = html_print_label_input_block(
$table->data[$i][1] = html_print_checkbox_switch('alerts_enabled', 1, ! $alerts_disabled, true); __('Alerts').ui_print_help_tip(__('Enable alert use in this group.'), true),
$i++; html_print_checkbox_switch('alerts_enabled', 1, ! $alerts_disabled, true)
);
$table->data[$i][0] = __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true); $table->data[2][1] = html_print_label_input_block(
$table->data[$i][1] = html_print_checkbox_switch('propagate', 1, $propagate, true); __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true),
$i++; html_print_checkbox_switch('propagate', 1, $propagate, true)
);
$table->data[$i][0] = __('Custom ID'); $table->data[3][0] = html_print_label_input_block(
$table->data[$i][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true); __('Custom ID'),
$i++; html_print_input_text('custom_id', $custom_id, '', 16, 255, true)
);
$table->data[$i][0] = __('Description'); $table->data[3][1] = html_print_label_input_block(
$table->data[$i][1] = html_print_input_text('description', $description, '', 60, 255, true); __('Description'),
$i++; html_print_input_text('description', $description, '', 60, 255, true)
);
$table->data[$i][0] = __('Contact').ui_print_help_tip(__('Contact information accessible through the _groupcontact_ macro'), true); $table->data[4][0] = html_print_label_input_block(
$table->data[$i][1] = html_print_textarea('contact', 4, 40, $contact, "class='min-height-0px'", true); __('Contact').ui_print_help_tip(__('Contact information accessible through the _groupcontact_ macro'), true),
$i++; html_print_textarea('contact', 4, 40, $contact, "class='min-height-0px'", true)
);
$table->data[$i][0] = __('Other').ui_print_help_tip(__('Information accessible through the _group_other_ macro'), true); $table->data[4][1] = html_print_label_input_block(
$table->data[$i][1] = html_print_textarea('other', 4, 40, $other, "class='min-height-0px'", true); __('Other').ui_print_help_tip(__('Information accessible through the _group_other_ macro'), true),
$i++; html_print_textarea('other', 4, 40, $other, "class='min-height-0px'", true)
);
// $isFunctionSkins = enterprise_include_once('include/functions_skins.php'); $table->data[5][0] = html_print_label_input_block(
// if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) { __('Max agents allowed').ui_print_help_tip(__('Set the maximum of agents allowed for this group. 0 is unlimited.'), true),
// $table->data[10][0] = __('Skin'); html_print_input_text('max_agents', $max_agents, '', 10, 255, true)
// $table->data[10][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true); );
// }
$table->data[$i][0] = __('Max agents allowed').'&nbsp;'.ui_print_help_tip(__('Set the maximum of agents allowed for this group. 0 is unlimited.'), true);
$table->data[$i][1] = html_print_input_text('max_agents', $max_agents, '', 10, 255, true);
$i++;
if (defined('METACONSOLE')) { $sec = (is_metaconsole() === true) ? 'advanced' : 'gagente';
$sec = 'advanced';
} else {
$sec = 'gagente';
}
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'" >'; echo '<form name="grupo" class="max_floating_element_size" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'" >';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel"'); $buttons = '';
if ($id_group) { if ($id_group) {
html_print_input_hidden('update_group', 1); $buttons .= html_print_input_hidden('update_group', 1, true);
html_print_input_hidden('id_group', $id_group); $buttons .= html_print_input_hidden('id_group', $id_group, true);
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"'); $buttons .= html_print_submit_button(
__('Update'),
'updbutton',
false,
['icon' => 'upd'],
true
);
} else { } else {
html_print_input_hidden('create_group', 1); $buttons .= html_print_input_hidden('create_group', 1);
html_print_submit_button(__('Create'), 'crtbutton', false, 'class="sub wand"'); $buttons .= html_print_submit_button(
__('Create'),
'crtbutton',
false,
['icon' => 'next'],
true
);
} }
echo '</div>'; $buttons .= html_print_button(
echo '</form>'; __('Go back'),
'button_back',
false,
'',
[
'icon' => 'back',
'mode' => 'secondary',
],
true
);
enterprise_hook('close_meta_frame'); html_print_action_buttons(
$buttons
);
echo '</form>';
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
@ -294,7 +309,7 @@ function icon_changed () {
if (data != "") { if (data != "") {
var params = []; var params = [];
params.push("get_image_path=1"); params.push("get_image_path=1");
params.push("img_src=images/groups_small/" + data); params.push("img_src=images/" + data);
params.push("page=include/ajax/skins.ajax"); params.push("page=include/ajax/skins.ajax");
params.push("only_src=1"); params.push("only_src=1");
jQuery.ajax ({ jQuery.ajax ({
@ -330,7 +345,7 @@ function parent_changed () {
} }
var params = []; var params = [];
params.push("get_image_path=1"); params.push("get_image_path=1");
params.push("img_src=images/groups_small/" + data['icon'] + ".png"); params.push("img_src=images/" + data['icon']);
params.push("page=include/ajax/skins.ajax"); params.push("page=include/ajax/skins.ajax");
params.push("only_src=1"); params.push("only_src=1");
jQuery.ajax ({ jQuery.ajax ({

View File

@ -15,8 +15,6 @@ global $config;
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -26,9 +24,26 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
return; return;
} }
if (!is_metaconsole()) { if (is_metaconsole() === false) {
// Header // 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 // Init vars
@ -53,7 +68,7 @@ if ($id_group) {
echo '<div id="both">&nbsp;</div>'; echo '<div id="both">&nbsp;</div>';
echo '</div>'; echo '</div>';
echo '<div id="foot">'; echo '<div id="foot">';
include 'general/footer.php'; // include 'general/footer.php';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
exit; exit;
@ -61,33 +76,52 @@ if ($id_group) {
} }
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->class = 'databox';
$table->class = 'databox filters';
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $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>'; echo '</span>';
if (is_metaconsole()) { if (is_metaconsole() === true) {
echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&offset='.$offset.'">'; $formUrl = 'index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&offset='.$offset;
} else { } else {
echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&offset='.$offset.'">'; $formUrl = 'index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&offset='.$offset;
} }
echo '<form name="grupo" method="POST" action="'.$formUrl.'">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id_group) { if ($id_group) {
html_print_input_hidden('update_group', 1); html_print_input_hidden('update_group', 1);
html_print_input_hidden('id_group', $id_group); html_print_input_hidden('id_group', $id_group);
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"'); $actionButtonTitle = __('Update');
$actionButtonName = 'updbutton';
} else { } else {
$actionButtonTitle = __('Create');
$actionButtonName = 'crtbutton';
html_print_input_hidden('create_group', 1); html_print_input_hidden('create_group', 1);
html_print_submit_button(__('Create'), 'crtbutton', false, 'class="sub wand"');
} }
echo '</div>'; $actionButtons = [];
echo '</form>';
enterprise_hook('close_meta_frame'); $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>';

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -274,8 +274,6 @@ if (is_ajax() === true) {
return; return;
} }
enterprise_hook('open_meta_frame');
$tab = (string) get_parameter('tab', 'groups'); $tab = (string) get_parameter('tab', 'groups');
if ($tab !== 'credbox' if ($tab !== 'credbox'
@ -308,11 +306,11 @@ $url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups'
$buttons['tree'] = [ $buttons['tree'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.$url_tree.'">'.html_print_image( 'text' => '<a href="'.$url_tree.'">'.html_print_image(
'images/gm_massive_operations.png', 'images/snmp-trap@svg.svg',
true, true,
[ [
'title' => __('Tree Group view'), 'title' => __('Tree Group view'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>', ).'</a>',
]; ];
@ -320,11 +318,11 @@ $buttons['tree'] = [
$buttons['groups'] = [ $buttons['groups'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.$url_groups.'">'.html_print_image( 'text' => '<a href="'.$url_groups.'">'.html_print_image(
'images/group.png', 'images/groups@svg.svg',
true, true,
[ [
'title' => __('Group view'), 'title' => __('Group view'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>', ).'</a>',
]; ];
@ -336,7 +334,7 @@ $buttons['credbox'] = [
true, true,
[ [
'title' => __('Credential Store'), 'title' => __('Credential Store'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>', ).'</a>',
]; ];
@ -364,12 +362,6 @@ switch ($tab) {
// Header. // Header.
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
agents_meta_print_header(); agents_meta_print_header();
html_print_div(
[
'class' => 'notify',
'content' => __('Edit or delete groups can cause problems with synchronization'),
]
);
} else { } else {
// Header. // Header.
ui_print_standard_header( ui_print_standard_header(
@ -746,14 +738,7 @@ if ($tab == 'tree') {
* Group tree view. * Group tree view.
*/ */
echo html_print_image( ui_print_spinner(__('Loading'));
'images/spinner.gif',
true,
[
'class' => 'loading_tree',
'style' => 'display: none;',
]
);
echo "<div id='tree-controller-recipient'></div>"; echo "<div id='tree-controller-recipient'></div>";
} else { } else {
/* /*
@ -766,6 +751,8 @@ if ($tab == 'tree') {
$search = (string) get_parameter('search', ''); $search = (string) get_parameter('search', '');
$block_size = $config['block_size']; $block_size = $config['block_size'];
$tablePagination = '';
if (empty($search) === false) { if (empty($search) === false) {
$search_name = 'AND t.nombre LIKE "%'.$search.'%"'; $search_name = 'AND t.nombre LIKE "%'.$search.'%"';
} }
@ -786,23 +773,58 @@ if ($tab == 'tree') {
} }
$form = "<form method='post' action=''>"; $form = "<form method='post' action=''>";
$form .= "<table class='databox filters bolder' width='100%'>"; $form .= "<table class='filter-table-adv' width='100%'>";
$form .= '<tr><td>'.__('Search').'&nbsp;&nbsp;&nbsp;'; $form .= '<tr><td>'.html_print_label_input_block(
$form .= html_print_input_text( __('Search'),
html_print_input_text(
'search', 'search',
$search, $search,
'', '',
30, 30,
30, 30,
true true
); )
$form .= '</td><td style="text-align: right">'; );
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>"; $form .= '</td>';
$form .= '</tr>'; $form .= '</tr>';
$form .= '</table>'; $form .= '</table>';
$buttons = html_print_submit_button(
__('Filter'),
'find',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
);
$form .= html_print_div(
[
'class' => 'action-buttons',
'content' => $buttons,
],
true
);
$form .= '</form>'; $form .= '</form>';
echo $form; ui_toggle(
$form,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
if (is_metaconsole() === true) {
ui_print_info_message(
__('Edit or delete groups can cause problems with synchronization')
);
}
$groups_sql = sprintf( $groups_sql = sprintf(
'SELECT t.*, 'SELECT t.*,
@ -875,7 +897,8 @@ if ($tab == 'tree') {
$table->data = []; $table->data = [];
foreach ($groups as $key => $group) { foreach ($groups as $key => $group) {
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo']; $url_edit = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
$url_tactical = 'index.php?sec=gagente&sec2=godmode/groups/tactical&id_group='.$group['id_grupo'];
if (is_metaconsole()) { if (is_metaconsole()) {
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'].'&tab=groups'; $url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'].'&tab=groups';
} else { } else {
@ -884,14 +907,14 @@ if ($tab == 'tree') {
$table->data[$key][0] = $group['id_grupo']; $table->data[$key][0] = $group['id_grupo'];
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>'; $table->data[$key][1] = '<a href="'.$url_tactical.'">'.$group['nombre'].'</a>';
} else { } else {
$table->data[$key][1] = $group['nombre']; $table->data[$key][1] = $group['nombre'];
} }
if ($group['icon'] != '') { if ($group['icon'] != '') {
$table->data[$key][2] = html_print_image( $table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png', 'images/'.$group['icon'],
true, true,
[ [
'style' => '', 'style' => '',
@ -914,14 +937,14 @@ if ($tab == 'tree') {
$table->data[$key][4] = $group['parent_name']; $table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description']; $table->data[$key][5] = $group['description'];
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$table->cellclass[$key][6] = 'action_buttons'; $table->cellclass[$key][6] = 'table_action_buttons';
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image( $table->data[$key][6] = '<a href="'.$url_edit.'">'.html_print_image(
'images/config.png', 'images/edit.svg',
true, true,
[ [
'alt' => __('Edit'), 'alt' => __('Edit'),
'title' => __('Edit'), 'title' => __('Edit'),
'border' => '0', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>'; ).'</a>';
@ -936,35 +959,26 @@ if ($tab == 'tree') {
} }
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image( $table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
'images/cross.png', 'images/delete.svg',
true, true,
[ [
'alt' => __('Delete'), 'alt' => __('Delete'),
'title' => __('Delete'), 'title' => __('Delete'),
'border' => '0', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>'; ).'</a>';
} }
} }
echo ui_pagination(
$groups_count,
false,
$offset,
$block_size,
true,
'offset',
true
);
html_print_table($table); html_print_table($table);
echo ui_pagination( $tablePagination = ui_pagination(
$groups_count, $groups_count,
false, false,
$offset, $offset,
$block_size, $block_size,
true, true,
'offset', 'offset',
true, false,
'pagination-bottom' 'pagination-bottom'
); );
} else { } else {
@ -977,20 +991,34 @@ if ($tab == 'tree') {
} }
} }
$button_form = '';
if ($is_management_allowed === true if ($is_management_allowed === true
&& (bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) check_acl($config['id_user'], 0, 'PM') === true
) { ) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">'; $button_form = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons w100p">'; $button_form .= html_print_submit_button(
html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"'); __('Create group'),
echo '</div>'; 'crt',
echo '</form>'; false,
['icon' => 'next'],
true
);
$button_form .= '</form>';
} }
html_print_action_buttons(
$button_form,
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
]
);
ui_require_javascript_file('TreeController', 'include/javascript/tree/'); ui_require_javascript_file('TreeController', 'include/javascript/tree/');
enterprise_hook('close_meta_frame');
$tab = 'group_edition'; $tab = 'group_edition';
?> ?>
@ -1007,7 +1035,7 @@ $tab = 'group_edition';
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0) if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
treeController.recipient.empty(); treeController.recipient.empty();
$(".loading_tree").show(); showSpinner();
var parameters = {}; var parameters = {};
parameters['page'] = "include/ajax/tree.ajax"; parameters['page'] = "include/ajax/tree.ajax";
@ -1031,7 +1059,7 @@ $tab = 'group_edition';
data: parameters, data: parameters,
success: function(data) { success: function(data) {
if (data.success) { if (data.success) {
$(".loading_tree").hide(); hideSpinner();
treeController.init({ treeController.init({
recipient: $("div#tree-controller-recipient"), recipient: $("div#tree-controller-recipient"),

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -43,7 +43,7 @@ if (is_ajax() === true) {
$get_group_json = (bool) get_parameter('get_group_json'); $get_group_json = (bool) get_parameter('get_group_json');
$get_group_agents = (bool) get_parameter('get_group_agents'); $get_group_agents = (bool) get_parameter('get_group_agents');
if ($get_group_json) { if ($get_group_json === true) {
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
if (! check_acl($config['id_user'], $id_group, 'AR')) { if (! check_acl($config['id_user'], $id_group, 'AR')) {
@ -66,13 +66,23 @@ if (is_ajax() === true) {
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
// Header. // Header.
ui_print_page_header( ui_print_standard_header(
__('Module groups defined in %s', get_product_name()), __('Module groups list'),
'images/module_group.png', 'images/module_group.png',
false, false,
'', '',
true, true,
'' [],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Module groups'),
],
]
); );
} }
@ -174,7 +184,7 @@ if ($is_management_allowed === true && $delete_group === true) {
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]); $result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
if ($result) { if ((bool) $result === true) {
$result = db_process_sql_update( $result = db_process_sql_update(
'tagente_modulo', 'tagente_modulo',
['id_module_group' => 0], ['id_module_group' => 0],
@ -223,11 +233,11 @@ if ($is_management_allowed === true && $delete_group === true) {
} }
} }
if (! $result) { ui_print_result_message(
ui_print_error_message(__('There was a problem deleting group')); $result,
} else { __('Group successfully deleted'),
ui_print_success_message(__('Group successfully deleted')); __('There was a problem deleting group')
} );
} }
// Prepare pagination. // Prepare pagination.
@ -243,7 +253,6 @@ $sql = 'SELECT *
$groups = db_get_all_rows_sql($sql); $groups = db_get_all_rows_sql($sql);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
if (empty($groups) === false) { if (empty($groups) === false) {
@ -254,6 +263,8 @@ if (empty($groups) === false) {
$table->head[2] = __('Delete'); $table->head[2] = __('Delete');
} }
$table->size[0] = '5%';
$table->align = []; $table->align = [];
$table->align[1] = 'left'; $table->align[1] = 'left';
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
@ -270,10 +281,10 @@ if (empty($groups) === false) {
if ($is_management_allowed === true) { 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'].'&offset='.$offset.'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>'; $data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'&offset='.$offset.'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) { 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&offset='.$offset_delete.'" 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&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
} else { } else {
$table->cellclass[][2] = 'action_buttons'; $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&offset='.$offset_delete.'" 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&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
} }
} else { } else {
$data[1] = '<strong>'; $data[1] = '<strong>';
@ -284,9 +295,8 @@ if (empty($groups) === false) {
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_groups, $url, $offset);
html_print_table($table); 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 { } else {
ui_print_info_message( ui_print_info_message(
[ [
@ -298,13 +308,18 @@ if (empty($groups) === false) {
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">'; echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; html_print_action_buttons(
html_print_submit_button( html_print_submit_button(
__('Create module group'), __('Create module group'),
'crt', 'crt',
false, false,
'class="sub next"' [ 'icon' => 'next' ],
true
),
[
'type' => 'form_action',
'right_content' => $tablePagination,
]
); );
echo '</div>';
echo '</form>'; echo '</form>';
} }

View File

@ -0,0 +1,248 @@
<?php
/**
* Group tactic view.
*
* @category Group Tactic View
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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;
check_login();
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Tactical View Group'
);
include 'general/noaccess.php';
return;
}
$id_group = get_parameter('id_group', '');
if (empty($id_group) === true) {
return;
}
$user_groups_acl = users_get_groups(false, 'AR');
if (in_array(groups_get_name($id_group), $user_groups_acl) === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Tactical View Group'
);
include 'general/noaccess.php';
return;
}
if (is_metaconsole() === false) {
// Header.
ui_print_standard_header(
__(groups_get_name($id_group)),
'images/group.png',
false,
'',
false,
[],
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Tactic group'),
],
]
);
}
ui_require_css_file('tactical_groups');
ui_require_javascript_file('tactical_groups');
$groups = groups_get_children($id_group);
$id_groups = [];
if (count($groups) > 0) {
foreach ($groups as $key => $value) {
$id_groups[] = $value['id_grupo'];
}
} else {
$id_groups[] = $id_group;
}
echo '<div id="tactic_view">';
echo '<table style="width: 100%;">';
echo '<tr>';
echo '<td class="tactical_group_left_column">';
$table_col1 = new stdClass();
$table_col1->class = 'no-class';
$table_col1->data = [];
$table_col1->rowclass[] = '';
$table_col1->headstyle[0] = 'text-align:center;';
$table_col1->width = '100%';
$table_col1->data[0][0] = groups_get_heat_map_agents($id_groups, 450, 100);
$table_col1->data[1][0] = tactical_groups_get_agents_and_monitoring($id_groups);
$distribution_by_so = '<table cellpadding=0 cellspacing=0 class="databox pies graph-distribution-so" width=100%><tr><td style="width:50%;">';
$distribution_by_so .= '<fieldset class="padding-0 databox tactical_set" id="distribution_by_so_graph">';
$distribution_by_so .= '<legend>'.__('Distribution by os').'</legend>';
$distribution_by_so .= html_print_image('images/spinner.gif', true, ['id' => 'spinner_distribution_by_so_graph']);
$distribution_by_so .= '</fieldset>';
$distribution_by_so .= '</td></tr></table>';
$table_col1->data[2][0] = $distribution_by_so;
ui_toggle(
html_print_table($table_col1, true),
__('Monitoring'),
'',
'',
false,
false
);
echo '</td>';
echo '<td class="tactical_group_left_column">';
$table_col2 = new stdClass();
$table_col2->class = 'no-class';
$table_col2->data = [];
$table_col2->rowclass[] = '';
$table_col2->headstyle[0] = 'text-align:center;';
$table_col2->width = '100%';
$table_col2->data[0][0] = tactical_groups_get_stats_alerts($id_groups);
$table_col2->data[1][0] = groups_get_stats_modules_status($id_groups);
$events_by_agents_group = '<table cellpadding=0 cellspacing=0 class="databox pies mrgn_top_15px" width=100%><tr><td style="width:50%;">';
$events_by_agents_group .= '<fieldset class="padding-0 databox tactical_set" id="events_by_agents_group_graph">';
$events_by_agents_group .= '<legend>'.__('Events by agent').'</legend>';
$events_by_agents_group .= html_print_image('images/spinner.gif', true, ['id' => 'spinner_events_by_agents_group_graph']);
$events_by_agents_group .= '</fieldset>';
$events_by_agents_group .= '</td></tr></table>';
$table_col2->data[2][0] = $events_by_agents_group;
ui_toggle(
html_print_table($table_col2, true),
__('Alerts and events'),
'',
'',
false,
false
);
echo '</td>';
echo '<td class="tactical_group_right_column">';
$table_col3 = new stdClass();
$table_col3->class = 'no-class';
$table_col3->data = [];
$table_col3->rowclass[] = '';
$table_col3->headstyle[0] = 'text-align:center;';
$table_col3->width = '100%';
try {
$columns = [
'alias',
'status',
'alerts',
'ultimo_contacto_remoto',
];
$columnNames = [
__('Alias'),
__('Status'),
__('Alerts'),
__('Ultimo contacto remoto'),
];
// Load datatables user interface.
$table_col3->data[3][0] = ui_print_datatable(
[
'id' => 'list_agents_tactical',
'class' => 'info_table',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columnNames,
'return' => true,
'ajax_url' => 'include/ajax/group',
'ajax_data' => [
'method' => 'getAgentsByGroup',
'id_group' => $id_group,
],
'no_sortable_columns' => [-1],
'order' => [
'field' => 'alias',
'direction' => 'asc',
],
]
);
} catch (Exception $e) {
echo $e->getMessage();
}
ui_toggle(
html_print_table($table_col3, true),
__('Agents'),
'',
'',
false,
false
);
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<div id="modal-info-agent"></div>'
?>
<script type="text/javascript">
$(document).ready(function () {
var parameters = {};
parameters["page"] = "include/ajax/group";
parameters["method"] = 'distributionBySoGraph';
parameters["id_group"] = <?php echo $id_group; ?>;
$.ajax({type: "GET",url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",data: parameters,
success: function(data) {
$("#spinner_distribution_by_so_graph").hide();
$("#distribution_by_so_graph").append(data);
}
});
parameters["method"] = 'groupEventsByAgent';
$.ajax({type: "GET",url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",data: parameters,
success: function(data) {
$("#spinner_events_by_agents_group_graph").hide();
$("#events_by_agents_group_graph").append(data);
const canvas = $('#events_by_agents_group_graph canvas')[0];
canvas.addEventListener('click', function(event) {
var middle_canvas = $('#events_by_agents_group_graph canvas').width() / 2;
if(event.layerX < middle_canvas){
window.location.replace("index.php?sec=eventos&sec2=operation/events/events&filter[id_group_filter]=<?php echo $id_group; ?>")
}
});
}
});
});
</script>

View File

@ -148,7 +148,11 @@ $delete = (bool) get_parameter_post('delete');
if ($delete === true) { if ($delete === true) {
$result = process_manage_delete($id_agents); $result = process_manage_delete($id_agents);
$info = '{"Agent":"'.implode(',', $id_agents).'"}'; if (empty($id_agents) === true) {
$info = '{"Agent":"empty"}';
} else {
$info = '{"Agent":"'.implode(',', $id_agents).'"}';
}
if ($result === true) { if ($result === true) {
db_pandora_audit( db_pandora_audit(

View File

@ -61,7 +61,6 @@ if (is_management_allowed() === false) {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
include_once $config['homedir'].'/include/functions_visual_map.php'; include_once $config['homedir'].'/include/functions_visual_map.php';
open_meta_frame();
} }
$edit_users = (int) get_parameter('edit_users'); $edit_users = (int) get_parameter('edit_users');
@ -589,8 +588,6 @@ if (is_metaconsole() === false) {
}); });
</script> </script>
<?php <?php
} else {
close_meta_frame();
} }
?> ?>

View File

@ -216,7 +216,7 @@ if ($option == '') {
$alertstab = [ $alertstab = [
'text' => '<a href="'.$url.'&tab=massive_alerts">'.html_print_image( 'text' => '<a href="'.$url.'&tab=massive_alerts">'.html_print_image(
'images/bell.png', 'images/alert@svg.svg',
true, true,
[ [
'title' => __('Alerts operations'), 'title' => __('Alerts operations'),
@ -228,7 +228,7 @@ $alertstab = [
$userstab = [ $userstab = [
'text' => '<a href="'.$url.'&tab=massive_users">'.html_print_image( 'text' => '<a href="'.$url.'&tab=massive_users">'.html_print_image(
'images/user.png', 'images/user.svg',
true, true,
[ [
'title' => __('Users operations'), 'title' => __('Users operations'),
@ -240,7 +240,7 @@ $userstab = [
$agentstab = [ $agentstab = [
'text' => '<a href="'.$url.'&tab=massive_agents">'.html_print_image( 'text' => '<a href="'.$url.'&tab=massive_agents">'.html_print_image(
'images/agent.png', 'images/agents@svg.svg',
true, true,
[ [
'title' => __('Agents operations'), 'title' => __('Agents operations'),
@ -252,7 +252,7 @@ $agentstab = [
$modulestab = [ $modulestab = [
'text' => '<a href="'.$url.'&tab=massive_modules">'.html_print_image( 'text' => '<a href="'.$url.'&tab=massive_modules">'.html_print_image(
'images/module.png', 'images/modules@svg.svg',
true, true,
[ [
'title' => __('Modules operations'), 'title' => __('Modules operations'),
@ -264,7 +264,7 @@ $modulestab = [
$pluginstab = [ $pluginstab = [
'text' => '<a href="'.$url.'&tab=massive_plugins">'.html_print_image( 'text' => '<a href="'.$url.'&tab=massive_plugins">'.html_print_image(
'images/plugin.png', 'images/plugins@svg.svg',
true, true,
[ [
'title' => __('Plugins operations'), 'title' => __('Plugins operations'),

View File

@ -33,10 +33,11 @@ require_once 'include/functions_menu.php';
check_login(); check_login();
$access_console_node = !is_reporting_console_node(); $access_console_node = is_reporting_console_node() === false;
$menu_godmode = []; $menu_godmode = [];
$menu_godmode['class'] = 'godmode'; $menu_godmode['class'] = 'godmode';
$menuGodmode = [];
if ($access_console_node === true) { if ($access_console_node === true) {
enterprise_include('godmode/menu.php'); enterprise_include('godmode/menu.php');
} }
@ -49,7 +50,7 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
) { ) {
$sub = []; $sub = [];
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Start'); $sub['godmode/servers/discovery&wiz=main']['text'] = __('Start');
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery'; $sub['godmode/servers/discovery&wiz=main']['id'] = 'discovery';
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list'); $sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist'; $sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
@ -71,6 +72,8 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices'); $sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd'; $sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
$sub['godmode/servers/discovery&wiz=hd']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=hd']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2; $sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
} }
@ -92,36 +95,36 @@ if ($access_console_node === true) {
$sub = []; $sub = [];
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'AD') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'AD') === true) {
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents'); $sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
$sub['godmode/agentes/modificar_agente']['id'] = 'Manage agents'; $sub['godmode/agentes/modificar_agente']['id'] = 'Manage_agents';
$sub['godmode/agentes/modificar_agente']['subsecs'] = ['godmode/agentes/configurar_agente']; $sub['godmode/agentes/modificar_agente']['subsecs'] = ['godmode/agentes/configurar_agente'];
} }
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['godmode/agentes/fields_manager']['text'] = __('Custom fields'); $sub['godmode/agentes/fields_manager']['text'] = __('Custom fields');
$sub['godmode/agentes/fields_manager']['id'] = 'Custom fields'; $sub['godmode/agentes/fields_manager']['id'] = 'custom_fields';
$sub['godmode/modules/manage_nc_groups']['text'] = __('Component groups'); $sub['godmode/modules/manage_nc_groups']['text'] = __('Component groups');
$sub['godmode/modules/manage_nc_groups']['id'] = 'Component groups'; $sub['godmode/modules/manage_nc_groups']['id'] = 'component_groups';
// Category. // Category.
$sub['godmode/category/category']['text'] = __('Module categories'); $sub['godmode/category/category']['text'] = __('Module categories');
$sub['godmode/category/category']['id'] = 'Module categories'; $sub['godmode/category/category']['id'] = 'module_categories';
$sub['godmode/category/category']['subsecs'] = 'godmode/category/edit_category'; $sub['godmode/category/category']['subsecs'] = 'godmode/category/edit_category';
$sub['godmode/modules/module_list']['text'] = __('Module types'); $sub['godmode/modules/module_list']['text'] = __('Module types');
$sub['godmode/modules/module_list']['id'] = 'Module types'; $sub['godmode/modules/module_list']['id'] = 'module_types';
$sub['godmode/groups/modu_group_list']['text'] = __('Module groups'); $sub['godmode/groups/modu_group_list']['text'] = __('Module groups');
$sub['godmode/groups/modu_group_list']['id'] = 'Module groups'; $sub['godmode/groups/modu_group_list']['id'] = 'module_groups';
$sub['godmode/setup/os']['text'] = __('Operating systems'); $sub['godmode/setup/os']['text'] = __('Operating systems');
$sub['godmode/setup/os']['id'] = 'Edit OS'; $sub['godmode/setup/os']['id'] = 'edit_OS';
} }
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
// Netflow. // Netflow.
if ((bool) $config['activate_netflow'] === true) { if ((bool) $config['activate_netflow'] === true) {
$sub['godmode/netflow/nf_edit']['text'] = __('Netflow filters'); $sub['godmode/netflow/nf_edit']['text'] = __('Netflow filters');
$sub['godmode/netflow/nf_edit']['id'] = 'Netflow filters'; $sub['godmode/netflow/nf_edit']['id'] = 'netflow_filters';
} }
} }
@ -135,13 +138,13 @@ if ($access_console_node === true) {
$sub = []; $sub = [];
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups'); $sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups'; $sub['godmode/groups/group_list']['id'] = 'manage_agents_groups';
} }
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
// Tag. // Tag.
$sub['godmode/tag/tag']['text'] = __('Module tags'); $sub['godmode/tag/tag']['text'] = __('Module tags');
$sub['godmode/tag/tag']['id'] = 'Module tags'; $sub['godmode/tag/tag']['id'] = 'module_tags';
$sub['godmode/tag/tag']['subsecs'] = 'godmode/tag/edit_tag'; $sub['godmode/tag/tag']['subsecs'] = 'godmode/tag/edit_tag';
enterprise_hook('enterprise_acl_submenu'); enterprise_hook('enterprise_acl_submenu');
@ -149,12 +152,12 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) { if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub['godmode/users/user_list']['text'] = __('Users management'); $sub['godmode/users/user_list']['text'] = __('Users management');
$sub['godmode/users/user_list']['id'] = 'Users management'; $sub['godmode/users/user_list']['id'] = 'Users_management';
} }
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['godmode/users/profile_list']['text'] = __('Profile management'); $sub['godmode/users/profile_list']['text'] = __('Profile management');
$sub['godmode/users/profile_list']['id'] = 'Profile management'; $sub['godmode/users/profile_list']['id'] = 'Profile_management';
} }
if (empty($sub) === false) { if (empty($sub) === false) {
@ -172,17 +175,17 @@ if ($access_console_node === true) {
$sub['templates']['subtype'] = 'nolink'; $sub['templates']['subtype'] = 'nolink';
$sub2 = []; $sub2 = [];
$sub2['godmode/modules/manage_module_templates']['text'] = __('Module templates'); $sub2['godmode/modules/manage_module_templates']['text'] = __('Module templates');
$sub2['godmode/modules/manage_module_templates']['id'] = 'Module templates'; $sub2['godmode/modules/manage_module_templates']['id'] = 'module_templates';
$sub2['godmode/modules/private_enterprise_numbers']['text'] = __('Private Enterprise Numbers'); $sub2['godmode/modules/private_enterprise_numbers']['text'] = __('Private Enterprise Numbers');
$sub2['godmode/modules/private_enterprise_numbers']['id'] = 'Private Enterprise Numbers'; $sub2['godmode/modules/private_enterprise_numbers']['id'] = 'private_Enterprise_Numbers';
$sub2['enterprise/godmode/modules/local_components']['text'] = __('Local components'); $sub2['enterprise/godmode/modules/local_components']['text'] = __('Local components');
$sub2['enterprise/godmode/modules/local_components']['id'] = 'Local components'; $sub2['enterprise/godmode/modules/local_components']['id'] = 'local_components';
$sub2['godmode/modules/manage_network_components']['text'] = __('Remote components'); $sub2['godmode/modules/manage_network_components']['text'] = __('Remote components');
$sub2['godmode/modules/manage_network_components']['id'] = 'Network components'; $sub2['godmode/modules/manage_network_components']['id'] = 'network_components';
$sub['templates']['sub2'] = $sub2; $sub['templates']['sub2'] = $sub2;
$sub['godmode/modules/manage_inventory_modules']['text'] = __('Inventory modules'); $sub['godmode/modules/manage_inventory_modules']['text'] = __('Inventory modules');
$sub['godmode/modules/manage_inventory_modules']['id'] = 'Inventory modules'; $sub['godmode/modules/manage_inventory_modules']['id'] = 'Inventory_modules';
enterprise_hook('autoconfiguration_menu'); enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu'); enterprise_hook('agent_repository_menu');
@ -199,7 +202,7 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['gmassive']['text'] = __('Bulk operations'); $sub['gmassive']['text'] = __('Bulk operations');
$sub['gmassive']['id'] = 'Bulk operations'; $sub['gmassive']['id'] = 'Bulk_operations';
$sub['gmassive']['type'] = 'direct'; $sub['gmassive']['type'] = 'direct';
$sub['gmassive']['subtype'] = 'nolink'; $sub['gmassive']['subtype'] = 'nolink';
$sub2 = []; $sub2 = [];
@ -221,7 +224,7 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'UM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store'); $sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store');
$sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential store'; $sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential_store';
} }
// Manage events. // Manage events.
@ -229,14 +232,14 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'EW') === true || (bool) check_acl($config['id_user'], 0, 'EM') === true) { if ((bool) check_acl($config['id_user'], 0, 'EW') === true || (bool) check_acl($config['id_user'], 0, 'EM') === true) {
// Custom event fields. // Custom event fields.
$sub2['godmode/events/events&section=filter']['text'] = __('Event filters'); $sub2['godmode/events/events&section=filter']['text'] = __('Event filters');
$sub2['godmode/events/events&section=filter']['id'] = 'Event filters'; $sub2['godmode/events/events&section=filter']['id'] = 'event_filters';
} }
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub2['godmode/events/events&section=fields']['text'] = __('Custom columns'); $sub2['godmode/events/events&section=fields']['text'] = __('Custom columns');
$sub2['godmode/events/events&section=fields']['id'] = 'Custom events'; $sub2['godmode/events/events&section=fields']['id'] = 'Custom_events';
$sub2['godmode/events/events&section=responses']['text'] = __('Event responses'); $sub2['godmode/events/events&section=responses']['text'] = __('Event responses');
$sub2['godmode/events/events&section=responses']['id'] = 'Event responses'; $sub2['godmode/events/events&section=responses']['id'] = 'Event_responses';
} }
if (empty($sub2) === false) { if (empty($sub2) === false) {
@ -265,12 +268,12 @@ if ($access_console_node === true) {
$sub = []; $sub = [];
$sub['godmode/alerts/alert_list']['text'] = __('List of Alerts'); $sub['godmode/alerts/alert_list']['text'] = __('List of Alerts');
$sub['godmode/alerts/alert_list']['id'] = 'List of Alerts'; $sub['godmode/alerts/alert_list']['id'] = 'List_of_Alerts';
$sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view']; $sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view'];
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$sub['godmode/alerts/alert_templates']['text'] = __('Templates'); $sub['godmode/alerts/alert_templates']['text'] = __('Templates');
$sub['godmode/alerts/alert_templates']['id'] = 'Templates'; $sub['godmode/alerts/alert_templates']['id'] = 'templates';
$sub['godmode/alerts/alert_templates']['pages'] = ['godmode/alerts/configure_alert_template']; $sub['godmode/alerts/alert_templates']['pages'] = ['godmode/alerts/configure_alert_template'];
$sub['godmode/alerts/alert_actions']['text'] = __('Actions'); $sub['godmode/alerts/alert_actions']['text'] = __('Actions');
@ -280,12 +283,12 @@ if ($access_console_node === true) {
$sub['godmode/alerts/alert_commands']['id'] = 'Commands'; $sub['godmode/alerts/alert_commands']['id'] = 'Commands';
$sub['godmode/alerts/alert_commands']['pages'] = ['godmode/alerts/configure_alert_command']; $sub['godmode/alerts/alert_commands']['pages'] = ['godmode/alerts/configure_alert_command'];
$sub['godmode/alerts/alert_special_days']['text'] = __('Special days list'); $sub['godmode/alerts/alert_special_days']['text'] = __('Special days list');
$sub['godmode/alerts/alert_special_days']['id'] = __('Special days list'); $sub['godmode/alerts/alert_special_days']['id'] = 'Special_days_list';
$sub['godmode/alerts/alert_special_days']['pages'] = ['godmode/alerts/configure_alert_special_days']; $sub['godmode/alerts/alert_special_days']['pages'] = ['godmode/alerts/configure_alert_special_days'];
enterprise_hook('eventalerts_submenu'); enterprise_hook('eventalerts_submenu');
$sub['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts'); $sub['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
$sub['godmode/snmpconsole/snmp_alert']['id'] = 'SNMP alerts'; $sub['godmode/snmpconsole/snmp_alert']['id'] = 'SNMP_alerts';
enterprise_hook('alert_inventory_submenu'); enterprise_hook('alert_inventory_submenu');
} }
@ -302,7 +305,7 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['godmode/servers/modificar_server']['text'] = __('Manage servers'); $sub['godmode/servers/modificar_server']['text'] = __('Manage servers');
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers'; $sub['godmode/servers/modificar_server']['id'] = 'Manage_servers';
} }
// This subtabs are only for Pandora Admin. // This subtabs are only for Pandora Admin.
@ -339,7 +342,7 @@ if ($access_console_node === true) {
$sub2 = []; $sub2 = [];
$sub2['godmode/setup/setup&section=general']['text'] = __('General Setup'); $sub2['godmode/setup/setup&section=general']['text'] = __('General Setup');
$sub2['godmode/setup/setup&section=general']['id'] = 'General Setup'; $sub2['godmode/setup/setup&section=general']['id'] = 'general_Setup';
$sub2['godmode/setup/setup&section=general']['refr'] = 0; $sub2['godmode/setup/setup&section=general']['refr'] = 0;
enterprise_hook('password_submenu'); enterprise_hook('password_submenu');
@ -380,13 +383,16 @@ if ($access_console_node === true) {
$sub2['godmode/setup/setup&section=external_tools']['text'] = __('External Tools'); $sub2['godmode/setup/setup&section=external_tools']['text'] = __('External Tools');
$sub2['godmode/setup/setup&section=external_tools']['refr'] = 0; $sub2['godmode/setup/setup&section=external_tools']['refr'] = 0;
$sub2['godmode/setup/setup&section=welcome_tips']['text'] = __('Welcome Tips');
$sub2['godmode/setup/setup&section=welcome_tips']['refr'] = 0;
if ((bool) $config['activate_gis'] === true) { if ((bool) $config['activate_gis'] === true) {
$sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS'); $sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS');
} }
$sub['general']['sub2'] = $sub2; $sub['general']['sub2'] = $sub2;
$sub['godmode/setup/license']['text'] = __('License'); $sub['godmode/setup/license']['text'] = __('License');
$sub['godmode/setup/license']['id'] = 'License'; $sub['godmode/setup/license']['id'] = 'license';
enterprise_hook('skins_submenu'); enterprise_hook('skins_submenu');
@ -406,28 +412,28 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
if ($access_console_node === true) { if ($access_console_node === true) {
// Audit //meter en extensiones. // Audit //meter en extensiones.
$sub['godmode/audit_log']['text'] = __('System audit log'); $sub['godmode/audit_log']['text'] = __('System audit log');
$sub['godmode/audit_log']['id'] = 'System audit log'; $sub['godmode/audit_log']['id'] = 'system_audit_log';
$sub['godmode/setup/links']['text'] = __('Links'); $sub['godmode/setup/links']['text'] = __('Links');
$sub['godmode/setup/links']['id'] = 'Links'; $sub['godmode/setup/links']['id'] = 'links';
$sub['tools/diagnostics']['text'] = __('Diagnostic info'); $sub['tools/diagnostics']['text'] = __('Diagnostic info');
$sub['tools/diagnostics']['id'] = 'Diagnostic info'; $sub['tools/diagnostics']['id'] = 'diagnostic_info';
enterprise_hook('omnishell'); enterprise_hook('omnishell');
enterprise_hook('ipam_submenu'); enterprise_hook('ipam_submenu');
$sub['godmode/setup/news']['text'] = __('Site news'); $sub['godmode/setup/news']['text'] = __('Site news');
$sub['godmode/setup/news']['id'] = 'Site news'; $sub['godmode/setup/news']['id'] = 'site_news';
} }
$sub['godmode/setup/file_manager']['text'] = __('File manager'); $sub['godmode/setup/file_manager']['text'] = __('File manager');
$sub['godmode/setup/file_manager']['id'] = 'File manager'; $sub['godmode/setup/file_manager']['id'] = 'file_manager';
if ($access_console_node === true) { if ($access_console_node === true) {
if (is_user_admin($config['id_user']) === true) { if (is_user_admin($config['id_user']) === true) {
$sub['extensions/db_status']['text'] = __('DB Schema Check'); $sub['extensions/db_status']['text'] = __('DB Schema Check');
$sub['extensions/db_status']['id'] = 'DB Schema Check'; $sub['extensions/db_status']['id'] = 'DB_Schema_Check';
$sub['extensions/db_status']['sec'] = 'gextensions'; $sub['extensions/db_status']['sec'] = 'gextensions';
$sub['extensions/dbmanager']['text'] = __('DB Interface'); $sub['extensions/dbmanager']['text'] = __('DB Interface');
$sub['extensions/dbmanager']['id'] = 'DB Interface'; $sub['extensions/dbmanager']['id'] = 'DB_Interface';
$sub['extensions/dbmanager']['sec'] = 'gextensions'; $sub['extensions/dbmanager']['sec'] = 'gextensions';
enterprise_hook('dbBackupManager'); enterprise_hook('dbBackupManager');
enterprise_hook('elasticsearch_interface_menu'); enterprise_hook('elasticsearch_interface_menu');
@ -469,7 +475,7 @@ if ($access_console_node === true) {
// Check if was displayed inside other menu. // Check if was displayed inside other menu.
if (empty($extension['godmode_menu']['fatherId']) === true) { if (empty($extension['godmode_menu']['fatherId']) === true) {
$sub2[$extmenu['sec2']]['text'] = __($extmenu['name']); $sub2[$extmenu['sec2']]['text'] = __($extmenu['name']);
$sub2[$extmenu['sec2']]['id'] = $extmenu['name']; $sub2[$extmenu['sec2']]['id'] = str_replace(' ', '_', $extmenu['name']);
$sub2[$extmenu['sec2']]['refr'] = 0; $sub2[$extmenu['sec2']]['refr'] = 0;
} else { } else {
if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) { if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) {
@ -477,7 +483,7 @@ if ($access_console_node === true) {
if (array_key_exists('subfatherId', $extmenu) === true) { if (array_key_exists('subfatherId', $extmenu) === true) {
if (strlen($extmenu['subfatherId']) > 0) { if (strlen($extmenu['subfatherId']) > 0) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']); $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = str_replace(' ', '_', $extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['icon'] = $extmenu['icon']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['sec'] = 'extensions'; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['sec'] = 'extensions';
@ -486,7 +492,7 @@ if ($access_console_node === true) {
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true; $menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
} else { } else {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']); $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = $extmenu['name']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = str_replace(' ', '_', $extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
@ -496,7 +502,7 @@ if ($access_console_node === true) {
} }
} else { } else {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']); $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = $extmenu['name']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = str_replace(' ', '_', $extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'gextensions'; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'gextensions';
@ -511,13 +517,13 @@ if ($access_console_node === true) {
// Complete the submenu. // Complete the submenu.
$extension_view = []; $extension_view = [];
$extension_view['godmode/extensions']['id'] = 'Extension manager view'; $extension_view['godmode/extensions']['id'] = 'extension_manager_view';
$extension_view['godmode/extensions']['text'] = __('Extension manager view'); $extension_view['godmode/extensions']['text'] = __('Extension manager view');
$extension_submenu = array_merge($extension_view, $sub2); $extension_submenu = array_merge($extension_view, $sub2);
$sub['godmode/extensions']['sub2'] = $extension_submenu; $sub['godmode/extensions']['sub2'] = $extension_submenu;
$sub['godmode/extensions']['text'] = __('Extension manager'); $sub['godmode/extensions']['text'] = __('Extension manager');
$sub['godmode/extensions']['id'] = 'Extension manager'; $sub['godmode/extensions']['id'] = 'extension_manager';
$sub['godmode/extensions']['type'] = 'direct'; $sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink'; $sub['godmode/extensions']['subtype'] = 'nolink';

View File

@ -45,18 +45,18 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
if (check_acl($config['id_user'], 0, 'PM') && enterprise_installed()) { if (check_acl($config['id_user'], 0, 'PM') && enterprise_installed()) {
$buttons['setup'] = [ $buttons['setup'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=general&sec2=godmode/setup/setup&amp;section=module_library">'.html_print_image('images/gm_setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).'</a>', 'text' => '<a href="index.php?sec=general&sec2=godmode/setup/setup&amp;section=module_library">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Setup'), 'class' => 'main_menu_icon invert_filter']).'</a>',
]; ];
} }
$buttons['categories'] = [ $buttons['categories'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gmodule_library&sec2=godmode/module_library/module_library_view&tab=categories">'.html_print_image('images/list.png', true, ['title' => __('Categories'), 'class' => 'invert_filter']).'</a>', 'text' => '<a href="index.php?sec=gmodule_library&sec2=godmode/module_library/module_library_view&tab=categories">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Categories'), 'class' => 'main_menu_icon invert_filter']).'</a>',
]; ];
$buttons['view'] = [ $buttons['view'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gmodule_library&sec2=godmode/module_library/module_library_view">'.html_print_image('images/eye_show.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'</a>', 'text' => '<a href="index.php?sec=gmodule_library&sec2=godmode/module_library/module_library_view">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('View'), 'class' => 'main_menu_icon invert_filter']).'</a>',
]; ];

View File

@ -33,7 +33,6 @@ $management_allowed = is_management_allowed();
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$sec = 'advanced'; $sec = 'advanced';
enterprise_include_once('meta/include/functions_components_meta.php'); enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header(); components_meta_print_header();
if ($management_allowed === false) { if ($management_allowed === false) {
@ -41,12 +40,24 @@ if (is_metaconsole() === true) {
} }
} else { } else {
$sec = 'gmodules'; $sec = 'gmodules';
ui_print_page_header(
__('Module management').' &raquo; '.__('Inventory modules'), ui_print_standard_header(
'images/page_white_text.png', __('Inventory modules'),
'images/hardware-software-component@svg.svg',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Configuration'),
],
[
'link' => '',
'label' => __('Inventory modules'),
],
]
); );
if ($management_allowed === false) { if ($management_allowed === false) {
@ -266,7 +277,7 @@ if ($create_module_inventory === true) {
$total_modules = db_get_sql('SELECT COUNT(*) FROM tmodule_inventory'); $total_modules = db_get_sql('SELECT COUNT(*) FROM tmodule_inventory');
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->styleTable = 'margin: 10px 10px 0; width: -webkit-fill-available; width: -moz-available';
$table->class = 'info_table'; $table->class = 'info_table';
$table->size = []; $table->size = [];
$table->size[0] = '140px'; $table->size[0] = '140px';
@ -282,6 +293,7 @@ $table->head[3] = __('Interpreter');
if ($management_allowed === true) { if ($management_allowed === true) {
$table->head[4] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); $table->head[4] = __('Action').html_print_checkbox('all_delete', 0, false, true, false);
$table->size[4] = '80px';
} }
$result = inventory_get_modules_list($offset); $result = inventory_get_modules_list($offset);
@ -302,9 +314,15 @@ if ($result === false) {
$data[1] = $row['description']; $data[1] = $row['description'];
if ($row['os_name'] == null) { if ($row['os_name'] == null) {
$data[2] = html_print_image('images/agent.png', true, ['border' => '0', 'alt' => __('Agent'), 'title' => __('Agent'), 'height' => '18', 'class' => 'invert_filter']); $data[2] = html_print_image('images/agents@svg.svg', true, ['border' => '0', 'alt' => __('Agent'), 'title' => __('Agent'), 'height' => '18', 'class' => 'invert_filter main_menu_icon']);
} else { } else {
$data[2] = ui_print_os_icon($row['id_os'], false, true); $data[2] = html_print_div(
[
'class' => 'invert_filter main_menu_icon',
'content' => ui_print_os_icon($row['id_os'], false, true),
],
true
);
} }
if ($row['interpreter'] == '') { if ($row['interpreter'] == '') {
@ -315,45 +333,78 @@ if ($result === false) {
if ($management_allowed === true) { if ($management_allowed === true) {
// Update module. // Update module.
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form&id_module_inventory='.$row['id_module_inventory'].'">'; $data[4] = '<div class="table_action_buttons">';
$data[4] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']).'</b></a>'; $data[4] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form&id_module_inventory='.$row['id_module_inventory'].'">';
$data[4] .= html_print_image('images/edit.svg', true, ['border' => '0', 'title' => __('Update'), 'class' => 'main_menu_icon invert_filter']).'</b></a>';
// Delete module. // Delete module.
$data[4] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules&delete_inventory_module='.$row['id_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'; $data[4] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules&delete_inventory_module='.$row['id_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']); $data[4] .= html_print_image('images/delete.svg', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'main_menu_icon invert_filter']);
$data[4] .= '</b></a>&nbsp;&nbsp;'; $data[4] .= '</b></a>&nbsp;&nbsp;';
$data[4] .= html_print_checkbox_extended('delete_multiple[]', $row['id_module_inventory'], false, false, '', 'class="check_delete"', true); $data[4] .= html_print_checkbox_extended('delete_multiple[]', $row['id_module_inventory'], false, false, '', 'class="check_delete"', true);
$data[4] .= '</div>';
} }
array_push($table->data, $data); array_push($table->data, $data);
} }
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_inventory_modules'>"; echo '<form id="form_delete" method="POST" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">';
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset);
html_print_table($table); html_print_table($table);
ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset, 0, false, 'offset', true, 'pagination-bottom'); echo '</form>';
echo "<div class='pdd_l_5px float-right'>";
echo '<form id="form_create" method="post" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form">';
echo html_print_input_hidden('create_module_inventory', 1);
echo '<form>';
$tablePagination = ui_pagination(
$total_modules,
'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules',
$offset,
0,
true,
'offset',
false
);
$actionButtons = '';
if ($management_allowed === true) { if ($management_allowed === true) {
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); $actionButtons .= html_print_submit_button(
__('Create'),
'crt',
false,
[
'icon' => 'wand',
'form' => 'form_create',
],
true
);
$actionButtons .= html_print_submit_button(
__('Delete'),
'delete_btn',
false,
[
'icon' => 'delete',
'mode' => 'secondary',
'form' => 'form_delete',
],
true
);
} }
echo '</div>'; html_print_action_buttons(
echo '</form>'; $actionButtons,
[
'type' => 'form_action',
'right_content' => $tablePagination,
],
false
);
} }
if ($management_allowed === true) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form">';
echo '<div class="float-right mrgn_btn_15px">';
html_print_input_hidden('create_module_inventory', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
}
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
enterprise_hook('close_meta_frame');
echo '<div id="deploy_messages" class="invisible">'; echo '<div id="deploy_messages" class="invisible">';
echo '<span>'.__( echo '<span>'.__(
'The configurations of inventory modules from the nodes have been unified. 'The configurations of inventory modules from the nodes have been unified.
@ -364,30 +415,14 @@ if (is_metaconsole() === true) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function() { $('[id^=checkbox-all_delete]').change(function() {
if ($("#checkbox-all_delete").prop("checked")) { if ($("input[name=all_delete]").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected'); $(".custom_checkbox_input").prop("checked", true);
$(".check_delete").prop("checked", true);
} }
else { else {
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected'); $(".custom_checkbox_input").prop("checked", false);
$(".check_delete").prop("checked", false);
} }
}); });
}); });
</script> </script>

View File

@ -26,23 +26,32 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'],
// Header // Header
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$sec = 'advanced'; $sec = 'advanced';
enterprise_include_once('meta/include/functions_components_meta.php'); enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header(); components_meta_print_header();
} else { } else {
$sec = 'gmodules'; $sec = 'gmodules';
ui_print_page_header( ui_print_standard_header(
__('Module management').' » '.__('Inventory modules'), __('Module management'),
'images/op_inventory.png', 'images/op_inventory.png',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Configuration'),
],
[
'link' => '',
'label' => __('Inventory modules'),
],
]
); );
} }
// Header
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
if ($is_windows) { if ($is_windows) {
ui_print_error_message(__('Not supported in Windows systems')); ui_print_error_message(__('Not supported in Windows systems'));
@ -96,88 +105,168 @@ if ($id_os == null) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filter-table-adv';
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'width: 50%';
$table->style[1] = 'width: 50%';
$table->data = []; $table->data = [];
$table->data[0][0] = '<strong>'.__('Name').'</strong>';
$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled); $table->data[0][] = html_print_label_input_block(
$table->data[1][0] = '<strong>'.__('Description').'</strong>'; __('Name'),
$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true); html_print_input_text(
$table->data[2][0] = '<strong>'.__('OS').'</strong>'; 'name',
$table->data[2][1] = html_print_select_from_sql( $name,
'SELECT id_os, name FROM tconfig_os ORDER BY name', '',
'id_os', 45,
$id_os, 100,
'', true,
'', $disabled
'', )
$return = true
); );
$table->data[3][0] = '<strong>'.__('Interpreter').'</strong>'; $table->data[0][] = html_print_label_input_block(
$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true); __('Description'),
$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true); html_print_input_text(
'description',
$description,
'',
60,
500,
true
)
);
$table->data['block_mode'][0] = '<strong>'.__('Block Mode').'</strong>'; $table->data[1][] = html_print_label_input_block(
$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true); __('OS'),
html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os ORDER BY name',
'id_os',
$id_os,
'',
'',
'',
$return = true
)
);
$table->data[4][0] = '<strong>'.__('Format').'</strong>'; $table->data[1][] = html_print_label_input_block(
$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true); __('Interpreter'),
$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true); html_print_input_text(
'interpreter',
$interpreter,
'',
25,
100,
true
).ui_print_input_placeholder(
__('Left blank for the LOCAL inventory modules'),
true
)
);
$table->data[5][0] = '<strong>'.__('Script mode').'</strong>'; $table->data[2][] = html_print_label_input_block(
$table->data[5][0] .= ui_print_help_tip(__(''), true); __('Format'),
$table->data[5][1] = __('Use script'); html_print_input_text(
$table->data[5][1] .= html_print_radio_button( 'format',
'script_mode', $data_format,
1, '',
'', 50,
$script_mode, 100,
true true
).'&nbsp;&nbsp;'; ).ui_print_input_placeholder(
$table->data[5][1] .= '&nbsp&nbsp&nbsp&nbsp'.__('Use inline code'); __('separate fields with ').SEPARATOR_COLUMN,
$table->data[5][1] .= html_print_radio_button( true
'script_mode', )
2, );
'',
$script_mode,
true
).'&nbsp;&nbsp;';
$table->data[6][0] = '<strong>'.__('Script path').'</strong>'; $table->data[2][] = html_print_label_input_block(
$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true); __('Block Mode'),
html_print_checkbox_switch(
'block_mode',
1,
$block_mode,
true
)
);
$table->data[7][0] = '<strong>'.__('Code').'</strong>'; $radioButtons = [];
$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true); $radioButtons[] = html_print_radio_button('script_mode', 1, __('Script mode'), $script_mode, true);
$radioButtons[] = html_print_radio_button('script_mode', 2, __('Use inline code'), $script_mode, true);
$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true); $table->data[3][] = html_print_label_input_block(
__('Script mode'),
html_print_div(
[
'class' => 'switch_radio_button',
'content' => implode('', $radioButtons),
],
true
)
);
echo '<form name="inventorymodule" id="inventorymodule_form" method="post" $table->colspan[4][0] = 2;
$table->data[4][0] = html_print_label_input_block(
__('Script path'),
html_print_input_text(
'script_path',
$script_path,
'',
50,
1000,
true
),
['div_class' => 'script_path_inventory_modules']
);
$table->data[4][0] .= html_print_label_input_block(
__('Code'),
html_print_textarea(
'code',
25,
80,
base64_decode($code),
'',
true
).ui_print_input_placeholder(
__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN,
true
),
['div_class' => 'code_inventory_modules']
);
echo '<form name="inventorymodule" id="inventorymodule_form" class="max_floating_element_size" method="post"
action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">'; action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">';
html_print_table($table); html_print_table($table);
if ($id_module_inventory) { if ($id_module_inventory) {
html_print_input_hidden('update_module_inventory', 1); html_print_input_hidden('update_module_inventory', 1);
html_print_input_hidden('id_module_inventory', $id_module_inventory); html_print_input_hidden('id_module_inventory', $id_module_inventory);
$buttonCaption = __('Update');
$buttonIcon = 'update';
} else { } else {
html_print_input_hidden('create_module_inventory', 1); html_print_input_hidden('create_module_inventory', 1);
$buttonCaption = __('Create');
$buttonIcon = 'wand';
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; $actionButtons = '';
if ($id_module_inventory) { $actionButtons = html_print_submit_button(
html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"'); $buttonCaption,
} else { 'submit',
html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"'); false,
} ['icon' => $buttonIcon],
true
);
$actionButtons .= html_print_go_back_button(
'index.php?sec=gmodules&sec2=godmode/modules/manage_inventory_modules',
['button_class' => ''],
true
);
echo '</div>'; html_print_action_buttons($actionButtons);
echo '</form>'; echo '</form>';
if (defined('METACONSOLE')) {
enterprise_hook('close_meta_frame');
}
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -185,21 +274,21 @@ if (defined('METACONSOLE')) {
var mode = <?php echo $script_mode; ?>; var mode = <?php echo $script_mode; ?>;
if (mode == 1) { if (mode == 1) {
$('#table1-6').show(); $('.script_path_inventory_modules').show();
$('#table1-7').hide(); $('.code_inventory_modules').hide();
} else { } else {
$('#table1-7').show(); $('.code_inventory_modules').show();
$('#table1-6').hide(); $('.script_path_inventory_modules').hide();
} }
$('input[type=radio][name=script_mode]').change(function() { $('input[type=radio][name=script_mode]').change(function() {
if (this.value == 1) { if (this.value == 1) {
$('#table1-6').show(); $('.script_path_inventory_modules').show();
$('#table1-7').hide(); $('.code_inventory_modules').hide();
} }
else if (this.value == 2) { else if (this.value == 2) {
$('#table1-7').show(); $('.code_inventory_modules').show();
$('#table1-6').hide(); $('.script_path_inventory_modules').hide();
} }
}); });
}); });

View File

@ -1,23 +1,36 @@
<?php <?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 // Load global vars.
// ==================================================
// 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; global $config;
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -32,16 +45,27 @@ require_once $config['homedir'].'/include/functions_network_components.php';
require_once $config['homedir'].'/include/functions_component_groups.php'; require_once $config['homedir'].'/include/functions_component_groups.php';
// Header // Header
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
components_meta_print_header(); components_meta_print_header();
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Module management').' &raquo; '.__('Component group management'), __('Component group management'),
'', '',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Component groups'),
],
]
); );
$sec = 'gmodules'; $sec = 'gmodules';
} }
@ -234,12 +258,11 @@ foreach ($groups as $group_key => $group_val) {
$groups = component_groups_get_groups_tree_recursive($groups_clean, 0, 0); $groups = component_groups_get_groups_tree_recursive($groups_clean, 0, 0);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false); $table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name'); $table->head[0] = __('Name');
if (is_management_allowed() === true || is_metaconsole()) { if (is_management_allowed() === true || is_metaconsole() === true) {
$table->head[1] = __('Action'); $table->head[1] = __('Action');
} }
@ -270,10 +293,16 @@ foreach ($groups as $group) {
$data[0] = $tabulation.'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>'; $data[0] = $tabulation.'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
} }
$table->cellclass[][1] = 'action_buttons'; $table->cellclass[][1] = 'table_action_buttons';
if (is_management_allowed() === true || is_metaconsole()) { if (is_management_allowed() === true || is_metaconsole()) {
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;' $data[1] = html_print_anchor(
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>'; [
'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 invert_filter']),
],
true
);
} }
array_push($table->data, $data); array_push($table->data, $data);
@ -296,35 +325,61 @@ if (is_management_allowed() === false && is_metaconsole() === false) {
); );
} }
if (isset($data)) { $actionButtons = [];
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_nc_groups'>"; if (isset($data) === true) {
html_print_input_hidden('multiple_delete', 1); echo '<form id="multiple_delete_form" method="POST" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_nc_groups">';
html_print_table($table); 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>'; echo '</form>';
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined component groups') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined component groups') ]);
} }
if (is_management_allowed() === true || is_metaconsole()) { if (is_management_allowed() === true || is_metaconsole()) {
echo '<form method="post" action='.$url.'>'; // Create form.
echo '<div class="float-right">'; echo '<form id="create_form" method="POST" action="'.$url.'">';
html_print_input_hidden('new', 1); html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>'; 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
);
}
} }
enterprise_hook('close_meta_frame'); html_print_action_buttons(
implode('', $actionButtons),
['type' => 'form_action']
);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){ $('[id^=checkbox-delete_multiple]').change(function(){
@ -332,11 +387,11 @@ enterprise_hook('close_meta_frame');
$(this).parent().parent().removeClass('checkselected'); $(this).parent().parent().removeClass('checkselected');
} }
else{ 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")) { if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected'); $('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true); $(".check_delete").prop("checked", true);
@ -344,11 +399,7 @@ enterprise_hook('close_meta_frame');
else{ else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected'); $('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false); $(".check_delete").prop("checked", false);
} }
}); });
}); });
</script> </script>

View File

@ -1,17 +1,32 @@
<?php <?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 // Load global vars.
// ==================================================
// 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; global $config;
check_login(); 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'; require_once $config['homedir'].'/include/functions_network_components.php';
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
$sec = (is_metaconsole() === true) ? 'advanced' : 'gmodules';
if (defined('METACONSOLE')) {
$sec = 'advanced';
} else {
$sec = 'gmodules';
}
if ($id) { if ($id) {
$group = network_components_get_group($id); $group = network_components_get_group($id);
@ -45,31 +55,24 @@ if ($id) {
} }
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->class = 'databox';
$table->class = 'databox filters';
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$table->class = 'databox data'; $table->class = 'databox data';
if ($id) { $table->head[0] = ($id) ? __('Update Group Component') : __('Create Group Component');
$table->head[0] = __('Update Group Component');
} else {
$table->head[0] = __('Create Group Component');
}
$table->head_colspan[0] = 4; $table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
} }
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'width: 0';
$table->style[2] = 'font-weight: bold'; $table->style[1] = 'width: 0';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text('name', $name, '', 15, 255, true); $table->data[0][1] = __('Parent');
$table->data[1][0] = html_print_input_text('name', $name, '', 0, 255, true, false, false, '', 'w100p');
$table->data[0][2] = __('Parent'); $table->data[1][1] = html_print_select(
$table->data[0][3] = html_print_select(
network_components_get_groups(), network_components_get_groups(),
'parent', 'parent',
$parent, $parent,
@ -81,17 +84,39 @@ $table->data[0][3] = html_print_select(
false 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); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) { if ($id) {
html_print_input_hidden('update', 1); html_print_input_hidden('update', 1);
html_print_input_hidden('id', $id); html_print_input_hidden('id', $id);
html_print_submit_button(__('Update'), 'crt', false, 'class="sub upd"'); $actionButtonTitle = __('Update');
} else { } else {
html_print_input_hidden('create', 1); 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>'; echo '</form>';

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -30,8 +30,6 @@ global $config;
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -287,16 +285,25 @@ if (is_metaconsole() === true) {
$help_header = 'network_component_tab'; $help_header = 'network_component_tab';
} }
ui_print_page_header( ui_print_standard_header(
__('Module management').' &raquo; '.__('Remote component management'), __('Remote component management'),
'', '',
false, false,
$help_header, $help_header,
true, true,
'', [],
false, [
'modulemodal' [
'link' => '',
'label' => __('Configuration'),
],
[
'link' => '',
'label' => __('Templates'),
],
]
); );
$sec = 'gmodules'; $sec = 'gmodules';
} }
@ -608,18 +615,6 @@ $url = ui_get_url_refresh(
true, true,
false false
); );
$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data = [];
$table->data[0][0] = __('Group');
$component_groups = network_components_get_groups(); $component_groups = network_components_get_groups();
@ -649,54 +644,81 @@ foreach ($component_groups as $component_group_key => $component_group_val) {
} }
} }
$table->data[0][1] = html_print_select( $name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components';
$component_groups, $table = new stdClass();
'search_id_group', $table->width = '100%';
$search_id_group, $table->class = 'filter-table-adv';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data = [];
$table->data[0][] = html_print_label_input_block(
__('Group'),
html_print_select(
$component_groups,
'search_id_group',
$search_id_group,
'',
__('All'),
0,
true,
false,
false,
'',
false,
'width: 100%'
)
);
$table->data[0][] = html_print_label_input_block(
__('Free Search'),
html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
).ui_print_input_placeholder(
__('Search by name, description, tcp send or tcp rcv, list matches.'),
true
)
);
$toggleFilters = '<form class="filters_form" method="POST" action="'.$url.'">';
$toggleFilters .= html_print_table($table, true);
$toggleFilters .= html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button(
__('Filter'),
'search',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
$toggleFilters .= '</form>';
ui_toggle(
$toggleFilters,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'', '',
__('All'),
0,
true, true,
false, false,
false
);
$table->data[0][2] = __('Free Search').ui_print_help_tip(
__('Search by name, description, tcp send or tcp rcv, list matches.'),
true
);
$table->data[0][3] = html_print_input_text(
'search_string',
$search_string,
'', '',
25, 'white-box-content',
255, 'box-flat white_table_graph fixed_filter_bar'
true
); );
if (is_metaconsole() === true) {
$table->data[0][4] = '<div>';
} else {
$table->data[0][4] = '<div class="action-buttons">';
}
$table->data[0][4] .= html_print_submit_button(
__('Search'),
'search',
false,
'class="sub search"',
true
);
$table->data[0][4] .= '</div>';
if (is_metaconsole() === true) {
$filter = '<form class="filters_form" method="post" action="'.$url.'">';
$filter .= html_print_table($table, true);
$filter .= '</form>';
ui_toggle($filter, __('Show Options'));
} else {
echo '<form method="post" action="'.$url.'">';
html_print_table($table);
echo '</form>';
}
$filter = []; $filter = [];
if ($search_id_group) { if ($search_id_group) {
@ -714,8 +736,7 @@ $total_components = network_components_get_network_components(
); );
$total_components = $total_components[0]['total']; $total_components = $total_components[0]['total'];
$offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset; $offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset;
ui_pagination($total_components, $name_url); $filter['offset'] = (int) get_parameter('offset');
$filter['offset'] = $offset;
$filter['limit'] = (int) $config['block_size']; $filter['limit'] = (int) $config['block_size'];
$components = network_components_get_network_components( $components = network_components_get_network_components(
false, false,
@ -737,7 +758,7 @@ if ($components === false) {
} }
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->styleTable = 'margin: 10px 10px 0; width: -webkit-fill-available; width: -moz-available';
$table->head = []; $table->head = [];
$table->class = 'info_table'; $table->class = 'info_table';
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
@ -800,55 +821,7 @@ foreach ($components as $component) {
$data[0] = io_safe_output($component['name']); $data[0] = io_safe_output($component['name']);
} }
switch ($component['id_modulo']) { $data[1] .= ui_print_servertype_icon((int) $component['id_modulo']);
case MODULE_NETWORK:
$data[1] .= html_print_image(
'images/op_network.png',
true,
[
'title' => __('Network module'),
'class' => 'invert_filter',
]
);
break;
case MODULE_WMI:
$data[1] .= html_print_image(
'images/wmi.png',
true,
[
'title' => __('WMI module'),
'class' => 'invert_filter',
]
);
break;
case MODULE_PLUGIN:
$data[1] .= html_print_image(
'images/plugin.png',
true,
[
'title' => __('Plug-in module'),
'class' => 'invert_filter',
]
);
break;
case MODULE_WIZARD:
$data[1] .= html_print_image(
'images/wand.png',
true,
[
'title' => __('Wizard module'),
'class' => 'invert_filter',
]
);
break;
default:
// Not possible.
break;
}
$data[2] = ui_print_moduletype_icon($component['type'], true); $data[2] = ui_print_moduletype_icon($component['type'], true);
$data[3] = "<span class='font_8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>'; $data[3] = "<span class='font_8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';
@ -856,59 +829,59 @@ foreach ($components as $component) {
$data[5] = $component['max'].' / '.$component['min']; $data[5] = $component['max'].' / '.$component['min'];
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$table->cellclass[][6] = 'action_buttons'; $table->cellclass[][6] = 'table_action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'&offset='.$offset.'">'.html_print_image(
'images/copy.png', $data[6] = html_print_anchor(
true,
[ [
'alt' => __('Duplicate'), 'href' => $url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'&offset='.$offset,
'title' => __('Duplicate'), 'content' => html_print_image(
'class' => 'invert_filter', 'images/copy.svg',
] true,
).'</a>'; [
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'&offset='.$offset_delete.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image( 'title' => __('Duplicate'),
'images/cross.png', 'class' => 'invert_filter main_menu_icon',
true, ]
),
],
true
);
$data[6] .= html_print_anchor(
[ [
'alt' => __('Delete'), 'href' => $url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'&offset='.$offset_delete,
'title' => __('Delete'), 'onClick' => 'if (! confirm (\''.__('Are you sure?').'\')) return false',
'class' => 'invert_filter', 'content' => html_print_image(
] 'images/delete.svg',
).'</a>'; true,
[
'title' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
} }
array_push($table->data, $data); array_push($table->data, $data);
} }
if (isset($data) === true) { $tablePagination = ui_pagination(
if ($is_management_allowed === true) { $total_components,
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>"; $url,
html_print_input_hidden('multiple_delete', 1); 0,
} 0,
true,
'offset',
false
);
html_print_table($table); echo '<form id="form_delete" method="POST" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure.'">';
ui_pagination( html_print_table($table);
$total_components, html_print_input_hidden('multiple_delete', 1);
$name_url, echo '</form>';
0,
0, if (isset($data) === false) {
false,
'offset',
true,
'pagination-bottom'
);
if ($is_management_allowed === true) {
echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button(
__('Delete'),
'delete_btn',
false,
'class="sub delete"'
);
echo '</div>';
echo '</form>';
}
} else {
ui_print_info_message( ui_print_info_message(
[ [
'no_close' => true, 'no_close' => true,
@ -917,11 +890,33 @@ if (isset($data) === true) {
); );
} }
$actionButtons = [];
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
echo '<form method="post" action="'.$url.'">'; $actionButtons[] = html_print_submit_button(
echo '<div class="right_align mrgn_btn_15px">'; __('Create'),
html_print_input_hidden('new_component', 1); 'crt',
html_print_select( false,
[
'icon' => 'wand',
'form' => 'form_create',
],
true
);
$actionButtons[] = html_print_submit_button(
__('Delete'),
'delete_btn',
false,
[
'icon' => 'delete',
'mode' => 'secondary',
'form' => 'form_delete',
],
true
);
// Create.
$actionButtons[] = '<form style="z-index: 10" id="form_create" method="post" action="'.$url.'">';
$actionButtons[] = html_print_input_hidden('new_component', 1, true);
$actionButtons[] = html_print_select(
[ [
COMPONENT_TYPE_NETWORK => __('Create a new network component'), COMPONENT_TYPE_NETWORK => __('Create a new network component'),
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'), COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
@ -933,47 +928,41 @@ if ($is_management_allowed === true) {
'', '',
'', '',
'', '',
'' true,
);
html_print_submit_button(
__('Create'),
'crt',
false, false,
'class="sub next mrgn_lft_5px"' true,
'',
false,
'z-index: 10'
); );
echo '</div>'; $actionButtons[] = '</form>';
echo '</form>';
} }
enterprise_hook('close_meta_frame'); html_print_action_buttons(
implode('', $actionButtons),
[
'type' => 'form_action',
'right_content' => $tablePagination,
]
);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){ $('[id^=checkbox-delete_multiple]').click(function(){
if($(this).parent().parent().hasClass('checkselected')){ if($(this).prop("checked") === false ){
$(this).parent().parent().removeClass('checkselected'); $(this).prop("checked", false);
} } else {
else{ $(this).prop("checked", true);
$(this).parent().parent().addClass('checkselected');
} }
}); });
$('[id^=checkbox-all_delete]').change(function(){ $('#checkbox-all_delete').click(function(){
if ($("#checkbox-all_delete").prop("checked")) { if ($("#checkbox-all_delete").prop("checked") === true) {
$('[id^=checkbox-delete_multiple]') $("[id^=checkbox-delete_multiple]").prop("checked", true);
.parent()
.parent()
.addClass('checkselected');
$(".check_delete")
.prop("checked", true);
} }
else{ else{
$('[id^=checkbox-delete_multiple]') $("[id^=checkbox-delete_multiple]").prop("checked", false);
.parent()
.parent()
.removeClass('checkselected');
$(".check_delete").prop("checked", false);
} }
}); });
}); });

View File

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

View File

@ -104,7 +104,7 @@ function generateExtraFields($extra_fields, $protocol)
'class' => 'float-right', 'class' => 'float-right',
'style' => $cntFields <= 1 ? 'opacity: 0.5;' : '', 'style' => $cntFields <= 1 ? 'opacity: 0.5;' : '',
'content' => html_print_image( 'content' => html_print_image(
'images/cross.png', 'images/delete.svg',
true, true,
[ [
'title' => __('Remove last macro oid'), 'title' => __('Remove last macro oid'),

View File

@ -263,10 +263,10 @@ foreach ($result as $row) {
$data[0] = html_print_checkbox_extended('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true); $data[0] = html_print_checkbox_extended('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true);
$data[1] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row['id_np'].'">'.io_safe_output($row['name']).'</a>'; $data[1] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row['id_np'].'">'.io_safe_output($row['name']).'</a>';
$data[2] = ui_print_truncate_text(io_safe_output($row['description']), 'description', true, true, true, '[&hellip;]'); $data[2] = ui_print_truncate_text(io_safe_output($row['description']), 'description', true, true, true, '[&hellip;]');
$table->cellclass[][3] = 'action_buttons'; $table->cellclass[][3] = 'table_action_buttons';
$data[3] = html_print_input_image( $data[3] = html_print_input_image(
'delete_profile', 'delete_profile',
'images/cross.png', 'images/delete.svg',
$row['id_np'], $row['id_np'],
'', '',
true, true,
@ -286,7 +286,7 @@ foreach ($result as $row) {
'class' => 'invert_filter', 'class' => 'invert_filter',
] ]
); );
$data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);

View File

@ -1,17 +1,32 @@
<?php <?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 // Load global vars.
// ==================================================
// 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; global $config;
check_login(); check_login();
@ -26,12 +41,30 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
} }
// Header. // 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_module = (bool) get_parameter_post('update_module');
// Update // Update
if ($update_module) { if ($update_module === true) {
$name = get_parameter_post('name'); $name = get_parameter_post('name');
$id_type = get_parameter_post('id_type'); $id_type = get_parameter_post('id_type');
$description = get_parameter_post('description'); $description = get_parameter_post('description');
@ -54,43 +87,33 @@ if ($update_module) {
} }
} }
$table = new stdClass();
$table->id = 'module_type_list';
$table->class = 'info_table';
$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'>"; $table->data = [];
echo '<thead>';
echo '<th>'.__('Icon').'</th>';
echo '<th>'.__('ID').'</th>';
echo '<th>'.__('Name').'</th>';
echo '<th>'.__('Description').'</th>';
echo '</thead';
$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) { if ($rows === false) {
$rows = []; $rows = [];
} }
$color = 0;
foreach ($rows as $row) { foreach ($rows as $row) {
if ($color == 1) { $data[0] = $row['id_tipo'];
$tdcolor = 'datos'; $data[1] = html_print_image('images/'.$row['icon'], true, ['class' => 'main_menu_icon invert_filter']);
$color = 0; $data[2] = $row['nombre'];
} else { $data[3] = $row['descripcion'];
$tdcolor = 'datos2';
$color = 1;
}
echo " array_push($table->data, $data);
<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>';
} }
echo '</table>'; html_print_table($table);
// $tablePagination = ui_pagination($total_groups, $url, $offset, 0, true, 'offset', false);

Some files were not shown because too many files have changed in this diff Show More