2009-06-09 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/agent_manager.php: Added autocomplete support to parent selection, which is no a dropdown anymore. Partial fix for #2707924. * godmode/agentes/configurar_agente.php: Parent data is now the agent name, not the agent id. * include/javascript/jquery.ajaxqueue.js, include/javascript/jquery.autocomplete.js, include/javascript/jquery.bgiframe.js: Added to repository. Autocompleter jQuery plugin. * include/styles/pandora.css: Added autocomplete styles. * include/functions_db.php: Added more support for search parameter to get_group_agents() so you can pass a filter array now. * operation/agentes/estado_agente.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1741 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
01ac826a4f
commit
a6851ba01a
|
@ -1,4 +1,25 @@
|
|||
2009-06-08 Esteban Sanchez <estebans@artica.es>
|
||||
2009-06-09 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* godmode/agentes/agent_manager.php: Added autocomplete support
|
||||
to parent selection, which is no a dropdown anymore. Partial fix for
|
||||
#2707924.
|
||||
|
||||
* godmode/agentes/configurar_agente.php: Parent data is now the
|
||||
agent name, not the agent id.
|
||||
|
||||
* include/javascript/jquery.ajaxqueue.js,
|
||||
include/javascript/jquery.autocomplete.js,
|
||||
include/javascript/jquery.bgiframe.js: Added to repository.
|
||||
Autocompleter jQuery plugin.
|
||||
|
||||
* include/styles/pandora.css: Added autocomplete styles.
|
||||
|
||||
* include/functions_db.php: Added more support for search
|
||||
parameter to get_group_agents() so you can pass a filter array now.
|
||||
|
||||
* operation/agentes/estado_agente.php: Style correction.
|
||||
|
||||
2009-06-09 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/styles/help.css, include/styles/pandora_minimal.css,
|
||||
include/styles/ie.css, include/styles/menu.css,
|
||||
|
|
|
@ -13,6 +13,30 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
if (is_ajax ()) {
|
||||
$search_parents = (bool) get_parameter ('search_parents');
|
||||
|
||||
if ($search_parents) {
|
||||
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.'%"';
|
||||
$filter[] = 'id_agente != '.$id_agent;
|
||||
|
||||
$agents = get_agents ($filter, array ('nombre', 'direccion'));
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
echo $agent['nombre']."|".$agent['direccion']."\n";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// Load global vars
|
||||
enterprise_include ('godmode/agentes/agent_manager.php');
|
||||
|
||||
|
@ -104,7 +128,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_select ($agents, 'id_parent', $id_parent, '', __('None'), 0, true, false, false); //I use get_agent_name because the user might not have rights to the current parent
|
||||
$table->data[2][1] = print_input_text ('id_parent', get_agent_name ($id_parent),
|
||||
'', 30, 100, true);
|
||||
|
||||
|
||||
$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);
|
||||
|
@ -171,11 +197,36 @@ if ($id_agente) {
|
|||
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 () {
|
||||
$("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 $("#grupo").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', 'none');
|
||||
if (data == "")
|
||||
return false;
|
||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
||||
},
|
||||
delay: 200
|
||||
}
|
||||
);
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -113,7 +113,8 @@ if ($create_agent) {
|
|||
$intervalo = (string) get_parameter_post ("intervalo", 300);
|
||||
$comentarios = (string) get_parameter_post ("comentarios");
|
||||
$modo = (int) get_parameter_post ("modo");
|
||||
$id_parent = (int) get_parameter_post ("id_parent");
|
||||
$id_parent = (string) get_parameter_post ("id_parent");
|
||||
$id_parent = (int) get_agent_id ($id_parent);
|
||||
$server_name = (string) get_parameter_post ("server_name");
|
||||
$id_os = (int) get_parameter_post ("id_os");
|
||||
$disabled = (int) get_parameter_post ("disabled");
|
||||
|
@ -274,7 +275,8 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
$id_os = (int) get_parameter_post ("id_os");
|
||||
$disabled = (bool) get_parameter_post ("disabled");
|
||||
$server_name = (string) get_parameter_post ("server_name", "");
|
||||
$id_parent = (int) get_parameter_post ("id_parent", 0);
|
||||
$id_parent = (string) get_parameter_post ("id_parent");
|
||||
$id_parent = (int) get_agent_id ($id_parent);
|
||||
$custom_id = (string) get_parameter_post ("custom_id", "");
|
||||
|
||||
//Verify if there is another agent with the same name but different ID
|
||||
|
|
|
@ -343,9 +343,16 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower") {
|
|||
} else {
|
||||
$search_sql .= ' AND disabled = 0';
|
||||
}
|
||||
unset ($search["disabled"]);
|
||||
if (isset ($search["string"])) {
|
||||
$string = safe_input ($search["string"]);
|
||||
$search_sql .= ' AND (nombre LIKE "'.$string.'" OR comentarios LIKE "'.$string.'" OR direccion LIKE "'.$string.'")';
|
||||
$search_sql .= ' AND (nombre LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%")';
|
||||
|
||||
unset ($search["string"]);
|
||||
}
|
||||
|
||||
if (! empty ($search)) {
|
||||
$search_sql .= ' AND '.format_array_to_where_clause_sql ($search);
|
||||
}
|
||||
} else {
|
||||
$search_sql .= ' AND disabled = 0';
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* Ajax Queue Plugin
|
||||
*
|
||||
* Homepage: http://jquery.com/plugins/project/ajaxqueue
|
||||
* Documentation: http://docs.jquery.com/AjaxQueue
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
jQuery.ajaxQueue({
|
||||
url: "test.php",
|
||||
success: function(html){ jQuery("ul").append(html); }
|
||||
});
|
||||
jQuery.ajaxQueue({
|
||||
url: "test.php",
|
||||
success: function(html){ jQuery("ul").append(html); }
|
||||
});
|
||||
jQuery.ajaxSync({
|
||||
url: "test.php",
|
||||
success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
|
||||
});
|
||||
jQuery.ajaxSync({
|
||||
url: "test.php",
|
||||
success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<ul style="position: absolute; top: 5px; right: 5px;"></ul>
|
||||
|
||||
*/
|
||||
/*
|
||||
* Queued Ajax requests.
|
||||
* A new Ajax request won't be started until the previous queued
|
||||
* request has finished.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Synced Ajax requests.
|
||||
* The Ajax request will happen as soon as you call this method, but
|
||||
* the callbacks (success/error/complete) won't fire until all previous
|
||||
* synced requests have been completed.
|
||||
*/
|
||||
|
||||
|
||||
(function($) {
|
||||
|
||||
var ajax = $.ajax;
|
||||
|
||||
var pendingRequests = {};
|
||||
|
||||
var synced = [];
|
||||
var syncedData = [];
|
||||
|
||||
$.ajax = function(settings) {
|
||||
// create settings for compatibility with ajaxSetup
|
||||
settings = jQuery.extend(settings, jQuery.extend({}, jQuery.ajaxSettings, settings));
|
||||
|
||||
var port = settings.port;
|
||||
|
||||
switch(settings.mode) {
|
||||
case "abort":
|
||||
if ( pendingRequests[port] ) {
|
||||
pendingRequests[port].abort();
|
||||
}
|
||||
return pendingRequests[port] = ajax.apply(this, arguments);
|
||||
case "queue":
|
||||
var _old = settings.complete;
|
||||
settings.complete = function(){
|
||||
if ( _old )
|
||||
_old.apply( this, arguments );
|
||||
jQuery([ajax]).dequeue("ajax" + port );;
|
||||
};
|
||||
|
||||
jQuery([ ajax ]).queue("ajax" + port, function(){
|
||||
ajax( settings );
|
||||
});
|
||||
return;
|
||||
case "sync":
|
||||
var pos = synced.length;
|
||||
|
||||
synced[ pos ] = {
|
||||
error: settings.error,
|
||||
success: settings.success,
|
||||
complete: settings.complete,
|
||||
done: false
|
||||
};
|
||||
|
||||
syncedData[ pos ] = {
|
||||
error: [],
|
||||
success: [],
|
||||
complete: []
|
||||
};
|
||||
|
||||
settings.error = function(){ syncedData[ pos ].error = arguments; };
|
||||
settings.success = function(){ syncedData[ pos ].success = arguments; };
|
||||
settings.complete = function(){
|
||||
syncedData[ pos ].complete = arguments;
|
||||
synced[ pos ].done = true;
|
||||
|
||||
if ( pos == 0 || !synced[ pos-1 ] )
|
||||
for ( var i = pos; i < synced.length && synced[i].done; i++ ) {
|
||||
if ( synced[i].error ) synced[i].error.apply( jQuery, syncedData[i].error );
|
||||
if ( synced[i].success ) synced[i].success.apply( jQuery, syncedData[i].success );
|
||||
if ( synced[i].complete ) synced[i].complete.apply( jQuery, syncedData[i].complete );
|
||||
|
||||
synced[i] = null;
|
||||
syncedData[i] = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
return ajax.apply(this, arguments);
|
||||
};
|
||||
|
||||
})(jQuery);
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,10 @@
|
|||
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $
|
||||
* $Rev: 2447 $
|
||||
*
|
||||
* Version 2.1.1
|
||||
*/
|
||||
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
|
|
@ -933,6 +933,57 @@ div#event_control {
|
|||
clear:right;
|
||||
}
|
||||
|
||||
/* Autocomplete styles */
|
||||
.ac_results {
|
||||
padding: 0px;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
overflow: hidden;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.ac_results ul {
|
||||
width: 100%;
|
||||
list-style-position: outside;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.ac_results li {
|
||||
margin: 0px;
|
||||
padding: 2px 5px;
|
||||
cursor: default;
|
||||
display: block;
|
||||
/*
|
||||
if width will be 100% horizontal scrollbar will apear
|
||||
when scroll mode will be used
|
||||
*/
|
||||
/*width: 100%;*/
|
||||
font: menu;
|
||||
font-size: 12px;
|
||||
/*
|
||||
it is very important, if line-height not setted or setted
|
||||
in relative units scroll will be broken in firefox
|
||||
*/
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.ac_loading {
|
||||
background: white url('../images/loading.gif') right center no-repeat;
|
||||
}
|
||||
|
||||
.ac_over {
|
||||
background-color: #efefef;
|
||||
}
|
||||
span.ac_extra_field,
|
||||
span.ac_extra_field strong {
|
||||
font-style: italic;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
|
||||
div#pandora_logo_header {
|
||||
/* Put here your company logo (139x60 pixels) like this: */
|
||||
/* background: url(../../images/MiniLogoArtica.jpg); */
|
||||
|
|
|
@ -42,6 +42,7 @@ if (is_ajax ()) {
|
|||
echo json_encode (get_agent_module_last_value ($id_module));
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue