mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
Just send unified diff to client, not full old & new value
This commit is contained in:
parent
ae000be2bc
commit
39e7820520
@ -260,6 +260,17 @@ class History
|
||||
$row[$field] = explode(Tracking::ONE2N_SEPERATOR,$row[$field]);
|
||||
}
|
||||
}
|
||||
if ($row['history_old_value'] !== Tracking::DIFF_MARKER && (
|
||||
$this->needs_diff($row['history_status'], $row['history_old_value']) ||
|
||||
$this->needs_diff($row['history_status'], $row['history_old_value'])
|
||||
))
|
||||
{
|
||||
// Larger text stored with full old / new value - calculate diff and just send that
|
||||
$diff = new \Text_Diff('auto', array(explode("\n",$row['history_new_value']), explode("\n",$row['history_old_value'])));
|
||||
$renderer = new \Text_Diff_Renderer_unified();
|
||||
$row['history_new_value'] = $renderer->render($diff);
|
||||
$row['history_old_value'] = Tracking::DIFF_MARKER;
|
||||
}
|
||||
// Get information needed for proper display
|
||||
if($row['history_appname'] == 'filemanager')
|
||||
{
|
||||
@ -297,4 +308,10 @@ class History
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
protected function needs_diff($name, $value)
|
||||
{
|
||||
return $name == 'note' || $name == 'description' ||
|
||||
($value && (strlen($value) > 50 || strstr($value, "\n") !== FALSE));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user