Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Revert "LongPluginOutput: Fix missing support of multi line in html"
Browse files Browse the repository at this point in the history
This reverts commit 14fdf63.

The fix actually fixes nothing for the following reasons:

1) The "Long plugin output" field of a host's or service's detail window already has `\n' replaced with the HTML break tag.
This is because the information is gathered via Icinga Web's API which calls `Api_Result_OutputRewriteModel::rewritePluginOutput()'
in the controller `ApiSearchAction'.
Note that the carriage return `\r' is not taken into accout, but that's not a problem here.

2) Grids do not benefit from `Api_Result_OutputRewriteModel::rewritePluginOutput()' as its not being called. The `nl2br()' should've
helped here. According to http://www.ietf.org/rfc/rfc4627.txt the JSON representation of strings must escape control characters which includes the line feed `\n'
and the carriage return `\r'. So '\n', '\r' and '\r\n' become '\\n', '\\r' and '\\r\\n' respectively making them a textual representation of the control characters.
The `nl2br()' implementation however only replaces the unescaped line feed and carriage return which does of course replace nothing in the above case.

3) Introducing `String::nl2br()' while ExtJS provides `Ext.util.Format.nl2br()' is superfluous.

refs #2653
  • Loading branch information
lippserd committed Jun 26, 2014
1 parent 8130f6f commit 97bf45e
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 55 deletions.
1 change: 0 additions & 1 deletion app/modules/AppKit/config/javascript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<ae:parameter>%core.root_dir%/lib/jsgettext/lib/Gettext.js</ae:parameter>

<ae:parameter>%core.module_dir%/AppKit/lib/js/ext-overrides/TreeNodeDontLeak.js</ae:parameter>
<ae:parameter>%core.module_dir%/AppKit/lib/js/utils/String.js</ae:parameter>
</javascript>

<!--
Expand Down
30 changes: 0 additions & 30 deletions app/modules/AppKit/lib/js/utils/String.js

This file was deleted.

11 changes: 0 additions & 11 deletions app/modules/Cronks/lib/js/Cronk/grid/renderer/ColumnRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ Ext.ns('Cronk.grid');
Cronk.grid.ColumnRenderer = {

customColumnPerfdataSanitized: function (cfg) {

var multiLine = false;

if (!Ext.isEmpty(cfg.multiLine) && cfg.multiLine) {
multiLine = true;
}

return function (value, metaData, record, rowIndex, colIndex, store) {
if (!value) {
return _('no value');
Expand All @@ -106,10 +99,6 @@ Ext.ns('Cronk.grid');

metaData.attr = 'ext:qtip="' + Ext.util.Format.htmlEncode(value) + '"';

if (multiLine === true) {
value = String(value).nl2br();
}

return value;
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Ext.ns('Icinga.Cronks.Tackle.Information');
Icinga.Cronks.Tackle.Information.LongPluginOutput = Ext.extend(
Icinga.Cronks.Tackle.Information.OutputPanel, {
title: _("Long plugin output"),
keepLineBreaksInHTML: true,
tplField: 'object_long_output'
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Ext.ns('Icinga.Cronks.Tackle.Information');

Icinga.Cronks.Tackle.Information.OutputPanel = Ext.extend(Ext.Panel, {
autoScroll: true,
keepLineBreaksInHTML: false,

constructor: function(c) {
Icinga.Cronks.Tackle.Information
Expand All @@ -49,17 +48,6 @@ Ext.ns('Icinga.Cronks.Tackle.Information');

Icinga.Cronks.Tackle.Information
.OutputPanel.superclass.initComponent.call(this);
},

update: function(htmlOrData, loadScripts, cb) {
if (!Ext.isEmpty(this.tplField) && this.keepLineBreaksInHTML === true) {
if (!Ext.isEmpty(htmlOrData[this.tplField])) {
htmlOrData[this.tplField] = String(htmlOrData[this.tplField]).nl2br();
}
}

Icinga.Cronks.Tackle.Information
.OutputPanel.superclass.update.call(this, htmlOrData, loadScripts, cb);
}
});

Expand Down

0 comments on commit 97bf45e

Please sign in to comment.