mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 11:29:12 +02:00
* godmode/agentes/alert_manager.php: Removed from repository. Agent alerts manager is now done in alerts/alert_list.php * godmode/agentes/manage_config.php, godmode/alerts/configure_alert, godmode/agentes/configurar_agente.php: Use alerts/alert_list.php instead of deleted agentes/alert_manager.php. * godmode/alerts/alert_list.php: It can handle now a list of agents or be included by configurar_agente. Now it's a single page to manage all the alerts defined in agents. * godmode/reporting/map_builder.php: Javascript style correction. * include/javascript/jquery.pandora.controls.js: Added pandoraSelectAgent which allows the loading of a module list from an agent list. * include/styles/pandora.css: Styles for alert_list. * include/functions_agents.php: Added options to get_agent_alerts_compound() and get_agent_alerts_simple() to add extra user filtering. * pandoradb.sql, pandoradb_migrate_20_to_21.sql, include/functions_alerts.php: Actions in an alert module has now id or they cannot be removed. * include/functions_db.php: format_array_to_where_clause_sql() can now get limit and offset values. * include/functions_html.php: Removed select- prefix to print_select elements because it was breaking javascript code. Needs more works on that. * operation/agentes/estado_agente.php: Added get_agent_module_last_value AJAX operation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1466 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
112 lines
3.0 KiB
JavaScript
112 lines
3.0 KiB
JavaScript
$(document).ready (function () {
|
|
var dummyFunc = function () {
|
|
return;
|
|
};
|
|
|
|
$.extend ({
|
|
pandoraSelectGroup: new function() {
|
|
this.defaults = {
|
|
agentSelectId: "id_agent",
|
|
loadingId: "agent_loading",
|
|
callbackBefore: dummyFunc,
|
|
callbackPre: dummyFunc,
|
|
callbackPost: dummyFunc,
|
|
callbackAfter: dummyFunc,
|
|
debug: false
|
|
};
|
|
|
|
/* public methods */
|
|
this.construct = function (settings) {
|
|
return this.each (function() {
|
|
this.config = {};
|
|
|
|
var config = $.extend (this.config, $.pandoraSelectGroup.defaults, settings);
|
|
|
|
$(this).change (function () {
|
|
var $select = $("select#"+config.agentSelectId).disable ();
|
|
$("#"+config.loadingId).show ();
|
|
$("option[value!=0]", $select).remove ();
|
|
config.callbackBefore (this);
|
|
|
|
jQuery.post ("ajax.php",
|
|
{"page" : "godmode/groups/group_list",
|
|
"get_group_agents" : 1,
|
|
"id_group" : this.value
|
|
},
|
|
function (data, status) {
|
|
jQuery.each (data, function (id, value) {
|
|
config.callbackPre ();
|
|
option = $("<option></option>")
|
|
.attr ("value", id)
|
|
.html (value);
|
|
config.callbackPost (id, value, option);
|
|
$("#"+config.agentSelectId).append (option);
|
|
});
|
|
$("#"+config.loadingId).hide ();
|
|
$select.enable ();
|
|
config.callbackAfter ();
|
|
},
|
|
"json"
|
|
);
|
|
});
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
$.extend ({
|
|
pandoraSelectAgent: new function() {
|
|
this.defaults = {
|
|
moduleSelectId: "id_agent_module",
|
|
loadingId: "module_loading",
|
|
callbackBefore: dummyFunc,
|
|
callbackPre: dummyFunc,
|
|
callbackPost: dummyFunc,
|
|
callbackAfter: dummyFunc,
|
|
debug: false
|
|
};
|
|
|
|
/* public methods */
|
|
this.construct = function (settings) {
|
|
return this.each (function() {
|
|
this.config = {};
|
|
|
|
var config = $.extend (this.config, $.pandoraSelectAgent.defaults, settings);
|
|
|
|
$(this).change (function () {
|
|
var $select = $("select#"+config.moduleSelectId).disable ();
|
|
$("#"+config.loadingId).show ();
|
|
$("option[value!=0]", $select).remove ();
|
|
config.callbackBefore (this);
|
|
|
|
jQuery.post ('ajax.php',
|
|
{"page": "operation/agentes/ver_agente",
|
|
"get_agent_modules_json": 1,
|
|
"id_agent": this.value
|
|
},
|
|
function (data) {
|
|
jQuery.each (data, function (i, value) {
|
|
config.callbackPre ();
|
|
option = $("<option></option>")
|
|
.attr ("value", value['id_agente_modulo'])
|
|
.html (html_entity_decode (value['nombre']));
|
|
config.callbackPost (i, value, option);
|
|
$("#"+config.moduleSelectId).append (option);
|
|
});
|
|
$("#"+config.loadingId).hide ();
|
|
$select.enable ();
|
|
config.callbackAfter ();
|
|
},
|
|
"json"
|
|
);
|
|
});
|
|
});
|
|
};
|
|
}
|
|
});
|
|
$.fn.extend({
|
|
pandoraSelectGroup: $.pandoraSelectGroup.construct,
|
|
pandoraSelectAgent: $.pandoraSelectAgent.construct,
|
|
});
|
|
});
|