mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
bulk operations agents in meta #8290
This commit is contained in:
parent
42d1ccbc13
commit
87bfd08bb9
@ -14,7 +14,7 @@
|
|||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -29,7 +29,7 @@
|
|||||||
// Begin.
|
// Begin.
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if ((bool) check_acl($config['id_user'], 0, 'AW') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
'Trying to access massive agent deletion section'
|
'Trying to access massive agent deletion section'
|
||||||
@ -38,10 +38,11 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once 'include/functions_agents.php';
|
require_once $config['homedir'].'/include/functions_agents.php';
|
||||||
require_once 'include/functions_alerts.php';
|
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||||
require_once 'include/functions_modules.php';
|
require_once $config['homedir'].'/include/functions_modules.php';
|
||||||
require_once 'include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
|
require_once $config['homedir'].'/include/functions_massive_operations.php';
|
||||||
|
|
||||||
|
|
||||||
function process_manage_delete($id_agents)
|
function process_manage_delete($id_agents)
|
||||||
@ -99,19 +100,50 @@ $recursion = get_parameter('recursion');
|
|||||||
|
|
||||||
$delete = (bool) get_parameter_post('delete');
|
$delete = (bool) get_parameter_post('delete');
|
||||||
|
|
||||||
if ($delete) {
|
if ($delete === true) {
|
||||||
$result = process_manage_delete($id_agents);
|
$result = process_manage_delete($id_agents);
|
||||||
|
|
||||||
$info = '{"Agent":"'.implode(',', $id_agents).'"}';
|
$info = '{"Agent":"'.implode(',', $id_agents).'"}';
|
||||||
if ($result) {
|
if ($result === true) {
|
||||||
db_pandora_audit('Massive management', 'Delete agent ', false, false, $info);
|
db_pandora_audit(
|
||||||
|
'Massive management',
|
||||||
|
'Delete agent ',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to delete agent', false, false, $info);
|
db_pandora_audit(
|
||||||
|
'Massive management',
|
||||||
|
'Fail try to delete agent',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$groups = users_get_groups();
|
|
||||||
|
|
||||||
|
if (is_metaconsole() === false && is_management_allowed() === false) {
|
||||||
|
if (\is_metaconsole() === false) {
|
||||||
|
$url_link = '<a target="_blank" href="'.ui_get_meta_url($url).'">';
|
||||||
|
$url_link .= __('metaconsole');
|
||||||
|
$url_link .= '</a>';
|
||||||
|
} else {
|
||||||
|
$url_link = __('any node');
|
||||||
|
}
|
||||||
|
|
||||||
|
\ui_print_warning_message(
|
||||||
|
__(
|
||||||
|
'This node is configured with centralized mode. All alert calendar information is read only. Go to %s to manage it.',
|
||||||
|
$url_link
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $groups = users_get_groups();
|
||||||
|
$table = new stdClass;
|
||||||
$table->id = 'delete_table';
|
$table->id = 'delete_table';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
@ -177,31 +209,75 @@ $table->data[1][3] = html_print_select(
|
|||||||
__('All'),
|
__('All'),
|
||||||
2,
|
2,
|
||||||
true,
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
'',
|
'',
|
||||||
'',
|
false,
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'width:30%;'
|
'width:30%;'
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[2][0] = __('Agents');
|
if (is_metaconsole() === true) {
|
||||||
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
|
$servers = metaconsole_get_servers();
|
||||||
$table->data[2][0] .= html_print_image('images/spinner.png', true);
|
$server_fields = [];
|
||||||
$table->data[2][0] .= '</span>';
|
foreach ($servers as $key => $server) {
|
||||||
$table->data[2][1] = html_print_select(
|
$server_fields[$key] = $server['server_name'];
|
||||||
agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false)), false, 'none'),
|
}
|
||||||
|
|
||||||
|
$table->data[2][2] = __('Node');
|
||||||
|
$table->data[2][3] = html_print_select(
|
||||||
|
$server_fields,
|
||||||
|
'node',
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
__('All'),
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$table->data[3][0] = __('Agents');
|
||||||
|
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
|
||||||
|
$table->data[3][0] .= html_print_image('images/spinner.png', true);
|
||||||
|
$table->data[3][0] .= '</span>';
|
||||||
|
$table->data[3][1] = html_print_select(
|
||||||
|
agents_get_agents_selected(
|
||||||
|
array_keys(users_get_groups($config['id_user'], 'AW', false))
|
||||||
|
),
|
||||||
'id_agents[]',
|
'id_agents[]',
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
|
$url = 'index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents';
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$ulr = 'index.php?sec=advanced&sec2=advanced/massive_operations&tab=massive_agents&pure=0&option=delete_agents';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<form method="post" id="form_agents" action="'.$url.'">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
if (is_management_allowed() === true) {
|
|
||||||
|
if (is_metaconsole() === true || is_management_allowed() === true) {
|
||||||
attachActionButton('delete', 'delete', $table->width);
|
attachActionButton('delete', 'delete', $table->width);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,21 +291,15 @@ ui_require_jquery_file('pandora.controls');
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
var recursion;
|
var recursion;
|
||||||
|
|
||||||
$("#checkbox-recursion").click(function () {
|
$("#checkbox-recursion").click(function () {
|
||||||
recursion = this.checked ? 1 : 0;
|
recursion = this.checked ? 1 : 0;
|
||||||
|
|
||||||
$("#id_group").trigger("change");
|
$("#id_group").trigger("change");
|
||||||
});
|
});
|
||||||
|
|
||||||
var disabled;
|
var disabled;
|
||||||
|
|
||||||
$("#disabled").click(function () {
|
$("#disabled").click(function () {
|
||||||
|
|
||||||
disabled = this.value;
|
disabled = this.value;
|
||||||
|
|
||||||
$("#id_group").trigger("change");
|
$("#id_group").trigger("change");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -253,7 +323,6 @@ ui_require_jquery_file('pandora.controls');
|
|||||||
|
|
||||||
disabled = 2;
|
disabled = 2;
|
||||||
|
|
||||||
$("#id_group").trigger("change");
|
//$("#id_group").trigger("change");
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
/* globals jQuery, js_html_entity_decode */
|
||||||
(function($) {
|
(function($) {
|
||||||
var dummyFunc = function () {
|
var dummyFunc = function() {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var _pandoraSelectGroupAgent = function (disabled) {
|
var _pandoraSelectGroupAgent = function(disabled) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
@ -19,134 +20,138 @@
|
|||||||
debug: false,
|
debug: false,
|
||||||
disabled: disabled || false,
|
disabled: disabled || false,
|
||||||
privilege: "",
|
privilege: "",
|
||||||
|
serialized: false,
|
||||||
|
serialized_separator: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
this.construct = function (settings) {
|
this.construct = function(settings) {
|
||||||
return this.each (function() {
|
return this.each(function() {
|
||||||
this.config = {};
|
this.config = {};
|
||||||
|
|
||||||
this.config = $.extend (this.config, that.defaults, settings);
|
this.config = $.extend(this.config, that.defaults, settings);
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
|
|
||||||
$(this).change (function () {
|
$(this).change(function() {
|
||||||
var $select = $(config.agentSelect).disable ();
|
var $select = $(config.agentSelect).disable();
|
||||||
$(config.loading).show ();
|
$(config.loading).show();
|
||||||
$("option[value!=0]", $select).remove ();
|
$("option[value!=0]", $select).remove();
|
||||||
if (! config.callbackBefore (this))
|
if (!config.callbackBefore(this)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
|
var recursion_value;
|
||||||
if (typeof config.recursion === "function") {
|
if (typeof config.recursion === "function") {
|
||||||
// Perform this for those cases where recursion parameter is obtained through a function that returns a variable that is set in the lexical environment where this constructor is called.
|
// Perform this for those cases where recursion parameter
|
||||||
var recursion_value = config.recursion();
|
// is obtained through a function that returns a variable
|
||||||
|
// that is set in the lexical environment
|
||||||
|
// where this constructor is called.
|
||||||
|
recursion_value = config.recursion();
|
||||||
|
|
||||||
if (typeof recursion_value === "boolean") {
|
if (typeof recursion_value === "boolean") {
|
||||||
recursion_value = recursion_value ? 1 : 0;
|
recursion_value = recursion_value ? 1 : 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var recursion_value = config.recursion;
|
recursion_value = config.recursion;
|
||||||
}
|
}
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
"page" : "godmode/groups/group_list",
|
page: "godmode/groups/group_list",
|
||||||
"get_group_agents" : 1,
|
get_group_agents: 1,
|
||||||
"id_group" : this.value,
|
id_group: this.value,
|
||||||
"recursion" : recursion_value,
|
recursion: recursion_value,
|
||||||
"filter_agents_json" : config.filter_agents_json,
|
filter_agents_json: config.filter_agents_json,
|
||||||
"disabled" : (typeof config.disabled === "function")
|
disabled:
|
||||||
? (config.disabled())
|
typeof config.disabled === "function"
|
||||||
: (config.disabled),
|
? config.disabled()
|
||||||
"status_agents" : config.status_agents,
|
: config.disabled,
|
||||||
"add_alert_bulk_op" : config.add_alert_bulk_op,
|
status_agents: config.status_agents,
|
||||||
"privilege" : config.privilege,
|
add_alert_bulk_op: config.add_alert_bulk_op,
|
||||||
|
privilege: config.privilege,
|
||||||
// Add a key prefix to avoid auto sorting in js object conversion
|
// Add a key prefix to avoid auto sorting in js object conversion
|
||||||
"keys_prefix" : "_"
|
keys_prefix: "_"
|
||||||
};
|
};
|
||||||
if(opts['disabled'] == 1 || opts['disabled'] == 0){
|
if (opts["disabled"] == 1 || opts["disabled"] == 0) {
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post(
|
||||||
|
"ajax.php",
|
||||||
opts,
|
opts,
|
||||||
function (data, status) {
|
function(data) {
|
||||||
jQuery.each (data, function (id, value) {
|
jQuery.each(data, function(id, value) {
|
||||||
// Remove keys_prefix from the index
|
// Remove keys_prefix from the index.
|
||||||
id = id.substring(1);
|
id = id.substring(1);
|
||||||
if (id !== 'keycount') {
|
if (id !== "keycount") {
|
||||||
config.callbackPre ();
|
config.callbackPre();
|
||||||
option = $("<option></option>")
|
var option = $("<option></option>")
|
||||||
.attr ("value", id)
|
.attr("value", id)
|
||||||
.html (value);
|
.html(value);
|
||||||
config.callbackPost (id, value, option);
|
config.callbackPost(id, value, option);
|
||||||
$(config.agentSelect).append (option);
|
$(config.agentSelect).append(option);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(config.loading).hide ();
|
$(config.loading).hide();
|
||||||
$select.enable ();
|
$select.enable();
|
||||||
config.callbackAfter ();
|
config.callbackAfter();
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
opts["disabled"] = 0;
|
||||||
|
jQuery.post(
|
||||||
|
"ajax.php",
|
||||||
|
opts,
|
||||||
|
function(data) {
|
||||||
|
jQuery.each(data, function(id, value) {
|
||||||
|
// Remove keys_prefix from the index
|
||||||
|
id = id.substring(1);
|
||||||
|
if (id !== "keycount") {
|
||||||
|
config.callbackPre();
|
||||||
|
var option = $("<option></option>")
|
||||||
|
.attr("value", id)
|
||||||
|
.html(value);
|
||||||
|
config.callbackPost(id, value, option);
|
||||||
|
$(config.agentSelect).append(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(config.loading).hide();
|
||||||
|
$select.enable();
|
||||||
|
config.callbackAfter();
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
opts["disabled"] = 1;
|
||||||
|
jQuery.post(
|
||||||
|
"ajax.php",
|
||||||
|
opts,
|
||||||
|
function(data) {
|
||||||
|
jQuery.each(data, function(id, value) {
|
||||||
|
// Remove keys_prefix from the index
|
||||||
|
id = id.substring(1);
|
||||||
|
if (id !== "keycount") {
|
||||||
|
config.callbackPre();
|
||||||
|
var option = $("<option></option>")
|
||||||
|
.attr("value", id)
|
||||||
|
.html(value);
|
||||||
|
config.callbackPost(id, value, option);
|
||||||
|
$(config.agentSelect).append(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(config.loading).hide();
|
||||||
|
$select.enable();
|
||||||
|
config.callbackAfter();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
opts['disabled'] = 0;
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
opts,
|
|
||||||
function (data, status) {
|
|
||||||
jQuery.each (data, function (id, value) {
|
|
||||||
// Remove keys_prefix from the index
|
|
||||||
id = id.substring(1);
|
|
||||||
if (id !== 'keycount') {
|
|
||||||
config.callbackPre ();
|
|
||||||
option = $("<option></option>")
|
|
||||||
.attr ("value", id)
|
|
||||||
.html (value);
|
|
||||||
config.callbackPost (id, value, option);
|
|
||||||
$(config.agentSelect).append (option);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(config.loading).hide ();
|
|
||||||
$select.enable ();
|
|
||||||
config.callbackAfter ();
|
|
||||||
},
|
|
||||||
"json"
|
|
||||||
);
|
|
||||||
opts['disabled'] = 1;
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
opts,
|
|
||||||
function (data, status) {
|
|
||||||
jQuery.each (data, function (id, value) {
|
|
||||||
// Remove keys_prefix from the index
|
|
||||||
id = id.substring(1);
|
|
||||||
if (id !== 'keycount') {
|
|
||||||
config.callbackPre ();
|
|
||||||
option = $("<option></option>")
|
|
||||||
.attr ("value", id)
|
|
||||||
.html (value);
|
|
||||||
config.callbackPost (id, value, option);
|
|
||||||
$(config.agentSelect).append (option);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(config.loading).hide ();
|
|
||||||
$select.enable ();
|
|
||||||
config.callbackAfter ();
|
|
||||||
},
|
|
||||||
"json"
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend ({
|
$.extend({
|
||||||
pandoraSelectGroupAgent: new _pandoraSelectGroupAgent(),
|
pandoraSelectGroupAgent: new _pandoraSelectGroupAgent(),
|
||||||
pandoraSelectGroupAgentDisabled: new _pandoraSelectGroupAgent(true),
|
pandoraSelectGroupAgentDisabled: new _pandoraSelectGroupAgent(true)
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend ({
|
$.extend({
|
||||||
pandoraSelectAgentModule: new function() {
|
pandoraSelectAgentModule: new (function() {
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
moduleSelect: "select#id_agent_module",
|
moduleSelect: "select#id_agent_module",
|
||||||
loading: "#module_loading",
|
loading: "#module_loading",
|
||||||
@ -162,62 +167,67 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
this.construct = function (settings) {
|
this.construct = function(settings) {
|
||||||
return this.each (function() {
|
return this.each(function() {
|
||||||
this.config = {};
|
this.config = {};
|
||||||
|
|
||||||
this.config = $.extend (this.config, $.pandoraSelectAgentModule.defaults, settings);
|
this.config = $.extend(
|
||||||
|
this.config,
|
||||||
|
$.pandoraSelectAgentModule.defaults,
|
||||||
|
settings
|
||||||
|
);
|
||||||
|
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
$(this).change (function () {
|
$(this).change(function() {
|
||||||
var $select = $(config.moduleSelect).disable ();
|
var $select = $(config.moduleSelect).disable();
|
||||||
$(config.loading).show ();
|
$(config.loading).show();
|
||||||
$("option[value!=0]", $select).remove ();
|
$("option[value!=0]", $select).remove();
|
||||||
if (! config.callbackBefore (this))
|
if (!config.callbackBefore(this)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
jQuery.post ('ajax.php',
|
jQuery.post(
|
||||||
|
"ajax.php",
|
||||||
{
|
{
|
||||||
"page": "operation/agentes/ver_agente",
|
page: "operation/agentes/ver_agente",
|
||||||
"get_agent_modules_json": 1,
|
get_agent_modules_json: 1,
|
||||||
"id_agent": this.value,
|
id_agent: this.value,
|
||||||
"disabled": config.moduleFilter.disabled,
|
disabled: config.moduleFilter.disabled,
|
||||||
"delete_pending": config.moduleFilter.deletePending
|
delete_pending: config.moduleFilter.deletePending
|
||||||
},
|
},
|
||||||
function (data) {
|
function(data) {
|
||||||
jQuery.each (data, function (i, value) {
|
jQuery.each(data, function(i, value) {
|
||||||
config.callbackPre ();
|
config.callbackPre();
|
||||||
// Get the selected item from hidden field
|
// Get the selected item from hidden field
|
||||||
selected = $('#hidden-'+config.moduleSelect.attr('id')+'_selected').val();
|
var selected = $(
|
||||||
|
"#hidden-" + config.moduleSelect.attr("id") + "_selected"
|
||||||
|
).val();
|
||||||
|
var option;
|
||||||
if (selected == i) {
|
if (selected == i) {
|
||||||
option = $("<option></option>")
|
option = $("<option></option>")
|
||||||
.prop ("selected", true)
|
.prop("selected", true)
|
||||||
.attr ("value", value['id_agente_modulo'])
|
.attr("value", value["id_agente_modulo"])
|
||||||
.html (js_html_entity_decode (value['nombre']));
|
.html(js_html_entity_decode(value["nombre"]));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
option = $("<option></option>")
|
option = $("<option></option>")
|
||||||
.attr ("value", value['id_agente_modulo'])
|
.attr("value", value["id_agente_modulo"])
|
||||||
.html (js_html_entity_decode (value['nombre']));
|
.html(js_html_entity_decode(value["nombre"]));
|
||||||
}
|
}
|
||||||
config.callbackPost (i, value, option);
|
config.callbackPost(i, value, option);
|
||||||
$(config.moduleSelect).append (option);
|
$(config.moduleSelect).append(option);
|
||||||
});
|
});
|
||||||
$(config.loading).hide ();
|
$(config.loading).hide();
|
||||||
$select.enable ();
|
$select.enable();
|
||||||
config.callbackAfter ();
|
config.callbackAfter();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
})()
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend ({
|
$.extend({
|
||||||
pandoraSelectAgentAlert: new function() {
|
pandoraSelectAgentAlert: new (function() {
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
alertSelect: "select#id_agent_module",
|
alertSelect: "select#id_agent_module",
|
||||||
loading: "#alert_loading",
|
loading: "#alert_loading",
|
||||||
@ -229,50 +239,57 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
this.construct = function (settings) {
|
this.construct = function(settings) {
|
||||||
return this.each (function() {
|
return this.each(function() {
|
||||||
this.config = {};
|
this.config = {};
|
||||||
|
|
||||||
this.config = $.extend (this.config, $.pandoraSelectAgentAlert.defaults, settings);
|
this.config = $.extend(
|
||||||
|
this.config,
|
||||||
|
$.pandoraSelectAgentAlert.defaults,
|
||||||
|
settings
|
||||||
|
);
|
||||||
|
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
|
|
||||||
$(this).change (function () {
|
$(this).change(function() {
|
||||||
var $select = $(config.alertSelect).disable ();
|
var $select = $(config.alertSelect).disable();
|
||||||
$(config.loading).show ();
|
$(config.loading).show();
|
||||||
$("option[value!=0]", $select).remove ();
|
$("option[value!=0]", $select).remove();
|
||||||
if (! config.callbackBefore (this))
|
if (!config.callbackBefore(this)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
jQuery.post ('ajax.php',
|
jQuery.post(
|
||||||
{"page": "include/ajax/alert_list.ajax",
|
"ajax.php",
|
||||||
"get_agent_alerts_simple": 1,
|
{
|
||||||
"id_agent": this.value
|
page: "include/ajax/alert_list.ajax",
|
||||||
|
get_agent_alerts_simple: 1,
|
||||||
|
id_agent: this.value
|
||||||
},
|
},
|
||||||
function (data) {
|
function(data) {
|
||||||
jQuery.each (data, function (i, value) {
|
jQuery.each(data, function(i, value) {
|
||||||
config.callbackPre ();
|
config.callbackPre();
|
||||||
option = $("<option></option>")
|
var option = $("<option></option>")
|
||||||
.attr ("value", value['id'])
|
.attr("value", value["id"])
|
||||||
.html (js_html_entity_decode (value['template']['name']))
|
.html(js_html_entity_decode(value["template"]["name"]))
|
||||||
.append (" ("+js_html_entity_decode (value['module_name'])+")");
|
.append(
|
||||||
config.callbackPost (i, value, option);
|
" (" + js_html_entity_decode(value["module_name"]) + ")"
|
||||||
$(config.alertSelect).append (option);
|
);
|
||||||
|
config.callbackPost(i, value, option);
|
||||||
|
$(config.alertSelect).append(option);
|
||||||
});
|
});
|
||||||
$(config.loading).hide ();
|
$(config.loading).hide();
|
||||||
$select.enable ();
|
$select.enable();
|
||||||
config.callbackAfter ();
|
config.callbackAfter();
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
})()
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend ({
|
$.extend({
|
||||||
pandoraSelectOS: new function() {
|
pandoraSelectOS: new (function() {
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
alertSelect: "select#id_os",
|
alertSelect: "select#id_os",
|
||||||
spanPreview: "#os_preview",
|
spanPreview: "#os_preview",
|
||||||
@ -280,46 +297,45 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
this.construct = function (settings) {
|
this.construct = function(settings) {
|
||||||
return this.each (function() {
|
return this.each(function() {
|
||||||
this.config = {};
|
this.config = {};
|
||||||
this.config = $.extend (this.config, $.pandoraSelectOS.defaults, settings);
|
this.config = $.extend(
|
||||||
|
this.config,
|
||||||
|
$.pandoraSelectOS.defaults,
|
||||||
|
settings
|
||||||
|
);
|
||||||
|
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
|
|
||||||
$(this).change (function () {
|
$(this).change(function() {
|
||||||
var id_os = this.value;
|
var id_os = this.value;
|
||||||
|
|
||||||
var home_url;
|
var home_url;
|
||||||
if (typeof(settings) == 'undefined')
|
if (typeof settings == "undefined") home_url = "./";
|
||||||
home_url = './';
|
else home_url = settings.home_url;
|
||||||
else
|
|
||||||
home_url = settings.home_url;
|
|
||||||
|
|
||||||
$(config.spanPreview).fadeOut ('fast', function () {
|
$(config.spanPreview).fadeOut("fast", function() {
|
||||||
$("img", config.spanPreview).remove ();
|
$("img", config.spanPreview).remove();
|
||||||
jQuery.post (home_url + 'ajax.php',
|
jQuery.post(
|
||||||
{"page": "godmode/setup/setup",
|
home_url + "ajax.php",
|
||||||
"get_os_icon": 1,
|
{ page: "godmode/setup/setup", get_os_icon: 1, id_os: id_os },
|
||||||
"id_os": id_os
|
function(data) {
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
$(config.spanPreview)
|
$(config.spanPreview)
|
||||||
.append (data)
|
.append(data)
|
||||||
.fadeIn ('fast');
|
.fadeIn("fast");
|
||||||
},
|
},
|
||||||
"html"
|
"html"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
})()
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend ({
|
$.extend({
|
||||||
pandoraSelectGroupIcon: new function() {
|
pandoraSelectGroupIcon: new (function() {
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
alertSelect: "select#id_group",
|
alertSelect: "select#id_group",
|
||||||
spanPreview: "#group_preview",
|
spanPreview: "#group_preview",
|
||||||
@ -327,45 +343,54 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
this.construct = function (settings) {
|
this.construct = function(settings) {
|
||||||
return this.each (function() {
|
return this.each(function() {
|
||||||
this.config = {};
|
this.config = {};
|
||||||
this.config = $.extend (this.config, $.pandoraSelectGroupIcon.defaults, settings);
|
this.config = $.extend(
|
||||||
|
this.config,
|
||||||
|
$.pandoraSelectGroupIcon.defaults,
|
||||||
|
settings
|
||||||
|
);
|
||||||
|
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
|
|
||||||
$(this).change (function () {
|
$(this).change(function() {
|
||||||
var id_group = this.value;
|
var id_group = this.value;
|
||||||
|
|
||||||
$(config.spanPreview).fadeOut ('fast', function () {
|
$(config.spanPreview).fadeOut("fast", function() {
|
||||||
$("img", config.spanPreview).remove ();
|
$("img", config.spanPreview).remove();
|
||||||
jQuery.post ('ajax.php',
|
jQuery.post(
|
||||||
{"page": "godmode/groups/group_list",
|
"ajax.php",
|
||||||
"get_group_json": 1,
|
{
|
||||||
"id_group": id_group
|
page: "godmode/groups/group_list",
|
||||||
|
get_group_json: 1,
|
||||||
|
id_group: id_group
|
||||||
},
|
},
|
||||||
function (data) {
|
function(data) {
|
||||||
img = $("<img />").attr ("src", "images/groups_small/"+data["icon"]+".png");
|
var img = $("<img />").attr(
|
||||||
|
"src",
|
||||||
|
"images/groups_small/" + data["icon"] + ".png"
|
||||||
|
);
|
||||||
$(config.spanPreview)
|
$(config.spanPreview)
|
||||||
.append (img)
|
.append(img)
|
||||||
.fadeIn ('fast');
|
.fadeIn("fast");
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
})()
|
||||||
});
|
});
|
||||||
|
|
||||||
$.fn.extend({
|
$.fn.extend({
|
||||||
pandoraSelectGroupAgent: $.pandoraSelectGroupAgent.construct,
|
pandoraSelectGroupAgent: $.pandoraSelectGroupAgent.construct,
|
||||||
pandoraSelectGroupAgentDisabled: $.pandoraSelectGroupAgentDisabled.construct,
|
pandoraSelectGroupAgentDisabled:
|
||||||
|
$.pandoraSelectGroupAgentDisabled.construct,
|
||||||
pandoraSelectAgentModule: $.pandoraSelectAgentModule.construct,
|
pandoraSelectAgentModule: $.pandoraSelectAgentModule.construct,
|
||||||
pandoraSelectAgentAlert: $.pandoraSelectAgentAlert.construct,
|
pandoraSelectAgentAlert: $.pandoraSelectAgentAlert.construct,
|
||||||
pandoraSelectOS: $.pandoraSelectOS.construct,
|
pandoraSelectOS: $.pandoraSelectOS.construct,
|
||||||
pandoraSelectGroupIcon: $.pandoraSelectGroupIcon.construct
|
pandoraSelectGroupIcon: $.pandoraSelectGroupIcon.construct
|
||||||
});
|
});
|
||||||
}) (jQuery);
|
})(jQuery);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user