mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Improved the code readability and added support to retrieve the agents from the new table of the metaconsole
This commit is contained in:
parent
1ae9ee0810
commit
afc54630a8
@ -183,7 +183,7 @@ if (defined('METACONSOLE')) {
|
|||||||
$table->rowstyle["all_2"] = 'display: none;';
|
$table->rowstyle["all_2"] = 'display: none;';
|
||||||
$table->data["all_2"][0] = __('Servers');
|
$table->data["all_2"][0] = __('Servers');
|
||||||
$table->data["all_2"][1] = html_meta_print_select_servers(false,
|
$table->data["all_2"][1] = html_meta_print_select_servers(false,
|
||||||
false, 'servers', '', '', '', 0, true);
|
false, 'servers', '', 'metaconsole_init();', '', 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -210,8 +210,12 @@ $table->data["all_one_item_per_agent"][1] .= html_print_input_hidden(
|
|||||||
|
|
||||||
$table->rowstyle["all_4"] = 'display: none;';
|
$table->rowstyle["all_4"] = 'display: none;';
|
||||||
$table->data["all_4"][0] = __('Agents');
|
$table->data["all_4"][0] = __('Agents');
|
||||||
$table->data["all_4"][1] = html_print_select(
|
|
||||||
agents_get_group_agents(0, false, "none", false, true),
|
$agents_list = array();
|
||||||
|
if (!defined('METACONSOLE'))
|
||||||
|
$agents_list = agents_get_group_agents(0, false, "none", false, true);
|
||||||
|
|
||||||
|
$table->data["all_4"][1] = html_print_select($agents_list,
|
||||||
'id_agents[]', 0, false, '', '', true, true);
|
'id_agents[]', 0, false, '', '', true, true);
|
||||||
$table->data["all_4"][2] = ' <span style="vertical-align: top;">' .
|
$table->data["all_4"][2] = ' <span style="vertical-align: top;">' .
|
||||||
__('Modules') . '</span>';
|
__('Modules') . '</span>';
|
||||||
@ -272,7 +276,7 @@ else {
|
|||||||
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';
|
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defined("METACONSOLE")){
|
if (defined("METACONSOLE")) {
|
||||||
echo "<div class='title_tactical' style='margin-top: 15px; '>" . __('Wizard') . "</div>";
|
echo "<div class='title_tactical' style='margin-top: 15px; '>" . __('Wizard') . "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,16 +300,14 @@ echo '<span id="none_text" style="display: none;">' . __('None') . '</span>';
|
|||||||
echo '<span id="loading_text" style="display: none;">' . __('Loading...') . '</span>';
|
echo '<span id="loading_text" style="display: none;">' . __('Loading...') . '</span>';
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var show_only_enabled_modules = true;
|
|
||||||
|
|
||||||
<?php
|
var metaconsole_enabled = <?php echo json_encode(defined('METACONSOLE')); ?>;
|
||||||
if (defined('METACONSOLE')) {
|
var show_only_enabled_modules = true;
|
||||||
echo 'var url_ajax = "../../ajax.php";';
|
var url_ajax = "ajax.php";
|
||||||
|
|
||||||
|
if (metaconsole_enabled) {
|
||||||
|
url_ajax = "../../ajax.php";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
echo 'var url_ajax = "ajax.php";';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
hidden_rows();
|
hidden_rows();
|
||||||
@ -314,40 +316,42 @@ $(document).ready (function () {
|
|||||||
selected = $("#process_value").val();
|
selected = $("#process_value").val();
|
||||||
|
|
||||||
if (selected == <?php echo PROCESS_VALUE_NONE; ?>) {
|
if (selected == <?php echo PROCESS_VALUE_NONE; ?>) {
|
||||||
$("tr", "#wizard_table").filter(function () {return /^.*modulegraph_simplevalue.*/.test(this.id); }).hide();
|
$("tr", "#wizard_table").filter(function () {
|
||||||
|
return /^.*modulegraph_simplevalue.*/.test(this.id);
|
||||||
|
}).hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("tr", "#wizard_table").filter(function () {return /^.*modulegraph_simplevalue.*/.test(this.id); }).show();
|
$("tr", "#wizard_table").filter(function () {
|
||||||
|
return /^.*modulegraph_simplevalue.*/.test(this.id);
|
||||||
|
}).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#groups").change (function () {
|
$("#groups").change (function () {
|
||||||
$('#id_agents').attr('disabled', true);
|
$('#id_agents')
|
||||||
$('#id_agents').empty ();
|
.attr('disabled', true)
|
||||||
$('#id_agents').append ($('<option></option>').html($("#loading_text").html()));
|
.empty ()
|
||||||
$('#id_agents').css ("width", "auto");
|
.css ("width", "auto")
|
||||||
$('#id_agents').css ("max-width", "");
|
.css ("max-width", "")
|
||||||
|
.append ($('<option></option>').html($("#loading_text").html()));
|
||||||
|
|
||||||
var data_params = {"page": "include/ajax/agent",
|
var data_params = {
|
||||||
"get_agents_group": 1,
|
page: "include/ajax/agent",
|
||||||
"id_group": $("#groups").val(),
|
get_agents_group: 1,
|
||||||
<?php
|
id_group: $("#groups").val(),
|
||||||
if (defined('METACONSOLE')) {
|
mode: "json"
|
||||||
echo '"id_server": $("#servers").val(),' . "\n";
|
};
|
||||||
}
|
|
||||||
?>
|
if (metaconsole_enabled)
|
||||||
"mode": "json"
|
data_params.id_server = $("#servers").val();
|
||||||
};
|
|
||||||
|
|
||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: data_params,
|
data: data_params,
|
||||||
async: false,
|
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: url_ajax,
|
url: url_ajax,
|
||||||
timeout: 10000,
|
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$('#id_agents').empty ();
|
$('#id_agents').empty();
|
||||||
|
|
||||||
if (isEmptyObject(data)) {
|
if (isEmptyObject(data)) {
|
||||||
var noneText = $("#none_text").html(); //Trick for catch the translate text.
|
var noneText = $("#none_text").html(); //Trick for catch the translate text.
|
||||||
@ -361,35 +365,32 @@ $(document).ready (function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#id_agents').css ("width", "auto");
|
|
||||||
$('#id_agents').css ("max-width", "");
|
|
||||||
|
|
||||||
|
|
||||||
$('#id_agents').removeAttr('disabled');
|
$('#id_agents').removeAttr('disabled');
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#id_agents").change ( function() {
|
$("#id_agents").change ( function() {
|
||||||
if ($("#hidden-item_per_agent_test").val() == 0)
|
if ($("#hidden-item_per_agent_test").val() == 0) {
|
||||||
agent_changed_by_multiple_agents(
|
var options = {};
|
||||||
<?php
|
|
||||||
if (defined('METACONSOLE')) {
|
if (metaconsole_enabled) {
|
||||||
echo "{'data': {'id_server': 'servers', 'metaconsole': 1, 'homedir': '../../'}}";
|
options = {
|
||||||
|
'data': {
|
||||||
|
'id_server': 'servers',
|
||||||
|
'metaconsole': 1,
|
||||||
|
'homedir': '../../'
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
);
|
agent_changed_by_multiple_agents(options);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php
|
if (metaconsole_enabled) {
|
||||||
if (defined('METACONSOLE')) {
|
metaconsole_init();
|
||||||
echo "metaconsole_init();";
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
$("select[name='kind_relationship']").change(function() {
|
$("select[name='kind_relationship']").change(function() {
|
||||||
|
|
||||||
@ -500,7 +501,7 @@ function item_per_agent_change(itemPerAgent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function metaconsole_init() {
|
function metaconsole_init() {
|
||||||
$("#groups").trigger('change');
|
$("#groups").change();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user