';
-echo "".html_print_select_groups(
- $config['id_user'],
- ($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'),
- true,
- 'group',
- '',
- 'filterByGroup($(\'#group\').val());',
- '',
- 0,
- true
-).' | ';
-echo '
';
-echo ''.html_print_select(
- agents_get_group_agents(),
- 'id_agents[]',
- 0,
- false,
- '',
- '',
- true,
- true,
- true,
- 'w100p',
- false,
- ''
-).' | ';
-echo ' | ';
-echo ''.html_print_select(
- [],
- 'module[]',
- 0,
- false,
- '',
- 0,
- true,
- true,
- true,
- 'w100p',
- false,
- ''
+echo ' | '.html_print_input(
+ [
+ 'type' => 'select_multiple_modules_filtered',
+ 'uniqId' => 'modules',
+ 'class' => 'flex flex-row',
+
+ ]
).' | ';
echo '
';
echo "";
@@ -403,52 +361,34 @@ ui_require_jquery_file('autocomplete');
$(document).ready (function () {
$(document).data('text_for_module', $("#none_text").html());
- $("#id_agents").change(agent_changed_by_multiple_agents);
-
$("#submit-add").click(function() {
- $('#module').map(function(){
- if ($(this).val() != "0" )
- $(this).prop('selected', true);
- });
-
- if($('#module')[0].childElementCount == 1 && ($('#module')[0].value == "" || $('#module')[0].value == "0")) {
+ if($('#filtered-module-modules-modules')[0].value == "" || $('#filtered-module-modules-modules')[0].value == "0") {
alert("");
return false;
}
+
+ var modules_selected = $(
+ "#filtered-module-modules-modules"
+ ).val();
+ var agents_selected = $(
+ "#filtered-module-agents-modules"
+ ).val();
+
+ $("#agentmodules").submit( function(eventObj) {
+ $("").attr("type", "hidden")
+ .attr("value", agents_selected)
+ .attr("name", "id_agents")
+ .appendTo("#agentmodules");
+ $("").attr("type", "hidden")
+ .attr("value", modules_selected)
+ .attr("name", "id_modules")
+ .appendTo("#agentmodules");
+ return true;
+ });
});
});
-function filterByGroup(idGroup) {
- $('#id_agents').empty ();
- $('#module').empty();
- $("#module").append ($("").attr ("value", 0).html (''));
-
- jQuery.post ("ajax.php",
- {"page" : "godmode/groups/group_list",
- "get_group_agents" : 1,
- "id_group" : idGroup,
- // Add a key prefix to avoid auto sorting in js object conversion
- "keys_prefix" : "_"
- },
- function (data, status) {
- i = 0
- jQuery.each (data, function (id, value) {
- // Remove keys_prefix from the index
- id = id.substring(1);
-
- i++;
- $("#id_agents").append ($("").attr ("value", id).html (value));
- });
-
- if (i == 0) {
- $("#id_agents").append ($("").attr ("value", 0).html (''));
- }
- },
- "json"
- );
-}
-
function added_ids_sorted_items_to_hidden_input() {
var ids = '';
var first = true;
diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php
index 92d117df1b..7993d7e38a 100644
--- a/pandora_console/godmode/reporting/graph_builder.php
+++ b/pandora_console/godmode/reporting/graph_builder.php
@@ -222,8 +222,8 @@ function add_quotes($item)
if ($add_module === true) {
$id_graph = get_parameter('id');
- $id_modules = get_parameter('module');
- $id_agents = get_parameter('id_agents');
+ $id_agent_modules = explode(',', get_parameter('id_modules'));
+ $id_agents = explode(',', get_parameter('id_agents'));
$weight = get_parameter('weight');
// Id modules has double entities conversion.
@@ -234,9 +234,7 @@ if ($add_module === true) {
// to browse in db.
io_safe_input_array($id_modules);
- $id_agent_modules = db_get_all_rows_sql(
- 'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"
- );
+
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
@@ -244,7 +242,7 @@ if ($add_module === true) {
$order = $order['field_order'];
foreach ($id_agent_modules as $id_agent_module) {
$order++;
- $result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order]);
+ $result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module, 'weight' => $weight, 'field_order' => $order]);
}
} else {
$result = false;
diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js
index c813c8e26a..8baef88586 100644
--- a/pandora_console/include/javascript/multiselect_filtered.js
+++ b/pandora_console/include/javascript/multiselect_filtered.js
@@ -231,13 +231,8 @@ function fmModuleChange(uniqId) {
if (data) {
jQuery.each(data, function(id, value) {
var option = $("")
- .attr(
- "value",
- value["id_node"]
- ? value["id_node"] + "|" + value["id_agente_modulo"]
- : value["id_agente_modulo"]
- )
- .html(value["nombre"]);
+ .attr("value", id)
+ .html(value);
$("#filtered-module-modules-" + uniqId).append(option);
});
}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 5ff90674f4..45a4b8c65d 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -8455,3 +8455,34 @@ div#err_msg_centralised {
display: flex;
flex-direction: row;
}
+
+#select_multiple_modules_filtered > div {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-around;
+ align-items: center;
+ margin: 5px;
+ flex-wrap: wrap;
+ flex: 1 1 320px;
+}
+
+#select_multiple_modules_filtered > div > div {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ flex-wrap: wrap;
+ width: 250px;
+}
+
+#select_multiple_modules_filtered > div > div > * {
+ flex: auto;
+}
+
+#select_multiple_modules_filtered > div > div > select {
+ min-width: 250px !important;
+}
+
+#select_multiple_modules_filtered > div > div > .select2 {
+ min-width: 250px !important;
+}
|