2012-09-13 Miguel de Dios <miguel.dedios@artica.es>
* operation/incidents/incident_detail.php, operation/agentes/exportdata.php, operation/events/events_list.php, operation/events/events.php, godmode/events/event_edit_filter.php, godmode/massive/massive_edit_agents.php, include/functions_api.php, include/constants.php, include/javascript/pandora.js, include/functions_ui.php: started to use the new function "ui_print_agent_autocomplete_input" to make more easy (and standar) the autocomplete agent input. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6974 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
1fcb387ac7
commit
1fdbcd86f6
|
@ -1,3 +1,14 @@
|
|||
2012-09-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/incidents/incident_detail.php,
|
||||
operation/agentes/exportdata.php, operation/events/events_list.php,
|
||||
operation/events/events.php, godmode/events/event_edit_filter.php,
|
||||
godmode/massive/massive_edit_agents.php, include/functions_api.php,
|
||||
include/constants.php, include/javascript/pandora.js,
|
||||
include/functions_ui.php: started to use the new function
|
||||
"ui_print_agent_autocomplete_input" to make more easy (and standar)
|
||||
the autocomplete agent input.
|
||||
|
||||
2012-09-13 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/styles/pandora_legacy.css
|
||||
|
|
|
@ -190,13 +190,13 @@ $table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80,
|
|||
|
||||
$table->data[1][0] = '<b>'.__('Filter group').'</b>' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
|
||||
$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['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true,
|
||||
false, false);
|
||||
|
||||
$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,
|
||||
false, false);
|
||||
$own_info['is_admin'], 'id_group', $id_group, '', '', -1, true,
|
||||
false, false);
|
||||
|
||||
$types = get_event_types ();
|
||||
// Expand standard array to add not_normal (not exist in the array, used only for searches)
|
||||
|
@ -217,10 +217,13 @@ $table->data[6][0] = '<b>' . __('Free search') . '</b>';
|
|||
$table->data[6][1] = html_print_input_text ('search', io_safe_output($search), '', 15, 255, true);
|
||||
|
||||
$table->data[7][0] = '<b>' . __('Agent search') . '</b>';
|
||||
$src_code = html_print_image('images/lightning.png', true, false, true);
|
||||
$table->data[7][1] = html_print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(' . $src_code . ') no-repeat right;'), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'text_agent';
|
||||
$params['selectbox_group'] = 'id_group';
|
||||
$params['value'] = $text_agent;
|
||||
$table->data[7][1] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
$lpagination[25] = 25;
|
||||
$lpagination[50] = 50;
|
||||
|
@ -275,70 +278,3 @@ echo '</form>';
|
|||
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready( function() {
|
||||
$("#text_id_agent").autocomplete({
|
||||
minLength: 2,
|
||||
source: function( request, response ) {
|
||||
var term = request.term; //Word to search
|
||||
|
||||
var data_params = {
|
||||
page: "include/ajax/agent",
|
||||
"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");
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -236,9 +236,12 @@ $groups = users_get_groups ($config["id_user"], "AR",false);
|
|||
$agents = agents_get_group_agents (array_keys ($groups));
|
||||
|
||||
$table->data[0][0] = __('Parent');
|
||||
$table->data[0][1] = html_print_input_text_extended ('id_parent', agents_get_name ($id_parent), 'text-id_parent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['value'] = agents_get_name ($id_parent);
|
||||
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
$table->data[0][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
|
||||
|
||||
|
@ -413,17 +416,12 @@ ui_require_jquery_file ('pandora.controls');
|
|||
ui_require_jquery_file ('pandora.controls');
|
||||
ui_require_jquery_file ('ajaxqueue');
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
ui_require_jquery_file ('autocomplete');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
//Use this function for change 3 icons when change the selectbox
|
||||
$(document).ready (function () {
|
||||
function get_n_conf_files(idAgents) {
|
||||
|
||||
}
|
||||
|
||||
$("#id_agents").change (function () {
|
||||
var idAgents = Array();
|
||||
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
||||
|
@ -457,29 +455,6 @@ $(document).ready (function () {
|
|||
|
||||
$("select#id_os").pandoraSelectOS ();
|
||||
|
||||
$("#text-id_parent").autocomplete ("ajax.php",
|
||||
{
|
||||
scroll: true,
|
||||
minChars: 2,
|
||||
extraParams: {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
search_parents: 1,
|
||||
id_group: function() { return $("#group").val(); },
|
||||
id_agent: <?php echo $id_agente ?>
|
||||
},
|
||||
formatItem: function (data, i, total) {
|
||||
if (total == 0)
|
||||
$("#text-id_parent").css ('background-color', '#cc0000');
|
||||
else
|
||||
$("#text-id_parent").css ('background-color', '');
|
||||
if (data == "")
|
||||
return false;
|
||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
||||
},
|
||||
delay: 200
|
||||
}
|
||||
);
|
||||
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function (){
|
||||
recursion = this.checked ? 1 : 0;
|
||||
|
|
|
@ -2047,6 +2047,11 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$input_id = $parameters['input_id'];
|
||||
}
|
||||
|
||||
$selectbox_group = ''; //Default value
|
||||
if (isset($parameters['selectbox_group'])) {
|
||||
$selectbox_group = $parameters['selectbox_group'];
|
||||
}
|
||||
|
||||
//Default value
|
||||
$icon_image = html_print_image('images/lightning.png', true, false, true);
|
||||
if (isset($parameters['icon_image'])) {
|
||||
|
@ -2103,6 +2108,16 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$disabled = $parameters['disabled'];
|
||||
}
|
||||
|
||||
$selectbox_id = 'id_agent_module'; //Default value
|
||||
if (isset($parameters['selectbox_id'])) {
|
||||
$selectbox_id = $parameters['selectbox_id'];
|
||||
}
|
||||
|
||||
$add_none_module = true; //Default value
|
||||
if (isset($parameters['add_none_module'])) {
|
||||
$add_none_module = $parameters['add_none_module'];
|
||||
}
|
||||
|
||||
// Javascript configurations
|
||||
//-----------------------------------------
|
||||
$javascript = true; //Default value
|
||||
|
@ -2110,11 +2125,6 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript = $parameters['javascript'];
|
||||
}
|
||||
|
||||
$selectbox_id = 'id_agent_module'; //Default value
|
||||
if (isset($parameters['selectbox_id'])) {
|
||||
$selectbox_id = $parameters['selectbox_id'];
|
||||
}
|
||||
|
||||
$javascript_is_function_select = false; //Default value
|
||||
if (isset($parameters['javascript_is_function_select'])) {
|
||||
$javascript_is_function_select = $parameters['javascript_is_function_select'];
|
||||
|
@ -2130,11 +2140,13 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
function function_select_' . $input_name . '(agent_name) {
|
||||
|
||||
$("#' . $selectbox_id . '").empty ();
|
||||
|
||||
var inputs = [];
|
||||
inputs.push ("agent_name=" + agent_name);
|
||||
inputs.push ("filter=delete_pending = 0");
|
||||
inputs.push ("get_agent_modules_json=1");
|
||||
inputs.push ("page=operation/agentes/ver_agente");
|
||||
|
||||
jQuery.ajax ({
|
||||
data: inputs.join ("&"),
|
||||
type: "GET",
|
||||
|
@ -2142,9 +2154,11 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
timeout: 10000,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$("#' . $selectbox_id . '")
|
||||
.append($("<option></option>")
|
||||
.attr("value", 0).text("--"));
|
||||
if (' . ((int)$add_none_module) . ') {
|
||||
$("#' . $selectbox_id . '")
|
||||
.append($("<option></option>")
|
||||
.attr("value", 0).text("--"));
|
||||
}
|
||||
|
||||
jQuery.each (data, function(i, val) {
|
||||
s = js_html_entity_decode(val["nombre"]);
|
||||
|
@ -2166,7 +2180,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
}
|
||||
|
||||
//Default value
|
||||
$javascript_page = 'godmode/agentes/agent_manager';
|
||||
$javascript_page = 'include/ajax/agent';
|
||||
if (isset($parameters['javascript_page'])) {
|
||||
$javascript_page = $parameters['javascript_page'];
|
||||
}
|
||||
|
@ -2181,7 +2195,16 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
|
||||
var data_params = {
|
||||
"page": "' . $javascript_page . '",
|
||||
"search_parents_2": 1,
|
||||
"search_agents_2": 1,
|
||||
id_group: function() {
|
||||
var group_id = 0;
|
||||
|
||||
if (' . ((int)!empty($selectbox_group)) . ') {
|
||||
group_id = $("#' . $selectbox_group . '").val();
|
||||
}
|
||||
|
||||
return group_id;
|
||||
},
|
||||
"q": term};
|
||||
|
||||
jQuery.ajax ({
|
||||
|
@ -2202,6 +2225,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
},
|
||||
select: function( event, ui ) {
|
||||
var agent_name = ui.item.name;
|
||||
var agent_id = ui.item.id;
|
||||
|
||||
//Put the name
|
||||
$(this).val(agent_name);
|
||||
|
@ -2210,6 +2234,10 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
' . $javascript_name_function_select . '(agent_name);
|
||||
}
|
||||
|
||||
if (' . ((int)$print_hidden_input_idagent) . ') {
|
||||
$("#' . $hidden_input_idagent_id . '").val(agent_id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
@ -2228,18 +2256,18 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
.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 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");
|
||||
}';
|
||||
|
||||
//Force to style of items
|
||||
$(".ui-autocomplete").css("text-align", "left");
|
||||
}
|
||||
';
|
||||
if (isset($parameters['javascript_function_change'])) {
|
||||
$javascript_function_change = $parameters['javascript_function_change'];
|
||||
}
|
||||
|
@ -2262,10 +2290,8 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
|
||||
$html = '';
|
||||
|
||||
$attrs = '';
|
||||
if ($show_helptip) {
|
||||
$attrs = array('style' => 'background: url(' . $icon_image . ') no-repeat right;');
|
||||
}
|
||||
|
||||
$attrs = array('style' => 'background: url(' . $icon_image . ') no-repeat right;');
|
||||
|
||||
$html = html_print_input_text_extended($input_name, $value,
|
||||
$input_id, $helptip_text, $size, $maxlength, $disabled, '', $attrs, true);
|
||||
|
|
|
@ -4,7 +4,8 @@ var ENTERPRISE_DIR = 'enterprise';
|
|||
function toggleDiv (divid){
|
||||
if (document.getElementById(divid).style.display == 'none') {
|
||||
document.getElementById(divid).style.display = 'block';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
document.getElementById(divid).style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +32,11 @@ function js_html_entity_decode (str) {
|
|||
return "";
|
||||
|
||||
str2 = str.replace (/</g, "<").
|
||||
replace (/>/g,">").replace(/</g,'<').replace(/>/g,'>')
|
||||
.replace(/\/g,'\\').replace(/"/g,'\"').replace(/'/g,'\'')
|
||||
.replace(/&/g,'&').replace(/ /g,' ')
|
||||
.replace(/ /g, '\r').replace(/ /g, '\n');
|
||||
replace (/>/g,">").replace(/</g,'<')
|
||||
.replace(/>/g,'>').replace(/\/g,'\\')
|
||||
.replace(/"/g,'\"').replace(/'/g,'\'')
|
||||
.replace(/&/g,'&').replace(/ /g,' ')
|
||||
.replace(/ /g, '\r').replace(/ /g, '\n');
|
||||
|
||||
return str2;
|
||||
}
|
||||
|
@ -53,6 +55,7 @@ Array.prototype.in_array = function () {
|
|||
if(this[j] == arguments[0])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -173,50 +176,50 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
|
|||
homedir = event.data.homedir;
|
||||
|
||||
jQuery.post (homedir + '/ajax.php',
|
||||
{"page": "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json_for_multiple_agents": 1,
|
||||
"id_agent[]": idAgents,
|
||||
"all": find_modules,
|
||||
"custom_condition": custom_condition,
|
||||
"selection_mode": selection_mode
|
||||
},
|
||||
function (data) {
|
||||
$('#module').empty ();
|
||||
{"page": "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json_for_multiple_agents": 1,
|
||||
"id_agent[]": idAgents,
|
||||
"all": find_modules,
|
||||
"custom_condition": custom_condition,
|
||||
"selection_mode": selection_mode
|
||||
},
|
||||
function (data) {
|
||||
$('#module').empty ();
|
||||
|
||||
if (isEmptyObject(data)) {
|
||||
var noneText = $("#none_text").html(); //Trick for catch the translate text.
|
||||
if (isEmptyObject(data)) {
|
||||
var noneText = $("#none_text").html(); //Trick for catch the translate text.
|
||||
|
||||
if (noneText == null) {
|
||||
noneText = 'None';
|
||||
}
|
||||
if (noneText == null) {
|
||||
noneText = 'None';
|
||||
}
|
||||
|
||||
$('#module').append ($('<option></option>').html (noneText).attr ("None", "").attr('selected', true));
|
||||
$('#module').append ($('<option></option>').html (noneText).attr ("None", "").attr('selected', true));
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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 (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';
|
||||
}
|
||||
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);
|
||||
$('#module').append ($('<option></option>').html (s).attr ("value", i));
|
||||
$('#module').fadeIn ('normal');
|
||||
});
|
||||
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
||||
}
|
||||
}
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$('#module').append ($('<option></option>').html (s).attr ("value", i));
|
||||
$('#module').fadeIn ('normal');
|
||||
});
|
||||
if (selected != undefined)
|
||||
$('#module').attr ('value', selected);
|
||||
$('#module').css ("width", "auto");
|
||||
|
@ -347,28 +350,28 @@ function module_changed_by_multiple_modules (event, id_module, selected) {
|
|||
else {
|
||||
if (typeof(data['any_text']) != 'undefined') {
|
||||
$('#agents').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.
|
||||
}
|
||||
else {
|
||||
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
||||
|
||||
if (anyText == null) {
|
||||
anyText = 'Any';
|
||||
}
|
||||
if (anyText == null) {
|
||||
anyText = 'Any';
|
||||
}
|
||||
|
||||
$('#agents').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
||||
}
|
||||
}
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$('#agents').append ($('<option></option>').html (s).attr ("value", val));
|
||||
$('#agents').fadeIn ('normal');
|
||||
});
|
||||
if (selected != undefined)
|
||||
$('#agents').attr ('value', selected);
|
||||
$('#agents').removeAttr('disabled');
|
||||
},
|
||||
"json"
|
||||
);
|
||||
$('#agents').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
||||
}
|
||||
}
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$('#agents').append ($('<option></option>').html (s).attr ("value", val));
|
||||
$('#agents').fadeIn ('normal');
|
||||
});
|
||||
if (selected != undefined)
|
||||
$('#agents').attr ('value', selected);
|
||||
$('#agents').removeAttr('disabled');
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -190,7 +190,9 @@ if (empty($export_btn)) {
|
|||
|
||||
$groups = users_get_groups ($config['id_user'], "AR");
|
||||
|
||||
$table->data[0][1] = html_print_select_groups($config['id_user'], "AR", true, "group", $group, 'submit_group();', '', 0, true, false, true, 'w130', false);
|
||||
$table->data[0][1] = html_print_select_groups($config['id_user'],
|
||||
"AR", true, "group", $group, '', '', 0, true, false, true,
|
||||
'w130', false);
|
||||
|
||||
//Agent selector
|
||||
$table->data[1][0] = '<b>'.__('Source agent').'</b>';
|
||||
|
@ -212,9 +214,16 @@ if (empty($export_btn)) {
|
|||
//Src code of lightning image with skins
|
||||
$src_code = html_print_image ('images/lightning.png', true, false, true);
|
||||
|
||||
$table->data[1][1] = html_print_input_text_extended ('agent', agents_get_name ($agent), 'text-agent', '', 40, 100, false, '',
|
||||
array('style' => "background: url($src_code) no-repeat right;"), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
||||
$params = array();
|
||||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent';
|
||||
$params['selectbox_group'] = 'group';
|
||||
$params['value'] = agents_get_name ($agent);
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['add_none_module'] = false;
|
||||
$params['selectbox_id'] = 'module_arr';
|
||||
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
//Module selector
|
||||
$table->data[2][0] = '<b>'.__('Modules').'</b>';
|
||||
|
@ -279,7 +288,7 @@ if (empty($export_btn)) {
|
|||
|
||||
// Submit button
|
||||
echo '<div class="action-buttons" style="width:98%;">';
|
||||
html_print_button (__('Export'), 'export_btn', $disabled_export_button, 'change_action()', 'class="sub wand"');
|
||||
html_print_button (__('Export'), 'export_btn', false, 'change_action()', 'class="sub wand"');
|
||||
echo '</div></form>';
|
||||
}
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
|
@ -287,113 +296,24 @@ ui_require_jquery_file ('ajaxqueue');
|
|||
ui_require_jquery_file ('bgiframe');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
var inputActive = true;
|
||||
/* <![CDATA[ */
|
||||
function change_action() {
|
||||
type = $("#export_type").val();
|
||||
var f = document.forms.export_form;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: "page=operation/agentes/exportdata&search_agents=1&id_group=" + $("#group").val(),
|
||||
success: function(msg){
|
||||
if (msg.length == 0) {
|
||||
$("#text-agent").css ('background-color', '#FF8080');
|
||||
$("#text-agent").val("<?php echo __("No agents in this category");?>");
|
||||
$("#text-agent").attr("disabled", true);
|
||||
$("#text-agent").css ('color', '#000000');
|
||||
inputActive = false;
|
||||
}
|
||||
switch (type) {
|
||||
case 'csv':
|
||||
f.action = "operation/agentes/exportdata.csv.php";
|
||||
break;
|
||||
case 'excel':
|
||||
f.action = "operation/agentes/exportdata.excel.php";
|
||||
break;
|
||||
case 'avg':
|
||||
case 'data':
|
||||
f.action = "index.php?sec=reporting&sec2=operation/agentes/exportdata&export_btn=1";
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (inputActive) {
|
||||
$("#text-agent").autocomplete({
|
||||
minLength: 2,
|
||||
source: function( request, response ) {
|
||||
var term = request.term; //Word to search
|
||||
|
||||
var data_params = {
|
||||
page: "include/ajax/agent",
|
||||
search_agents_2: 1,
|
||||
id_group: function() { return $("#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);
|
||||
|
||||
this.form.submit();
|
||||
|
||||
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");
|
||||
$("#export_form").submit();
|
||||
}
|
||||
});
|
||||
|
||||
function change_action() {
|
||||
type = $("#export_type").val();
|
||||
var f = document.forms.export_form;
|
||||
|
||||
switch (type) {
|
||||
case 'csv':
|
||||
f.action = "operation/agentes/exportdata.csv.php";
|
||||
break;
|
||||
case 'excel':
|
||||
f.action = "operation/agentes/exportdata.excel.php";
|
||||
break;
|
||||
case 'avg':
|
||||
case 'data':
|
||||
f.action = "index.php?sec=reporting&sec2=operation/agentes/exportdata&export_btn=1";
|
||||
break;
|
||||
}
|
||||
$("#export_form").submit();
|
||||
}
|
||||
|
||||
function submit_group() {
|
||||
var f = document.forms.export_form;
|
||||
f.action = "index.php?sec=reporting&sec2=operation/agentes/exportdata";
|
||||
f.form.submit();
|
||||
}
|
||||
/* ]]> */
|
||||
/* ]]> */
|
||||
</script>
|
|
@ -389,63 +389,6 @@ ui_require_jquery_file ('bgiframe');
|
|||
/* <![CDATA[ */
|
||||
|
||||
$(document).ready( function() {
|
||||
$("#text_id_agent").autocomplete({
|
||||
minLength: 2,
|
||||
source: function( request, response ) {
|
||||
var term = request.term; //Word to search
|
||||
|
||||
var data_params = {
|
||||
"page": "godmode/agentes/agent_manager",
|
||||
"search_parents_2": 1,
|
||||
"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 == "") {
|
||||
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");
|
||||
|
||||
$("input[name=allbox]").change (function() {
|
||||
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));
|
||||
|
@ -707,7 +650,6 @@ $(document).ready( function() {
|
|||
document.getElementById(divid).style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
|
||||
|
|
|
@ -308,14 +308,19 @@ html_print_input_text ('search', io_safe_output($search), '', 15);
|
|||
echo '</td>';
|
||||
|
||||
//Agent search
|
||||
$src_code = html_print_image('images/lightning.png', true, false, true);
|
||||
echo "<td>".__('Agent search')."</td><td>";
|
||||
html_print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(' . $src_code . ') no-repeat right;'))
|
||||
. '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
||||
echo "<td>" . __('Agent search') . "</td>";
|
||||
echo '<td class="datos">';
|
||||
$params = array();
|
||||
$params['show_helptip'] = false;
|
||||
$params['input_name'] = 'id_agent';
|
||||
$params['value'] = $text_agent;
|
||||
ui_print_agent_autocomplete_input($params);
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
// User selectable block size
|
||||
echo '<tr><td>';
|
||||
|
@ -765,7 +770,7 @@ foreach ($result as $event) {
|
|||
|
||||
if (in_array('id_agentmodule',$show_fields)) {
|
||||
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=data">'
|
||||
.db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]).'</a>';
|
||||
.db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]).'</a>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
@ -815,7 +820,8 @@ foreach ($result as $event) {
|
|||
else {
|
||||
$data[$i] = '';
|
||||
}
|
||||
$i++;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (in_array('source',$show_fields)) {
|
||||
|
@ -835,7 +841,7 @@ foreach ($result as $event) {
|
|||
if (($event["estado"] != 1) and (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) {
|
||||
$data[$i] .= '<a href="javascript: toggleCommentForm(' . $event['id_evento'] . ')" id="validate-'.$event["id_evento"].'">';
|
||||
$data[$i] .= html_print_image ("images/ok.png", true,
|
||||
array ("title" => __('Validate event')));
|
||||
array ("title" => __('Validate event')));
|
||||
$data[$i] .= '</a> ';
|
||||
}
|
||||
else {
|
||||
|
@ -857,7 +863,7 @@ foreach ($result as $event) {
|
|||
|
||||
$data[$i] .= '<a href="javascript: toggleVisibleExtendedInfo(' . $event["id_evento"] . ');">';
|
||||
$data[$i] .= html_print_image ("images/eye.png", true,
|
||||
array ("title" => __('Show more')));
|
||||
array ("title" => __('Show more')));
|
||||
$data[$i] .= '</a> ';
|
||||
|
||||
// Create incident from this event
|
||||
|
@ -1157,6 +1163,17 @@ foreach ($result as $event) {
|
|||
$string .= '</td></tr>';
|
||||
}
|
||||
|
||||
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Unknown instructions') . '</td><td align="left">';
|
||||
if ($event["unknown_instructions"] != '') {
|
||||
$string .= $event["unknown_instructions"];
|
||||
$string .= '</td></tr><tr>';
|
||||
$odd = ($odd == '')? 'rowOdd' : '';
|
||||
}
|
||||
else {
|
||||
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
||||
}
|
||||
$string .= '</td></tr>';
|
||||
|
||||
$string .= '</table>';
|
||||
|
||||
$data = array($string);
|
||||
|
@ -1210,7 +1227,6 @@ unset ($table);
|
|||
/*
|
||||
<![CDATA[ */
|
||||
$(document).ready( function() {
|
||||
|
||||
// Don't collapse filter if update button has been pushed
|
||||
if ($("#hidden-toogle_filter").val() == 'false'){
|
||||
$("#event_control").toggle ();
|
||||
|
@ -1224,7 +1240,7 @@ $(document).ready( function() {
|
|||
|
||||
$("#filter_id").change(function () {
|
||||
// If selected 'none' flush filter
|
||||
if ( $("#filter_id").val() == 0 ){
|
||||
if ( $("#filter_id").val() == 0 ) {
|
||||
$("#text-id_name").val('');
|
||||
$("#ev_group").val(0);
|
||||
$("#event_type").val('');
|
||||
|
@ -1253,35 +1269,35 @@ $(document).ready( function() {
|
|||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
if (i == 'id_name')
|
||||
$("#text-id_name").val(val);
|
||||
if (i == 'id_group')
|
||||
$("#ev_group").val(val);
|
||||
if (i == 'event_type')
|
||||
$("#event_type").val(val);
|
||||
if (i == 'severity')
|
||||
$("#severity").val(val);
|
||||
if (i == 'status')
|
||||
$("#status").val(val);
|
||||
if (i == 'search')
|
||||
$("#text-search").val(val);
|
||||
if (i == 'text_agent')
|
||||
$("#text_id_agent").val(val);
|
||||
if (i == 'pagination')
|
||||
$("#pagination").val(val);
|
||||
if (i == 'event_view_hr')
|
||||
$("#text-event_view_hr").val(val);
|
||||
if (i == 'id_user_ack')
|
||||
$("#id_user_ack").val(val);
|
||||
if (i == 'group_rep')
|
||||
$("#group_rep").val(val);
|
||||
if (i == 'tag')
|
||||
$("#tag").val(val);
|
||||
if (i == 'filter_only_alert')
|
||||
$("#filter_only_alert").val(val);
|
||||
if (i == 'id_group_filter')
|
||||
$("#id_group").val(val);
|
||||
});
|
||||
if (i == 'id_name')
|
||||
$("#text-id_name").val(val);
|
||||
if (i == 'id_group')
|
||||
$("#ev_group").val(val);
|
||||
if (i == 'event_type')
|
||||
$("#event_type").val(val);
|
||||
if (i == 'severity')
|
||||
$("#severity").val(val);
|
||||
if (i == 'status')
|
||||
$("#status").val(val);
|
||||
if (i == 'search')
|
||||
$("#text-search").val(val);
|
||||
if (i == 'text_agent')
|
||||
$("#text_id_agent").val(val);
|
||||
if (i == 'pagination')
|
||||
$("#pagination").val(val);
|
||||
if (i == 'event_view_hr')
|
||||
$("#text-event_view_hr").val(val);
|
||||
if (i == 'id_user_ack')
|
||||
$("#id_user_ack").val(val);
|
||||
if (i == 'group_rep')
|
||||
$("#group_rep").val(val);
|
||||
if (i == 'tag')
|
||||
$("#tag").val(val);
|
||||
if (i == 'filter_only_alert')
|
||||
$("#filter_only_alert").val(val);
|
||||
if (i == 'id_group_filter')
|
||||
$("#id_group").val(val);
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
@ -1293,7 +1309,8 @@ $(document).ready( function() {
|
|||
// Checks if the filter has name or not
|
||||
if ($('#row_name').css('visibility') == 'hidden') {
|
||||
$('#row_name').css('visibility', '');
|
||||
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Define name and group for the filter and click on Save filter again'); ?> </h3>');
|
||||
$('#show_filter_error')
|
||||
.html('<h3 class="error"> <?php echo __('Define name and group for the filter and click on Save filter again'); ?> </h3>');
|
||||
$('#filter_name_color').css('color', '#CC0000');
|
||||
$('#filter_group_color').css('color', '#CC0000');
|
||||
// If the filter has name insert in database
|
||||
|
@ -1343,23 +1360,24 @@ $(document).ready( function() {
|
|||
$('#filter_id').append ($('<option></option>').html ( <?php echo "'" . __('none') . "'" ?> ).attr ("value", 0));
|
||||
// Reload filters select
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/events/events_list",
|
||||
"get_event_filters" : 1
|
||||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
{
|
||||
"page" : "operation/events/events_list",
|
||||
"get_event_filters" : 1
|
||||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
|
||||
if (i == id_filter_save){
|
||||
$('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
|
||||
}
|
||||
else {
|
||||
$('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
|
||||
}
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
if (i == id_filter_save){
|
||||
$('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
|
||||
}
|
||||
else {
|
||||
$('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
|
||||
}
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
$("#submit-update_filter").css('visibility', '');
|
||||
}
|
||||
return false;
|
||||
|
@ -1370,7 +1388,9 @@ $(document).ready( function() {
|
|||
|
||||
// If the filter name is blank show error
|
||||
if ($('#text-id_name').val() == '') {
|
||||
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Filter name cannot be left blank'); ?> </h3>');
|
||||
$('#show_filter_error')
|
||||
.html('<h3 class="error"> <?php echo __('Filter name cannot be left blank'); ?> </h3>');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1396,7 +1416,7 @@ $(document).ready( function() {
|
|||
"id_group_filter": $("#id_group").val()
|
||||
},
|
||||
function (data) {
|
||||
if (data == 'ok'){
|
||||
if (data == 'ok') {
|
||||
$('#show_filter_error').html('<h3 class="suc"> <?php echo __('Filter updated'); ?> </h3>');
|
||||
}
|
||||
else {
|
||||
|
@ -1415,19 +1435,19 @@ $(document).ready( function() {
|
|||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
if (i == id_filter_update){
|
||||
s = js_html_entity_decode(val);
|
||||
if (i == id_filter_update) {
|
||||
$('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
$('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
|
||||
// Change toggle arrow when it's clicked
|
||||
|
@ -1467,8 +1487,6 @@ $(document).ready( function() {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
|
|
|
@ -340,17 +340,7 @@ echo '</td>';
|
|||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="datos"><b>'.__('Agent').'</b></td>';
|
||||
echo '<td class="datos">';
|
||||
//html_print_input_hidden('id_agent', $id_agent);
|
||||
//html_print_input_text_extended ('agent', agents_get_name ($id_agent), 'text-agent', '', 30, 100, false, '', array('style' => 'background: url(images/lightning.png) no-repeat right;'));
|
||||
//ui_print_help_tip(__("Type at least two characters to search"), false);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
//////////
|
||||
echo '<tr>';
|
||||
echo '<td class="datos"><b>'.__('Teste').'</b></td>';
|
||||
echo '<td class="datos"><b>' . __('Agent') . '</b></td>';
|
||||
echo '<td class="datos">';
|
||||
$params = array();
|
||||
$params['show_helptip'] = true;
|
||||
|
@ -389,9 +379,9 @@ echo "</div></form>";
|
|||
|
||||
//If we're actually working on an incident
|
||||
if (isset ($id_inc)) {
|
||||
// ********************************************************************
|
||||
//******************************************************************
|
||||
// Notes
|
||||
// ********************************************************************
|
||||
//******************************************************************
|
||||
|
||||
echo '<div>';
|
||||
|
||||
|
@ -439,9 +429,9 @@ if (isset ($id_inc)) {
|
|||
unset ($table);
|
||||
|
||||
|
||||
// ************************************************************
|
||||
//******************************************************************
|
||||
// Files attached to this incident
|
||||
// ************************************************************
|
||||
//******************************************************************
|
||||
|
||||
$result = incidents_get_attach ($id_inc);
|
||||
|
||||
|
@ -487,9 +477,9 @@ if (isset ($id_inc)) {
|
|||
}
|
||||
unset ($table);
|
||||
|
||||
// ************************************************************
|
||||
//******************************************************************
|
||||
// Upload control
|
||||
// ************************************************************
|
||||
//******************************************************************
|
||||
|
||||
|
||||
// Upload control
|
||||
|
@ -511,8 +501,3 @@ if (isset ($id_inc)) {
|
|||
}
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
$(document).ready (function () {
|
||||
//agent_autocomplete('#text-agent', '#hidden-server_name', '#hidden-id_agent');
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue