mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-25 14:41:50 +01:00
If two widgets have the same ID, and they both return objects as values (eg: link widgets) then merge the values instead of replacing
This commit is contained in:
parent
f1ea3db040
commit
9a6e3d59a8
@ -195,6 +195,12 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
{
|
{
|
||||||
$value['col_filter'][$parent_id] = $queriedRange['parent_id'];
|
$value['col_filter'][$parent_id] = $queriedRange['parent_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If specific data requested, just do that
|
||||||
|
if (($row_id = $value['row_id']) && $queryiedRange['refresh'])
|
||||||
|
{
|
||||||
|
$value['col_filter'][$row_id] = $queriedRange['refresh'];
|
||||||
|
}
|
||||||
$rows = $result['data'] = $result['order'] = array();
|
$rows = $result['data'] = $result['order'] = array();
|
||||||
$result['total'] = self::call_get_rows($value, $rows, $result['readonlys']);
|
$result['total'] = self::call_get_rows($value, $rows, $result['readonlys']);
|
||||||
$result['lastModification'] = egw_time::to('now', 'ts')-1;
|
$result['lastModification'] = egw_time::to('now', 'ts')-1;
|
||||||
|
@ -1178,7 +1178,7 @@ var et2_link_add = et2_inputWidget.extend({
|
|||||||
},
|
},
|
||||||
doLoadingFinished: function() {
|
doLoadingFinished: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.app_select = et2_createWidget("link-apps", this.options ,this);
|
this.app_select = et2_createWidget("link-apps", jQuery.extend({},this.options,{'id': this.options.id + 'app'}) ,this);
|
||||||
this.div.append(this.app_select.getDOMNode());
|
this.div.append(this.app_select.getDOMNode());
|
||||||
this.button = et2_createWidget("button", {label: this.egw().lang("add")}, this);
|
this.button = et2_createWidget("button", {label: this.egw().lang("add")}, this);
|
||||||
this.button.set_label(this.egw().lang("add"));
|
this.button.set_label(this.egw().lang("add"));
|
||||||
|
@ -404,18 +404,27 @@ etemplate2.prototype.getValues = function(_root)
|
|||||||
id = typeof _target == "undefined" ? 0 : Object.keys(_target).length;
|
id = typeof _target == "undefined" ? 0 : Object.keys(_target).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var value = _widget.getValue();
|
||||||
|
|
||||||
// Check whether the entry is really undefined
|
// Check whether the entry is really undefined
|
||||||
if (typeof _target[id] != "undefined")
|
if (typeof _target[id] != "undefined" && (typeof _target[id] != 'object' || typeof value != 'object'))
|
||||||
{
|
{
|
||||||
egw.debug("error", _widget, "Overwriting value of '" + _widget.id +
|
egw.debug("error", _widget, "Overwriting value of '" + _widget.id +
|
||||||
"', id exists twice!");
|
"', id exists twice!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the value of the widget and reset its dirty flag
|
// Store the value of the widget and reset its dirty flag
|
||||||
var value = _widget.getValue();
|
|
||||||
if (value !== null)
|
if (value !== null)
|
||||||
{
|
{
|
||||||
_target[id] = value;
|
// Merge, if possible (link widget)
|
||||||
|
if(typeof _target[id] == 'object' && typeof value == 'object')
|
||||||
|
{
|
||||||
|
_target[id] = jQuery.extend([],_target[id],value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_target[id] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (jQuery.isEmptyObject(_target))
|
else if (jQuery.isEmptyObject(_target))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user