2009-02-23 Esteban Sanchez <estebans@artica.es>

* include/javascript/jquery.pandora.controls.js: Changed agent and
	module selector to allow any kind of object instead of only an id.
	Tiny changes to allow multiple elements in a page.

	* include/functions_html.php: Added a separator for duplicated select
	elements (it's useful sometimes to get this number with javascript and
	using a separator helps)

	* godmode/agentes/manage_delete.php,
	godmode/agentes/manage_config.php: Fixed agent and group selector to
	fits changes in pandora.controls.js.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1475 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-02-23 16:23:58 +00:00
parent 2fde4ae37e
commit 7a65a5670e
5 changed files with 37 additions and 20 deletions

View File

@ -1,3 +1,17 @@
2009-02-23 Esteban Sanchez <estebans@artica.es>
* include/javascript/jquery.pandora.controls.js: Changed agent and
module selector to allow any kind of object instead of only an id.
Tiny changes to allow multiple elements in a page.
* include/functions_html.php: Added a separator for duplicated select
elements (it's useful sometimes to get this number with javascript and
using a separator helps)
* godmode/agentes/manage_delete.php,
godmode/agentes/manage_config.php: Fixed agent and group selector to
fits changes in pandora.controls.js.
2009-02-23 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Fixed id counter on print_select.

View File

@ -238,13 +238,13 @@ require_jquery_file ('pandora.controls');
<script type="text/javascript">
$(document).ready (function () {
$("#source_id_group").pandoraSelectGroup ({
agentSelectId: "source_id_agent",
loadingId: "source_agent_loading"
agentSelect: "select#source_id_agent",
loading: "#source_agent_loading"
});
$("#destiny_id_group").pandoraSelectGroup ({
agentSelectId: "destiny_id_agent\\[\\]",
loadingId: "destiny_agent_loading",
agentSelect: "select#destiny_id_agent\\[\\]",
loading: "#destiny_agent_loading",
callbackPost: function (id, value, option) {
if ($("#source_id_agent").fieldValue ().in_array (id)) {
/* Hide source agent */

View File

@ -116,7 +116,7 @@ require_jquery_file ('pandora.controls');
<script type="text/javascript">
$(document).ready (function () {
$("#id_group").pandoraSelectGroup ({
agentSelectId: "id_agents\\[\\]"
agentSelect: "select#id_agents\\[\\]"
});
});
</script>

View File

@ -44,7 +44,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
//If duplicate names exist, it will start numbering. Otherwise it won't (for backwards compatibility)
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
$name = $name.$idcounter[$name];
$name = $name.'-'.$idcounter[$name];
} else {
$idcounter[$name] = 0;
}

View File

@ -6,8 +6,8 @@ $(document).ready (function () {
$.extend ({
pandoraSelectGroup: new function() {
this.defaults = {
agentSelectId: "id_agent",
loadingId: "agent_loading",
agentSelect: "select#id_agent",
loading: "#agent_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
@ -20,11 +20,12 @@ $(document).ready (function () {
return this.each (function() {
this.config = {};
var config = $.extend (this.config, $.pandoraSelectGroup.defaults, settings);
this.config = $.extend (this.config, $.pandoraSelectGroup.defaults, settings);
var config = this.config;
$(this).change (function () {
var $select = $("select#"+config.agentSelectId).disable ();
$("#"+config.loadingId).show ();
var $select = $(config.agentSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
config.callbackBefore (this);
@ -40,9 +41,9 @@ $(document).ready (function () {
.attr ("value", id)
.html (value);
config.callbackPost (id, value, option);
$("#"+config.agentSelectId).append (option);
$(config.agentSelect).append (option);
});
$("#"+config.loadingId).hide ();
$(config.loading).hide ();
$select.enable ();
config.callbackAfter ();
},
@ -57,8 +58,8 @@ $(document).ready (function () {
$.extend ({
pandoraSelectAgent: new function() {
this.defaults = {
moduleSelectId: "id_agent_module",
loadingId: "module_loading",
moduleSelect: "select#id_agent_module",
loading: "module_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
@ -71,11 +72,13 @@ $(document).ready (function () {
return this.each (function() {
this.config = {};
var config = $.extend (this.config, $.pandoraSelectAgent.defaults, settings);
this.config = $.extend (this.config, $.pandoraSelectAgent.defaults, settings);
var config = this.config;
$(this).change (function () {
var $select = $("select#"+config.moduleSelectId).disable ();
$("#"+config.loadingId).show ();
var $select = $(config.moduleSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
config.callbackBefore (this);
@ -91,9 +94,9 @@ $(document).ready (function () {
.attr ("value", value['id_agente_modulo'])
.html (html_entity_decode (value['nombre']));
config.callbackPost (i, value, option);
$("#"+config.moduleSelectId).append (option);
$(config.moduleSelect).append (option);
});
$("#"+config.loadingId).hide ();
$(config.loading).hide ();
$select.enable ();
config.callbackAfter ();
},