#10118 Added group multiselector

This commit is contained in:
Daniel Maya 2023-02-13 17:06:09 +01:00
parent 4cd0820f11
commit 5b263981c4
5 changed files with 29 additions and 16 deletions

View File

@ -2,6 +2,8 @@ START TRANSACTION;
ALTER TABLE `tserver` ADD COLUMN `server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0;
ALTER TABLE `tmap` MODIFY COLUMN `id_group` TEXT NOT NULL default '';
CREATE TABLE IF NOT EXISTS `tmonitor_filter` (
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_name` VARCHAR(600) NOT NULL,

View File

@ -792,17 +792,22 @@ class NetworkMap
|| $this->mapOptions['map_filter']['dont_show_subgroups'] == 1
) {
// Show only current selected group.
$filter['id_grupo'] = $this->idGroup;
$filter['id_grupo'] = explode(',', $this->idGroup);
} else {
// Show current group and children.
$childrens = groups_get_children($this->idGroup, null, true);
if (!empty($childrens)) {
$childrens = array_keys($childrens);
foreach (explode(',', $this->idGroup) as $key => $group) {
$childrens = groups_get_children($group, null, true);
if (!empty($childrens)) {
$childrens = array_keys($childrens);
$filter['id_grupo'] = $childrens;
$filter['id_grupo'][] = $this->idGroup;
} else {
$filter['id_grupo'] = $this->idGroup;
if (empty($filter['id_grupo']) === false) {
$filter['id_grupo'] = array_merge($filter['id_grupo'], $childrens);
} else {
$filter['id_grupo'] = $childrens;
}
} else {
$filter['id_grupo'][] = $group;
}
}
}

View File

@ -337,7 +337,14 @@ if ($not_found) {
);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
$table->data[3][1] = html_print_input_text(
'description',
$description,
'',
100,
100,
true
);
$table->data[4][0] = __('Position X');
$table->data[4][1] = html_print_input_text('pos_x', $offset_x, '', 2, 10, true);
@ -401,11 +408,12 @@ if ($not_found) {
$config['id_user'],
'AR',
true,
'id_group',
$id_group,
'id_group[]',
explode(',', $id_group),
'',
'',
'',
true,
true
).'</div>';
$table->data['source_data_group'][1] .= html_print_image(

View File

@ -237,7 +237,7 @@ if ($new_networkmap || $save_networkmap) {
}
if ($save_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
$id_group = get_parameter('id_group', 0);
$id_group_map = (int) get_parameter('id_group_map', 0);
@ -292,7 +292,7 @@ if ($new_networkmap || $save_networkmap) {
$values = [];
$values['name'] = $name;
$values['id_group'] = $id_group;
$values['id_group'] = implode(',', $id_group);
$values['source_period'] = 60;
$values['width'] = $width;
$values['height'] = $height;
@ -333,7 +333,7 @@ if ($new_networkmap || $save_networkmap) {
if ($source == 'group') {
$values['source'] = 0;
$values['source_data'] = $id_group;
$values['source_data'] = implode(',', $id_group);
} else if ($source == 'recon_task') {
$values['source'] = 1;
$values['source_data'] = $recon_task_id;

View File

@ -315,8 +315,6 @@ if (is_ajax() === true) {
$("#source").change(function() {
const source = $(this).val();
console.log("aaaaaaaaaaaaaaaa");
if (source == \'recon_task\') {
$("#form_editor-source_data_ip_mask")
.css(\'display\', \'none\');