Get the link entry app selection menu working again

This commit is contained in:
nathan 2021-08-12 11:21:49 -06:00
parent 1d0772a064
commit 54e5826fc7

View File

@ -102,7 +102,8 @@ export class et2_link_to extends et2_inputWidget
* *
* @memberOf et2_link_to * @memberOf et2_link_to
*/ */
constructor(_parent : et2_widget, _attrs? : WidgetConfig, _child? : object) { constructor(_parent: et2_widget, _attrs?: WidgetConfig, _child?: object)
{
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_link_to._attributes, _child || {})); super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_link_to._attributes, _child || {}));
this.div = jQuery(document.createElement("div")).addClass("et2_link_to et2_toolbar"); this.div = jQuery(document.createElement("div")).addClass("et2_link_to et2_toolbar");
@ -143,13 +144,20 @@ export class et2_link_to extends et2_inputWidget
*/ */
getDOMNode(_sender) getDOMNode(_sender)
{ {
if(_sender == this) { if (_sender == this)
{
return this.div[0]; return this.div[0];
} else if (_sender._type == 'link-entry') { }
else if (_sender._type == 'link-entry')
{
return this.link_div[0]; return this.link_div[0];
} else if (_sender._type == 'file') { }
else if (_sender._type == 'file')
{
return this.file_div[0]; return this.file_div[0];
} else if (_sender._type == 'vfs-select') { }
else if (_sender._type == 'vfs-select')
{
return this.filemanager_button[0]; return this.filemanager_button[0];
} }
} }
@ -203,8 +211,16 @@ export class et2_link_to extends et2_inputWidget
only_app: this.options.only_app, only_app: this.options.only_app,
application_list: this.options.application_list, application_list: this.options.application_list,
blur: this.options.search_label ? this.options.search_label : this.egw().lang('Search...'), blur: this.options.search_label ? this.options.search_label : this.egw().lang('Search...'),
query: function() { self.link_button.hide(); return true;}, query: function ()
select: function() {self.link_button.show(); return true;}, {
self.link_button.hide();
return true;
},
select: function ()
{
self.link_button.show();
return true;
},
readonly: this.options.readonly readonly: this.options.readonly
}; };
this.link_entry = <et2_link_entry>et2_createWidget("link-entry", link_entry_attrs, this); this.link_entry = <et2_link_entry>et2_createWidget("link-entry", link_entry_attrs, this);
@ -246,7 +262,8 @@ export class et2_link_to extends et2_inputWidget
}; };
// only set server-side callback, if we have a real application-id (not null or array) // only set server-side callback, if we have a real application-id (not null or array)
// otherwise it only gives an error on server-side // otherwise it only gives an error on server-side
if (self.options.value && self.options.value.to_id && typeof self.options.value.to_id != 'object') { if (self.options.value && self.options.value.to_id && typeof self.options.value.to_id != 'object')
{
select_attrs.method = 'EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_existing'; select_attrs.method = 'EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_existing';
select_attrs.method_id = self.options.value.to_app + ':' + self.options.value.to_id; select_attrs.method_id = self.options.value.to_app + ':' + self.options.value.to_id;
} }
@ -267,9 +284,11 @@ export class et2_link_to extends et2_inputWidget
{ {
// Find the tab widget, if there is one // Find the tab widget, if there is one
var tabs: et2_widget = self; var tabs: et2_widget = self;
do { do
{
tabs = tabs.getParent(); tabs = tabs.getParent();
} while (tabs != self.getRoot() && tabs.getType() != 'tabbox'); }
while (tabs != self.getRoot() && tabs.getType() != 'tabbox');
if (tabs != self.getRoot()) if (tabs != self.getRoot())
{ {
(<et2_tabbox><unknown>tabs).activateTab(self); (<et2_tabbox><unknown>tabs).activateTab(self);
@ -325,7 +344,8 @@ export class et2_link_to extends et2_inputWidget
// Files // Files
if (!self.options.no_files) if (!self.options.no_files)
{ {
for(var file in self.file_upload.options.value) { for (var file in self.file_upload.options.value)
{
links.push({ links.push({
app: 'file', app: 'file',
@ -333,7 +353,10 @@ export class et2_link_to extends et2_inputWidget
name: self.file_upload.options.value[file].name, name: self.file_upload.options.value[file].name,
type: self.file_upload.options.value[file].type, type: self.file_upload.options.value[file].type,
remark: jQuery("li[file='" + self.file_upload.options.value[file].name.replace(/'/g, '&quot') + "'] > input", self.file_upload.progress) remark: jQuery("li[file='" + self.file_upload.options.value[file].name.replace(/'/g, '&quot') + "'] > input", self.file_upload.progress)
.filter(function() { return jQuery(this).attr("placeholder") != jQuery(this).val();}).val() .filter(function ()
{
return jQuery(this).attr("placeholder") != jQuery(this).val();
}).val()
}); });
} }
} }
@ -366,7 +389,8 @@ export class et2_link_to extends et2_inputWidget
this.status_span.fadeIn().delay(1000).fadeOut(); this.status_span.fadeIn().delay(1000).fadeOut();
delete this.options.value.app; delete this.options.value.app;
delete this.options.value.id; delete this.options.value.id;
for(var file in this.file_upload.options.value) { for (var file in this.file_upload.options.value)
{
delete this.file_upload.options.value[file]; delete this.file_upload.options.value[file];
} }
this.file_upload.progress.empty(); this.file_upload.progress.empty();
@ -407,8 +431,10 @@ export class et2_link_to extends et2_inputWidget
var self = this; var self = this;
var list_widget = null; var list_widget = null;
this.getRoot().iterateOver( this.getRoot().iterateOver(
function(widget) { function (widget)
if(widget.id == self.id) { {
if (widget.id == self.id)
{
list_widget = widget; list_widget = widget;
if (success === true) if (success === true)
{ {
@ -433,7 +459,8 @@ export class et2_link_to extends et2_inputWidget
if (typeof link.title == 'undefined') if (typeof link.title == 'undefined')
{ {
// Callback to server for title // Callback to server for title
egw.link_title(link.app, link.id, function(title) { egw.link_title(link.app, link.id, function (title)
{
link.title = title; link.title = title;
list_widget._add_link(link); list_widget._add_link(link);
}); });
@ -470,6 +497,7 @@ export class et2_link_to extends et2_inputWidget
this.options.no_files = no_files; this.options.no_files = no_files;
} }
} }
et2_register_widget(et2_link_to, ["link-to"]); et2_register_widget(et2_link_to, ["link-to"]);
/** /**
@ -510,7 +538,8 @@ export class et2_link_apps extends et2_selectbox
} }
// Register to update preference // Register to update preference
var self = this; var self = this;
this.input.bind("click",function() { this.input.bind("click", function ()
{
if (typeof self.options.value != 'undefined') var appname = self.options.value.to_app; if (typeof self.options.value != 'undefined') var appname = self.options.value.to_app;
egw.set_preference(appname || self.egw().getAppName(), 'link_app', self.getValue()); egw.set_preference(appname || self.egw().getAppName(), 'link_app', self.getValue());
}); });
@ -547,6 +576,7 @@ export class et2_link_apps extends et2_selectbox
super.transformAttributes(_attrs); super.transformAttributes(_attrs);
} }
} }
et2_register_widget(et2_link_apps, ["link-apps"]); et2_register_widget(et2_link_apps, ["link-apps"]);
/** /**
@ -641,7 +671,8 @@ export class et2_link_entry extends et2_inputWidget
this.createInputWidget(); this.createInputWidget();
var self = this; var self = this;
jQuery(this.getInstanceManager().DOMContainer).on('clear', function(){ jQuery(this.getInstanceManager().DOMContainer).on('clear', function ()
{
// We need to unbind events to prevent a second triggerd event handler // We need to unbind events to prevent a second triggerd event handler
// (eg. setting a project in infolog edit dialog) when the widget gets cleared. // (eg. setting a project in infolog edit dialog) when the widget gets cleared.
jQuery(self.getDOMNode()).off(); jQuery(self.getDOMNode()).off();
@ -670,40 +701,17 @@ export class et2_link_entry extends et2_inputWidget
// Application selection // Application selection
jQuery.widget("custom.iconselectmenu", jQuery.ui.selectmenu, { jQuery.widget("custom.iconselectmenu", jQuery.ui.selectmenu, {
_setText: function(element, value) _renderButtonItem: function (value)
{ {
if(element === this.buttonText) var _value = value.value;
{
this._setButtonText(value);
}
else
{
this._superApply(element, value);
}
},
_setButtonText: function( value )
{
var _value = this.focusIndex;
if(typeof this.focusIndex === 'undefined')
{
_value = this.element.find( "option:selected" ).val();
}
else
{
var selected = this.items[_value] || {};
_value = selected.value;
}
var url = self.egw().image('navbar', _value); var url = self.egw().image('navbar', _value);
var buttonItem = jQuery("<span>", { var buttonItem = jQuery("<span>", {
"class": "ui-selectmenu-text", "class": "ui-selectmenu-text",
title: value title: value.label
}); });
jQuery('.ui-selectmenu-text', this.button).replaceWith(buttonItem);
buttonItem.css('background-image', 'url(' + url + ')'); buttonItem.css('background-image', 'url(' + url + ')');
return buttonItem;
}, },
_renderItem: function (ul, item) _renderItem: function (ul, item)
{ {
@ -772,7 +780,10 @@ export class et2_link_entry extends et2_inputWidget
// Search input // Search input
this.search = jQuery(document.createElement("input")) this.search = jQuery(document.createElement("input"))
// .attr("type", "search") // Fake it for all browsers below // .attr("type", "search") // Fake it for all browsers below
.focus(function(){if(!self.options.only_app) { .focus(function ()
{
if (!self.options.only_app)
{
// Adjust width, leave room for app select & link button // Adjust width, leave room for app select & link button
self.div.removeClass("no_app"); self.div.removeClass("no_app");
if (self.options.app_icons) if (self.options.app_icons)
@ -783,8 +794,10 @@ export class et2_link_entry extends et2_inputWidget
{ {
self.app_select.show(); self.app_select.show();
} }
}}) }
.blur(function(e) { })
.blur(function (e)
{
if (self.div.has(e.relatedTarget).length) return; if (self.div.has(e.relatedTarget).length) return;
if (self.options.app_icons) if (self.options.app_icons)
{ {
@ -794,7 +807,8 @@ export class et2_link_entry extends et2_inputWidget
} }
else if (self.search.val()) else if (self.search.val())
{ {
if(self.options.only_app) { if (self.options.only_app)
{
// Adjust width, leave room for app select & link button // Adjust width, leave room for app select & link button
self.div.addClass("no_app"); self.div.addClass("no_app");
} }
@ -843,7 +857,8 @@ export class et2_link_entry extends et2_inputWidget
var extra: any = {}; var extra: any = {};
// Extra stuff // Extra stuff
if(typeof item.label == 'object') { if (typeof item.label == 'object')
{
extra = item.label; extra = item.label;
item.label = extra.label ? extra.label : extra; item.label = extra.label ? extra.label : extra;
if (extra['style.backgroundColor'] || extra.color) if (extra['style.backgroundColor'] || extra.color)
@ -867,7 +882,10 @@ export class et2_link_entry extends et2_inputWidget
// Normal stuff // Normal stuff
li.append(jQuery("<a></a>").text(item.label)) li.append(jQuery("<a></a>").text(item.label))
.appendTo(ul); .appendTo(ul);
window.setTimeout(function(){ul.css('max-width', jQuery('.et2_container').width()-ul.offset().left);}, 300); window.setTimeout(function ()
{
ul.css('max-width', jQuery('.et2_container').width() - ul.offset().left);
}, 300);
return li; return li;
}; };
@ -1032,11 +1050,14 @@ export class et2_link_entry extends et2_inputWidget
} }
if (!_value.app) _value.app = this.options.only_app || this.app_select.val(); if (!_value.app) _value.app = this.options.only_app || this.app_select.val();
if(_value.id) { if (_value.id)
{
// Remove specific display and revert to CSS file // Remove specific display and revert to CSS file
// show() would use inline, should be inline-block // show() would use inline, should be inline-block
this.clear.css('display', ''); this.clear.css('display', '');
} else { }
else
{
this.clear.hide(); this.clear.hide();
return; return;
} }
@ -1045,7 +1066,8 @@ export class et2_link_entry extends et2_inputWidget
console.warn("Bad value for link widget. Need an object with keys 'app', 'id', and optionally 'title'", _value); console.warn("Bad value for link widget. Need an object with keys 'app', 'id', and optionally 'title'", _value);
return; return;
} }
if(!_value.title) { if (!_value.title)
{
var title = this.egw().link_title(_value.app, _value.id); var title = this.egw().link_title(_value.app, _value.id);
if (title != null) if (title != null)
{ {
@ -1156,7 +1178,8 @@ export class et2_link_entry extends et2_inputWidget
if (!this.options.query(request, this)) return false; if (!this.options.query(request, this)) return false;
} }
if((typeof request.no_cache == 'undefined' && !request.no_cache) && request.term in this.cache) { if ((typeof request.no_cache == 'undefined' && !request.no_cache) && request.term in this.cache)
{
return response(this.cache[request.term]); return response(this.cache[request.term]);
} }
@ -1210,7 +1233,10 @@ export class et2_link_entry extends et2_inputWidget
this.search.change(); this.search.change();
// Turn off processing flag when done // Turn off processing flag when done
window.setTimeout(jQuery.proxy(function() {delete this.processing;},event.data)); window.setTimeout(jQuery.proxy(function ()
{
delete this.processing;
}, event.data));
} }
/** /**
@ -1226,7 +1252,8 @@ export class et2_link_entry extends et2_inputWidget
} }
this.search.removeClass("loading"); this.search.removeClass("loading");
var result = []; var result = [];
for(var id in data) { for (var id in data)
{
result.push({"value": id, "label": data[id]}); result.push({"value": id, "label": data[id]});
} }
this.cache[this.search.val()] = result; this.cache[this.search.val()] = result;
@ -1256,7 +1283,8 @@ export class et2_link_entry extends et2_inputWidget
} }
// Links to other entries // Links to other entries
if(values.id) { if (values.id)
{
links.push({ links.push({
app: values.app, app: values.app,
id: values.id id: values.id
@ -1285,13 +1313,15 @@ export class et2_link_entry extends et2_inputWidget
*/ */
_link_result(success) _link_result(success)
{ {
if(success) { if (success)
{
this.status_span.fadeIn().delay(1000).fadeOut(); this.status_span.fadeIn().delay(1000).fadeOut();
delete this.options.value.app; delete this.options.value.app;
delete this.options.value.id; delete this.options.value.id;
} }
} }
} }
et2_register_widget(et2_link_entry, ["link-entry"]); et2_register_widget(et2_link_entry, ["link-entry"]);
/** /**
@ -1363,17 +1393,22 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
if (this.options['class']) this.label_span.addClass(this.options['class']); if (this.options['class']) this.label_span.addClass(this.options['class']);
this.setDOMNode(this.label_span[0]); this.setDOMNode(this.label_span[0]);
} }
destroy() destroy()
{ {
if (this.link) this.link.unbind(); if (this.link) this.link.unbind();
this.link = null; this.link = null;
super.destroy.apply(this, arguments); super.destroy.apply(this, arguments);
} }
set_label(label) set_label(label)
{ {
// Remove current label // Remove current label
this.label_span.contents() this.label_span.contents()
.filter(function(){ return this.nodeType == 3; }).remove(); .filter(function ()
{
return this.nodeType == 3;
}).remove();
var parts = et2_csvSplit(label, 2, "%s"); var parts = et2_csvSplit(label, 2, "%s");
this.label_span.prepend(parts[0]); this.label_span.prepend(parts[0]);
@ -1383,6 +1418,7 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
// add class if label is empty // add class if label is empty
this.label_span.toggleClass('et2_label_empty', !label || !parts[0]); this.label_span.toggleClass('et2_label_empty', !label || !parts[0]);
} }
set_value(_value) set_value(_value)
{ {
if (typeof _value != 'object' && _value && !this.options.only_app) if (typeof _value != 'object' && _value && !this.options.only_app)
@ -1421,7 +1457,8 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
{ {
// try to fetch value.title if it wasn't fetched during initiation. // try to fetch value.title if it wasn't fetched during initiation.
if (!_value.title) _value.title = self.egw().link_title(_value.app, _value.id); if (!_value.title) _value.title = self.egw().link_title(_value.app, _value.id);
if( !self.options.target_app ){ if (!self.options.target_app)
{
self.options.target_app = _value.app; self.options.target_app = _value.app;
} }
const target = self.options.extra_link_target || _value.app; const target = self.options.extra_link_target || _value.app;
@ -1439,7 +1476,10 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
var node = this.link[0]; var node = this.link[0];
if (_value.app && _value.id) if (_value.app && _value.id)
{ {
var title = this.egw().link_title(_value.app, _value.id, function(title) {self.set_title(node, title);}, this); var title = this.egw().link_title(_value.app, _value.id, function (title)
{
self.set_title(node, title);
}, this);
if (title != null) if (title != null)
{ {
_value.title = title; _value.title = title;
@ -1522,6 +1562,7 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
} }
} }
et2_register_widget(et2_link, ["link", "link-entry_ro"]); et2_register_widget(et2_link, ["link", "link-entry_ro"]);
/** /**
@ -1584,7 +1625,8 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va
destroy() destroy()
{ {
super.destroy.apply(this, arguments); super.destroy.apply(this, arguments);
if (this.node != null) { if (this.node != null)
{
jQuery(this.node).children().unbind(); jQuery(this.node).children().unbind();
} }
} }
@ -1649,6 +1691,7 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va
this.egw().jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_list', [_value], this.set_value, this); this.egw().jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_list', [_value], this.set_value, this);
return; return;
} }
/** /**
* Function to get media content to feed the expose * Function to get media content to feed the expose
* @param {type} _value * @param {type} _value
@ -1680,13 +1723,15 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va
if (mediaContent[0].href && mediaContent[0].href.match(/\/webdav.php/, 'ig')) mediaContent[0]["download_href"] = mediaContent[0].href + '?download'; if (mediaContent[0].href && mediaContent[0].href.match(/\/webdav.php/, 'ig')) mediaContent[0]["download_href"] = mediaContent[0].href + '?download';
return mediaContent; return mediaContent;
} }
_add_link(_link_data) _add_link(_link_data)
{ {
var self = this; var self = this;
var link = jQuery(document.createElement("li")) var link = jQuery(document.createElement("li"))
.appendTo(this.list) .appendTo(this.list)
.addClass("et2_link loading") .addClass("et2_link loading")
.click( function(e){ .click(function (e)
{
var fe = egw_get_file_editor_prefered_mimes(_link_data.type); var fe = egw_get_file_editor_prefered_mimes(_link_data.type);
if (self.options.expose_view && typeof _link_data.type != 'undefined' if (self.options.expose_view && typeof _link_data.type != 'undefined'
&& _link_data.type.match(self.mime_regexp, 'ig') && !_link_data.type.match(self.mime_audio_regexp, 'ig')) && _link_data.type.match(self.mime_regexp, 'ig') && !_link_data.type.match(self.mime_audio_regexp, 'ig'))
@ -1719,7 +1764,8 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va
// Now that link is created, get title from server & update // Now that link is created, get title from server & update
else else
{ {
this.egw().link_title(_link_data.app, _link_data.id, function(title) { this.egw().link_title(_link_data.app, _link_data.id, function (title)
{
if (title) if (title)
this.removeClass("loading").text(title); this.removeClass("loading").text(title);
else else
@ -1791,7 +1837,9 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va
this._labelContainer.contents().not(this.list).remove(); this._labelContainer.contents().not(this.list).remove();
} }
} }
}){}; })
{
};
et2_register_widget(et2_link_string, ["link-string"]); et2_register_widget(et2_link_string, ["link-string"]);
/** /**
@ -1991,7 +2039,10 @@ export class et2_link_list extends et2_link_string
var link_id = isNaN(self.context.data.link_id) ? self.context.data : self.context.data.link_id; var link_id = isNaN(self.context.data.link_id) ? self.context.data : self.context.data.link_id;
var row = jQuery('#link_' + (self.context.data.dom_id ? self.context.data.dom_id : self.context.data.link_id), self.list); var row = jQuery('#link_' + (self.context.data.dom_id ? self.context.data.dom_id : self.context.data.link_id), self.list);
et2_dialog.show_dialog( et2_dialog.show_dialog(
function(button) { if(button == et2_dialog.YES_BUTTON) self._delete_link(link_id,row);}, function (button)
{
if (button == et2_dialog.YES_BUTTON) self._delete_link(link_id, row);
},
egw.lang('Delete link?') egw.lang('Delete link?')
); );
}); });
@ -2128,7 +2179,8 @@ export class et2_link_list extends et2_link_string
//Bind the click handler if there is download_url //Bind the click handler if there is download_url
if (_link_data && (typeof _link_data.download_url != 'undefined' || _link_data.app != 'egw-data')) if (_link_data && (typeof _link_data.download_url != 'undefined' || _link_data.app != 'egw-data'))
{ {
$td.click( function(){ $td.click(function ()
{
var fe_mime = egw_get_file_editor_prefered_mimes(_link_data.type); var fe_mime = egw_get_file_editor_prefered_mimes(_link_data.type);
// Check if the link entry is mime with media type, in order to open it in expose view // Check if the link entry is mime with media type, in order to open it in expose view
if (typeof _link_data.type != 'undefined' && if (typeof _link_data.type != 'undefined' &&
@ -2183,7 +2235,8 @@ export class et2_link_list extends et2_link_string
.bind('click', function () .bind('click', function ()
{ {
et2_dialog.show_dialog( et2_dialog.show_dialog(
function(button) { function (button)
{
if (button == et2_dialog.YES_BUTTON) if (button == et2_dialog.YES_BUTTON)
{ {
self._delete_link( self._delete_link(
@ -2222,7 +2275,8 @@ export class et2_link_list extends et2_link_string
{ {
row.on("dragstart", _link_data, function (event) row.on("dragstart", _link_data, function (event)
{ {
if(event.dataTransfer == null) { if (event.dataTransfer == null)
{
return; return;
} }
var data = event.data || {}; var data = event.data || {};
@ -2275,6 +2329,7 @@ export class et2_link_list extends et2_link_string
}); });
} }
} }
_delete_link(link_id, row) _delete_link(link_id, row)
{ {
if (row) if (row)
@ -2290,7 +2345,13 @@ export class et2_link_list extends et2_link_string
if (typeof link_id != "object") if (typeof link_id != "object")
{ {
egw.json("EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_delete", [link_id], egw.json("EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_delete", [link_id],
function(data) { if(data) {row.slideUp(row.remove);}} function (data)
{
if (data)
{
row.slideUp(row.remove);
}
}
).sendRequest(); ).sendRequest();
} }
else if (row) else if (row)
@ -2305,7 +2366,8 @@ export class et2_link_list extends et2_link_string
var self = this; var self = this;
var _widget = link_id.widget || null; var _widget = link_id.widget || null;
this.getRoot().iterateOver( this.getRoot().iterateOver(
function(widget) { function (widget)
{
if (widget.id == self.id) if (widget.id == self.id)
{ {
_widget = widget; _widget = widget;
@ -2379,6 +2441,7 @@ export class et2_link_list extends et2_link_string
} }
} }
} }
et2_register_widget(et2_link_list, ["link-list"]); et2_register_widget(et2_link_list, ["link-list"]);
@ -2404,6 +2467,7 @@ export class et2_link_add extends et2_inputWidget
private div: JQuery; private div: JQuery;
private app_select: et2_link_apps; private app_select: et2_link_apps;
private button: et2_button; private button: et2_button;
/** /**
* Constructor * Constructor
*/ */
@ -2418,6 +2482,7 @@ export class et2_link_add extends et2_inputWidget
this.div = jQuery(document.createElement("div")).append(this.span); this.div = jQuery(document.createElement("div")).append(this.span);
this.setDOMNode(this.div[0]); this.setDOMNode(this.div[0]);
} }
doLoadingFinished() doLoadingFinished()
{ {
super.doLoadingFinished.apply(this, arguments); super.doLoadingFinished.apply(this, arguments);
@ -2432,7 +2497,10 @@ export class et2_link_add extends et2_inputWidget
application_list: this.options.application ? this.options.application : null application_list: this.options.application ? this.options.application : null
}), this); }), this);
this.div.append(this.app_select.getDOMNode()); this.div.append(this.app_select.getDOMNode());
this.button = <et2_button>et2_createWidget("button", {id:this.options.id+"_add",label: this.egw().lang("add")}, this); this.button = <et2_button>et2_createWidget("button", {
id: this.options.id + "_add",
label: this.egw().lang("add")
}, this);
this.button.set_label(this.egw().lang("add")); this.button.set_label(this.egw().lang("add"));
var self = this; var self = this;
this.button.click = function () this.button.click = function ()
@ -2444,6 +2512,7 @@ export class et2_link_add extends et2_inputWidget
return true; return true;
} }
/** /**
* Should be handled client side. * Should be handled client side.
* Return null to avoid overwriting other link values, in case designer used the same ID for multiple widgets * Return null to avoid overwriting other link values, in case designer used the same ID for multiple widgets
@ -2453,4 +2522,5 @@ export class et2_link_add extends et2_inputWidget
return null; return null;
} }
} }
et2_register_widget(et2_link_add, ["link-add"]); et2_register_widget(et2_link_add, ["link-add"]);