mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
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:
parent
ea97077df3
commit
971687744e
@ -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>
|
2012-03-07 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/functions_graph.php
|
* include/functions_graph.php
|
||||||
|
@ -126,69 +126,95 @@ ui_require_css_file ('cluetip');
|
|||||||
ui_require_jquery_file ('cluetip');
|
ui_require_jquery_file ('cluetip');
|
||||||
ui_require_jquery_file ('pandora.controls');
|
ui_require_jquery_file ('pandora.controls');
|
||||||
ui_require_jquery_file ('bgiframe');
|
ui_require_jquery_file ('bgiframe');
|
||||||
ui_require_jquery_file ('autocomplete');
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
$("#text_id_agent").autocomplete({
|
||||||
$("#text_id_agent").autocomplete(
|
minLength: 2,
|
||||||
"ajax.php",
|
source: function( request, response ) {
|
||||||
{
|
var term = request.term; //Word to search
|
||||||
minChars: 2,
|
|
||||||
scroll:true,
|
var data_params = {
|
||||||
extraParams: {
|
|
||||||
page: "operation/agentes/exportdata",
|
page: "operation/agentes/exportdata",
|
||||||
search_agents: 1,
|
"search_agents_2": 1,
|
||||||
id_group: function() { return $("#id_group").val(); }
|
id_group: function() { return $("#id_group").val(); },
|
||||||
},
|
"q": term};
|
||||||
formatItem: function (data, i, total) {
|
|
||||||
if (total == 0)
|
jQuery.ajax ({
|
||||||
$("#text_id_agent").css ('background-color', '#cc0000');
|
data: data_params,
|
||||||
else
|
async: false,
|
||||||
$("#text_id_agent").css ('background-color', '');
|
type: "POST",
|
||||||
if (data == "")
|
url: action="ajax.php",
|
||||||
return false;
|
timeout: 10000,
|
||||||
|
dataType: "json",
|
||||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
success: function (data) {
|
||||||
},
|
response(data);
|
||||||
delay: 200
|
return;
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
return;
|
||||||
|
},
|
||||||
$("#text_id_agent").result (
|
select: function( event, ui ) {
|
||||||
function () {
|
var agent_name = ui.item.name;
|
||||||
selectAgent = true;
|
|
||||||
var agent_name = this.value;
|
//Put the name
|
||||||
$('#id_agent_module').fadeOut ('normal', function () {
|
$(this).val(agent_name);
|
||||||
$('#id_agent_module').empty ();
|
|
||||||
var inputs = [];
|
$('#id_agent_module').fadeOut ('normal', function () {
|
||||||
inputs.push ("agent_name=" + agent_name);
|
$('#id_agent_module').empty ();
|
||||||
inputs.push ('filter=delete_pending = 0 AND id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_estado WHERE utimestamp = 0)');
|
var inputs = [];
|
||||||
inputs.push ("get_agent_modules_json=1");
|
inputs.push ("agent_name=" + agent_name);
|
||||||
inputs.push ("page=operation/agentes/ver_agente");
|
inputs.push ('filter=delete_pending = 0 AND id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_estado WHERE utimestamp = 0)');
|
||||||
jQuery.ajax ({
|
inputs.push ("get_agent_modules_json=1");
|
||||||
data: inputs.join ("&"),
|
inputs.push ("page=operation/agentes/ver_agente");
|
||||||
type: 'GET',
|
jQuery.ajax ({
|
||||||
url: action="ajax.php",
|
data: inputs.join ("&"),
|
||||||
timeout: 10000,
|
type: 'GET',
|
||||||
dataType: 'json',
|
url: action="ajax.php",
|
||||||
success: function (data) {
|
timeout: 10000,
|
||||||
$('#id_agent_module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
dataType: 'json',
|
||||||
jQuery.each (data, function (i, val) {
|
success: function (data) {
|
||||||
s = js_html_entity_decode (val['nombre']);
|
$('#id_agent_module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
||||||
$('#id_agent_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
jQuery.each (data, function (i, val) {
|
||||||
});
|
s = js_html_entity_decode (val['nombre']);
|
||||||
$('#id_agent_module').enable();
|
$('#id_agent_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
||||||
$('#id_agent_module').fadeIn ('normal');
|
});
|
||||||
}
|
$('#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) : ?>
|
<?php if (! $id_agente) : ?>
|
||||||
$("#id_group").pandoraSelectGroupAgent ({
|
$("#id_group").pandoraSelectGroupAgent ({
|
||||||
|
@ -22,6 +22,7 @@ if (! check_acl ($config["id_user"], 0, "IR")) {
|
|||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access event viewer");
|
"Trying to access event viewer");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ if ($id){
|
|||||||
$permission = events_check_event_filter_group ($id);
|
$permission = events_check_event_filter_group ($id);
|
||||||
if (!$permission) { // User doesn't have permissions to see this filter
|
if (!$permission) { // User doesn't have permissions to see this filter
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +69,8 @@ if ($id) {
|
|||||||
$group_rep = $filter['group_rep'];
|
$group_rep = $filter['group_rep'];
|
||||||
$tag = $filter['tag'];
|
$tag = $filter['tag'];
|
||||||
$filter_only_alert = $filter['filter_only_alert'];
|
$filter_only_alert = $filter['filter_only_alert'];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$id_group = '';
|
$id_group = '';
|
||||||
$id_group_filter = '';
|
$id_group_filter = '';
|
||||||
$id_name = '';
|
$id_name = '';
|
||||||
@ -101,8 +104,9 @@ if ($update) {
|
|||||||
$filter_only_alert = get_parameter('filter_only_alert','');
|
$filter_only_alert = get_parameter('filter_only_alert','');
|
||||||
|
|
||||||
if ($id_name == '') {
|
if ($id_name == '') {
|
||||||
ui_print_error_message (__('Not updated. Blank name'));
|
ui_print_error_message (__('Not updated. Blank name'));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$values = array ('id_filter' => $id,
|
$values = array ('id_filter' => $id,
|
||||||
'id_name' => $id_name,
|
'id_name' => $id_name,
|
||||||
'id_group_filter' => $id_group_filter,
|
'id_group_filter' => $id_group_filter,
|
||||||
@ -119,7 +123,7 @@ if ($update) {
|
|||||||
'tag' => $tag,
|
'tag' => $tag,
|
||||||
'filter_only_alert' => $filter_only_alert
|
'filter_only_alert' => $filter_only_alert
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = db_process_sql_update ('tevent_filter', $values, array ('id_filter' => $id));
|
$result = db_process_sql_update ('tevent_filter', $values, array ('id_filter' => $id));
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
@ -160,16 +164,19 @@ if ($create) {
|
|||||||
'tag' => $tag,
|
'tag' => $tag,
|
||||||
'filter_only_alert' => $filter_only_alert
|
'filter_only_alert' => $filter_only_alert
|
||||||
);
|
);
|
||||||
|
|
||||||
$id = db_process_sql_insert('tevent_filter', $values);
|
$id = db_process_sql_insert('tevent_filter', $values);
|
||||||
|
|
||||||
if ($id === false) {
|
if ($id === false) {
|
||||||
ui_print_error_message ('Error creating filter');
|
ui_print_error_message ('Error creating filter');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui_print_success_message ('Filter created successfully');
|
ui_print_success_message ('Filter created successfully');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$own_info = get_user_info ($config['id_user']);
|
||||||
|
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->border = 0;
|
$table->border = 0;
|
||||||
$table->cellspacing = 3;
|
$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,
|
$own_info['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true,
|
||||||
false, false);
|
false, false);
|
||||||
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
|
||||||
$table->data[2][0] = '<b>'.__('Group').'</b>';
|
$table->data[2][0] = '<b>'.__('Group').'</b>';
|
||||||
$table->data[2][1] = html_print_select_groups($config['id_user'], "IW",
|
$table->data[2][1] = html_print_select_groups($config['id_user'], "IW",
|
||||||
$own_info['is_admin'], 'id_group', $id_group, '', '', -1, true,
|
$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 ('update', 1);
|
||||||
html_print_input_hidden ('id', $id);
|
html_print_input_hidden ('id', $id);
|
||||||
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
html_print_input_hidden ('create', 1);
|
html_print_input_hidden ('create', 1);
|
||||||
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
||||||
}
|
}
|
||||||
@ -267,37 +274,70 @@ echo '</div>';
|
|||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
ui_require_jquery_file ('bgiframe');
|
ui_require_jquery_file ('bgiframe');
|
||||||
ui_require_jquery_file ('autocomplete');
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
|
$("#text_id_agent").autocomplete({
|
||||||
$("#text_id_agent").autocomplete(
|
minLength: 2,
|
||||||
"ajax.php",
|
source: function( request, response ) {
|
||||||
{
|
var term = request.term; //Word to search
|
||||||
minChars: 2,
|
|
||||||
scroll:true,
|
var data_params = {
|
||||||
extraParams: {
|
page: "operation/agentes/exportdata",
|
||||||
page: "operation/agentes/exportdata",
|
"search_agents_2": 1,
|
||||||
search_agents: 1,
|
id_group: function() { return $("#id_group").val(); },
|
||||||
add: '<?php echo json_encode(array('-1' => "All", '0' => "System"));?>',
|
"q": term};
|
||||||
id_group: function() { return $("#id_group").val(); }
|
|
||||||
},
|
jQuery.ajax ({
|
||||||
formatItem: function (data, i, total) {
|
data: data_params,
|
||||||
if (total == 0)
|
async: false,
|
||||||
$("#text_id_agent").css ('background-color', '#cc0000');
|
type: "POST",
|
||||||
else
|
url: action="ajax.php",
|
||||||
$("#text_id_agent").css ('background-color', '');
|
timeout: 10000,
|
||||||
if (data == "")
|
dataType: "json",
|
||||||
return false;
|
success: function (data) {
|
||||||
|
response(data);
|
||||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
return;
|
||||||
},
|
}
|
||||||
delay: 200
|
});
|
||||||
}
|
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");
|
||||||
|
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
|
@ -657,7 +657,6 @@ echo '</div>';
|
|||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
ui_require_jquery_file ('timeentry');
|
ui_require_jquery_file ('timeentry');
|
||||||
ui_require_jquery_file ('autocomplete');
|
|
||||||
ui_require_javascript_file('pandora');
|
ui_require_javascript_file('pandora');
|
||||||
if ($enterpriseEnable) {
|
if ($enterpriseEnable) {
|
||||||
reporting_enterprise_text_box();
|
reporting_enterprise_text_box();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user