Merge branch 'ent-7025-operaciones-masivas-error' into 'develop'
Ent 7025 operaciones masivas error Closes pandora_enterprise#7025 See merge request artica/pandorafms!3833
This commit is contained in:
commit
ea7c7c88b2
pandora_console
godmode/massive
massive_add_action_alerts.phpmassive_add_alerts.phpmassive_add_profiles.phpmassive_copy_modules.phpmassive_delete_action_alerts.phpmassive_delete_agents.phpmassive_delete_alerts.phpmassive_delete_modules.phpmassive_delete_profiles.phpmassive_edit_agents.phpmassive_edit_modules.phpmassive_edit_plugins.phpmassive_enable_disable_alerts.phpmassive_operations.phpmassive_standby_alerts.php
include
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for Add actions alerts in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -195,9 +210,6 @@ $table->data[1][0] .= '</span>';
|
||||||
$table->data[1][1] = html_print_select([], 'id_agents[]', 0, false, __('Any'), '', true, true);
|
$table->data[1][1] = html_print_select([], 'id_agents[]', 0, false, __('Any'), '', true, true);
|
||||||
|
|
||||||
$table->data[2][0] = __('Alert templates');
|
$table->data[2][0] = __('Alert templates');
|
||||||
$table->data[2][0] .= '<span id="template_loading" class="invisible">';
|
|
||||||
$table->data[2][0] .= html_print_image('images/spinner.png', true);
|
|
||||||
$table->data[2][0] .= '</span>';
|
|
||||||
$table->data[2][1] = html_print_select([], 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0);
|
$table->data[2][1] = html_print_select([], 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0);
|
||||||
$table->data[2][2] = __('When select agents');
|
$table->data[2][2] = __('When select agents');
|
||||||
$table->data[2][2] .= '<br>';
|
$table->data[2][2] .= '<br>';
|
||||||
|
@ -251,36 +263,20 @@ $agents_with_templates_json = json_encode($agents_with_templates_json);
|
||||||
|
|
||||||
echo "<input type='hidden' id='hidden-agents_with_templates' value='$agents_with_templates_json'>";
|
echo "<input type='hidden' id='hidden-agents_with_templates' value='$agents_with_templates_json'>";
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('add', 'create', $table->width);
|
||||||
html_print_input_hidden('add', 1);
|
|
||||||
html_print_submit_button(__('Add'), 'go', false, 'class="sub add"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
|
|
||||||
|
ui_require_javascript_file('massive_operations');
|
||||||
ui_require_jquery_file('form');
|
ui_require_jquery_file('form');
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("#form_alerts").submit(function() {
|
|
||||||
var get_parameters_count = window.location.href.slice(
|
|
||||||
window.location.href.indexOf('?') + 1).split('&').length;
|
|
||||||
var post_parameters_count = $("#form_alerts").serializeArray().length;
|
|
||||||
|
|
||||||
var count_parameters =
|
|
||||||
get_parameters_count + post_parameters_count;
|
|
||||||
|
|
||||||
if (count_parameters > limit_parameters_massive) {
|
|
||||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
update_alerts();
|
update_alerts();
|
||||||
|
|
||||||
|
@ -319,7 +315,7 @@ $(document).ready (function () {
|
||||||
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
||||||
idAgents.push($(val).val());
|
idAgents.push($(val).val());
|
||||||
});
|
});
|
||||||
$("#template_loading").show();
|
showSpinner();
|
||||||
|
|
||||||
var $select_template = $("#id_alert_templates").disable ();
|
var $select_template = $("#id_alert_templates").disable ();
|
||||||
|
|
||||||
|
@ -340,7 +336,7 @@ $(document).ready (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#id_alert_templates").append (options);
|
$("#id_alert_templates").append (options);
|
||||||
$("#template_loading").hide ();
|
hideSpinner();
|
||||||
$select_template.enable ();
|
$select_template.enable ();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
|
|
|
@ -278,10 +278,8 @@ $table->data[2][3] = '';
|
||||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('add', 'add', $table->width);
|
||||||
html_print_input_hidden('add', 1);
|
|
||||||
html_print_submit_button(__('Add'), 'go', false, 'class="sub add"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
// TODO: Change to iu_print_error system.
|
// TODO: Change to iu_print_error system.
|
||||||
|
@ -299,7 +297,7 @@ ui_require_jquery_file('pandora.controls');
|
||||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("#form_alerts").submit(function() {
|
/* $("#form_alerts").submit(function() {
|
||||||
var get_parameters_count = window.location.href.slice(
|
var get_parameters_count = window.location.href.slice(
|
||||||
window.location.href.indexOf('?') + 1).split('&').length;
|
window.location.href.indexOf('?') + 1).split('&').length;
|
||||||
var post_parameters_count = $("#form_alerts").serializeArray().length;
|
var post_parameters_count = $("#form_alerts").serializeArray().length;
|
||||||
|
@ -311,7 +309,7 @@ $(document).ready (function () {
|
||||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
}); */
|
||||||
|
|
||||||
$("#checkbox-recursion").click(function () {
|
$("#checkbox-recursion").click(function () {
|
||||||
$("#id_group").trigger("change");
|
$("#id_group").trigger("change");
|
||||||
|
@ -321,7 +319,7 @@ $(document).ready (function () {
|
||||||
|
|
||||||
$("#id_group").change (function () {
|
$("#id_group").change (function () {
|
||||||
var $select = $("#id_agents").enable ();
|
var $select = $("#id_agents").enable ();
|
||||||
$("#agent_loading").show ();
|
showSpinner();
|
||||||
$("option", $select).remove ();
|
$("option", $select).remove ();
|
||||||
|
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post ("ajax.php",
|
||||||
|
@ -340,7 +338,7 @@ $(document).ready (function () {
|
||||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||||
});
|
});
|
||||||
$("#id_agents").append (options);
|
$("#id_agents").append (options);
|
||||||
$("#agent_loading").hide ();
|
hideSpinner();
|
||||||
$select.enable ();
|
$select.enable ();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
|
|
|
@ -1,20 +1,34 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for Add profiles in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'UM')) {
|
if (!check_acl($config['id_user'], 0, 'UM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
|
@ -219,14 +233,14 @@ $data[2] .= html_print_select(
|
||||||
'width: 100%'
|
'width: 100%'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Waiting spinner.
|
||||||
|
ui_print_spinner(__('Loading'));
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('create_profiles', 'update', $table->width);
|
||||||
html_print_input_hidden('create_profiles', 1);
|
|
||||||
html_print_submit_button(__('Create'), 'go', false, 'class="sub add"');
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for copy modules in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -294,22 +309,17 @@ echo '<legend><span>'.__('To agent(s)').'</span></legend>';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
attachActionButton('do_operation', 'copy', $table->width);
|
||||||
|
|
||||||
html_print_input_hidden('do_operation', 1);
|
|
||||||
html_print_submit_button(__('Copy'), 'go', false, 'class="sub wand"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
|
// Load JS files.
|
||||||
|
ui_require_javascript_file('pandora_modules');
|
||||||
ui_require_jquery_file('form');
|
ui_require_jquery_file('form');
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
var module_alerts;
|
var module_alerts;
|
||||||
|
@ -514,7 +524,7 @@ $(document).ready (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#manage_config_form").submit (function () {
|
$("#manage_config_form").submit (function () {
|
||||||
var get_parameters_count = window.location.href.slice(
|
/* var get_parameters_count = window.location.href.slice(
|
||||||
window.location.href.indexOf('?') + 1).split('&').length;
|
window.location.href.indexOf('?') + 1).split('&').length;
|
||||||
var post_parameters_count = $("#manage_config_form").serializeArray().length;
|
var post_parameters_count = $("#manage_config_form").serializeArray().length;
|
||||||
|
|
||||||
|
@ -522,9 +532,13 @@ $(document).ready (function () {
|
||||||
get_parameters_count + post_parameters_count;
|
get_parameters_count + post_parameters_count;
|
||||||
|
|
||||||
if (count_parameters > limit_parameters_massive) {
|
if (count_parameters > limit_parameters_massive) {
|
||||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
alert("
|
||||||
|
<?php
|
||||||
|
// echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.');
|
||||||
|
?>
|
||||||
|
");
|
||||||
return false;
|
return false;
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for delete action alerts in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -270,10 +285,8 @@ $agents_with_templates_json = json_encode($agents_with_templates_json);
|
||||||
|
|
||||||
echo "<input type='hidden' id='hidden-agents_with_templates' value='".$agents_with_templates_json."'>";
|
echo "<input type='hidden' id='hidden-agents_with_templates' value='".$agents_with_templates_json."'>";
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('delete', 'delete', $table->width);
|
||||||
html_print_input_hidden('delete', 1);
|
|
||||||
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
echo '<h3 class="error invisible" id="message"></h3>';
|
echo '<h3 class="error invisible" id="message"></h3>';
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for delete agents in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -186,11 +201,8 @@ $table->data[2][1] = html_print_select(
|
||||||
|
|
||||||
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
|
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
if (!is_central_policies_on_node()) {
|
if (is_central_policies_on_node() === false) {
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('delete', 'delete', $table->width);
|
||||||
html_print_input_hidden('delete', 1);
|
|
||||||
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
|
|
||||||
echo '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
@ -202,24 +214,8 @@ ui_require_jquery_file('pandora.controls');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("#form_agents").submit(function() {
|
|
||||||
var get_parameters_count = window.location.href.slice(
|
|
||||||
window.location.href.indexOf('?') + 1).split('&').length;
|
|
||||||
var post_parameters_count = $("#form_agents").serializeArray().length;
|
|
||||||
|
|
||||||
var count_parameters =
|
|
||||||
get_parameters_count + post_parameters_count;
|
|
||||||
|
|
||||||
if (count_parameters > limit_parameters_massive) {
|
|
||||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var recursion;
|
var recursion;
|
||||||
|
|
||||||
$("#checkbox-recursion").click(function () {
|
$("#checkbox-recursion").click(function () {
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for Delete alerts in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -321,10 +336,8 @@ $table->data[2][3] = html_print_select([], 'module[]', '', false, '', '', true,
|
||||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_alerts" >';
|
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_alerts" >';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
attachActionButton('delete', 'delete', $table->width);
|
||||||
html_print_input_hidden('delete', 1);
|
|
||||||
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
// Hack to translate text "none" in PHP to javascript
|
// Hack to translate text "none" in PHP to javascript
|
||||||
|
@ -371,7 +384,7 @@ $(document).ready (function () {
|
||||||
|
|
||||||
$("#id_group").change (function () {
|
$("#id_group").change (function () {
|
||||||
var $select = $("#id_agents").disable ();
|
var $select = $("#id_agents").disable ();
|
||||||
$("#agent_loading").show ();
|
showSpinner();
|
||||||
$("option", $select).remove ();
|
$("option", $select).remove ();
|
||||||
|
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post ("ajax.php",
|
||||||
|
@ -393,7 +406,7 @@ $(document).ready (function () {
|
||||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||||
});
|
});
|
||||||
$("#id_agents").append (options);
|
$("#id_agents").append (options);
|
||||||
$("#agent_loading").hide ();
|
hideSpinner();
|
||||||
$select.enable ();
|
$select.enable ();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for delete modules in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -563,10 +578,8 @@ $table->data['form_agents_3'][3] = html_print_select(
|
||||||
echo '<form method="post" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
|
echo '<form method="post" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('delete', 'delete', $table->width);
|
||||||
html_print_input_hidden('delete', 1);
|
|
||||||
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
|
@ -575,6 +588,9 @@ ui_require_jquery_file('form');
|
||||||
// Hack to translate text "none" in PHP to javascript
|
// Hack to translate text "none" in PHP to javascript
|
||||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||||
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
|
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
|
||||||
|
|
||||||
|
// Load JS files.
|
||||||
|
ui_require_javascript_file('pandora_modules');
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
|
|
||||||
if ($selection_mode == 'modules') {
|
if ($selection_mode == 'modules') {
|
||||||
|
@ -586,13 +602,10 @@ if ($selection_mode == 'modules') {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
|
|
||||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
$("#checkbox-select_all_modules").change(function() {
|
$("#checkbox-select_all_modules").change(function() {
|
||||||
if( $('#checkbox-select_all_modules').prop('checked')) {
|
if( $('#checkbox-select_all_modules').prop('checked')) {
|
||||||
$("#module_name option").prop('selected', 'selected');
|
$("#module_name option").prop('selected', 'selected');
|
||||||
|
@ -689,7 +702,7 @@ $(document).ready (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#module_loading").show ();
|
showSpinner();
|
||||||
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
|
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
|
||||||
$("#module_name").attr ("disabled", "disabled")
|
$("#module_name").attr ("disabled", "disabled")
|
||||||
$("#module_name option[value!=0]").remove ();
|
$("#module_name option[value!=0]").remove ();
|
||||||
|
@ -702,7 +715,7 @@ $(document).ready (function () {
|
||||||
.html(value["nombre"]);
|
.html(value["nombre"]);
|
||||||
$("#module_name").append (option);
|
$("#module_name").append (option);
|
||||||
});
|
});
|
||||||
$("#module_loading").hide();
|
hideSpinner();
|
||||||
$("#module_name").removeAttr ("disabled");
|
$("#module_name").removeAttr ("disabled");
|
||||||
//Filter modules. Call the function when the select is fully loaded.
|
//Filter modules. Call the function when the select is fully loaded.
|
||||||
var textNoData = "<?php echo __('None'); ?>";
|
var textNoData = "<?php echo __('None'); ?>";
|
||||||
|
@ -832,21 +845,7 @@ $(document).ready (function () {
|
||||||
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
selector = $("#form_edit input[name=selection_mode]:checked").val();
|
||||||
$("#id_agents").trigger("change");
|
$("#id_agents").trigger("change");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#form_modules").submit(function() {
|
|
||||||
var get_parameters_count = window.location.href.slice(
|
|
||||||
window.location.href.indexOf('?') + 1).split('&').length;
|
|
||||||
var post_parameters_count = $("#form_modules").serializeArray().length;
|
|
||||||
|
|
||||||
var count_parameters =
|
|
||||||
get_parameters_count + post_parameters_count;
|
|
||||||
|
|
||||||
if (count_parameters > limit_parameters_massive) {
|
|
||||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if("<?php echo $delete; ?>"){
|
if("<?php echo $delete; ?>"){
|
||||||
if("<?php echo $selection_mode; ?>" == 'agents'){
|
if("<?php echo $selection_mode; ?>" == 'agents'){
|
||||||
$("#groups_select").trigger("change");
|
$("#groups_select").trigger("change");
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for delete profiles in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||||
|
@ -199,16 +214,13 @@ array_push($table->data, $data);
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
attachActionButton('delete_profiles', 'delete', $table->width);
|
||||||
html_print_input_hidden('delete_profiles', 1);
|
|
||||||
html_print_submit_button(__('Delete'), 'del', false, 'class="sub delete"');
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
unset($table);
|
unset($table);
|
||||||
|
|
||||||
// TODO: Change to iu_print_error system
|
// TODO: Change to iu_print_error system.
|
||||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
|
|
||||||
ui_require_jquery_file('form');
|
ui_require_jquery_file('form');
|
||||||
|
@ -224,7 +236,7 @@ $(document).ready (function () {
|
||||||
var $select = $("#users_id").disable ();
|
var $select = $("#users_id").disable ();
|
||||||
$("#users_loading").show ();
|
$("#users_loading").show ();
|
||||||
$("option", $select).remove ();
|
$("option", $select).remove ();
|
||||||
console.log($("#groups_id").val());
|
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post ("ajax.php",
|
||||||
{"page" : "godmode/massive/massive_delete_profiles",
|
{"page" : "godmode/massive/massive_delete_profiles",
|
||||||
"get_users" : 1,
|
"get_users" : 1,
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for edit agents in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -327,13 +342,16 @@ if ($update_agents) {
|
||||||
// Update Custom Fields
|
// Update Custom Fields
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$info[$field['id_field']] = $field['name'];
|
$info[$field['id_field']] = $field['name'];
|
||||||
if (get_parameter_post('customvalue_'.$field['id_field'], '') != '') {
|
$value = get_parameter('customvalue_'.$field['id_field']);
|
||||||
|
if (empty($value) === false) {
|
||||||
$key = $field['id_field'];
|
$key = $field['id_field'];
|
||||||
$value = get_parameter_post('customvalue_'.$field['id_field'], '');
|
$old_value = db_get_all_rows_filter(
|
||||||
|
'tagent_custom_data',
|
||||||
$old_value = db_get_all_rows_filter('tagent_custom_data', ['id_agent' => $id_agent, 'id_field' => $key]);
|
[
|
||||||
|
'id_agent' => $id_agent,
|
||||||
|
'id_field' => $key,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
if ($old_value === false) {
|
if ($old_value === false) {
|
||||||
// Create custom field if not exist
|
// Create custom field if not exist
|
||||||
|
@ -346,14 +364,16 @@ if ($update_agents) {
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$result = db_process_sql_update(
|
if ($old_value[0]['description'] !== $value) {
|
||||||
'tagent_custom_data',
|
$result = db_process_sql_update(
|
||||||
['description' => $value],
|
'tagent_custom_data',
|
||||||
[
|
['description' => $value],
|
||||||
'id_field' => $key,
|
[
|
||||||
'id_agent' => $id_agent,
|
'id_field' => $key,
|
||||||
]
|
'id_agent' => $id_agent,
|
||||||
);
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,7 +393,7 @@ if ($update_agents) {
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result !== false,
|
$result !== false,
|
||||||
__('Agents updated successfully').'('.$n_edited.')',
|
__('Agents updated successfully (%d)', $n_edited),
|
||||||
__('Agents cannot be updated (maybe there was no field to update)')
|
__('Agents cannot be updated (maybe there was no field to update)')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -830,19 +850,16 @@ if (!empty($fields)) {
|
||||||
|
|
||||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
||||||
|
|
||||||
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
|
|
||||||
html_print_input_hidden('update_agents', 1);
|
|
||||||
html_print_input_hidden('id_agente', $id_agente);
|
html_print_input_hidden('id_agente', $id_agente);
|
||||||
|
|
||||||
echo '</div>';
|
if (is_central_policies_on_node() === false) {
|
||||||
|
attachActionButton('update_agents', 'update', $table->width);
|
||||||
|
}
|
||||||
|
|
||||||
// Shown and hide div
|
// Shown and hide div
|
||||||
echo '</div></form>';
|
echo '</div></form>';
|
||||||
|
|
||||||
ui_require_jquery_file('form');
|
ui_require_jquery_file('form');
|
||||||
ui_require_jquery_file('pandora.controls');
|
|
||||||
|
|
||||||
|
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
ui_require_jquery_file('ajaxqueue');
|
ui_require_jquery_file('ajaxqueue');
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for edit modules in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -280,9 +295,6 @@ $table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-bl
|
||||||
|
|
||||||
$table->rowclass['form_modules_1'] = 'select_modules_row';
|
$table->rowclass['form_modules_1'] = 'select_modules_row';
|
||||||
$table->data['form_modules_1'][0] = __('Module type');
|
$table->data['form_modules_1'][0] = __('Module type');
|
||||||
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
|
|
||||||
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
|
|
||||||
$table->data['form_modules_1'][0] .= '</span>';
|
|
||||||
|
|
||||||
$types[0] = __('All');
|
$types[0] = __('All');
|
||||||
$table->colspan['form_modules_1'][1] = 2;
|
$table->colspan['form_modules_1'][1] = 2;
|
||||||
|
@ -1161,30 +1173,37 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($id_plugin)) {
|
if (empty($id_plugin) === false) {
|
||||||
$preload = db_get_sql("SELECT description FROM tplugin WHERE id = $id_plugin");
|
$preload = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT description FROM tplugin WHERE id = %s',
|
||||||
|
$id_plugin
|
||||||
|
)
|
||||||
|
);
|
||||||
$preload = io_safe_output($preload);
|
$preload = io_safe_output($preload);
|
||||||
$preload = str_replace("\n", '<br>', $preload);
|
$preload = str_replace("\n", '<br>', $preload);
|
||||||
} else {
|
} else {
|
||||||
$preload = '';
|
$preload = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data['edit21'][1] = '<span style="font-weight: normal;" id="plugin_description">'.$preload.'</span>';
|
$table->data['edit21'][1] = sprintf(
|
||||||
|
'<span style="font-weight: normal;" id="plugin_description">%s</span>',
|
||||||
|
$preload
|
||||||
|
);
|
||||||
|
|
||||||
|
echo '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_modules" id="form_edit">';
|
||||||
echo '<form method="post" '.'action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_modules" '.'id="form_edit">';
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
attachActionButton('update', 'update', $table->width);
|
||||||
html_print_input_hidden('update', 1);
|
|
||||||
html_print_submit_button(__('Update'), 'go', false, 'class="sub upd"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
// Hack to translate text "none" in PHP to javascript
|
// Hack to translate text "none" in PHP to javascript.
|
||||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||||
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
|
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
|
||||||
|
// Load JS files.
|
||||||
|
ui_require_javascript_file('pandora_modules');
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
|
|
||||||
if ($selection_mode == 'modules') {
|
if ($selection_mode == 'modules') {
|
||||||
|
@ -1196,27 +1215,11 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">flag_load_plugin_component = false;</script>
|
|
||||||
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
flag_load_plugin_component = false;
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("#form_edit").submit(function() {
|
|
||||||
var get_parameters_count = window.location.href.slice(
|
|
||||||
window.location.href.indexOf('?') + 1).split('&').length;
|
|
||||||
var post_parameters_count = $("#form_edit").serializeArray().length;
|
|
||||||
|
|
||||||
var count_parameters =
|
|
||||||
get_parameters_count + post_parameters_count;
|
|
||||||
|
|
||||||
if (count_parameters > limit_parameters_massive) {
|
|
||||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#checkbox-select_all_modules").change(function() {
|
$("#checkbox-select_all_modules").change(function() {
|
||||||
if( $('#checkbox-select_all_modules').prop('checked')) {
|
if( $('#checkbox-select_all_modules').prop('checked')) {
|
||||||
|
@ -1340,7 +1343,7 @@ $(document).ready (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#module_loading").show ();
|
showSpinner();
|
||||||
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
|
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
|
||||||
$("#module_name").attr ("disabled", "disabled")
|
$("#module_name").attr ("disabled", "disabled")
|
||||||
$("#module_name option[value!=0]").remove ();
|
$("#module_name option[value!=0]").remove ();
|
||||||
|
@ -1351,7 +1354,7 @@ $(document).ready (function () {
|
||||||
option = $("<option></option>").attr ("value", value["nombre"]).html (value["nombre"]);
|
option = $("<option></option>").attr ("value", value["nombre"]).html (value["nombre"]);
|
||||||
$("#module_name").append (option);
|
$("#module_name").append (option);
|
||||||
});
|
});
|
||||||
$("#module_loading").hide ();
|
hideSpinner();
|
||||||
$("#module_name").removeAttr ("disabled");
|
$("#module_name").removeAttr ("disabled");
|
||||||
//Filter modules. Call the function when the select is fully loaded.
|
//Filter modules. Call the function when the select is fully loaded.
|
||||||
var textNoData = "<?php echo __('None'); ?>";
|
var textNoData = "<?php echo __('None'); ?>";
|
||||||
|
@ -1864,7 +1867,6 @@ function changePluginSelect() {
|
||||||
$('#hidden-macros').val(data['base64']);
|
$('#hidden-macros').val(data['base64']);
|
||||||
|
|
||||||
jQuery.each (data['array'], function (i, macro) {
|
jQuery.each (data['array'], function (i, macro) {
|
||||||
console.log(macro);
|
|
||||||
if (macro['desc'] != '') {
|
if (macro['desc'] != '') {
|
||||||
$("#delete_table-edit21").after("<tr class='macro_field' id='delete_table-edit"+(80+parseInt(i))+"'><td style='font-weight:bold;'>"+macro['desc']+"<input type='hidden' name='desc"+macro['macro']+"' value='"+macro['desc']+"'></td><td><input type='text' name='"+macro['macro']+"'></td></tr>");
|
$("#delete_table-edit21").after("<tr class='macro_field' id='delete_table-edit"+(80+parseInt(i))+"'><td style='font-weight:bold;'>"+macro['desc']+"<input type='hidden' name='desc"+macro['macro']+"' value='"+macro['desc']+"'></td><td><input type='text' name='"+macro['macro']+"'></td></tr>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for edit plugins in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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();
|
||||||
|
@ -371,10 +386,7 @@ echo '<form method="POST" id="form-massive_plugin_edition"
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo "<div style='text-align: right; width: ".$table->width."'>";
|
attachActionButton('update', 'update', $table->width);
|
||||||
html_print_input_hidden('update', 1);
|
|
||||||
html_print_submit_button(__('Update'), 'upd-btn', false, 'class="sub upd"');
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
@ -405,35 +417,6 @@ echo '</form>';
|
||||||
canSubmit = val;
|
canSubmit = val;
|
||||||
$submitButton.prop('disabled', !val);
|
$submitButton.prop('disabled', !val);
|
||||||
}
|
}
|
||||||
|
|
||||||
var showSpinner = function () {
|
|
||||||
var $loadingSpinner = $pluginsSelect.siblings('img#loading_spinner');
|
|
||||||
|
|
||||||
if ($loadingSpinner.length > 0) {
|
|
||||||
// Display inline instead using the show function
|
|
||||||
// cause its absolute positioning.
|
|
||||||
$loadingSpinner.css('display', 'inline');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$loadingSpinner = $('<img />');
|
|
||||||
|
|
||||||
$loadingSpinner
|
|
||||||
.prop('id', 'loading_spinner')
|
|
||||||
.css('padding-left', '5px')
|
|
||||||
.css('position', 'absolute')
|
|
||||||
.css('top', $pluginsSelect.position().top + 'px')
|
|
||||||
.prop('src', "<?php echo $config['homeurl'].'/'; ?>images/spinner.gif");
|
|
||||||
|
|
||||||
$pluginsSelect.parent().append($loadingSpinner);
|
|
||||||
}
|
|
||||||
|
|
||||||
var hideSpinner = function () {
|
|
||||||
var $loadingSpinner = $pluginsSelect.siblings('img#loading_spinner');
|
|
||||||
|
|
||||||
if ($loadingSpinner.length > 0)
|
|
||||||
$loadingSpinner.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
var clearModulePluginMacrosValues = function () {
|
var clearModulePluginMacrosValues = function () {
|
||||||
$('input.plugin-macro')
|
$('input.plugin-macro')
|
||||||
|
@ -864,6 +847,7 @@ echo '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorHandler = function (error) {
|
var errorHandler = function (error) {
|
||||||
|
hideSpinner();
|
||||||
console.log("<?php echo __('Error'); ?>: " + error.message);
|
console.log("<?php echo __('Error'); ?>: " + error.message);
|
||||||
// alert("<?php echo __('Error'); ?>: " + err.message);
|
// alert("<?php echo __('Error'); ?>: " + err.message);
|
||||||
|
|
||||||
|
@ -927,7 +911,10 @@ echo '</form>';
|
||||||
$agentModulesRow.show();
|
$agentModulesRow.show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("<?php echo __('There are no modules using this plugin'); ?>");
|
var contents = {};
|
||||||
|
contents.html = '<?php echo __('There are no modules using this plugin'); ?>';
|
||||||
|
contents.title = '<?php echo __('Massive operations'); ?>';
|
||||||
|
showMassiveModal(contents);
|
||||||
|
|
||||||
// Abort the another call
|
// Abort the another call
|
||||||
if (typeof pluginXHR !== 'undefined') {
|
if (typeof pluginXHR !== 'undefined') {
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for enable/disable alerts in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Main view for Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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.
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -26,6 +41,7 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
require_once 'include/functions_agents.php';
|
require_once 'include/functions_agents.php';
|
||||||
require_once 'include/functions_alerts.php';
|
require_once 'include/functions_alerts.php';
|
||||||
require_once 'include/functions_modules.php';
|
require_once 'include/functions_modules.php';
|
||||||
|
require_once 'include/functions_massive_operations.php';
|
||||||
|
|
||||||
enterprise_include('godmode/massive/massive_operations.php');
|
enterprise_include('godmode/massive/massive_operations.php');
|
||||||
|
|
||||||
|
@ -316,35 +332,49 @@ $submit_template_enabled = get_parameter('id_alert_template_enabled');
|
||||||
$submit_template_not_standby = get_parameter('id_alert_template_not_standby');
|
$submit_template_not_standby = get_parameter('id_alert_template_not_standby');
|
||||||
$submit_template_standby = get_parameter('id_alert_template_standby');
|
$submit_template_standby = get_parameter('id_alert_template_standby');
|
||||||
$submit_add = get_parameter('crtbutton');
|
$submit_add = get_parameter('crtbutton');
|
||||||
|
// Waiting spinner.
|
||||||
|
ui_print_spinner(__('Loading'));
|
||||||
|
// Modal for show messages.
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'id' => 'massive_modal',
|
||||||
|
'content' => '',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Load common JS files.
|
||||||
|
ui_require_javascript_file('massive_operations');
|
||||||
|
|
||||||
echo '<div id="loading" display="none">';
|
|
||||||
echo html_print_image('images/wait.gif', true, ['border' => '0']).'<br />';
|
|
||||||
echo '<strong>'.__('Please wait...').'</strong>';
|
|
||||||
echo '</div>';
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$('#manage_config_form').submit( function() {
|
$('#button-go').click( function(e) {
|
||||||
confirm_status =
|
var limitParametersMassive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||||
confirm("<?php echo __('Are you sure?'); ?>");
|
var thisForm = e.target.form.id;
|
||||||
if (confirm_status)
|
|
||||||
$("#loading").css("display", "");
|
var get_parameters_count = window.location.href.slice(
|
||||||
else
|
window.location.href.indexOf('?') + 1).split('&').length;
|
||||||
|
var post_parameters_count = $('#'+thisForm).serializeArray().length;
|
||||||
|
var totalCount = get_parameters_count + post_parameters_count;
|
||||||
|
|
||||||
|
var contents = {};
|
||||||
|
|
||||||
|
contents.html = '<?php echo __('No changes have been made because they exceed the maximum allowed (%d). Make fewer changes or contact the administrator.', $config['limit_parameters_massive']); ?>';
|
||||||
|
contents.title = '<?php echo __('Massive operations'); ?>';
|
||||||
|
contents.question = '<?php echo __('Are you sure?'); ?>';
|
||||||
|
contents.ok = '<?php echo __('OK'); ?>';
|
||||||
|
contents.cancel = '<?php echo __('Cancel'); ?>';
|
||||||
|
|
||||||
|
var operation = massiveOperationValidation(contents, totalCount, limitParametersMassive, thisForm);
|
||||||
|
|
||||||
|
if (operation == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[id^=form]').submit( function() {
|
|
||||||
confirm_status =
|
|
||||||
confirm("<?php echo __('Are you sure?'); ?>");
|
|
||||||
if (confirm_status)
|
|
||||||
$("#loading").css("display", "");
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#loading").css("display", "none");
|
|
||||||
});
|
});
|
||||||
|
/* ]]> */
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View for delete action alerts in Massive Operations
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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 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
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
@ -285,7 +300,7 @@ $(document).ready (function () {
|
||||||
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
||||||
idAgents.push($(val).val());
|
idAgents.push($(val).val());
|
||||||
});
|
});
|
||||||
$("#template_loading").show();
|
showSpinner();
|
||||||
|
|
||||||
var $select_template = $("#id_alert_templates").disable ();
|
var $select_template = $("#id_alert_templates").disable ();
|
||||||
$("option", $select_template).remove ();
|
$("option", $select_template).remove ();
|
||||||
|
@ -302,7 +317,7 @@ $(document).ready (function () {
|
||||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||||
});
|
});
|
||||||
$("#id_alert_templates").append (options);
|
$("#id_alert_templates").append (options);
|
||||||
$("#template_loading").hide ();
|
hideSpinner();
|
||||||
$select_template.enable ();
|
$select_template.enable ();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Massive Operations Functions
|
||||||
|
*
|
||||||
|
* @category Configuration
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Massive Operations
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a action button for submit the form.
|
||||||
|
*
|
||||||
|
* @param string $action Action to send in form.
|
||||||
|
* @param string $buttonAction Action of the button: Create, Update or Delete.
|
||||||
|
* @param string $tableWidth Set the table width for the container.
|
||||||
|
* @param boolean $return If true, return a formed string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function attachActionButton(
|
||||||
|
string $action,
|
||||||
|
string $buttonAction,
|
||||||
|
string $tableWidth,
|
||||||
|
bool $return=false
|
||||||
|
) {
|
||||||
|
switch ($buttonAction) {
|
||||||
|
case 'add':
|
||||||
|
$caption = 'Add';
|
||||||
|
$class = 'add';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'copy':
|
||||||
|
$caption = 'Copy';
|
||||||
|
$class = 'wand';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'create':
|
||||||
|
$caption = 'Create';
|
||||||
|
$class = 'upd';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'update':
|
||||||
|
$caption = 'Update';
|
||||||
|
$class = 'upd';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'delete':
|
||||||
|
$caption = 'Delete';
|
||||||
|
$class = 'delete';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do none.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'style' => sprintf('width: %s', $tableWidth),
|
||||||
|
'content' => html_print_input_hidden(
|
||||||
|
$action,
|
||||||
|
1
|
||||||
|
).html_print_button(
|
||||||
|
__($caption),
|
||||||
|
'go',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
sprintf('class="sub %s"', $class),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
$return
|
||||||
|
);
|
||||||
|
}
|
|
@ -6301,3 +6301,56 @@ function ui_print_reveal_password(string $name, bool $return=false)
|
||||||
|
|
||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a spinner box for waiting times
|
||||||
|
* TIP: It's made for Massive Operations, but it migth used in entire project.
|
||||||
|
*
|
||||||
|
* @param string $text Text for show in spinner. English term Loading for default.
|
||||||
|
* @param boolean $return If true, return the string with the formed element.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function ui_print_spinner(string $text='Loading', bool $return=false)
|
||||||
|
{
|
||||||
|
$output = '';
|
||||||
|
|
||||||
|
$output .= '<center>';
|
||||||
|
|
||||||
|
$output .= html_print_div(
|
||||||
|
[
|
||||||
|
'id' => 'loading_spinner',
|
||||||
|
'class' => 'white_box invisible',
|
||||||
|
'content' => '<span style="font-size:25px;">'.$text.'...</span>'.html_print_image(
|
||||||
|
'images/spinner.gif',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'border' => '0',
|
||||||
|
'width' => '25px',
|
||||||
|
'heigth' => '25px',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= '</center>';
|
||||||
|
|
||||||
|
$output .= '
|
||||||
|
<script type="text/javascript">
|
||||||
|
function hideSpinner() {
|
||||||
|
document.getElementById("loading_spinner").classList.add("invisible");
|
||||||
|
}
|
||||||
|
function showSpinner() {
|
||||||
|
document.getElementById("loading_spinner").classList.remove("invisible");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
|
||||||
|
if ($return === true) {
|
||||||
|
return $output;
|
||||||
|
} else {
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/** global $ */
|
||||||
|
function massiveOperationValidation(contents, totalCount, limit, thisForm) {
|
||||||
|
var output = false;
|
||||||
|
|
||||||
|
// If the amount of changes exceed the limit, the operation stops.
|
||||||
|
if (totalCount > limit) {
|
||||||
|
showMassiveModal(contents);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
confirmDialog({
|
||||||
|
title: contents.title,
|
||||||
|
message: contents.question,
|
||||||
|
ok: contents.ok,
|
||||||
|
cancel: contents.cancel,
|
||||||
|
onAccept: function() {
|
||||||
|
showSpinner();
|
||||||
|
output = true;
|
||||||
|
$("#" + thisForm).submit();
|
||||||
|
},
|
||||||
|
onDeny: function() {
|
||||||
|
hideSpinner();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMassiveModal(contents) {
|
||||||
|
$("#massive_modal")
|
||||||
|
.empty()
|
||||||
|
.html(contents.html);
|
||||||
|
// Set the title.
|
||||||
|
$("#massive_modal").prop("title", contents.title);
|
||||||
|
// Build the dialog for show the mesage.
|
||||||
|
$("#massive_modal").dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
width: 800,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: "OK",
|
||||||
|
click: function() {
|
||||||
|
hideSpinner();
|
||||||
|
$(this).dialog("close");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
},
|
||||||
|
closeOnEscape: false,
|
||||||
|
open: function(event, ui) {
|
||||||
|
$(".ui-dialog-titlebar-close").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
function showMassiveOperationMessage(message) {
|
||||||
|
$("#massive_modal")
|
||||||
|
.empty()
|
||||||
|
.html(message);
|
||||||
|
|
||||||
|
$("#massive_modal").prop("title", "Massive operations");
|
||||||
|
|
||||||
|
$("#massive_modal").dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
width: 800,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: "OK",
|
||||||
|
click: function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
hideSpinner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
},
|
||||||
|
closeOnEscape: false,
|
||||||
|
open: function(event, ui) {
|
||||||
|
$(".ui-dialog-titlebar-close").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
*/
|
|
@ -809,6 +809,7 @@ p.center {
|
||||||
cursor: help;
|
cursor: help;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Legacy spinner */
|
||||||
#loading {
|
#loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
|
@ -819,6 +820,19 @@ p.center {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* New standard spinner */
|
||||||
|
#loading_spinner {
|
||||||
|
position: fixed;
|
||||||
|
margin-left: 30%;
|
||||||
|
text-align: center;
|
||||||
|
top: 50%;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 2px solid #82b92e;
|
||||||
|
box-shadow: 2px 2px 2px #9dbba1;
|
||||||
|
padding: 20px;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
.tactical_set legend {
|
.tactical_set legend {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: #3f3f3f;
|
color: #3f3f3f;
|
||||||
|
|
Loading…
Reference in New Issue