From dc0218260182c83ff5d3d86ed2ccb6649e8da297 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 21 Apr 2010 16:13:42 +0000 Subject: [PATCH] 2010-04-21 Miguel de Dios * include/javascript/pandora.js: small improve, added new parameter into the function "agent_module_autocomplete", the parameter is "noneValue" for add a option for none module in the select of modules git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2582 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ pandora_console/include/javascript/pandora.js | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9927945bb3..e4ef1c2590 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2010-04-21 Miguel de Dios + + * include/javascript/pandora.js: small improve, added new parameter into + the function "agent_module_autocomplete", the parameter is "noneValue" for + add a option for none module in the select of modules + 2010-04-20 Junichi Satoh * extras/check_other_languages.sh: Added missing '/'. diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 630c38f5f0..8e15c0ec71 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -102,7 +102,7 @@ function agent_changed (event, id_agent, selected) { * @param id_agent_id id of the hidden field to store the agent id * @param id_agent_module_selector id of the selector for the modules of the agent. */ -function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_selector) { +function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_selector, noneValue) { $(id_agent_name).autocomplete( "ajax.php", { @@ -129,7 +129,7 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_ $(id_agent_name).result ( function (e, data, formatted) { $(id_agent_module_selector).attr('disabled', false); - agent_id = data[1]; + agent_id = data[1]; $(id_agent_id).val(agent_id); jQuery.post ('ajax.php', {"page": "operation/agentes/ver_agente", @@ -140,6 +140,14 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_ }, function (data) { $(id_agent_module_selector).empty(); + if (typeof(noneValue) != "undefined") { + if (noneValue == true) { + option = $("") + .attr ("value", 0) + .html ("--"); + $(id_agent_module_selector).append (option); + } + } jQuery.each (data, function (i, value) { option = $("") .attr ("value", value['id_agente_modulo'])