2010-05-18 Miguel de Dios <miguel.dedios@artica.es>

* include/javascript/pandora.js: added function 
	"agent_changed_by_multiple_agents_id" for response to change agent in
	wizard in visual console editor.

	* operation/agentes/ver_agente.php: added response to
	"get_agent_modules_json_for_multiple_agents_id" for the ajax previous
	function.
	
	* godmode/reporting/visual_console_builder.wizard.php: used new javascript
	function.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2743 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-05-18 10:03:06 +00:00
parent 0eaa5935cf
commit 20a4660d06
4 changed files with 83 additions and 1 deletions

View File

@ -1,3 +1,16 @@
2010-05-18 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js: added function
"agent_changed_by_multiple_agents_id" for response to change agent in
wizard in visual console editor.
* operation/agentes/ver_agente.php: added response to
"get_agent_modules_json_for_multiple_agents_id" for the ajax previous
function.
* godmode/reporting/visual_console_builder.wizard.php: used new javascript
function.
2010-05-17 Sergio Martin <sergio.martin@artica.es>
* include/languages/cs.po

View File

@ -82,6 +82,6 @@ echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>';
<script language="javascript" type="text/javascript">
$(document).ready (function () {
//$("#id_agents").change (agent_changed);
$("#id_agents").change (agent_changed_by_multiple_agents);
$("#id_agents").change (agent_changed_by_multiple_agents_id);
});
</script>

View File

@ -165,6 +165,65 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
}
/**
* Fill up select box with id "module" with modules after agent has been selected, but this not empty the select box.s
*
* @param event that has been triggered
* @param id_agent Agent ID that has been selected
* @param selected Which module(s) have to be selected
*/
function agent_changed_by_multiple_agents_id (event, id_agent, selected) {
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {
//val() because the var is same <option val="NNN"></option>
idAgents.push($(val).val());
});
$('#module').attr ('disabled', 1);
$('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente",
"get_agent_modules_json_for_multiple_agents_id": 1,
"id_agent[]": idAgents
},
function (data) {
$('#module').empty ();
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val['nombre']);
//$('#module').append ($('<option></option>').html (s).attr ("value", val));
$('#module').append ($('<option></option>').html (s).attr ("value", val['id_agente_modulo']));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').attr ('disabled', 0);
},
"json"
);
}
/**
* Autocomplete Agent box and module selector functions.
*

View File

@ -32,6 +32,7 @@ if (is_ajax ()) {
$get_agent_status_tooltip = (bool) get_parameter ("get_agent_status_tooltip");
$get_agents_group_json = (bool) get_parameter ("get_agents_group_json");
$get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents");
$get_agent_modules_json_for_multiple_agents_id = (bool) get_parameter("get_agent_modules_json_for_multiple_agents_id");
if ($get_agents_group_json) {
$id_group = get_parameter('id_group');
@ -62,6 +63,15 @@ if (is_ajax ()) {
return;
}
if ($get_agent_modules_json_for_multiple_agents_id) {
$idAgents = get_parameter('id_agent');
$nameModules = get_db_all_rows_sql('SELECT nombre, id_agente_modulo FROM tagente_modulo WHERE id_agente IN (' . implode(',', $idAgents) . ')');
echo json_encode($nameModules);
return;
}
if ($get_agent_modules_json_for_multiple_agents) {
$idAgents = get_parameter('id_agent');