forked from extern/egroupware
Hide app selectbox if application is specified
This commit is contained in:
parent
452b7c98e1
commit
422c35ba92
@ -355,24 +355,32 @@ var et2_link_entry = et2_valueWidget.extend({
|
|||||||
this.div = $j(document.createElement("div")).addClass("et2_link_entry");
|
this.div = $j(document.createElement("div")).addClass("et2_link_entry");
|
||||||
|
|
||||||
// Application selection
|
// Application selection
|
||||||
|
|
||||||
this.app_select = $j(document.createElement("select")).appendTo(this.div)
|
this.app_select = $j(document.createElement("select")).appendTo(this.div)
|
||||||
.change(function(e) {
|
.change(function(e) {
|
||||||
self.cache = {}; // Clear cache when app changes
|
self.cache = {}; // Clear cache when app changes
|
||||||
self.options.value.app = self.app_select.val();
|
self.options.value.app = self.app_select.val();
|
||||||
})
|
})
|
||||||
.css("width","39%");
|
.css("width","39%");
|
||||||
|
var opt_count = 0;
|
||||||
for(var key in this.options.select_options) {
|
for(var key in this.options.select_options) {
|
||||||
|
opt_count++;
|
||||||
var option = $j(document.createElement("option"))
|
var option = $j(document.createElement("option"))
|
||||||
.attr("value", key)
|
.attr("value", key)
|
||||||
.text(this.options.select_options[key]);
|
.text(this.options.select_options[key]);
|
||||||
option.appendTo(this.app_select);
|
option.appendTo(this.app_select);
|
||||||
}
|
}
|
||||||
|
this.app_select.val(this.options.application);
|
||||||
|
if(opt_count == 1)
|
||||||
|
{
|
||||||
|
this.app_select.hide();
|
||||||
|
}
|
||||||
self.options.value.app = this.app_select.val();
|
self.options.value.app = this.app_select.val();
|
||||||
|
|
||||||
// Search input
|
// Search input
|
||||||
this.search = $j(document.createElement("input")).attr("type", "search")
|
this.search = $j(document.createElement("input")).attr("type", "search")
|
||||||
.css("width","50%")
|
.css("width","50%")
|
||||||
.focus(function(){self.app_select.show();})
|
.focus(function(){if(!self.options.application) {self.app_select.show();}})
|
||||||
.appendTo(this.div);
|
.appendTo(this.div);
|
||||||
|
|
||||||
this.set_blur(this.options.blur ? this.options.blur : egw.lang("search"), this.search);
|
this.set_blur(this.options.blur ? this.options.blur : egw.lang("search"), this.search);
|
||||||
@ -401,7 +409,19 @@ var et2_link_entry = et2_valueWidget.extend({
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
|
||||||
_attrs["select_options"] = egw.link_app_list('query');
|
_attrs["select_options"] = {};
|
||||||
|
if(_attrs["application"])
|
||||||
|
{
|
||||||
|
var apps = et2_csvSplit(_attrs["application"], null, ",");
|
||||||
|
for(var i = 0; i < apps.length; i++)
|
||||||
|
{
|
||||||
|
_attrs["select_options"][apps[i]] = egw.lang(apps[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_attrs["select_options"] = egw.link_app_list('query');
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether the options entry was found, if not read it from the
|
// Check whether the options entry was found, if not read it from the
|
||||||
// content array.
|
// content array.
|
||||||
|
Loading…
Reference in New Issue
Block a user