';
+ $adv_secondary_groups_label .= '
';
+ $adv_secondary_groups_label .= __('Secondary groups');
+ $adv_secondary_groups_label .= '
';
+ $adv_secondary_groups_label .= '
';
+ $select_agent_secondary = html_print_select_agent_secondary(
+ $agent,
+ $id_agente
);
// Safe operation mode.
@@ -821,19 +712,15 @@ if (enterprise_installed()) {
}
// General display distribution.
-$table_adv_options = $advanced_div.$adv_secondary_groups_label.'
-
- '.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
+$table_adv_options = $advanced_div;
+$table_adv_options .= $adv_secondary_groups_label;
+$table_adv_options .= $select_agent_secondary;
+$table_adv_options .= '
';
+
+$table_adv_options .= '';
+$table_adv_options .= $table_adv_parent;
+$table_adv_options .= $table_adv_module_mode;
+$table_adv_options .= $table_adv_cascade;
if ($new_agent) {
// If agent is new, show custom id as old style format.
@@ -1110,133 +997,6 @@ ui_require_jquery_file('bgiframe');
}
}
- function agent_manager_add_secondary_groups (event, id_agent) {
- event.preventDefault();
- var primary_value = $("#grupo").val()
- // The selected primary value cannot be selected like secondary
- if ($("#secondary_groups option:selected[value=" + primary_value + "]").length > 0) {
- alert("")
- return
- }
-
- // On agent creation PHP will update the secondary groups table (not via AJAX)
- if (id_agent == 0) {
- agent_manager_add_secondary_groups_ui();
- agent_manager_update_hidden_input_secondary();
- return;
- }
-
- var selected_items = new Array();
- $("#secondary_groups option:selected").each(function(){
- selected_items.push($(this).val())
- })
-
- var data = {
- page: "godmode/agentes/agent_manager",
- id_agent: id_agent,
- groups: selected_items,
- add_secondary_groups: 1,
- }
-
- // Make the AJAX call to update the secondary groups
- $.ajax({
- type: "POST",
- url: "ajax.php",
- dataType: "html",
- data: data,
- success: function (data) {
- if (data == 1) {
- agent_manager_add_secondary_groups_ui();
- } else {
- console.error("Error in AJAX call to add secondary groups")
- }
- },
- error: function (data) {
- console.error("Fatal error in AJAX call to add secondary groups")
- }
- });
- }
-
- function agent_manager_remove_secondary_groups (event, id_agent) {
- event.preventDefault();
-
- // On agent creation PHP will update the secondary groups table (not via AJAX)
- if (id_agent == 0) {
- agent_manager_remove_secondary_groups_ui();
- agent_manager_update_hidden_input_secondary();
- return;
- }
-
- var selected_items = new Array();
- $("#secondary_groups_selected option:selected").each(function(){
- selected_items.push($(this).val())
- })
-
- var data = {
- page: "godmode/agentes/agent_manager",
- id_agent: id_agent,
- groups: selected_items,
- remove_secondary_groups: 1,
- }
-
- // Make the AJAX call to update the secondary groups
- $.ajax({
- type: "POST",
- url: "ajax.php",
- dataType: "html",
- data: data,
- success: function (data) {
- if (data == 1) {
- agent_manager_remove_secondary_groups_ui();
- } else {
- console.error("Error in AJAX call to add secondary groups")
- }
- },
- error: function (data) {
- console.error("Fatal error in AJAX call to add secondary groups")
- }
- });
- }
-
- // Move from left input to right input
- function agent_manager_add_secondary_groups_ui () {
- $("#secondary_groups_selected option[value=0]").remove()
- $("#secondary_groups option:selected").each(function() {
- $(this).remove().appendTo("#secondary_groups_selected")
- })
- }
-
- // Move from right input to left input
- function agent_manager_remove_secondary_groups_ui () {
- // Remove the groups selected if success
- $("#secondary_groups_selected option:selected").each(function(){
- $(this).remove().appendTo("#secondary_groups")
- })
-
- // Add none if empty select
- if ($("#secondary_groups_selected option").length == 0) {
- $("#secondary_groups_selected").append($('