2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php, godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php, godmode/reporting/map_builder.php, include/functions_db.php, include/functions_html.php, operation/agentes/exportdata.php, operation/agentes/ver_agente.php: very changes for add input text autocomplete with ajax jquery for agent input in several forms. Add to form this exportdata, graph_builder, map_builder. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e827103c67
commit
8f746d443d
|
@ -1,3 +1,13 @@
|
|||
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php,
|
||||
godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php,
|
||||
godmode/reporting/map_builder.php, include/functions_db.php,
|
||||
include/functions_html.php, operation/agentes/exportdata.php,
|
||||
operation/agentes/ver_agente.php: very changes for add input text
|
||||
autocomplete with ajax jquery for agent input in several forms. Add to form
|
||||
this exportdata, graph_builder, map_builder.
|
||||
|
||||
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* index.php: add another ob_start for html result is with good order.
|
||||
|
|
|
@ -130,9 +130,9 @@ $groups = get_user_groups ($config["id_user"]);
|
|||
$agents = get_group_agents (array_keys ($groups));
|
||||
|
||||
$table->data[2][0] = __('Parent');
|
||||
$table->data[2][1] = print_input_text ('id_parent', get_agent_name ($id_parent),
|
||||
'', 30, 100, true);
|
||||
|
||||
$table->data[2][1] = print_input_text_extended ('id_parent', get_agent_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 two chars at least for search") . '</span></a>';
|
||||
|
||||
$table->data[3][0] = __('Group');
|
||||
$table->data[3][1] = print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo WHERE id_grupo > 1 ORDER BY nombre', 'grupo', $grupo, '', '', 0, true);
|
||||
|
|
|
@ -67,6 +67,10 @@ $table->data[0][2] .= '</span>';
|
|||
$table->data[0][3] = print_select (get_group_agents ($source_id_group, false, "none"),
|
||||
'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
|
||||
|
||||
//$table->data[0][3] = print_input_text_extended ('id_agent', __('Select'), 'text-id_agent', '', 25, 100, false, '',
|
||||
// array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
|
||||
// . '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||
|
||||
echo '<form id="manage_config_form" method="post">';
|
||||
|
||||
echo '<fieldset id="fieldset_source">';
|
||||
|
|
|
@ -219,9 +219,12 @@ echo "<div id='alert_control' style='display:none'>\n";
|
|||
$arrayAgents[$agentElement['id_agente']] = $agentElement['nombre'];
|
||||
}
|
||||
echo "<td>".__('Agents')."</td><td>";
|
||||
print_input_text ('agent_name', $agentName, '', 30, 100);
|
||||
//print_select ($arrayAgents, "agent_id", $agentID, '', __('All'),-1);
|
||||
echo print_input_text_extended ('agent_name', $agentName, 'text-agent_name', '', 25, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||
echo "</td>\n";
|
||||
|
||||
|
||||
echo "<td>".__('Module name')."</td><td>";
|
||||
print_input_text ('module_name', $moduleName, '', 15);
|
||||
echo "</td>\n";
|
||||
|
@ -429,10 +432,15 @@ if (! $id_agente) {
|
|||
false, '', '', true);
|
||||
|
||||
$table->data['agent'][0] = __('Agent');
|
||||
$table->data['agent'][1] = print_select (get_group_agents (array_keys ($groups), false, "none"), 'id_agent', 0, false, __('Select'), 0, true);
|
||||
$table->data['agent'][1] .= ' <span id="agent_loading" class="invisible">';
|
||||
$table->data['agent'][1] .= '<img src="images/spinner.gif" />';
|
||||
$table->data['agent'][1] .= '</span>';
|
||||
|
||||
$table->data['agent'][1] = print_input_text_extended ('id_agent', __('Select'), 'text-id_agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||
|
||||
// $table->data['agent'][1] = print_select (get_group_agents (array_keys ($groups), false, "none"), 'id_agent', 0, false, __('Select'), 0, true);
|
||||
// $table->data['agent'][1] .= ' <span id="agent_loading" class="invisible">';
|
||||
// $table->data['agent'][1] .= '<img src="images/spinner.gif" />';
|
||||
// $table->data['agent'][1] .= '</span>';
|
||||
}
|
||||
|
||||
$table->data[0][0] = __('Module');
|
||||
|
@ -510,6 +518,28 @@ require_jquery_file ('autocomplete');
|
|||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
|
||||
$("#text-id_agent").autocomplete(
|
||||
"ajax.php",
|
||||
{
|
||||
minChars: 2,
|
||||
scroll:true,
|
||||
extraParams: {
|
||||
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', 'none');
|
||||
if (data == "")
|
||||
return false;
|
||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
||||
},
|
||||
delay: 200
|
||||
}
|
||||
);
|
||||
|
||||
//----------------------------
|
||||
$("#text-agent_name").autocomplete ("ajax.php",
|
||||
|
@ -547,7 +577,7 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
|
||||
$("#id_agent").pandoraSelectAgentModule ();
|
||||
//$("#id_agent").pandoraSelectAgentModule ();
|
||||
<?php endif; ?>
|
||||
$("a.template_details").cluetip ({
|
||||
arrows: true,
|
||||
|
|
|
@ -14,6 +14,35 @@
|
|||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
if (is_ajax ()) {
|
||||
$search_agents = (bool) get_parameter ('search_agents');
|
||||
|
||||
if ($search_agents) {
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
|
||||
$id_agent = (int) get_parameter ('id_agent');
|
||||
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
$filter = array ();
|
||||
$filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
||||
$filter['id_grupo'] = $id_group;
|
||||
|
||||
$agents = get_agents ($filter, array ('nombre', 'direccion'));
|
||||
if ($agents === false)
|
||||
return;
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
echo $agent['nombre']."|".$agent['direccion']."\n";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Login check
|
||||
require_once ("include/config.php");
|
||||
if ($config['flash_charts']) {
|
||||
|
@ -282,7 +311,10 @@ echo "<td class='datos' colspan=2>";
|
|||
|
||||
$user_groups = implode (',', array_keys (get_user_groups ($config["id_user"])));
|
||||
|
||||
print_select_from_sql ("SELECT id_agente, nombre FROM tagente WHERE disabled = 0 AND id_grupo IN ($user_groups) ORDER BY nombre", 'id_agent', $id_agent, '', '--', 0);
|
||||
print_input_text_extended ('id_agent', get_agent_name ($id_parent), 'text-id_agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'));
|
||||
echo '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||
//print_select_from_sql ("SELECT id_agente, nombre FROM tagente WHERE disabled = 0 AND id_grupo IN ($user_groups) ORDER BY nombre", 'id_agent', $id_agent, '', '--', 0);
|
||||
|
||||
// SOURCE MODULE FORM
|
||||
if (isset ($chunkdata))
|
||||
|
@ -506,6 +538,11 @@ if (isset($module_array)){
|
|||
echo "</table>";
|
||||
}
|
||||
|
||||
require_jquery_file ('pandora.controls');
|
||||
require_jquery_file ('ajaxqueue');
|
||||
require_jquery_file ('bgiframe');
|
||||
require_jquery_file ('autocomplete');
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
|
@ -536,6 +573,63 @@ function agent_changed () {
|
|||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
$('#id_agent').change (agent_changed);
|
||||
//$('#id_agent').change (agent_changed);
|
||||
|
||||
|
||||
$("#text-id_agent").autocomplete(
|
||||
"ajax.php",
|
||||
{
|
||||
minChars: 2,
|
||||
scroll:true,
|
||||
extraParams: {
|
||||
page: "godmode/reporting/graph_builder",
|
||||
search_agents: 1,
|
||||
id_group: function() { return $("#group").val(); }
|
||||
},
|
||||
formatItem: function (data, i, total) {
|
||||
if (total == 0)
|
||||
$("#text-id_agent").css ('background-color', '#cc0000');
|
||||
else
|
||||
$("#text-id_agent").css ('background-color', 'none');
|
||||
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 () {
|
||||
|
||||
|
||||
var agent_name = this.value;
|
||||
$('#id_module').fadeOut ('normal', function () {
|
||||
$('#id_module').empty ();
|
||||
var inputs = [];
|
||||
inputs.push ("agent_name=" + agent_name);
|
||||
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_module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = html_entity_decode (val['nombre']);
|
||||
$('#id_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
||||
});
|
||||
$('#id_module').fadeIn ('normal');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -13,6 +13,33 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
if (is_ajax ()) {
|
||||
$search_agents = (bool) get_parameter ('search_agents');
|
||||
|
||||
if ($search_agents) {
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
|
||||
$id_agent = (int) get_parameter ('id_agent');
|
||||
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
||||
|
||||
$filter = array ();
|
||||
$filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
||||
|
||||
$agents = get_agents ($filter, array ('nombre', 'direccion'));
|
||||
if ($agents === false)
|
||||
return;
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
echo $agent['nombre']."|".$agent['direccion']."\n";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ("include/config.php");
|
||||
|
||||
check_login ();
|
||||
|
@ -412,7 +439,10 @@ if (! $edit_layout && ! $id_layout) {
|
|||
$table->data[4][0] = __('Width');
|
||||
$table->data[4][1] = print_input_text ('width', '', '', 5, 5, true);
|
||||
$table->data[5][0] = __('Agent');
|
||||
$table->data[5][1] = print_select ($agents, 'agent', '', '', '--', 0, true);
|
||||
// $table->data[5][1] = print_select ($agents, 'agent', '', '', '--', 0, true);
|
||||
$table->data[5][1] = print_input_text_extended ('agent', '', 'text-agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||
$table->data[6][0] = __('Module');
|
||||
$table->data[6][1] = print_select (array (), 'module', '', '', '--', 0, true);
|
||||
$table->data[7][0] = __('Period');
|
||||
|
@ -427,7 +457,7 @@ if (! $edit_layout && ! $id_layout) {
|
|||
$table->data[10][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout,
|
||||
'map_linked', '', '', 'None', '', true);
|
||||
|
||||
echo '<form id="form_layout_data_editor" method="post" action="index.php?sec=greporting&sec2=godmode/reporting/map_builder">';
|
||||
echo '<form id="form_layout_data_editor" method="post" action="index.php?sec=greporting&sec2=godmode/reporting/map_builder" onsubmit="javascript: return testAgentCorrect();">';
|
||||
print_table ($table);
|
||||
print_input_hidden ('create_layout_data', 1);
|
||||
print_input_hidden ('update_layout_data', 0);
|
||||
|
@ -451,10 +481,80 @@ require_jquery_file ('colorpicker');
|
|||
require_jquery_file ('pandora.controls');
|
||||
require_javascript_file ('wz_jsgraphics');
|
||||
require_javascript_file ('pandora_visual_console');
|
||||
require_jquery_file ('ajaxqueue');
|
||||
require_jquery_file ('bgiframe');
|
||||
require_jquery_file ('autocomplete');
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var selectAgent = false;
|
||||
var id_agent_module = 0;
|
||||
|
||||
function testAgentCorrect() {
|
||||
if (selectAgent) return true;
|
||||
else {
|
||||
alert ("<? echo __("No selected agent, please select any agent."); ?>");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$("#text-agent").autocomplete(
|
||||
"ajax.php",
|
||||
{
|
||||
minChars: 2,
|
||||
scroll:true,
|
||||
extraParams: {
|
||||
page: "operation/agentes/exportdata",
|
||||
search_agents: 1,
|
||||
id_group: function() { return $("#group").val(); }
|
||||
},
|
||||
formatItem: function (data, i, total) {
|
||||
if (total == 0)
|
||||
$("#text-agent").css ('background-color', '#cc0000');
|
||||
else
|
||||
$("#text-agent").css ('background-color', 'none');
|
||||
if (data == "")
|
||||
return false;
|
||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
||||
},
|
||||
delay: 200
|
||||
}
|
||||
);
|
||||
|
||||
$("#text-agent").result (
|
||||
function () {
|
||||
selectAgent = true;
|
||||
var agent_name = this.value;
|
||||
$('#module').fadeOut ('normal', function () {
|
||||
$('#module').empty ();
|
||||
var inputs = [];
|
||||
inputs.push ("agent_name=" + agent_name);
|
||||
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) {
|
||||
$('#module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = html_entity_decode (val['nombre']);
|
||||
$('#module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
||||
});
|
||||
$('#module').fadeIn ('normal');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
<?php if ($id_layout): ?>
|
||||
if (lines)
|
||||
draw_lines (lines, 'layout_map');
|
||||
|
|
|
@ -351,6 +351,13 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower") {
|
|||
unset ($search["string"]);
|
||||
}
|
||||
|
||||
if (isset ($search["name"])) {
|
||||
$name = safe_input ($search["name"]);
|
||||
$search_sql .= ' AND nombre LIKE "' . $name . '" ';
|
||||
|
||||
unset ($search["name"]);
|
||||
}
|
||||
|
||||
if (! empty ($search)) {
|
||||
$search_sql .= ' AND '.format_array_to_where_clause_sql ($search);
|
||||
}
|
||||
|
@ -361,6 +368,13 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower") {
|
|||
$sql = sprintf ("SELECT id_agente, nombre FROM tagente %s ORDER BY nombre", $search_sql);
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
////////////////LOG AJAX///////////////////////
|
||||
///////////////////////////////////////////////
|
||||
//$log = fopen ( "/tmp/log_sql", "a");
|
||||
//fwrite ($log, $sql."\n\n");
|
||||
//fclose($log);
|
||||
///////////////////////////////////////////////
|
||||
|
||||
if ($result === false)
|
||||
return array (); //Return an empty array
|
||||
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* Prints the print_r with <pre> tags
|
||||
*/
|
||||
function debugPrint ($var) {
|
||||
echo "<pre>";print_r($var);echo "</pre>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints an array of fields in a popup menu of a form.
|
||||
|
|
|
@ -13,6 +13,34 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
if (is_ajax ()) {
|
||||
$search_agents = (bool) get_parameter ('search_agents');
|
||||
|
||||
if ($search_agents) {
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
|
||||
$id_agent = (int) get_parameter ('id_agent');
|
||||
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
$filter = array ();
|
||||
$filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
||||
$filter['id_grupo'] = $id_group;
|
||||
|
||||
$agents = get_agents ($filter, array ('nombre', 'direccion'));
|
||||
if ($agents === false)
|
||||
return;
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
echo $agent['nombre']."|".$agent['direccion']."\n";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Load global vars
|
||||
|
@ -31,7 +59,11 @@ require_javascript_file ('calendar');
|
|||
echo "<h2>".__('Pandora agents')." » ".__('Export data')."</h2>";
|
||||
|
||||
$group = get_parameter_post ('group', 1);
|
||||
$agent = get_parameter_post ('agent', 0);
|
||||
//$agent = get_parameter_post ('agent', 0);
|
||||
$agentName = get_parameter_post ('agent', 0);
|
||||
$agents = get_agents (array('nombre LIKE "' . $agentName . '"'), array ('id_agente'));
|
||||
$agent = $agents[0]['id_agente'];
|
||||
|
||||
$module = (array) get_parameter_post ('module_arr', array ());
|
||||
$start_date = get_parameter_post ('start_date', 0);
|
||||
$end_date = get_parameter_post ('end_date', 0);
|
||||
|
@ -187,6 +219,7 @@ if ($group > 0) {
|
|||
|
||||
$agents = array ();
|
||||
$rows = get_agents ($filter, false, 'AR');
|
||||
if ($rows == null) $rows = array();
|
||||
foreach ($rows as $row) {
|
||||
$agents[$row['id_agente']] = $row['nombre'];
|
||||
}
|
||||
|
@ -195,7 +228,10 @@ if (!in_array ($agent, array_keys ($agents))) {
|
|||
$agent = current (array_keys ($agents));
|
||||
}
|
||||
|
||||
$table->data[1][1] = print_select ($agents, "agent", $agent, 'this.form.submit();', '', 0, true, false, true, 'w130', false);
|
||||
//$table->data[1][1] = print_select ($agents, "agent", $agent, 'this.form.submit();', '', 0, true, false, true, 'w130', false);
|
||||
$table->data[1][1] = print_input_text_extended ('agent', get_agent_name ($agent), 'text-agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
|
||||
. '<a href="#" class="tip"> <span>' . __("Type two chars at least for search") . '</span></a>';
|
||||
|
||||
//Module selector
|
||||
$table->data[2][0] = '<b>'.__('Modules').'</b>';
|
||||
|
@ -239,4 +275,60 @@ echo '<div class="action-buttons" style="width:550px;">';
|
|||
print_submit_button (__('Export'), 'export_btn', false, 'class="sub wand"');
|
||||
echo '</div></form>';
|
||||
|
||||
require_jquery_file ('pandora.controls');
|
||||
require_jquery_file ('ajaxqueue');
|
||||
require_jquery_file ('bgiframe');
|
||||
require_jquery_file ('autocomplete');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
var inputActive = true;
|
||||
|
||||
$.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 __("None agent in this category");?>");
|
||||
$("#text-agent").attr("disabled", true);
|
||||
$("#text-agent").css ('color', '#000000');
|
||||
inputActive = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (inputActive) {
|
||||
$("#text-agent").autocomplete(
|
||||
"ajax.php",
|
||||
{
|
||||
minChars: 2,
|
||||
scroll:true,
|
||||
extraParams: {
|
||||
page: "operation/agentes/exportdata",
|
||||
search_agents: 1,
|
||||
id_group: function() { return $("#group").val(); }
|
||||
},
|
||||
formatItem: function (data, i, total) {
|
||||
if (total == 0)
|
||||
$("#text-agent").css ('background-color', '#cc0000');
|
||||
else
|
||||
$("#text-agent").css ('background-color', 'none');
|
||||
if (data == "")
|
||||
return false;
|
||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
||||
},
|
||||
delay: 200
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$("#text-agent").result(function(event, data, formatted) {
|
||||
this.form.submit();
|
||||
});
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -41,10 +41,18 @@ if (is_ajax ()) {
|
|||
$filter = (string) get_parameter ('filter');
|
||||
$fields = (string) get_parameter ('fields');
|
||||
$indexed = (bool) get_parameter ('indexed', true);
|
||||
$agentName = (string) get_parameter ('agent_name', null);
|
||||
|
||||
if ($agentName != null) {
|
||||
$search = array();
|
||||
$search['name'] = $agentName;
|
||||
}
|
||||
else
|
||||
$search = false;
|
||||
|
||||
/* Get all agents if no agent was given */
|
||||
if ($id_agent == 0)
|
||||
$id_agent = array_keys (get_group_agents (array_keys (get_user_groups ()), false, "none"));
|
||||
$id_agent = array_keys (get_group_agents (array_keys (get_user_groups ()), $search, "none"));
|
||||
|
||||
$agent_modules = get_agent_modules ($id_agent,
|
||||
($fields != '' ? explode (',', $fields) : "*"),
|
||||
|
|
Loading…
Reference in New Issue