backport of Nathans r48352: Fix history log widget no longer working

This commit is contained in:
Ralf Becker 2014-08-27 17:28:07 +00:00
parent de3cb0f4db
commit 0a93f3dc0c
6 changed files with 50 additions and 23 deletions

View File

@ -63,4 +63,27 @@ class etemplate_widget_historylog extends etemplate_widget
}
}
}
/**
* Validate input
*
* For dates (except duration), it is always a full timestamp in W3C format,
* which we then convert to the format the application is expecting. This can
* be either a unix timestamp, just a date, just time, or whatever is
* specified in the template.
*
* @param string $cname current namespace
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
* @param array $content
* @param array &$validated=array() validated content
* @return boolean true if no validation error, false otherwise
*/
public function validate($cname, array $expand, array $content, &$validated=array())
{
$form_name = self::form_name($cname, $this->id, $expand);
$value = self::get_array($content, $form_name);
$valid =& self::get_array($validated, $form_name, true);
$valid = $value;
return true;
}
}

View File

@ -294,14 +294,17 @@ class etemplate_widget_nextmatch extends etemplate_widget
if (($template = etemplate_widget_template::instance(self::$request->template['name'], self::$request->template['template_set'],
self::$request->template['version'], self::$request->template['load_via'])))
{
$template = $template->getElementById($form_name);
$template = $template->getElementById($form_name, strpos($form_name, 'history') == 0 ? 'historylog' : 'nextmatch');
$expand = array(
'cont' => array($form_name => $filters),
);
$valid_filters = array();
$template->run('validate', array('', $expand, $expand['cont'], &$valid_filters), false); // $respect_disabled=false: as client may disable things, here we validate everything and leave it to the get_rows to interpret
$filters = $valid_filters[$form_name];
if($template)
{
$template->run('validate', array('', $expand, $expand['cont'], &$valid_filters), false); // $respect_disabled=false: as client may disable things, here we validate everything and leave it to the get_rows to interpret
$filters = $valid_filters[$form_name];
}
//error_log($this . " Valid filters: " . array2string($filters));
}

View File

@ -33,6 +33,7 @@
*/
var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
{
createNamespace: true,
attributes: {
"value": {
"name": "Value",
@ -52,8 +53,8 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
{'id': 'user_ts', caption: 'Date', 'width': '120px', widget_type: 'date-time'},
{'id': 'owner', caption: 'User', 'width': '150px', widget_type: 'select-account'},
{'id': 'status', caption: 'Changed', 'width': '120px', widget_type: 'select'},
{'id': 'new_value', caption: 'New Value', 'width': 'auto'},
{'id': 'old_value', caption: 'Old Value', 'width': 'auto'}
{'id': 'new_value', caption: 'New Value', 'width': '50%'},
{'id': 'old_value', caption: 'Old Value', 'width': '50%'}
],
TIMESTAMP: 0, OWNER: 1, FIELD: 2, NEW_VALUE: 3, OLD_VALUE: 4,
@ -415,7 +416,13 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
{
nodes = self.columns[i].nodes.clone();
}
else if (self._needsDiffWidget(_data['status'], _data[self.columns[self.OLD_VALUE].id]) ||
else if ((
// Already parsed & cached
typeof _data[self.columns[self.NEW_VALUE].id] == "object" &&
typeof _data[self.columns[self.NEW_VALUE].id].new != "undefined") ||
// Large old value
self._needsDiffWidget(_data['status'], _data[self.columns[self.OLD_VALUE].id]) ||
// Large new value
self._needsDiffWidget(_data['status'], _data[self.columns[self.NEW_VALUE].id]))
{
// Large text value - span both columns, and show a nice diff
@ -426,10 +433,13 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
widget = self.diff.widget;
nodes = self.diff.nodes.clone();
_data[self.columns[i].id] = {
'old': _data[self.columns[i+1].id],
'new': _data[self.columns[i].id]
};
if (typeof _data[self.columns[self.NEW_VALUE].id] == "string")
{
_data[self.columns[i].id] = {
'old': _data[self.columns[i+1].id],
'new': _data[self.columns[i].id]
};
}
// Skip column 4
jthis.parents("td").attr("colspan", 2)

View File

@ -944,7 +944,7 @@ var et2_selectbox_ro = et2_selectbox.extend([et2_IDetachedDOM],
for(var o in this.optionValues)
{
var option = this.optionValues[o];
var key = typeof option == 'object' && typeof option.value != 'undefined' ? option.value : o;
var key = typeof option == 'object' && option != null && typeof option.value != 'undefined' ? option.value : o;
if (key != _value[i]) continue;
var label = typeof option == 'object' ? option.label : option;
if (_value.length == 1)

View File

@ -349,9 +349,6 @@ tr.dialogOperators td,
#infolog-edit table.egwGridView_outer {
max-width: 100%;
}
#infolog-edit #infolog-edit_history {
max-width: 785px;
}
#infolog-edit div.et2_hbox {
white-space: nowrap;
}

View File

@ -290,19 +290,13 @@ div.et2_box_widget{
table.egwGridView_outer{
max-width: 100%;
}
// Tab History
#infolog-edit_history{
max-width: 785px;
}
div.et2_hbox {
white-space: nowrap;
}
white-space: nowrap;
}
}
.infolog_fixedHeight {
height: auto;
height: auto;
}
//TYP