mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Add support for multi-part history values into historylog
This commit is contained in:
parent
3ceda8324d
commit
bd51cb4a08
@ -285,10 +285,41 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider,et2_IResizeable],
|
|||||||
var field = this.options.value['status-widgets'][key];
|
var field = this.options.value['status-widgets'][key];
|
||||||
var attrs = {'readonly': true, 'id': key};
|
var attrs = {'readonly': true, 'id': key};
|
||||||
var options = null;
|
var options = null;
|
||||||
|
var widget = null;
|
||||||
if(typeof field == 'object')
|
if(typeof field == 'object')
|
||||||
|
{
|
||||||
|
var need_box = false;
|
||||||
|
for(var j in field)
|
||||||
|
{
|
||||||
|
if(et2_registry[field[j]])
|
||||||
|
{
|
||||||
|
need_box = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(need_box)
|
||||||
|
{
|
||||||
|
// Multi-part value needs multiple widgets
|
||||||
|
widget = et2_createWidget('vbox', attrs, this);
|
||||||
|
for(var i in field)
|
||||||
|
{
|
||||||
|
if(typeof field[i] == 'object')
|
||||||
|
{
|
||||||
|
attrs['select_options'] = field[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete attrs['select_options'];
|
||||||
|
}
|
||||||
|
var child = et2_createWidget(typeof field[i] == 'string' ? field[i] : 'select', attrs, widget);
|
||||||
|
child.transformAttributes(attrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
attrs['select_options'] = field;
|
attrs['select_options'] = field;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Check for options after the type, ex: link-entry:infolog
|
// Check for options after the type, ex: link-entry:infolog
|
||||||
else if (field.indexOf(':') > 0)
|
else if (field.indexOf(':') > 0)
|
||||||
{
|
{
|
||||||
@ -296,7 +327,10 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider,et2_IResizeable],
|
|||||||
field = options.shift();
|
field = options.shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
var widget = et2_createWidget(typeof field == 'string' ? field : 'select', attrs, this);
|
if(widget == null)
|
||||||
|
{
|
||||||
|
widget = et2_createWidget(typeof field == 'string' ? field : 'select', attrs, this);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse / set legacy options
|
// Parse / set legacy options
|
||||||
if(options)
|
if(options)
|
||||||
@ -336,10 +370,15 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider,et2_IResizeable],
|
|||||||
widget.transformAttributes(attrs);
|
widget.transformAttributes(attrs);
|
||||||
|
|
||||||
// Save to use for each row
|
// Save to use for each row
|
||||||
|
var nodes = widget._children.length ? [] : jQuery(widget.getDetachedNodes());
|
||||||
|
for(var i = 0; i < widget._children.length; i++)
|
||||||
|
{
|
||||||
|
nodes.push(jQuery(widget._children[i].getDetachedNodes()));
|
||||||
|
}
|
||||||
this.fields[key] = {
|
this.fields[key] = {
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
widget: widget,
|
widget: widget,
|
||||||
nodes: jQuery(widget.getDetachedNodes())
|
nodes: nodes
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Widget for text diffs
|
// Widget for text diffs
|
||||||
@ -410,8 +449,15 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider,et2_IResizeable],
|
|||||||
var widget = self.columns[i].widget;
|
var widget = self.columns[i].widget;
|
||||||
if(typeof widget == 'undefined' && typeof self.fields[_data.status] != 'undefined')
|
if(typeof widget == 'undefined' && typeof self.fields[_data.status] != 'undefined')
|
||||||
{
|
{
|
||||||
nodes = self.fields[_data.status].nodes.clone();
|
|
||||||
widget = self.fields[_data.status].widget;
|
widget = self.fields[_data.status].widget;
|
||||||
|
if(!widget._children.length)
|
||||||
|
{
|
||||||
|
nodes = self.fields[_data.status].nodes.clone();
|
||||||
|
}
|
||||||
|
for(var j = 0; j < widget._children.length; j++)
|
||||||
|
{
|
||||||
|
nodes.push(self.fields[_data.status].nodes[j].clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (widget)
|
else if (widget)
|
||||||
{
|
{
|
||||||
@ -461,7 +507,24 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider,et2_IResizeable],
|
|||||||
// No widget fallback - display actual value
|
// No widget fallback - display actual value
|
||||||
nodes = '<span>'+_data[self.columns[i].id] + '</span>';
|
nodes = '<span>'+_data[self.columns[i].id] + '</span>';
|
||||||
}
|
}
|
||||||
if(widget) widget.setDetachedAttributes(nodes, {value:_data[self.columns[i].id]});
|
if(widget)
|
||||||
|
{
|
||||||
|
if(widget._children.length)
|
||||||
|
{
|
||||||
|
// Multi-part values
|
||||||
|
var box = $j(widget.getDOMNode()).clone();
|
||||||
|
for(var j = 0; j < widget._children.length; j++)
|
||||||
|
{
|
||||||
|
widget._children[j].setDetachedAttributes(nodes[j], {value:_data[self.columns[i].id][j]});
|
||||||
|
box.append(nodes[j]);
|
||||||
|
}
|
||||||
|
nodes = box;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
widget.setDetachedAttributes(nodes, {value:_data[self.columns[i].id]});
|
||||||
|
}
|
||||||
|
}
|
||||||
$j(this).append(nodes);
|
$j(this).append(nodes);
|
||||||
});
|
});
|
||||||
$j(tr).append(row.children());
|
$j(tr).append(row.children());
|
||||||
|
@ -249,6 +249,14 @@ class historylog
|
|||||||
) as $row) {
|
) as $row) {
|
||||||
$row['user_ts'] = $GLOBALS['egw']->db->from_timestamp($row['history_timestamp']) + 3600 * $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
|
$row['user_ts'] = $GLOBALS['egw']->db->from_timestamp($row['history_timestamp']) + 3600 * $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
|
||||||
|
|
||||||
|
// Explode multi-part values
|
||||||
|
foreach(array('history_new_value','history_old_value') as $field)
|
||||||
|
{
|
||||||
|
if(strpos($row[$field],bo_tracking::ONE2N_SEPERATOR) !== false)
|
||||||
|
{
|
||||||
|
$row[$field] = explode(bo_tracking::ONE2N_SEPERATOR,$row[$field]);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Get information needed for proper display
|
// Get information needed for proper display
|
||||||
if($row['history_appname'] == 'filemanager')
|
if($row['history_appname'] == 'filemanager')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user