2009-04-20 16:00:27 +02:00
|
|
|
/* Modules ids to check types */
|
|
|
|
var id_modules_icmp = Array (6, 7);
|
|
|
|
var id_modules_tcp = Array (8, 9, 10, 11);
|
|
|
|
var id_modules_snmp = Array (15, 16, 17, 18);
|
|
|
|
|
|
|
|
function configure_modules_form () {
|
|
|
|
$("#id_module_type").change (function () {
|
|
|
|
if (id_modules_icmp.in_array (this.value)) {
|
2013-04-16 16:51:04 +02:00
|
|
|
$("tr#simple-snmp_1, tr#simple-snmp_2, tr#simple-tcp_send, tr#simple-tcp_receive").hide ();
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-tcp_port").attr ("disabled", "1");
|
2013-02-27 11:22:51 +01:00
|
|
|
}
|
|
|
|
else if (id_modules_snmp.in_array (this.value)) {
|
2009-04-20 16:00:27 +02:00
|
|
|
$("tr#simple-snmp_1, tr#simple-snmp_2").show ();
|
2013-04-16 16:51:04 +02:00
|
|
|
$("tr#simple-tcp_send, tr#simple-tcp_receive").hide ();
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-tcp_port").removeAttr ("disabled");
|
2013-02-27 11:22:51 +01:00
|
|
|
}
|
|
|
|
else if (id_modules_tcp.in_array (this.value)) {
|
2009-04-20 16:00:27 +02:00
|
|
|
$("tr#simple-snmp_1, tr#simple-snmp_2").hide ();
|
2013-04-16 16:51:04 +02:00
|
|
|
$("tr#simple-tcp_send, tr#simple-tcp_receive").show ();
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-tcp_port").removeAttr ("disabled");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-04-16 16:51:04 +02:00
|
|
|
$("#id_module_type").trigger("change");
|
|
|
|
|
2009-09-07 18:40:56 +02:00
|
|
|
$("#local_component_group").change (function () {
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2009-09-07 18:40:56 +02:00
|
|
|
var $select = $("#local_component").hide ();
|
|
|
|
$("#component").hide ();
|
2012-09-11 12:51:23 +02:00
|
|
|
if (this.value == 0) {
|
|
|
|
reset_data_module_form();
|
2009-09-07 18:40:56 +02:00
|
|
|
return;
|
2012-09-11 12:51:23 +02:00
|
|
|
}
|
2009-09-07 18:40:56 +02:00
|
|
|
$("#component_loading").show ();
|
|
|
|
$(".error, #no_component").hide ();
|
|
|
|
$("option[value!=0]", $select).remove ();
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "godmode/agentes/module_manager_editor",
|
|
|
|
"get_module_local_components" : 1,
|
|
|
|
"id_module_component_group" : this.value,
|
|
|
|
"id_module_component_type" : $("#hidden-id_module_component_type").attr ("value")
|
|
|
|
},
|
|
|
|
function (data, status) {
|
|
|
|
if (data == false) {
|
|
|
|
$("#component_loading").hide ();
|
2013-07-08 13:06:44 +02:00
|
|
|
$("#no_component").show ();
|
2009-09-07 18:40:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
option = $("<option></option>")
|
|
|
|
.attr ("value", val['id'])
|
|
|
|
.append (val['name']);
|
|
|
|
$select.append (option);
|
|
|
|
});
|
|
|
|
$("#component_loading").hide ();
|
|
|
|
$select.show ();
|
|
|
|
$("#component").show ();
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2012-09-11 12:51:23 +02:00
|
|
|
function reset_data_module_form() {
|
|
|
|
// Delete macro fields
|
|
|
|
$('.macro_field').remove();
|
|
|
|
|
|
|
|
// Hide show/hide configuration data switch
|
|
|
|
$('#simple-show_configuration_data').hide();
|
|
|
|
$('#simple-hide_configuration_data').hide();
|
|
|
|
$('#configuration_data_legend').hide();
|
|
|
|
|
|
|
|
$("#textarea_configuration_data").val('');
|
|
|
|
$('#simple-configuration_data').show();
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-09-11 12:51:23 +02:00
|
|
|
$("#text-name").val('');
|
|
|
|
$("#textarea_description").val('');
|
|
|
|
$("#checkbox-history_data").check ();
|
|
|
|
$("#text-max").attr ("value", "");
|
|
|
|
$("#text-min").attr ("value", "");
|
|
|
|
$("#text-min_warning").attr ("value", 0);
|
|
|
|
$("#text-max_warning").attr ("value", 0);
|
|
|
|
$("#text-str_warning").attr ("value", '');
|
|
|
|
$("#text-min_critical").attr ("value", 0);
|
|
|
|
$("#text-max_critical").attr ("value", 0);
|
|
|
|
$("#text-str_critical").attr ("value", '');
|
|
|
|
$("#text-ff_event").attr ("value", 0);
|
|
|
|
$("#text-post_process").attr("value", 0);
|
|
|
|
$("#text-unit").attr("value", '');
|
2012-09-17 Ramon Novoa <rnovoa@artica.es>
* include/javascript/pandora_modules.js,
include/functions_network_components.php,
pandoradb.sql,
extensions/plugin_registration.php,
operation/agentes/status_monitor.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php: Added inverse intervals for
warning and critical limits.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6977 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-17 16:29:45 +02:00
|
|
|
$("#text-critical_inverse").attr ("value", 0);
|
|
|
|
$("#text-warning_inverse").attr ("value", 0);
|
2012-09-17 18:03:38 +02:00
|
|
|
$("#textarea_critical_instructions").attr ("value", '');
|
|
|
|
$("#textarea_warning_instructions").attr ("value", '');
|
|
|
|
$("#textarea_unknown_instructions").attr ("value", '');
|
|
|
|
|
2012-09-11 12:51:23 +02:00
|
|
|
}
|
2009-09-07 18:40:56 +02:00
|
|
|
|
|
|
|
$("#local_component").change (function () {
|
2012-09-11 12:51:23 +02:00
|
|
|
if (this.value == 0) {
|
|
|
|
reset_data_module_form();
|
2009-09-07 18:40:56 +02:00
|
|
|
return;
|
2012-09-11 12:51:23 +02:00
|
|
|
}
|
2009-09-07 18:40:56 +02:00
|
|
|
$("#component_loading").show ();
|
|
|
|
$(".error").hide ();
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "godmode/agentes/module_manager_editor",
|
|
|
|
"get_module_local_component" : 1,
|
|
|
|
"id_module_component" : this.value
|
|
|
|
},
|
|
|
|
function (data, status) {
|
2010-03-08 13:49:49 +01:00
|
|
|
configuration_data = js_html_entity_decode (data['data']);
|
|
|
|
$("#text-name").attr ("value", js_html_entity_decode (data["name"]));
|
|
|
|
$("#textarea_description").attr ("value", js_html_entity_decode (data["description"]));
|
2013-02-27 10:51:48 +01:00
|
|
|
$("#textarea_configuration_data").val(configuration_data);
|
2009-09-07 18:40:56 +02:00
|
|
|
$("#component_loading").hide ();
|
2013-04-12 13:12:20 +02:00
|
|
|
$("#id_module_type").val(data["type"]);
|
2012-07-05 11:16:57 +02:00
|
|
|
$("#text-max").attr ("value", data["max"]);
|
|
|
|
$("#text-min").attr ("value", data["min"]);
|
|
|
|
// Workaround to update the advanced select control from html and ajax
|
2013-07-17 13:12:37 +02:00
|
|
|
if (typeof 'period_select_module_interval_update' == 'function') {
|
2012-07-05 11:16:57 +02:00
|
|
|
period_select_module_interval_update(data["module_interval"]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
period_select_update('module_interval', data["module_interval"]);
|
2013-02-27 10:51:48 +01:00
|
|
|
}
|
|
|
|
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#id_module_group").val (data["id_module_group"]);
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-07-05 11:16:57 +02:00
|
|
|
if (data["history_data"])
|
|
|
|
$("#checkbox-history_data").check ();
|
|
|
|
else
|
|
|
|
$("#checkbox-history_data").uncheck ();
|
|
|
|
$("#text-min_warning").attr ("value", (data["min_warning"] == 0) ? 0 : data["min_warning"]);
|
|
|
|
$("#text-max_warning").attr ("value", (data["max_warning"] == 0) ? 0 : data["max_warning"]);
|
|
|
|
$("#text-str_warning").attr ("value", (data["str_warning"] == 0) ? 0 : data["str_warning"]);
|
|
|
|
$("#text-min_critical").attr ("value", (data["min_critical"] == 0) ? 0 : data["min_critical"]);
|
|
|
|
$("#text-max_critical").attr ("value", (data["max_critical"] == 0) ? 0 : data["max_critical"]);
|
|
|
|
$("#text-str_critical").attr ("value", (data["str_critical"] == 0) ? 0 : data["str_critical"]);
|
|
|
|
$("#text-ff_event").attr ("value", (data["min_ff_event"] == 0) ? 0 : data["min_ff_event"]);
|
2012-09-17 Ramon Novoa <rnovoa@artica.es>
* include/javascript/pandora_modules.js,
include/functions_network_components.php,
pandoradb.sql,
extensions/plugin_registration.php,
operation/agentes/status_monitor.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php: Added inverse intervals for
warning and critical limits.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6977 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-17 16:29:45 +02:00
|
|
|
$("#text-post_process").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
|
2012-07-05 11:16:57 +02:00
|
|
|
$("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"])
|
2012-09-17 Ramon Novoa <rnovoa@artica.es>
* include/javascript/pandora_modules.js,
include/functions_network_components.php,
pandoradb.sql,
extensions/plugin_registration.php,
operation/agentes/status_monitor.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php: Added inverse intervals for
warning and critical limits.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6977 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-17 16:29:45 +02:00
|
|
|
$("#text-critical_inverse").attr ("value", (data["critical_inverse"] == 0) ? 0 : data["critical_inverse"]);
|
|
|
|
$("#text-warning_inverse").attr ("value", (data["warning_inverse"] == 0) ? 0 : data["warning_inverse"]);
|
2012-07-05 11:16:57 +02:00
|
|
|
$("#component_loading").hide ();
|
|
|
|
$("#id_module_type").change ();
|
2013-02-27 10:51:48 +01:00
|
|
|
if ($("#id_category").is("select")) {
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#id_category").val (data["id_category"]);
|
2012-12-07 15:25:40 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#hidden-id_category").val(data["id_category"]);
|
|
|
|
}
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-12-10 19:04:27 +01:00
|
|
|
var tags = data["tags"];
|
|
|
|
|
|
|
|
// Reset the selection of tags (put all of them into available box)
|
|
|
|
$("#id_tag_selected option").each(function(){
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($(this).attr('value') != '') {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_selected").find("option[value='" + $(this).attr('value') + "']").remove();
|
|
|
|
$("select[name='id_tag_available[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
|
|
|
|
}
|
|
|
|
});
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($("#id_tag_available option").length > 1) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_available").find("option[value='']").remove();
|
|
|
|
}
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($("#id_tag_selected option").length == 0) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("select[name='id_tag_selected[]']").append($("<option></option>").val('').html('<i>None</i>'));
|
|
|
|
}
|
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
if (tags != '') {
|
2012-12-10 19:04:27 +01:00
|
|
|
tags = tags.split(',');
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-12-10 19:04:27 +01:00
|
|
|
// Fill the selected tags box with select ones
|
2013-07-17 13:12:37 +02:00
|
|
|
for (i = 0; i < tags.length; i++){
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_available option").each(function(){
|
2013-07-17 13:12:37 +02:00
|
|
|
if (tags[i] == $(this).text()) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_available").find("option[value='" + $(this).attr('value') + "']").remove();
|
|
|
|
$("select[name='id_tag_selected[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
|
|
|
|
$("#id_tag_selected").find("option[value='']").remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($("#id_tag_available option").length == 0) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("select[name='id_tag_available[]']").append($("<option></option>").val('').html('<i>None</i>'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-28 09:53:50 +02:00
|
|
|
if (data["throw_unknown_events"])
|
|
|
|
$("input[name='throw_unknown_events']").check();
|
|
|
|
else
|
|
|
|
$("input[name='throw_unknown_events']").uncheck();
|
|
|
|
|
2012-08-29 13:58:36 +02:00
|
|
|
// Delete macro fields
|
|
|
|
$('.macro_field').remove();
|
|
|
|
|
|
|
|
$('#hidden-macros').val('');
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-08-29 13:58:36 +02:00
|
|
|
var legend = '';
|
|
|
|
// If exist macros, load the fields
|
2013-07-17 13:12:37 +02:00
|
|
|
if (data["macros"] != '' && data["macros"] != null) {
|
2012-08-29 13:58:36 +02:00
|
|
|
$('#hidden-macros').val(Base64.encode(data["macros"]));
|
|
|
|
|
|
|
|
var obj = jQuery.parseJSON(data["macros"]);
|
|
|
|
$.each(obj, function(k,macro) {
|
|
|
|
add_macro_field(macro, 'simple-macro');
|
|
|
|
legend += macro['macro']+" = "+ macro['desc']+"<br>";
|
|
|
|
});
|
|
|
|
$('#configuration_data_legend').html(legend);
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-08-29 13:58:36 +02:00
|
|
|
$('#simple-show_configuration_data').show();
|
|
|
|
$('#simple-hide_configuration_data').hide();
|
|
|
|
$('#configuration_data_legend').show();
|
|
|
|
$('#simple-configuration_data').hide();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#simple-show_configuration_data').hide();
|
|
|
|
$('#simple-hide_configuration_data').hide();
|
|
|
|
$('#configuration_data_legend').hide();
|
|
|
|
$('#simple-configuration_data').show();
|
|
|
|
}
|
2009-09-07 18:40:56 +02:00
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2013-07-08 13:06:44 +02:00
|
|
|
network_component_group_change_event();
|
2014-03-12 12:06:06 +01:00
|
|
|
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#network_component").change (function () {
|
|
|
|
if (this.value == 0)
|
|
|
|
return;
|
|
|
|
$("#component_loading").show ();
|
|
|
|
$(".error").hide ();
|
|
|
|
jQuery.post ("ajax.php",
|
2014-03-18 16:29:09 +01:00
|
|
|
{
|
|
|
|
"page" : "godmode/agentes/module_manager_editor",
|
|
|
|
"get_module_component" : 1,
|
|
|
|
"id_module_component" : this.value
|
2009-04-20 16:00:27 +02:00
|
|
|
},
|
|
|
|
function (data, status) {
|
2010-03-08 13:49:49 +01:00
|
|
|
$("#text-name").attr ("value", js_html_entity_decode (data["name"]));
|
|
|
|
$("#textarea_description").attr ("value", js_html_entity_decode (data["description"]));
|
2013-04-12 13:12:20 +02:00
|
|
|
$("#id_module_type").val(data["type"]);
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-max").attr ("value", data["max"]);
|
|
|
|
$("#text-min").attr ("value", data["min"]);
|
2012-07-05 11:16:57 +02:00
|
|
|
// Workaround to update the advanced select control from html and ajax
|
2013-07-17 13:12:37 +02:00
|
|
|
if (typeof 'period_select_module_interval_update' == 'function') {
|
2012-07-05 11:16:57 +02:00
|
|
|
period_select_module_interval_update(data["module_interval"]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
period_select_update('module_interval', data["module_interval"]);
|
|
|
|
}
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-tcp_port").attr ("value", data["tcp_port"]);
|
2014-03-11 13:44:10 +01:00
|
|
|
$("#textarea_tcp_send")
|
|
|
|
.attr ("value", js_html_entity_decode (data["tcp_send"]));
|
|
|
|
$("#textarea_tcp_rcv")
|
|
|
|
.attr ("value", js_html_entity_decode (data["tcp_rcv"]));
|
|
|
|
$("#text-snmp_community")
|
|
|
|
.attr ("value", js_html_entity_decode (data["snmp_community"]));
|
|
|
|
$("#text-snmp_oid")
|
|
|
|
.val( js_html_entity_decode (data["snmp_oid"]));
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#oid, img#edit_oid").hide ();
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#id_module_group").val (data["id_module_group"]);
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#max_timeout").attr ("value", data["max_timeout"]);
|
2012-10-29 Ramon Novoa <rnovoa@artica.es>
* include/functions_reporting.php,
include/javascript/pandora_modules.js,
include/functions_network_components.php,
include/functions_api.php,
include/functions_netflow.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
extensions/resource_registration.php,
extensions/plugin_registration.php,
operation/menu.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/servers/plugin.php,
godmode/menu.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: Added support for
custom timeout and retries to remote modules.
* operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php,
godmode/netflow/nf_report_item.php,
godmode/netflow/nf_report.php,
godmode/netflow/nf_report_form.php,
godmode/netflow/nf.php: Deleted from repository. Netflow reports are
now integrated into custom reports.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7103 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-29 11:13:49 +01:00
|
|
|
$("#max_retries").attr ("value", data["max_retries"]);
|
2013-07-02 10:49:39 +02:00
|
|
|
if (data["id_plugin"] != undefined) {
|
|
|
|
$("#id_plugin").val(data["id_plugin"]);
|
|
|
|
}
|
2012-08-29 13:58:36 +02:00
|
|
|
$("#id_plugin").trigger('change');
|
2010-03-08 13:49:49 +01:00
|
|
|
$("#text-plugin_user").attr ("value", js_html_entity_decode (data["plugin_user"]));
|
|
|
|
$("#password-plugin_pass").attr ("value", js_html_entity_decode (data["plugin_pass"]));
|
|
|
|
$("#text-plugin_parameter").attr ("value", js_html_entity_decode (data["plugin_parameter"]));
|
2009-04-20 16:00:27 +02:00
|
|
|
if (data["history_data"])
|
|
|
|
$("#checkbox-history_data").check ();
|
|
|
|
else
|
|
|
|
$("#checkbox-history_data").uncheck ();
|
|
|
|
$("#text-min_warning").attr ("value", (data["min_warning"] == 0) ? 0 : data["min_warning"]);
|
2010-04-14 14:06:27 +02:00
|
|
|
$("#text-max_warning").attr ("value", (data["max_warning"] == 0) ? 0 : data["max_warning"]);
|
2013-02-19 11:57:37 +01:00
|
|
|
$("#text-str_warning").attr ("value", data["str_warning"]);
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-min_critical").attr ("value", (data["min_critical"] == 0) ? 0 : data["min_critical"]);
|
|
|
|
$("#text-max_critical").attr ("value", (data["max_critical"] == 0) ? 0 : data["max_critical"]);
|
2013-02-19 11:57:37 +01:00
|
|
|
$("#text-str_critical").attr ("value", data["str_critical"]);
|
2012-07-05 11:16:57 +02:00
|
|
|
$("#text-ff_event").attr ("value", (data["min_ff_event"] == 0) ? 0 : data["min_ff_event"]);
|
2012-09-17 Ramon Novoa <rnovoa@artica.es>
* include/javascript/pandora_modules.js,
include/functions_network_components.php,
pandoradb.sql,
extensions/plugin_registration.php,
operation/agentes/status_monitor.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php: Added inverse intervals for
warning and critical limits.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6977 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-17 16:29:45 +02:00
|
|
|
$("#text-post_process").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"]);
|
2012-09-17 Ramon Novoa <rnovoa@artica.es>
* include/javascript/pandora_modules.js,
include/functions_network_components.php,
pandoradb.sql,
extensions/plugin_registration.php,
operation/agentes/status_monitor.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php: Added inverse intervals for
warning and critical limits.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6977 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-17 16:29:45 +02:00
|
|
|
$("#text-critical_inverse").attr ("value", (data["critical_inverse"] == 0) ? 0 : data["critical_inverse"]);
|
|
|
|
$("#text-warning_inverse").attr ("value", (data["warning_inverse"] == 0) ? 0 : data["warning_inverse"]);
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#component_loading").hide ();
|
|
|
|
$("#id_module_type").change ();
|
2013-02-27 10:51:48 +01:00
|
|
|
if ($("#id_category").is("select")) {
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#id_category").val (data["id_category"]);
|
2012-12-07 15:25:40 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#hidden-id_category").val(data["id_category"]);
|
|
|
|
}
|
2012-12-10 19:04:27 +01:00
|
|
|
|
|
|
|
var tags = data["tags"];
|
|
|
|
|
|
|
|
// Reset the selection of tags (put all of them into available box)
|
2013-08-27 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php,
include/functions_events.php, include/functions.php,
include/javascript/pandora_modules.js,
include/functions_network_components.php,
include/functions_modules.php, include/constants.php, pandoradb.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: first version of
disabled unknown events for modules, now it is implemented in
modules, massive operations and components, but it is necesary in
local component, policy, api, cli, pandora server and recond task.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8701 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-08-27 15:05:30 +02:00
|
|
|
$("#id_tag_selected option").each(function() {
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($(this).attr('value') != '') {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_selected").find("option[value='" + $(this).attr('value') + "']").remove();
|
|
|
|
$("select[name='id_tag_available[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
|
|
|
|
}
|
|
|
|
});
|
2013-02-27 10:51:48 +01:00
|
|
|
if ($("#id_tag_available option").length > 1) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_available").find("option[value='']").remove();
|
|
|
|
}
|
2013-02-27 10:51:48 +01:00
|
|
|
if ($("#id_tag_selected option").length == 0) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("select[name='id_tag_selected[]']").append($("<option></option>").val('').html('<i>None</i>'));
|
|
|
|
}
|
|
|
|
|
2013-02-27 10:51:48 +01:00
|
|
|
if (tags != '') {
|
2012-12-10 19:04:27 +01:00
|
|
|
tags = tags.split(',');
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-12-10 19:04:27 +01:00
|
|
|
// Fill the selected tags box with select ones
|
2013-07-17 13:12:37 +02:00
|
|
|
for (i = 0; i < tags.length; i++){
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_available option").each(function(){
|
2013-07-17 13:12:37 +02:00
|
|
|
if (tags[i] == $(this).text()) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("#id_tag_available").find("option[value='" + $(this).attr('value') + "']").remove();
|
|
|
|
$("select[name='id_tag_selected[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
|
|
|
|
$("#id_tag_selected").find("option[value='']").remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($("#id_tag_available option").length == 0) {
|
2012-12-10 19:04:27 +01:00
|
|
|
$("select[name='id_tag_available[]']").append($("<option></option>").val('').html('<i>None</i>'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2014-06-13 10:39:11 +02:00
|
|
|
// Delete macro fields
|
|
|
|
$('.macro_field').remove();
|
|
|
|
$('#hidden-macros').val('');
|
2014-03-18 16:29:09 +01:00
|
|
|
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-08-14 14:52:29 +02:00
|
|
|
// If exist macros, load the fields
|
2013-07-17 13:12:37 +02:00
|
|
|
if (data["macros"] != '' && data["macros"] != null) {
|
2012-08-14 14:52:29 +02:00
|
|
|
$('#hidden-macros').val(Base64.encode(data["macros"]));
|
|
|
|
|
|
|
|
var obj = jQuery.parseJSON(data["macros"]);
|
|
|
|
$.each(obj, function(k,macro) {
|
|
|
|
add_macro_field(macro, 'simple-macro');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2010-02-12 12:47:57 +01:00
|
|
|
if (data["type"] >= 15 && data["type"] <= 18) {
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#snmp_version").val(data["tcp_send"]);
|
2010-02-12 12:47:57 +01:00
|
|
|
$("#text-snmp3_auth_user").val(data["plugin_user"]);
|
|
|
|
$("#text-snmp3_auth_pass").val(data["plugin_pass"]);
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#snmp3_auth_method").val(data["plugin_parameter"]);
|
|
|
|
$("#snmp3_privacy_method").val(data["custom_string_1"]);
|
2010-02-12 12:47:57 +01:00
|
|
|
$("#text-snmp3_privacy_pass").val(data["custom_string_2"]);
|
2013-07-02 10:49:39 +02:00
|
|
|
$("#snmp3_security_level").val(data["custom_string_3"]);
|
2010-02-12 12:47:57 +01:00
|
|
|
|
|
|
|
if (data["tcp_send"] == "3") {
|
|
|
|
$("#simple-field_snmpv3_row1").attr("style", "");
|
|
|
|
$("#simple-field_snmpv3_row2").attr("style", "");
|
|
|
|
$("#simple-field_snmpv3_row3").attr("style", "");
|
|
|
|
$("input[name=active_snmp_v3]").val(1);
|
|
|
|
}
|
|
|
|
}
|
2013-08-27 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php,
include/functions_events.php, include/functions.php,
include/javascript/pandora_modules.js,
include/functions_network_components.php,
include/functions_modules.php, include/constants.php, pandoradb.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: first version of
disabled unknown events for modules, now it is implemented in
modules, massive operations and components, but it is necesary in
local component, policy, api, cli, pandora server and recond task.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8701 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-08-27 15:05:30 +02:00
|
|
|
|
2014-09-10 16:12:59 +02:00
|
|
|
if (data["id_modulo"] == 4) {
|
|
|
|
changePluginSelect();
|
|
|
|
}
|
|
|
|
|
2013-08-27 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php,
include/functions_events.php, include/functions.php,
include/javascript/pandora_modules.js,
include/functions_network_components.php,
include/functions_modules.php, include/constants.php, pandoradb.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: first version of
disabled unknown events for modules, now it is implemented in
modules, massive operations and components, but it is necesary in
local component, policy, api, cli, pandora server and recond task.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8701 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-08-27 15:05:30 +02:00
|
|
|
if (data["throw_unknown_events"])
|
2013-08-28 09:53:50 +02:00
|
|
|
$("input[name='throw_unknown_events']").check();
|
2013-08-27 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components.php,
include/functions_events.php, include/functions.php,
include/javascript/pandora_modules.js,
include/functions_network_components.php,
include/functions_modules.php, include/constants.php, pandoradb.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: first version of
disabled unknown events for modules, now it is implemented in
modules, massive operations and components, but it is necesary in
local component, policy, api, cli, pandora server and recond task.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8701 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-08-27 15:05:30 +02:00
|
|
|
else
|
2013-08-28 09:53:50 +02:00
|
|
|
$("input[name='throw_unknown_events']").uncheck();
|
2009-04-20 16:00:27 +02:00
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$("img#edit_oid").click (function () {
|
|
|
|
$("#oid").hide ();
|
|
|
|
$("#text-snmp_oid").show ()
|
|
|
|
.attr ("value", $("#select_snmp_oid").fieldValue ());
|
|
|
|
$(this).hide ();
|
|
|
|
});
|
|
|
|
|
|
|
|
$("form#module_form").submit (function () {
|
2009-06-09 16:29:03 +02:00
|
|
|
if ($("#text-name").val () == "") {
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-name").focus ();
|
|
|
|
$("#message").showMessage (no_name_lang);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-05-11 15:53:24 +02:00
|
|
|
if ($("#id_plugin").attr ("value") == 0) {
|
|
|
|
$("#id_plugin").focus ();
|
|
|
|
$("#message").showMessage (no_plugin_lang);
|
|
|
|
return false;
|
|
|
|
}
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2009-06-09 16:29:03 +02:00
|
|
|
moduletype = $("#hidden-moduletype").val ();
|
|
|
|
if (moduletype == 5) {
|
|
|
|
if ($("#prediction_module").val () == null) {
|
|
|
|
$("#prediction_module").focus ();
|
2009-06-09 16:43:37 +02:00
|
|
|
$("#message").showMessage (no_prediction_module_lang);
|
2009-06-09 16:29:03 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-20 16:00:27 +02:00
|
|
|
module = $("#id_module_type").attr ("value");
|
|
|
|
|
|
|
|
if (id_modules_icmp.in_array (module) || id_modules_tcp.in_array (module) || id_modules_snmp.in_array (module)) {
|
|
|
|
/* Network module */
|
2009-06-09 16:29:03 +02:00
|
|
|
if ($("#text-ip_target").val () == "") {
|
2009-04-20 16:00:27 +02:00
|
|
|
$("#text-ip_target").focus ();
|
|
|
|
$("#message").showMessage (no_target_lang);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id_modules_snmp.in_array (module)) {
|
|
|
|
if ($("#text-snmp_oid").attr ("value") == "") {
|
|
|
|
if ($("#select_snmp_oid").attr ("value") == "") {
|
|
|
|
$("#message").showMessage (no_oid_lang);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#message").hide ();
|
|
|
|
return true;
|
|
|
|
});
|
2009-06-09 16:29:03 +02:00
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
if (typeof $("#prediction_id_group").pandoraSelectGroupAgent == 'function') {
|
2012-07-05 11:16:57 +02:00
|
|
|
$("#prediction_id_group").pandoraSelectGroupAgent ({
|
|
|
|
agentSelect: "select#prediction_id_agent",
|
|
|
|
callbackBefore: function () {
|
|
|
|
$("#module_loading").show ();
|
|
|
|
$("#prediction_module option").remove ();
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
callbackAfter: function (e) {
|
|
|
|
if ($("#prediction_id_agent").children ().length == 0) {
|
|
|
|
$("#module_loading").hide ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$("#prediction_id_agent").change ();
|
2009-06-09 16:29:03 +02:00
|
|
|
}
|
2012-07-05 11:16:57 +02:00
|
|
|
});
|
|
|
|
}
|
2009-06-09 16:29:03 +02:00
|
|
|
|
2013-02-27 10:51:48 +01:00
|
|
|
if (typeof $("#prediction_id_agent").pandoraSelectAgentModule == 'function') {
|
2012-07-05 11:16:57 +02:00
|
|
|
$("#prediction_id_agent").pandoraSelectAgentModule ({
|
|
|
|
moduleSelect: "select#prediction_module"
|
|
|
|
});
|
|
|
|
}
|
2009-04-20 16:00:27 +02:00
|
|
|
}
|
2012-07-24 15:25:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Functions to add and remove dynamic fields for macros
|
|
|
|
function delete_macro(prefix) {
|
|
|
|
var next_number = parseInt($('#next_macro').html());
|
|
|
|
// Is not possible delete first macro
|
2013-02-27 10:51:48 +01:00
|
|
|
if (next_number == 3) {
|
2012-07-24 15:25:30 +02:00
|
|
|
$('#delete_macro_button').hide();
|
|
|
|
}
|
|
|
|
var next_row = parseInt($('#next_row').html());
|
|
|
|
$('#next_macro').html(next_number-1);
|
2014-04-22 11:26:55 +02:00
|
|
|
$('#next_row').html(next_row-3);
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2014-04-22 11:26:55 +02:00
|
|
|
var nrow1 = next_row - 3;
|
|
|
|
var nrow2 = next_row - 2;
|
|
|
|
var nrow3 = next_row - 1;
|
2012-07-24 15:25:30 +02:00
|
|
|
|
|
|
|
var $row1 = $('#'+prefix+nrow1).remove();
|
|
|
|
var $row2 = $('#'+prefix+nrow2).remove();
|
2014-04-22 11:26:55 +02:00
|
|
|
var $row3 = $('#'+prefix+nrow3).remove();
|
2012-07-24 15:25:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function new_macro(prefix) {
|
|
|
|
$('#delete_macro_button').show();
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-07-24 15:25:30 +02:00
|
|
|
var next_row = parseInt($('#next_row').html());
|
2014-04-16 16:42:28 +02:00
|
|
|
|
2014-04-09 16:24:20 +02:00
|
|
|
$('#next_row').html(next_row + 3);
|
|
|
|
var nrow1 = next_row - 3;
|
|
|
|
var nrow2 = next_row - 2;
|
|
|
|
var nrow3 = next_row - 1;
|
|
|
|
var nrow4 = next_row;
|
|
|
|
var nrow5 = next_row + 1;
|
|
|
|
var nrow6 = next_row + 2;
|
2014-04-16 16:42:28 +02:00
|
|
|
|
2012-07-24 15:25:30 +02:00
|
|
|
var next_number = parseInt($('#next_macro').html());
|
2013-04-23 16:51:09 +02:00
|
|
|
$('#next_macro').html(next_number + 1);
|
2012-07-24 15:25:30 +02:00
|
|
|
var current_number = next_number - 1;
|
|
|
|
|
|
|
|
// Clone two last rows
|
2013-04-23 16:51:09 +02:00
|
|
|
var $row1 = $('#' + prefix + nrow1).clone(true);
|
|
|
|
var $row2 = $('#' + prefix + nrow2).clone(true);
|
2014-04-09 16:24:20 +02:00
|
|
|
var $row3 = $('#' + prefix + nrow3).clone(true);
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-07-24 15:25:30 +02:00
|
|
|
// Change the tr ID
|
2014-04-09 16:24:20 +02:00
|
|
|
$row1.attr('id',prefix + (nrow4));
|
|
|
|
$row2.attr('id',prefix + (nrow5));
|
|
|
|
$row3.attr('id',prefix + (nrow6));
|
2012-07-24 15:25:30 +02:00
|
|
|
// Change the td ID
|
|
|
|
$row1.find('td').attr('id', changeTdId);
|
|
|
|
$row2.find('td').attr('id', changeTdId);
|
2014-04-09 16:24:20 +02:00
|
|
|
$row3.find('td').attr('id', changeTdId);
|
2012-07-24 15:25:30 +02:00
|
|
|
|
|
|
|
// Insert after last field
|
2014-04-09 16:24:20 +02:00
|
|
|
$row3.insertAfter('#' + prefix + nrow3);
|
|
|
|
$row2.insertAfter('#' + prefix + nrow3);
|
|
|
|
$row1.insertAfter('#' + prefix + nrow3);
|
2012-07-24 15:25:30 +02:00
|
|
|
|
|
|
|
// Change labels
|
2013-02-27 10:51:48 +01:00
|
|
|
for(i = 0; i <= 3; i++) {
|
2014-04-09 16:24:20 +02:00
|
|
|
var label1 = $("#" + prefix + nrow4 + "-" + i).html();
|
2013-04-23 16:51:09 +02:00
|
|
|
var exp_reg = new RegExp('field' + current_number, 'g');
|
|
|
|
label1 = label1.replace(exp_reg,'field' + next_number);
|
2014-04-09 16:24:20 +02:00
|
|
|
$("#" + prefix + nrow4 + "-" + i).html(label1);
|
2012-07-24 15:25:30 +02:00
|
|
|
}
|
|
|
|
|
2013-02-27 10:51:48 +01:00
|
|
|
for(i = 0; i <= 1; i++) {
|
2014-04-09 16:24:20 +02:00
|
|
|
var label2 = $("#" + prefix + nrow5 + "-" + i).html();
|
2013-04-23 16:51:09 +02:00
|
|
|
var exp_reg = new RegExp('field' + current_number, 'g');
|
|
|
|
label2 = label2.replace(exp_reg,'field' + next_number);
|
2014-04-09 16:24:20 +02:00
|
|
|
$("#" + prefix + nrow5 + "-" + i).html(label2);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i <= 1; i++) {
|
|
|
|
var label3 = $("#" + prefix + nrow6 + "-" + i).html();
|
|
|
|
var exp_reg = new RegExp('field' + current_number, 'g');
|
|
|
|
label3 = label3.replace(exp_reg,'field' + next_number);
|
|
|
|
$("#" + prefix + nrow6 + "-" + i).html(label3);
|
2012-07-24 15:25:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Empty the text inputs
|
2013-04-23 16:51:09 +02:00
|
|
|
$('#text-field' + next_number + '_desc').val('');
|
|
|
|
$('#text-field' + next_number + '_help').val('');
|
|
|
|
$('#text-field' + next_number + '_value').val('');
|
2014-04-09 16:24:20 +02:00
|
|
|
$('#radio-field' + next_number + '_hide').val(0);
|
2012-07-24 15:25:30 +02:00
|
|
|
|
|
|
|
function changeTdId() {
|
|
|
|
switch(this.id) {
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow1) + '-0':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow4) + '-0';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow1) + '-1':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow4) + '-1';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow1) + '-2':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow4) + '-2';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow1) + '-3':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow4) + '-3';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow2) + '-0':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow5) + '-0';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow2) + '-1':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow5) + '-1';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow2) + '-2':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow5) + '-2';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
2013-04-23 16:51:09 +02:00
|
|
|
case prefix + (nrow2) + '-3':
|
2014-04-09 16:24:20 +02:00
|
|
|
return prefix + (nrow5) + '-3';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow3) + '-0':
|
|
|
|
return prefix + (nrow6) + '-0';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow3) + '-1':
|
|
|
|
return prefix + (nrow6) + '-1';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow3) + '-2':
|
|
|
|
return prefix + (nrow6) + '-2';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow3) + '-3':
|
|
|
|
return prefix + (nrow6) + '-3';
|
2012-07-24 15:25:30 +02:00
|
|
|
break;
|
|
|
|
}
|
2014-04-16 16:42:28 +02:00
|
|
|
}
|
2012-07-24 15:25:30 +02:00
|
|
|
}
|
|
|
|
|
2012-08-14 14:52:29 +02:00
|
|
|
function add_macro_field(macro, row_model_id) {
|
|
|
|
var macro_desc = macro['desc'];
|
2013-05-27 17:16:54 +02:00
|
|
|
// Change the carriage returns by html returns <br> in help
|
|
|
|
var macro_help = macro['help'].replace(/
/g,"<br>");
|
2012-08-14 14:52:29 +02:00
|
|
|
var macro_macro = macro['macro'];
|
2014-04-09 16:24:20 +02:00
|
|
|
var macro_value = $('<div />').html(macro['value']).text();
|
|
|
|
var macro_hide = macro['hide'];
|
2014-04-16 16:42:28 +02:00
|
|
|
|
2014-04-09 16:24:20 +02:00
|
|
|
macro_value.type = 'password';
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-08-14 14:52:29 +02:00
|
|
|
var row_id = row_model_id + macro_macro;
|
|
|
|
|
|
|
|
var $macro_field = $('#'+ row_model_id +'_field').clone(true);
|
|
|
|
|
|
|
|
// Change attributes to be unique and with identificable class
|
|
|
|
$macro_field.attr('id',row_id);
|
|
|
|
$macro_field.attr('class','macro_field');
|
2013-02-27 10:51:48 +01:00
|
|
|
|
2012-08-20 12:42:24 +02:00
|
|
|
// Get the number of fields already printed
|
|
|
|
var fields = $('.macro_field').size();
|
|
|
|
|
|
|
|
// If is the first, we insert it after model row
|
2013-02-27 10:51:48 +01:00
|
|
|
if (fields == 0) {
|
2012-08-20 12:42:24 +02:00
|
|
|
$macro_field.insertAfter('#'+ row_model_id +'_field');
|
|
|
|
}
|
|
|
|
// If there are more fields, we insert it after the last one
|
|
|
|
else {
|
|
|
|
$macro_field.insertAfter('#'+ $('.macro_field').eq(fields-1).attr('id'));
|
|
|
|
}
|
2012-08-14 14:52:29 +02:00
|
|
|
|
|
|
|
// Change the label
|
2013-02-27 10:51:48 +01:00
|
|
|
if (macro_help == '') {
|
2012-08-14 14:52:29 +02:00
|
|
|
$('#'+row_id).children().eq(0).html(macro_desc);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var field_desc = $('#'+row_id).children().eq(0).html();
|
|
|
|
field_desc = field_desc.replace('macro_desc',macro_desc);
|
|
|
|
field_desc = field_desc.replace('macro_help',macro_help);
|
2013-05-27 17:16:54 +02:00
|
|
|
|
|
|
|
// Get the cloned forced title id and replace for a uniq id
|
|
|
|
regex = /forced_title_(\w+)/;
|
|
|
|
var forced_title_id = field_desc.match(regex)[1];
|
|
|
|
var uniq_id = 'id' + (new Date()).getTime();
|
2013-08-16 11:15:44 +02:00
|
|
|
|
2013-05-27 17:16:54 +02:00
|
|
|
field_desc = field_desc.replace(forced_title_id, uniq_id);
|
|
|
|
field_desc = field_desc.replace(forced_title_id, uniq_id);
|
|
|
|
|
2012-08-14 14:52:29 +02:00
|
|
|
$('#'+row_id).children().eq(0).html(field_desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change the text box id and value
|
|
|
|
$('#'+row_id).children().eq(1).children().attr('id','text-'+macro_macro);
|
|
|
|
$('#'+row_id).children().eq(1).children().attr('name',macro_macro);
|
2014-04-09 16:24:20 +02:00
|
|
|
if (macro['hide']) {
|
|
|
|
$('#'+row_id).children().eq(1).children().attr('type','password');
|
|
|
|
}
|
2012-08-14 14:52:29 +02:00
|
|
|
$('#'+row_id).children().eq(1).children().val(macro_value);
|
2013-02-27 10:51:48 +01:00
|
|
|
|
|
|
|
|
2012-08-14 14:52:29 +02:00
|
|
|
$('#'+row_id).show();
|
|
|
|
}
|
|
|
|
|
|
|
|
function load_plugin_macros_fields(row_model_id) {
|
|
|
|
// Get plugin macros when selected and load macros fields
|
|
|
|
var id_plugin = $('#id_plugin').val();
|
|
|
|
|
|
|
|
var params = [];
|
|
|
|
params.push("page=include/ajax/module");
|
|
|
|
params.push("get_plugin_macros=1");
|
2014-03-18 16:29:09 +01:00
|
|
|
params.push("id_plugin=" + id_plugin);
|
|
|
|
|
2012-08-14 14:52:29 +02:00
|
|
|
jQuery.ajax ({
|
|
|
|
data: params.join ("&"),
|
|
|
|
type: 'POST',
|
2013-04-29 10:59:03 +02:00
|
|
|
url: action = get_php_value('absolute_homeurl') + "ajax.php",
|
2012-08-14 14:52:29 +02:00
|
|
|
async: false,
|
|
|
|
timeout: 10000,
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (data) {
|
|
|
|
// Delete all the macro fields
|
|
|
|
$('.macro_field').remove();
|
2013-02-27 10:51:48 +01:00
|
|
|
|
|
|
|
if (data['array'] != null) {
|
2012-08-14 14:52:29 +02:00
|
|
|
$('#hidden-macros').val(data['base64']);
|
|
|
|
jQuery.each (data['array'], function (i, macro) {
|
2013-07-17 13:12:37 +02:00
|
|
|
if (macro['desc'] != '') {
|
2012-08-17 14:18:00 +02:00
|
|
|
add_macro_field(macro, row_model_id);
|
|
|
|
}
|
2012-08-14 14:52:29 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2013-02-27 10:51:48 +01:00
|
|
|
});
|
2012-08-14 14:52:29 +02:00
|
|
|
}
|
|
|
|
|
2014-03-18 16:29:09 +01:00
|
|
|
function load_plugin_description(id_plugin) {
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{
|
|
|
|
"page" : "godmode/servers/plugin",
|
|
|
|
"get_plugin_description" : 1,
|
|
|
|
"id_plugin" : id_plugin
|
|
|
|
},
|
|
|
|
function (data, status) {
|
|
|
|
$("#plugin_description").html(data);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-03-15 10:30:46 +01:00
|
|
|
// Show the modal window of a module
|
|
|
|
function show_module_detail_dialog(module_id, id_agente) {
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
|
|
|
data: "page=include/ajax/module&get_module_detail=1&id_agente="+id_agente+"&id_module=" + module_id,
|
|
|
|
dataType: "json",
|
|
|
|
success: function(data){
|
|
|
|
$("#module_details_window").hide ()
|
|
|
|
.empty ()
|
|
|
|
.append (data)
|
|
|
|
.dialog ({
|
|
|
|
resizable: true,
|
|
|
|
draggable: true,
|
|
|
|
modal: true,
|
|
|
|
overlay: {
|
|
|
|
opacity: 0.5,
|
|
|
|
background: "black"
|
|
|
|
},
|
|
|
|
width: 620,
|
|
|
|
height: 500
|
|
|
|
})
|
|
|
|
.show ();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-07-08 13:06:44 +02:00
|
|
|
|
|
|
|
function network_component_group_change_event() {
|
|
|
|
$("#network_component_group").change (function () {
|
|
|
|
var $select = $("#network_component").hide ();
|
|
|
|
$("#component").hide ();
|
|
|
|
if (this.value == 0)
|
|
|
|
return;
|
|
|
|
$("#component_loading").show ();
|
|
|
|
$(".error, #no_component").hide ();
|
|
|
|
$("option[value!=0]", $select).remove ();
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "godmode/agentes/module_manager_editor",
|
|
|
|
"get_module_components" : 1,
|
|
|
|
"id_module_component_group" : this.value,
|
|
|
|
"id_module_component_type" : $("#hidden-id_module_component_type").attr ("value")
|
|
|
|
},
|
|
|
|
function (data, status) {
|
|
|
|
if (data == false) {
|
|
|
|
$("#component_loading").hide ();
|
|
|
|
$("#no_component").show ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
option = $("<option></option>")
|
|
|
|
.attr ("value", val['id_nc'])
|
|
|
|
.append (val['name']);
|
|
|
|
$select.append (option);
|
|
|
|
});
|
|
|
|
$("#component_loading").hide ();
|
|
|
|
$select.show ();
|
|
|
|
$("#component").show ();
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
2014-06-17 16:34:53 +02:00
|
|
|
|
|
|
|
function new_macro_local_component(prefix) {
|
|
|
|
$('#delete_macro_button').show();
|
|
|
|
|
|
|
|
var next_row = parseInt($('#next_row').html());
|
|
|
|
|
|
|
|
$('#next_row').html(next_row + 2);
|
|
|
|
var nrow1 = next_row - 2;
|
|
|
|
var nrow2 = next_row - 1;
|
|
|
|
var nrow3 = next_row;
|
|
|
|
var nrow4 = next_row + 1;
|
|
|
|
|
|
|
|
var next_number = parseInt($('#next_macro').html());
|
|
|
|
$('#next_macro').html(next_number + 1);
|
|
|
|
var current_number = next_number - 1;
|
|
|
|
|
|
|
|
// Clone two last rows
|
|
|
|
var $row1 = $('#' + prefix + nrow1).clone(true);
|
|
|
|
var $row2 = $('#' + prefix + nrow2).clone(true);
|
|
|
|
|
|
|
|
// Change the tr ID
|
|
|
|
$row1.attr('id',prefix + (nrow3));
|
|
|
|
$row2.attr('id',prefix + (nrow4));
|
|
|
|
// Change the td ID
|
|
|
|
$row1.find('td').attr('id', changeTdId);
|
|
|
|
$row2.find('td').attr('id', changeTdId);
|
|
|
|
|
|
|
|
// Insert after last field
|
|
|
|
$row2.insertAfter('#' + prefix + nrow2);
|
|
|
|
$row1.insertAfter('#' + prefix + nrow2);
|
|
|
|
|
|
|
|
// Change labels
|
|
|
|
for(i = 0; i <= 3; i++) {
|
|
|
|
var label1 = $("#" + prefix + nrow3 + "-" + i).html();
|
|
|
|
var exp_reg = new RegExp('field' + current_number, 'g');
|
|
|
|
label1 = label1.replace(exp_reg,'field' + next_number);
|
|
|
|
$("#" + prefix + nrow3 + "-" + i).html(label1);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i <= 1; i++) {
|
|
|
|
var label2 = $("#" + prefix + nrow4 + "-" + i).html();
|
|
|
|
var exp_reg = new RegExp('field' + current_number, 'g');
|
|
|
|
label2 = label2.replace(exp_reg,'field' + next_number);
|
|
|
|
$("#" + prefix + nrow4 + "-" + i).html(label2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Empty the text inputs
|
|
|
|
$('#text-field' + next_number + '_desc').val('');
|
|
|
|
$('#text-field' + next_number + '_help').val('');
|
|
|
|
$('#text-field' + next_number + '_value').val('');
|
|
|
|
|
|
|
|
function changeTdId() {
|
|
|
|
switch(this.id) {
|
|
|
|
case prefix + (nrow1) + '-0':
|
|
|
|
return prefix + (nrow3) + '-0';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow1) + '-1':
|
|
|
|
return prefix + (nrow3) + '-1';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow1) + '-2':
|
|
|
|
return prefix + (nrow3) + '-2';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow1) + '-3':
|
|
|
|
return prefix + (nrow3) + '-3';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow2) + '-0':
|
|
|
|
return prefix + (nrow4) + '-0';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow2) + '-1':
|
|
|
|
return prefix + (nrow4) + '-1';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow2) + '-2':
|
|
|
|
return prefix + (nrow4) + '-2';
|
|
|
|
break;
|
|
|
|
case prefix + (nrow2) + '-3':
|
|
|
|
return prefix + (nrow4) + '-3';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function delete_macro_local_component(prefix) {
|
|
|
|
var next_number = parseInt($('#next_macro').html());
|
|
|
|
// Is not possible delete first macro
|
|
|
|
if (next_number == 3) {
|
|
|
|
$('#delete_macro_button').hide();
|
|
|
|
}
|
|
|
|
var next_row = parseInt($('#next_row').html());
|
|
|
|
$('#next_macro').html(next_number-1);
|
|
|
|
$('#next_row').html(next_row-2);
|
|
|
|
|
|
|
|
var nrow1 = next_row - 2;
|
|
|
|
var nrow2 = next_row - 1;
|
|
|
|
|
|
|
|
var $row1 = $('#'+prefix+nrow1).remove();
|
|
|
|
var $row2 = $('#'+prefix+nrow2).remove();
|
|
|
|
}
|
|
|
|
|