From b7934f699c4b6af6e172a9054b148a164d60be5f Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 28 Feb 2019 15:15:26 -0700 Subject: [PATCH] Finish up UI - CSS - Popup sizing & formatting - diff resize when popup resizes --- api/js/etemplate/et2_widget_diff.js | 11 +++++++++-- api/js/etemplate/et2_widget_historylog.js | 10 +++++++++- api/src/Storage/Tracking.php | 5 ++--- api/templates/default/etemplate2.css | 3 +++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/api/js/etemplate/et2_widget_diff.js b/api/js/etemplate/et2_widget_diff.js index 18c314ebeb..1aea479e37 100644 --- a/api/js/etemplate/et2_widget_diff.js +++ b/api/js/etemplate/et2_widget_diff.js @@ -82,7 +82,7 @@ var et2_diff = (function(){ "use strict"; return et2_valueWidget.extend([et2_IDe jQuery(' ') .appendTo(self.div) .css("cursor", "pointer") - .click({diff: view, div: self.div}, function(e) { + .click({diff: view, div: self.div, label: self.options.label}, function(e) { var diff = e.data.diff; var div = e.data.div; self.un_minify(diff); @@ -90,11 +90,18 @@ var et2_diff = (function(){ "use strict"; return et2_valueWidget.extend([et2_IDe .append(diff); dialog_div.dialog({ - title: self.options.label, + title: e.data.label, width: 'auto', autoResize: true, modal: true, buttons: [{text: self.egw().lang('ok'), click: function() {jQuery(this).dialog("close");}}], + open: function() { + if(jQuery(this).parent().height() > jQuery(window).height()) + { + jQuery(this).height(jQuery(window).height() *0.7); + } + jQuery(this).dialog({position: "center"}); + }, close: function(event, ui) { // Need to destroy the dialog, etemplate widget needs divs back where they were dialog_div.dialog("destroy"); diff --git a/api/js/etemplate/et2_widget_historylog.js b/api/js/etemplate/et2_widget_historylog.js index 8c629d9ac2..bd7438c2f2 100644 --- a/api/js/etemplate/et2_widget_historylog.js +++ b/api/js/etemplate/et2_widget_historylog.js @@ -473,7 +473,9 @@ var et2_historylog = (function(){ "use strict"; return et2_valueWidget.extend([e widget = undefined; value = _data['share_email']; } - if(typeof widget == 'undefined' && typeof self.fields[_data.status] != 'undefined') + // Get widget from list, unless it needs a diff widget + if(typeof widget == 'undefined' && typeof self.fields[_data.status] != 'undefined' && i < self.NEW_VALUE || + i >= self.NEW_VALUE &&!self._needsDiffWidget(_data['status'], _data[self.columns[self.OLD_VALUE].id])) { widget = self.fields[_data.status].widget; if(!widget._children.length) @@ -586,6 +588,12 @@ var et2_historylog = (function(){ "use strict"; return et2_valueWidget.extend([e this.div.trigger('resize.' +this.options.value.app + this.options.value.id); } } + // Resize diff widgets to match new space + if(this.dataview) + { + var columns = this.dataview.getColumnMgr().columnWidths; + jQuery('.diff', this.div).parent().width(columns[this.NEW_VALUE] + columns[this.OLD_VALUE]); + } } });}).call(this); et2_register_widget(et2_historylog, ['historylog']); diff --git a/api/src/Storage/Tracking.php b/api/src/Storage/Tracking.php index 2ef70432d1..fbbe51617b 100644 --- a/api/src/Storage/Tracking.php +++ b/api/src/Storage/Tracking.php @@ -18,7 +18,6 @@ use EGroupware\Api; // explicitly reference classes still in phpgwapi or otherwise outside api use notifications; -use Text_Diff_Renderer_unified; /** * Abstract base class for trackering: @@ -463,8 +462,8 @@ abstract class Tracking strpos($data[$name], PHP_EOL) !== FALSE || strpos($old[$name], PHP_EOL) !== FALSE)) { // Multiline string, just store diff - $diff = new \Text_Diff('auto', array(explode("\n",$old[$name]), explode("\n",$data[$name]))); - $renderer = new \Text_Diff_Renderer_unified(); + $diff = new \Horde_Text_Diff('auto', array(explode("\n",$old[$name]), explode("\n",$data[$name]))); + $renderer = new \Horde_Text_Diff_Renderer_Unified(); $this->historylog->add( $status, $data[$this->id_field], diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index 2636534cd6..9bc072141d 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -585,6 +585,9 @@ div.diff { .diff .d2h-file-diff { overflow-x: hidden; } +.ui-widget-content .d2h-code-line-ctn { + white-space:normal; +} .ui-widget-content .d2h-file-diff { overflow-x: visible; overflow-y: visible;