2011-09-21 Junichi Satoh <junichi@rworks.jp>

* include/javascript/jquery.pandora.controls.js: Fixed disabled agents
	are shown as blank. Contributed by Yusuke Arai. Thanks!



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4975 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2011-09-21 04:23:28 +00:00
parent 9a3a252d71
commit 1926f11216
2 changed files with 64 additions and 105 deletions

View File

@ -1,3 +1,8 @@
2011-09-21 Junichi Satoh <junichi@rworks.jp>
* include/javascript/jquery.pandora.controls.js: Fixed disabled agents
are shown as blank. Contributed by Yusuke Arai. Thanks!
2011-09-21 Junichi Satoh <junichi@rworks.jp>
* include/help/ja/help_servers.php,

View File

@ -2,118 +2,72 @@
var dummyFunc = function () {
return true;
};
$.extend ({
pandoraSelectGroupAgent: new function() {
this.defaults = {
agentSelect: "select#id_agent",
recursion: 0,
loading: "#agent_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
callbackAfter: dummyFunc,
debug: false
};
/* public methods */
this.construct = function (settings) {
return this.each (function() {
this.config = {};
this.config = $.extend (this.config, $.pandoraSelectGroupAgent.defaults, settings);
var config = this.config;
$(this).change (function () {
var $select = $(config.agentSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
if (! config.callbackBefore (this))
return;
jQuery.post ("ajax.php",
{"page" : "godmode/groups/group_list",
"get_group_agents" : 1,
"id_group" : this.value,
"recursion" : config.recursion
},
function (data, status) {
jQuery.each (data, function (id, value) {
if (id !== 'keycount'){
config.callbackPre ();
option = $("<option></option>")
.attr ("value", id)
.html (value);
config.callbackPost (id, value, option);
$(config.agentSelect).append (option);
}
});
$(config.loading).hide ();
$select.enable ();
config.callbackAfter ();
},
"json"
);
});
});
};
}
});
$.extend ({
pandoraSelectGroupAgentDisabled: new function() {
this.defaults = {
agentSelect: "select#id_agent",
recursion: 0,
loading: "#agent_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
callbackAfter: dummyFunc,
debug: false
};
/* public methods */
this.construct = function (settings) {
return this.each (function() {
this.config = {};
this.config = $.extend (this.config, $.pandoraSelectGroupAgentDisabled.defaults, settings);
var config = this.config;
$(this).change (function () {
var $select = $(config.agentSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
if (! config.callbackBefore (this))
return;
jQuery.post ("ajax.php",
{"page" : "godmode/groups/group_list",
"get_group_agents" : 1,
"disabled" : 1,
"id_group" : this.value,
"recursion" : config.recursion
},
function (data, status) {
jQuery.each (data, function (id, value) {
var _pandoraSelectGroupAgent = function (disabled) {
var that = this;
this.defaults = {
agentSelect: "select#id_agent",
recursion: 0,
loading: "#agent_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
callbackAfter: dummyFunc,
debug: false,
disabled: disabled || false,
};
/* public methods */
this.construct = function (settings) {
return this.each (function() {
this.config = {};
this.config = $.extend (this.config, that.defaults, settings);
var config = this.config;
$(this).change (function () {
var $select = $(config.agentSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
if (! config.callbackBefore (this))
return;
var opts = {
"page" : "godmode/groups/group_list",
"get_group_agents" : 1,
"id_group" : this.value,
"recursion" : config.recursion,
"disabled" : config.disabled ? 1 : 0,
};
jQuery.post ("ajax.php",
opts,
function (data, status) {
jQuery.each (data, function (id, value) {
if (id !== 'keycount'){
config.callbackPre ();
option = $("<option></option>")
.attr ("value", id)
.html (value);
config.callbackPost (id, value, option);
$(config.agentSelect).append (option);
});
$(config.loading).hide ();
$select.enable ();
config.callbackAfter ();
},
"json"
);
});
}
});
$(config.loading).hide ();
$select.enable ();
config.callbackAfter ();
},
"json"
);
});
};
}
});
};
};
$.extend ({
pandoraSelectGroupAgent: new _pandoraSelectGroupAgent(),
pandoraSelectGroupAgentDisabled: new _pandoraSelectGroupAgent(true),
});
$.extend ({