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
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -29,7 +29,7 @@
|
|||
// Begin.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access massive agent deletion section'
|
||||
|
@ -38,10 +38,11 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
|
|||
return;
|
||||
}
|
||||
|
||||
require_once 'include/functions_agents.php';
|
||||
require_once 'include/functions_alerts.php';
|
||||
require_once 'include/functions_modules.php';
|
||||
require_once 'include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_massive_operations.php';
|
||||
|
||||
|
||||
function process_manage_delete($id_agents)
|
||||
|
@ -99,19 +100,50 @@ $recursion = get_parameter('recursion');
|
|||
|
||||
$delete = (bool) get_parameter_post('delete');
|
||||
|
||||
if ($delete) {
|
||||
if ($delete === true) {
|
||||
$result = process_manage_delete($id_agents);
|
||||
|
||||
$info = '{"Agent":"'.implode(',', $id_agents).'"}';
|
||||
if ($result) {
|
||||
db_pandora_audit('Massive management', 'Delete agent ', false, false, $info);
|
||||
if ($result === true) {
|
||||
db_pandora_audit(
|
||||
'Massive management',
|
||||
'Delete agent ',
|
||||
false,
|
||||
false,
|
||||
$info
|
||||
);
|
||||
} 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->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
|
@ -177,31 +209,75 @@ $table->data[1][3] = html_print_select(
|
|||
__('All'),
|
||||
2,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'width:30%;'
|
||||
);
|
||||
|
||||
$table->data[2][0] = __('Agents');
|
||||
$table->data[2][0] .= '<span id="agent_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(
|
||||
agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false)), false, 'none'),
|
||||
if (is_metaconsole() === true) {
|
||||
$servers = metaconsole_get_servers();
|
||||
$server_fields = [];
|
||||
foreach ($servers as $key => $server) {
|
||||
$server_fields[$key] = $server['server_name'];
|
||||
}
|
||||
|
||||
$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[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
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);
|
||||
if (is_management_allowed() === true) {
|
||||
|
||||
if (is_metaconsole() === true || is_management_allowed() === true) {
|
||||
attachActionButton('delete', 'delete', $table->width);
|
||||
}
|
||||
|
||||
|
@ -215,21 +291,15 @@ ui_require_jquery_file('pandora.controls');
|
|||
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
|
||||
var recursion;
|
||||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
var disabled;
|
||||
|
||||
$("#disabled").click(function () {
|
||||
|
||||
disabled = this.value;
|
||||
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
|
@ -253,7 +323,6 @@ ui_require_jquery_file('pandora.controls');
|
|||
|
||||
disabled = 2;
|
||||
|
||||
$("#id_group").trigger("change");
|
||||
|
||||
//$("#id_group").trigger("change");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/* globals jQuery, js_html_entity_decode */
|
||||
(function($) {
|
||||
var dummyFunc = function () {
|
||||
var dummyFunc = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
var _pandoraSelectGroupAgent = function (disabled) {
|
||||
var _pandoraSelectGroupAgent = function(disabled) {
|
||||
var that = this;
|
||||
|
||||
this.defaults = {
|
||||
|
@ -19,134 +20,138 @@
|
|||
debug: false,
|
||||
disabled: disabled || false,
|
||||
privilege: "",
|
||||
serialized: false,
|
||||
serialized_separator: ""
|
||||
};
|
||||
|
||||
/* public methods */
|
||||
this.construct = function (settings) {
|
||||
return this.each (function() {
|
||||
this.construct = function(settings) {
|
||||
return this.each(function() {
|
||||
this.config = {};
|
||||
|
||||
this.config = $.extend (this.config, that.defaults, settings);
|
||||
this.config = $.extend(this.config, that.defaults, settings);
|
||||
var config = this.config;
|
||||
|
||||
$(this).change (function () {
|
||||
var $select = $(config.agentSelect).disable ();
|
||||
$(config.loading).show ();
|
||||
$("option[value!=0]", $select).remove ();
|
||||
if (! config.callbackBefore (this))
|
||||
return;
|
||||
$(this).change(function() {
|
||||
var $select = $(config.agentSelect).disable();
|
||||
$(config.loading).show();
|
||||
$("option[value!=0]", $select).remove();
|
||||
if (!config.callbackBefore(this)) return;
|
||||
|
||||
var recursion_value;
|
||||
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.
|
||||
var recursion_value = config.recursion();
|
||||
// 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.
|
||||
recursion_value = config.recursion();
|
||||
|
||||
if (typeof recursion_value === "boolean") {
|
||||
recursion_value = recursion_value ? 1 : 0;
|
||||
}
|
||||
} else {
|
||||
var recursion_value = config.recursion;
|
||||
recursion_value = config.recursion;
|
||||
}
|
||||
|
||||
var opts = {
|
||||
"page" : "godmode/groups/group_list",
|
||||
"get_group_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : recursion_value,
|
||||
"filter_agents_json" : config.filter_agents_json,
|
||||
"disabled" : (typeof config.disabled === "function")
|
||||
? (config.disabled())
|
||||
: (config.disabled),
|
||||
"status_agents" : config.status_agents,
|
||||
"add_alert_bulk_op" : config.add_alert_bulk_op,
|
||||
"privilege" : config.privilege,
|
||||
page: "godmode/groups/group_list",
|
||||
get_group_agents: 1,
|
||||
id_group: this.value,
|
||||
recursion: recursion_value,
|
||||
filter_agents_json: config.filter_agents_json,
|
||||
disabled:
|
||||
typeof config.disabled === "function"
|
||||
? config.disabled()
|
||||
: config.disabled,
|
||||
status_agents: config.status_agents,
|
||||
add_alert_bulk_op: config.add_alert_bulk_op,
|
||||
privilege: config.privilege,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
keys_prefix: "_"
|
||||
};
|
||||
if(opts['disabled'] == 1 || opts['disabled'] == 0){
|
||||
jQuery.post ("ajax.php",
|
||||
if (opts["disabled"] == 1 || opts["disabled"] == 0) {
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
opts,
|
||||
function (data, status) {
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
function(data) {
|
||||
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);
|
||||
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 ();
|
||||
$(config.loading).hide();
|
||||
$select.enable();
|
||||
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"
|
||||
);
|
||||
}
|
||||
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(),
|
||||
pandoraSelectGroupAgentDisabled: new _pandoraSelectGroupAgent(true),
|
||||
pandoraSelectGroupAgentDisabled: new _pandoraSelectGroupAgent(true)
|
||||
});
|
||||
|
||||
$.extend ({
|
||||
pandoraSelectAgentModule: new function() {
|
||||
$.extend({
|
||||
pandoraSelectAgentModule: new (function() {
|
||||
this.defaults = {
|
||||
moduleSelect: "select#id_agent_module",
|
||||
loading: "#module_loading",
|
||||
|
@ -162,62 +167,67 @@
|
|||
};
|
||||
|
||||
/* public methods */
|
||||
this.construct = function (settings) {
|
||||
return this.each (function() {
|
||||
this.construct = function(settings) {
|
||||
return this.each(function() {
|
||||
this.config = {};
|
||||
|
||||
this.config = $.extend (this.config, $.pandoraSelectAgentModule.defaults, settings);
|
||||
this.config = $.extend(
|
||||
this.config,
|
||||
$.pandoraSelectAgentModule.defaults,
|
||||
settings
|
||||
);
|
||||
|
||||
var config = this.config;
|
||||
$(this).change (function () {
|
||||
var $select = $(config.moduleSelect).disable ();
|
||||
$(config.loading).show ();
|
||||
$("option[value!=0]", $select).remove ();
|
||||
if (! config.callbackBefore (this))
|
||||
return;
|
||||
$(this).change(function() {
|
||||
var $select = $(config.moduleSelect).disable();
|
||||
$(config.loading).show();
|
||||
$("option[value!=0]", $select).remove();
|
||||
if (!config.callbackBefore(this)) return;
|
||||
|
||||
jQuery.post ('ajax.php',
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
"page": "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json": 1,
|
||||
"id_agent": this.value,
|
||||
"disabled": config.moduleFilter.disabled,
|
||||
"delete_pending": config.moduleFilter.deletePending
|
||||
page: "operation/agentes/ver_agente",
|
||||
get_agent_modules_json: 1,
|
||||
id_agent: this.value,
|
||||
disabled: config.moduleFilter.disabled,
|
||||
delete_pending: config.moduleFilter.deletePending
|
||||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, value) {
|
||||
config.callbackPre ();
|
||||
function(data) {
|
||||
jQuery.each(data, function(i, value) {
|
||||
config.callbackPre();
|
||||
// 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) {
|
||||
option = $("<option></option>")
|
||||
.prop ("selected", true)
|
||||
.attr ("value", value['id_agente_modulo'])
|
||||
.html (js_html_entity_decode (value['nombre']));
|
||||
}
|
||||
else {
|
||||
.prop("selected", true)
|
||||
.attr("value", value["id_agente_modulo"])
|
||||
.html(js_html_entity_decode(value["nombre"]));
|
||||
} else {
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value['id_agente_modulo'])
|
||||
.html (js_html_entity_decode (value['nombre']));
|
||||
.attr("value", value["id_agente_modulo"])
|
||||
.html(js_html_entity_decode(value["nombre"]));
|
||||
}
|
||||
config.callbackPost (i, value, option);
|
||||
$(config.moduleSelect).append (option);
|
||||
config.callbackPost(i, value, option);
|
||||
$(config.moduleSelect).append(option);
|
||||
});
|
||||
$(config.loading).hide ();
|
||||
$select.enable ();
|
||||
config.callbackAfter ();
|
||||
$(config.loading).hide();
|
||||
$select.enable();
|
||||
config.callbackAfter();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
})()
|
||||
});
|
||||
|
||||
$.extend ({
|
||||
pandoraSelectAgentAlert: new function() {
|
||||
$.extend({
|
||||
pandoraSelectAgentAlert: new (function() {
|
||||
this.defaults = {
|
||||
alertSelect: "select#id_agent_module",
|
||||
loading: "#alert_loading",
|
||||
|
@ -229,50 +239,57 @@
|
|||
};
|
||||
|
||||
/* public methods */
|
||||
this.construct = function (settings) {
|
||||
return this.each (function() {
|
||||
this.construct = function(settings) {
|
||||
return this.each(function() {
|
||||
this.config = {};
|
||||
|
||||
this.config = $.extend (this.config, $.pandoraSelectAgentAlert.defaults, settings);
|
||||
this.config = $.extend(
|
||||
this.config,
|
||||
$.pandoraSelectAgentAlert.defaults,
|
||||
settings
|
||||
);
|
||||
|
||||
var config = this.config;
|
||||
|
||||
$(this).change (function () {
|
||||
var $select = $(config.alertSelect).disable ();
|
||||
$(config.loading).show ();
|
||||
$("option[value!=0]", $select).remove ();
|
||||
if (! config.callbackBefore (this))
|
||||
return;
|
||||
$(this).change(function() {
|
||||
var $select = $(config.alertSelect).disable();
|
||||
$(config.loading).show();
|
||||
$("option[value!=0]", $select).remove();
|
||||
if (!config.callbackBefore(this)) return;
|
||||
|
||||
jQuery.post ('ajax.php',
|
||||
{"page": "include/ajax/alert_list.ajax",
|
||||
"get_agent_alerts_simple": 1,
|
||||
"id_agent": this.value
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "include/ajax/alert_list.ajax",
|
||||
get_agent_alerts_simple: 1,
|
||||
id_agent: this.value
|
||||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, value) {
|
||||
config.callbackPre ();
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value['id'])
|
||||
.html (js_html_entity_decode (value['template']['name']))
|
||||
.append (" ("+js_html_entity_decode (value['module_name'])+")");
|
||||
config.callbackPost (i, value, option);
|
||||
$(config.alertSelect).append (option);
|
||||
function(data) {
|
||||
jQuery.each(data, function(i, value) {
|
||||
config.callbackPre();
|
||||
var option = $("<option></option>")
|
||||
.attr("value", value["id"])
|
||||
.html(js_html_entity_decode(value["template"]["name"]))
|
||||
.append(
|
||||
" (" + js_html_entity_decode(value["module_name"]) + ")"
|
||||
);
|
||||
config.callbackPost(i, value, option);
|
||||
$(config.alertSelect).append(option);
|
||||
});
|
||||
$(config.loading).hide ();
|
||||
$select.enable ();
|
||||
config.callbackAfter ();
|
||||
$(config.loading).hide();
|
||||
$select.enable();
|
||||
config.callbackAfter();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
})()
|
||||
});
|
||||
|
||||
$.extend ({
|
||||
pandoraSelectOS: new function() {
|
||||
$.extend({
|
||||
pandoraSelectOS: new (function() {
|
||||
this.defaults = {
|
||||
alertSelect: "select#id_os",
|
||||
spanPreview: "#os_preview",
|
||||
|
@ -280,46 +297,45 @@
|
|||
};
|
||||
|
||||
/* public methods */
|
||||
this.construct = function (settings) {
|
||||
return this.each (function() {
|
||||
this.construct = function(settings) {
|
||||
return this.each(function() {
|
||||
this.config = {};
|
||||
this.config = $.extend (this.config, $.pandoraSelectOS.defaults, settings);
|
||||
this.config = $.extend(
|
||||
this.config,
|
||||
$.pandoraSelectOS.defaults,
|
||||
settings
|
||||
);
|
||||
|
||||
var config = this.config;
|
||||
|
||||
$(this).change (function () {
|
||||
$(this).change(function() {
|
||||
var id_os = this.value;
|
||||
|
||||
var home_url;
|
||||
if (typeof(settings) == 'undefined')
|
||||
home_url = './';
|
||||
else
|
||||
home_url = settings.home_url;
|
||||
if (typeof settings == "undefined") home_url = "./";
|
||||
else home_url = settings.home_url;
|
||||
|
||||
$(config.spanPreview).fadeOut ('fast', function () {
|
||||
$("img", config.spanPreview).remove ();
|
||||
jQuery.post (home_url + 'ajax.php',
|
||||
{"page": "godmode/setup/setup",
|
||||
"get_os_icon": 1,
|
||||
"id_os": id_os
|
||||
},
|
||||
function (data) {
|
||||
$(config.spanPreview).fadeOut("fast", function() {
|
||||
$("img", config.spanPreview).remove();
|
||||
jQuery.post(
|
||||
home_url + "ajax.php",
|
||||
{ page: "godmode/setup/setup", get_os_icon: 1, id_os: id_os },
|
||||
function(data) {
|
||||
$(config.spanPreview)
|
||||
.append (data)
|
||||
.fadeIn ('fast');
|
||||
.append(data)
|
||||
.fadeIn("fast");
|
||||
},
|
||||
"html"
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
})()
|
||||
});
|
||||
|
||||
$.extend ({
|
||||
pandoraSelectGroupIcon: new function() {
|
||||
$.extend({
|
||||
pandoraSelectGroupIcon: new (function() {
|
||||
this.defaults = {
|
||||
alertSelect: "select#id_group",
|
||||
spanPreview: "#group_preview",
|
||||
|
@ -327,45 +343,54 @@
|
|||
};
|
||||
|
||||
/* public methods */
|
||||
this.construct = function (settings) {
|
||||
return this.each (function() {
|
||||
this.construct = function(settings) {
|
||||
return this.each(function() {
|
||||
this.config = {};
|
||||
this.config = $.extend (this.config, $.pandoraSelectGroupIcon.defaults, settings);
|
||||
this.config = $.extend(
|
||||
this.config,
|
||||
$.pandoraSelectGroupIcon.defaults,
|
||||
settings
|
||||
);
|
||||
|
||||
var config = this.config;
|
||||
|
||||
$(this).change (function () {
|
||||
$(this).change(function() {
|
||||
var id_group = this.value;
|
||||
|
||||
$(config.spanPreview).fadeOut ('fast', function () {
|
||||
$("img", config.spanPreview).remove ();
|
||||
jQuery.post ('ajax.php',
|
||||
{"page": "godmode/groups/group_list",
|
||||
"get_group_json": 1,
|
||||
"id_group": id_group
|
||||
$(config.spanPreview).fadeOut("fast", function() {
|
||||
$("img", config.spanPreview).remove();
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "godmode/groups/group_list",
|
||||
get_group_json: 1,
|
||||
id_group: id_group
|
||||
},
|
||||
function (data) {
|
||||
img = $("<img />").attr ("src", "images/groups_small/"+data["icon"]+".png");
|
||||
function(data) {
|
||||
var img = $("<img />").attr(
|
||||
"src",
|
||||
"images/groups_small/" + data["icon"] + ".png"
|
||||
);
|
||||
$(config.spanPreview)
|
||||
.append (img)
|
||||
.fadeIn ('fast');
|
||||
.append(img)
|
||||
.fadeIn("fast");
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
})()
|
||||
});
|
||||
|
||||
$.fn.extend({
|
||||
pandoraSelectGroupAgent: $.pandoraSelectGroupAgent.construct,
|
||||
pandoraSelectGroupAgentDisabled: $.pandoraSelectGroupAgentDisabled.construct,
|
||||
pandoraSelectGroupAgentDisabled:
|
||||
$.pandoraSelectGroupAgentDisabled.construct,
|
||||
pandoraSelectAgentModule: $.pandoraSelectAgentModule.construct,
|
||||
pandoraSelectAgentAlert: $.pandoraSelectAgentAlert.construct,
|
||||
pandoraSelectOS: $.pandoraSelectOS.construct,
|
||||
pandoraSelectGroupIcon: $.pandoraSelectGroupIcon.construct
|
||||
});
|
||||
}) (jQuery);
|
||||
})(jQuery);
|
||||
|
|
Loading…
Reference in New Issue