mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
Get custom field entries to other apps working in nextmatch, sort of
This commit is contained in:
parent
40054c6a01
commit
3ff03ca92f
@ -102,6 +102,9 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
|
|||||||
var global_data = this.getArrayMgr("modifications").getRoot().getEntry('~custom_fields~');
|
var global_data = this.getArrayMgr("modifications").getRoot().getEntry('~custom_fields~');
|
||||||
if(global_data.fields) this.options.fields = global_data.fields;
|
if(global_data.fields) this.options.fields = global_data.fields;
|
||||||
|
|
||||||
|
// For checking app entries
|
||||||
|
var apps = egw.link_app_list();
|
||||||
|
|
||||||
// Create the table rows
|
// Create the table rows
|
||||||
for(var field_name in this.options.customfields)
|
for(var field_name in this.options.customfields)
|
||||||
{
|
{
|
||||||
@ -116,7 +119,8 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
|
|||||||
.appendTo(this.tbody);
|
.appendTo(this.tbody);
|
||||||
var cf = jQuery(document.createElement("td"))
|
var cf = jQuery(document.createElement("td"))
|
||||||
.appendTo(row);
|
.appendTo(row);
|
||||||
var setup_function = '_setup_'+field.type;
|
var setup_function = '_setup_'+(apps[field.type] ? 'link_entry' : field.type.replace("-","_"));
|
||||||
|
|
||||||
var attrs = {
|
var attrs = {
|
||||||
'id': id,
|
'id': id,
|
||||||
'statustext': field.help,
|
'statustext': field.help,
|
||||||
@ -143,7 +147,8 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
|
|||||||
delete(attrs.label);
|
delete(attrs.label);
|
||||||
|
|
||||||
// Create widget
|
// Create widget
|
||||||
var widget = this.widgets[field_name] = et2_createWidget(field.type, attrs, this);
|
console.debug(attrs);
|
||||||
|
var widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Field is not to be shown
|
// Field is not to be shown
|
||||||
@ -225,6 +230,10 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
|
|||||||
_setup_select: function(field_name, field, attrs) {
|
_setup_select: function(field_name, field, attrs) {
|
||||||
attrs.select_options = field.values;
|
attrs.select_options = field.values;
|
||||||
},
|
},
|
||||||
|
_setup_link_entry: function(field_name, field, attrs) {
|
||||||
|
attrs.type = "link-entry";
|
||||||
|
attrs.application = field.type;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code for implementing et2_IDetachedDOM
|
* Code for implementing et2_IDetachedDOM
|
||||||
|
@ -1140,7 +1140,7 @@ var et2_nextmatch_customfields = et2_nextmatch_header.extend({
|
|||||||
widget = et2_createWidget("nextmatch-entryheader", {
|
widget = et2_createWidget("nextmatch-entryheader", {
|
||||||
id: cf_id,
|
id: cf_id,
|
||||||
application: field.type,
|
application: field.type,
|
||||||
blur: field.label,
|
blur: field.label
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -645,17 +645,26 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
if(!_value || !_value.title) {
|
if(typeof _value != 'object' && _value && !this.options.application)
|
||||||
this.link.text("").unbind();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(typeof _value != 'object' && !this.options.application)
|
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
// Application set, just passed ID
|
||||||
|
else if (_value == parseInt(_value))
|
||||||
|
{
|
||||||
|
_value = {
|
||||||
|
app: this.options.application,
|
||||||
|
id: _value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if(!_value || jQuery.isEmptyObject(_value)) {
|
||||||
|
this.link.text("").unbind();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!_value.title) {
|
if(!_value.title) {
|
||||||
var title = egw.link_title(_value.app, _value.id, this.set_value, this);
|
var self = this;
|
||||||
|
var title = egw.link_title(_value.app, _value.id, function(title) {self.set_title(self.link[0], title);}, this);
|
||||||
if(title != null) {
|
if(title != null) {
|
||||||
_value.title = title;
|
_value.title = title;
|
||||||
}
|
}
|
||||||
@ -665,11 +674,19 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.set_title(this.link, _value.title);
|
||||||
this.link.text(_value.title).unbind()
|
this.link.unbind()
|
||||||
.click( function(){egw.open(_value.id, _value.app, "edit", _value.extra);});
|
.click( function(){egw.open(_value.id, _value.app, "edit", _value.extra);});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the text to be displayed.
|
||||||
|
* Used as a callback, so node is provided to make sure we get the right one
|
||||||
|
*/
|
||||||
|
set_title: function(node, _value) {
|
||||||
|
jQuery(node).text(_value+"");
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list of attributes which can be set when working in the
|
* Creates a list of attributes which can be set when working in the
|
||||||
* "detached" mode. The result is stored in the _attrs array which is provided
|
* "detached" mode. The result is stored in the _attrs array which is provided
|
||||||
@ -703,7 +720,7 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
et2_register_widget(et2_link, ["link"]);
|
et2_register_widget(et2_link, ["link", "link-entry_ro"]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI widget for one or more links, comma separated
|
* UI widget for one or more links, comma separated
|
||||||
|
Loading…
Reference in New Issue
Block a user