2011-01-21 Miguel de Dios <miguel.dedios@artica.es>

* include/javascript/pandora.js, operation/agentes/exportdata.php,
	operation/agentes/ver_agente.php,
	godmode/reporting/visual_console_builder.wizard.php,
	godmode/reporting/visual_console_builder.editor.js,
	godmode/reporting/visual_console_builder.elements.php: fixed to show by ajax
	the disabled modules and the disabled agents.
	
	Fixes: #3155701




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3766 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-01-24 12:11:17 +00:00
parent e0d1fd9c7c
commit 9e444a9160
7 changed files with 47 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2011-01-21 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php: fixed to show by ajax
the disabled modules and the disabled agents.
Fixes: #3155701
2011-01-22 Sancho Lerena <slerena@artica.es>
* pandoradb_data.sql: Updated SQL with version and new embedded "so".

View File

@ -53,6 +53,7 @@ function eventsTextAgent() {
scroll:true,
extraParams: {
page: "operation/agentes/exportdata",
all: "enabled",
search_agents: 1,
id_group: function() { return $("#group").val(); }
},

View File

@ -143,7 +143,8 @@ foreach ($layoutDatas as $layoutData) {
'onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png" /></a>';
$table->data[$i + 2]['icon'] = '';
$table->data[$i + 2][0] = '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search.") . '</span></a>' . print_input_text_extended ('agent_' . $idLayoutData, get_agent_name($layoutData['id_agent']), 'text-agent_' . $idLayoutData, '', 15, 100, false, '',
$table->data[$i + 2][0] = '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search.") . '</span></a>' .
print_input_text_extended ('agent_' . $idLayoutData, get_agent_name($layoutData['id_agent']), 'text-agent_' . $idLayoutData, '', 15, 100, false, '',
array('class' => 'text-agent', 'style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), true);
$sql = 'SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE disabled = 0 AND id_agente = ' . $layoutData['id_agent'];
$table->data[$i + 2][1] = print_select_from_sql($sql,
@ -216,6 +217,7 @@ $(".text-agent").autocomplete(
scroll:true,
extraParams: {
page: "operation/agentes/exportdata",
all: "enabled",
search_agents: 1,
id_group: function() { return $("#group").val(); }
},

View File

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

View File

@ -123,13 +123,23 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
idAgents.push($(val).val());
});
//Hack to find only enabled modules
//Pass a flag as global var
find_modules = 'all';
if (typeof(show_only_enabled_modules) != "undefined") {
if (show_only_enabled_modules == true) {
find_modules = 'enabled';
}
}
$('#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": 1,
"id_agent[]": idAgents
"id_agent[]": idAgents,
"all": find_modules
},
function (data) {
$('#module').empty ();

View File

@ -25,6 +25,7 @@ if (is_ajax ()) {
$id_group = (int) get_parameter('id_group');
$addedItems = html_entity_decode((string) get_parameter('add'));
$addedItems = json_decode($addedItems);
$all = (string)get_parameter('all', 'all');
if ($addedItems != null) {
foreach ($addedItems as $item) {
@ -36,6 +37,12 @@ if (is_ajax ()) {
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter['id_grupo'] = $id_group;
switch ($all) {
case 'enabled':
$filter['disabled'] = 0;
break;
}
$agents = get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;

View File

@ -106,8 +106,20 @@ if (is_ajax ()) {
if ($get_agent_modules_json_for_multiple_agents) {
$idAgents = get_parameter('id_agent');
$all = (string)get_parameter('all', 'all');
switch ($all) {
default:
case 'all':
$enabled = '1 = 1';
break;
case 'enabled':
$enabled = 'disabled = 0';
break;
}
$nameModules = get_db_all_rows_sql('SELECT DISTINCT(nombre) FROM tagente_modulo t1 WHERE delete_pending = 0 AND id_agente IN (' . implode(',', $idAgents) . ') AND (SELECT count(nombre) FROM tagente_modulo t2 WHERE delete_pending = 0 AND t1.nombre = t2.nombre AND id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')');
$nameModules = get_db_all_rows_sql('SELECT DISTINCT(nombre)
FROM tagente_modulo t1
WHERE ' . $enabled . ' AND delete_pending = 0 AND id_agente IN (' . implode(',', $idAgents) . ') AND (SELECT count(nombre) FROM tagente_modulo t2 WHERE delete_pending = 0 AND t1.nombre = t2.nombre AND id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')');
$result = array();
foreach($nameModules as $nameModule) {