2013-03-05 Miguel de Dios <miguel.dedios@artica.es>

* extensions/snmp_explorer.php: improved the code style.
	
	* include/functions_html.php, include/ajax/module.php: rewrote the
	code for to use the last autocomplete jquery UI.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7786 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-05 16:03:01 +00:00
parent 03ff1a45ee
commit 404f44be98
4 changed files with 59 additions and 53 deletions

View File

@ -1,3 +1,10 @@
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/snmp_explorer.php: improved the code style.
* include/functions_html.php, include/ajax/module.php: rewrote the
code for to use the last autocomplete jquery UI.
2013-03-05 Mario Pulido <mario.pulido@artica.es>
*include/help/en/help_view_services.php,

View File

@ -393,7 +393,6 @@ function snmp_explorer() {
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
//ui_require_jquery_file ('autocomplete');
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */

View File

@ -23,18 +23,20 @@ if ($search_modules) {
$filter = get_parameter('q', '') . '%';
$other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true);
$modules = agents_get_modules($id_agents, false, (array('nombre' => $filter) + $other_filter));
$modules = agents_get_modules($id_agents, false,
(array('nombre' => $filter) + $other_filter));
if ($modules === false) $modules = array();
$modules = array_unique($modules);
foreach ($modules as $module) {
echo io_safe_output($module) . "\n";
}
$modules = io_safe_output($modules);
echo json_encode($modules);
}
$get_plugin_macros = get_parameter('get_plugin_macros');
if($get_plugin_macros) {
if ($get_plugin_macros) {
$plugin_macros = db_get_value('macros','tplugin','id',get_parameter('id_plugin',0));
$macros = array();

View File

@ -1876,7 +1876,7 @@ function html_print_autocomplete_modules($name = 'module', $default = '', $id_ag
$agents = db_get_all_rows_sql('SELECT id_agente FROM tagente WHERE id_grupo IN (' . implode(',', $groups) . ')');
if ($agents === false) $agents = array();
$id_agentsACL = array();
foreach ($agents as $agent) {
if (array_search($agent['id_agente'], $id_agents) !== false) {
@ -1890,56 +1890,54 @@ function html_print_autocomplete_modules($name = 'module', $default = '', $id_ag
ob_start();
ui_require_jquery_file ('autocomplete');
?>
<script type="text/javascript">
function escapeHTML (str)
{
var div = document.createElement('div');
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
}
$(document).ready (function () {
$("#text-<?php echo $name; ?>").autocomplete(
"ajax.php",
{
minChars: 2,
scroll:true,
extraParams: {
page: "include/ajax/module",
search_modules: 1,
id_agents: '<?php echo json_encode($id_agents); ?>',
other_filter: '<?php echo json_encode($filter); ?>'
},
formatItem: function (data, i, total) {
if (total == 0)
$("#text-<?php echo $name; ?>").css ('background-color', '#cc0000');
else
$("#text-<?php echo $name; ?>").css ('background-color', '');
if (data == "")
return false;
return escapeHTML(data[0]);
},
delay: 200
}
);
$("#text-<?php echo $name; ?>").result (
<?php echo $scriptResult; ?>
);
});
</script>
<?php
html_print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '',
array('style' => 'background: url(images/lightning_blue.png) no-repeat right;'));
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
$javascript_ajax_page =
ui_get_full_url('ajax.php', false, false, false, false);
?>
<script type="text/javascript">
function escapeHTML (str)
{
var div = document.createElement('div');
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
}
$(document).ready (function () {
$("#text-<?php echo $name; ?>").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
data_params = {
page: "include/ajax/module",
q: term,
search_modules: 1,
id_agents: '<?php echo json_encode($id_agents); ?>',
other_filter: '<?php echo json_encode($filter); ?>'
};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page;?>",
timeout: 10000,
dataType: "json",
success: function (data) {
response(data);
}
});
}
}
);
});
</script>
<?php
$output = ob_get_clean();
if ($return) {