2012-03-07 Miguel de Dios <miguel.dedios@artica.es>

* godmode/alerts/alert_list.builder.php,
	godmode/reporting/reporting_builder.item_editor.php: fixed javascript
	autocomplete.
	
	* godmode/events/event_edit_filter.php: fixed javascript autocomplete, and
	fixed the $owninfo.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5720 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-03-08 12:25:52 +00:00
parent 43c01be337
commit 43977d63c6
4 changed files with 166 additions and 92 deletions

View File

@ -1,3 +1,12 @@
2012-03-07 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/alert_list.builder.php,
godmode/reporting/reporting_builder.item_editor.php: fixed javascript
autocomplete.
* godmode/events/event_edit_filter.php: fixed javascript autocomplete, and
fixed the $owninfo.
2012-03-07 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php

View File

@ -126,69 +126,95 @@ ui_require_css_file ('cluetip');
ui_require_jquery_file ('cluetip');
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#text_id_agent").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
$("#text_id_agent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
page: "operation/agentes/exportdata",
search_agents: 1,
id_group: function() { return $("#id_group").val(); }
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text_id_agent").css ('background-color', '#cc0000');
else
$("#text_id_agent").css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
},
delay: 200
}
);
$("#text_id_agent").result (
function () {
selectAgent = true;
var agent_name = this.value;
$('#id_agent_module').fadeOut ('normal', function () {
$('#id_agent_module').empty ();
var inputs = [];
inputs.push ("agent_name=" + agent_name);
inputs.push ('filter=delete_pending = 0 AND id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_estado WHERE utimestamp = 0)');
inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente");
jQuery.ajax ({
data: inputs.join ("&"),
type: 'GET',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
$('#id_agent_module').append ($('<option></option>').attr ('value', 0).text ("--"));
jQuery.each (data, function (i, val) {
s = js_html_entity_decode (val['nombre']);
$('#id_agent_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
});
$('#id_agent_module').enable();
$('#id_agent_module').fadeIn ('normal');
}
});
"search_agents_2": 1,
id_group: function() { return $("#id_group").val(); },
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="ajax.php",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
$('#id_agent_module').fadeOut ('normal', function () {
$('#id_agent_module').empty ();
var inputs = [];
inputs.push ("agent_name=" + agent_name);
inputs.push ('filter=delete_pending = 0 AND id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_estado WHERE utimestamp = 0)');
inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente");
jQuery.ajax ({
data: inputs.join ("&"),
type: 'GET',
url: action="ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
$('#id_agent_module').append ($('<option></option>').attr ('value', 0).text ("--"));
jQuery.each (data, function (i, val) {
s = js_html_entity_decode (val['nombre']);
$('#id_agent_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
});
$('#id_agent_module').enable();
$('#id_agent_module').fadeIn ('normal');
}
});
});
}
);
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if ((item.ip == "") || (typeof(item.ip) == "undefined")) {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
<?php if (! $id_agente) : ?>
$("#id_group").pandoraSelectGroupAgent ({

View File

@ -22,6 +22,7 @@ if (! check_acl ($config["id_user"], 0, "IR")) {
db_pandora_audit("ACL Violation",
"Trying to access event viewer");
require ("general/noaccess.php");
return;
}
@ -33,6 +34,7 @@ if ($id){
$permission = events_check_event_filter_group ($id);
if (!$permission) { // User doesn't have permissions to see this filter
require ("general/noaccess.php");
return;
}
}
@ -67,7 +69,8 @@ if ($id) {
$group_rep = $filter['group_rep'];
$tag = $filter['tag'];
$filter_only_alert = $filter['filter_only_alert'];
} else {
}
else {
$id_group = '';
$id_group_filter = '';
$id_name = '';
@ -101,8 +104,9 @@ if ($update) {
$filter_only_alert = get_parameter('filter_only_alert','');
if ($id_name == '') {
ui_print_error_message (__('Not updated. Blank name'));
} else {
ui_print_error_message (__('Not updated. Blank name'));
}
else {
$values = array ('id_filter' => $id,
'id_name' => $id_name,
'id_group_filter' => $id_group_filter,
@ -119,7 +123,7 @@ if ($update) {
'tag' => $tag,
'filter_only_alert' => $filter_only_alert
);
$result = db_process_sql_update ('tevent_filter', $values, array ('id_filter' => $id));
ui_print_result_message ($result,
@ -160,16 +164,19 @@ if ($create) {
'tag' => $tag,
'filter_only_alert' => $filter_only_alert
);
$id = db_process_sql_insert('tevent_filter', $values);
if ($id === false) {
ui_print_error_message ('Error creating filter');
} else {
}
else {
ui_print_success_message ('Filter created successfully');
}
}
$own_info = get_user_info ($config['id_user']);
$table->width = '98%';
$table->border = 0;
$table->cellspacing = 3;
@ -186,7 +193,6 @@ $table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
$own_info['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true,
false, false);
$own_info = get_user_info ($config['id_user']);
$table->data[2][0] = '<b>'.__('Group').'</b>';
$table->data[2][1] = html_print_select_groups($config['id_user'], "IW",
$own_info['is_admin'], 'id_group', $id_group, '', '', -1, true,
@ -259,7 +265,8 @@ if ($id) {
html_print_input_hidden ('update', 1);
html_print_input_hidden ('id', $id);
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
} else {
}
else {
html_print_input_hidden ('create', 1);
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
}
@ -267,37 +274,70 @@ echo '</div>';
echo '</form>';
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
?>
<script language="javascript" type="text/javascript">
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready( function() {
$("#text_id_agent").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
page: "operation/agentes/exportdata",
search_agents: 1,
add: '<?php echo json_encode(array('-1' => "All", '0' => "System"));?>',
id_group: function() { return $("#id_group").val(); }
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text_id_agent").css ('background-color', '#cc0000');
else
$("#text_id_agent").css ('background-color', '');
if (data == "")
return false;
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
},
delay: 200
}
);
$("#text_id_agent").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
page: "operation/agentes/exportdata",
"search_agents_2": 1,
id_group: function() { return $("#id_group").val(); },
"q": term};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="ajax.php",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
return;
}
});
return;
},
select: function( event, ui ) {
var agent_name = ui.item.name;
//Put the name
$(this).val(agent_name);
return false;
}
})
.data( "autocomplete")._renderItem = function( ul, item ) {
if ((item.ip == "") || (typeof(item.ip) == "undefined")) {
text = "<a>" + item.name + "</a>";
}
else {
text = "<a>" + item.name
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
return $("<li></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
};
//Force the size of autocomplete
$(".ui-autocomplete").css("max-height", "100px");
$(".ui-autocomplete").css("overflow-y", "auto");
/* prevent horizontal scrollbar */
$(".ui-autocomplete").css("overflow-x", "hidden");
/* add padding to account for vertical scrollbar */
$(".ui-autocomplete").css("padding-right", "20px");
//Force to style of items
$(".ui-autocomplete").css("text-align", "left");
});
/* ]]> */

View File

@ -657,7 +657,6 @@ echo '</div>';
echo '</form>';
ui_require_jquery_file ('timeentry');
ui_require_jquery_file ('autocomplete');
ui_require_javascript_file('pandora');
if ($enterpriseEnable) {
reporting_enterprise_text_box();