[tryton-commits] changeset in sao:5.6 Escape external strings

2020-06-29 Thread Cédric Krier
changeset 6d7c2dbd02a4 in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=6d7c2dbd02a4
description:
Escape external strings

issue9394
review293931002
(grafted from d1858845ab3aebd0788b18c667c58617ee54ad4f)
diffstat:

 CHANGELOG|   2 ++
 src/tab.js   |   6 +++---
 src/view/form.js |   2 +-
 src/view/tree.js |   8 
 src/window.js|  16 
 5 files changed, 18 insertions(+), 16 deletions(-)

diffs (160 lines):

diff -r c553b983d10a -r 6d7c2dbd02a4 CHANGELOG
--- a/CHANGELOG Wed Jun 17 13:51:41 2020 +0200
+++ b/CHANGELOG Mon Jun 29 17:29:45 2020 +0200
@@ -1,3 +1,5 @@
+* Escape external string (issue9394)
+
 Version 5.6.3 - 2020-06-16
 * Bug fixes (see mercurial logs for details)
 
diff -r c553b983d10a -r 6d7c2dbd02a4 src/tab.js
--- a/src/tab.jsWed Jun 17 13:51:41 2020 +0200
+++ b/src/tab.jsMon Jun 29 17:29:45 2020 +0200
@@ -406,7 +406,7 @@
 role: 'tabpanel',
 'class': 'tab-pane',
 id: tab.id
-}).html(tab.el)
+}).append(tab.el)
 .appendTo(tabcontent);
 tab_link.tab('show');
 tabs.trigger('ready');
@@ -1358,7 +1358,7 @@
 }.bind(this));
 this.create_tabcontent();
 this.set_name(this.name);
-this.title.html(this.name_el.text());
+this.title.text(this.name_el.text());
 },
 compare: function(attributes) {
 if (!attributes) {
@@ -1398,7 +1398,7 @@
 this.set_name(wizard.name);
 wizard.tab = this;
 this.create_tabcontent();
-this.title.html(this.name_el.text());
+this.title.text(this.name_el.text());
 this.el.append(wizard.form);
 },
 create_toolbar: function() {
diff -r c553b983d10a -r 6d7c2dbd02a4 src/view/form.js
--- a/src/view/form.js  Wed Jun 17 13:51:41 2020 +0200
+++ b/src/view/form.js  Mon Jun 29 17:29:45 2020 +0200
@@ -780,7 +780,7 @@
 .append(img)
 .text(text))
 .appendTo(this.nav);
-pane.html(tab).appendTo(this.panes);
+pane.append(tab).appendTo(this.panes);
 if (!this.selected) {
 // Can not use .tab('show')
 page.addClass('active');
diff -r c553b983d10a -r 6d7c2dbd02a4 src/view/tree.js
--- a/src/view/tree.js  Wed Jun 17 13:51:41 2020 +0200
+++ b/src/view/tree.js  Mon Jun 29 17:29:45 2020 +0200
@@ -1336,7 +1336,7 @@
 if (item.length) {
 prefix.render(this.record, item);
 } else {
-prefix_el.html(prefix.render(this.record));
+
prefix_el.empty().append(prefix.render(this.record));
 }
 }
 }
@@ -1345,7 +1345,7 @@
 if (item.length) {
 column.render(this.record, item);
 } else {
-widget.html(column.render(this.record));
+widget.empty().append(column.render(this.record));
 }
 if (column.suffixes) {
 for (var k = 0; k < column.suffixes.length; k++) {
@@ -1355,7 +1355,7 @@
 if (item.length) {
 suffix.render(this.record, item);
 } else {
-suffix_el.html(suffix.render(this.record));
+
suffix_el.empty().append(suffix.render(this.record));
 }
 }
 }
@@ -1692,7 +1692,7 @@
 this.tree.columns.forEach(function(col, idx) {
 var td = this._get_column_td(idx);
 var static_el = this.get_static_el(td);
-static_el.html(col.render(this.record)).show();
+static_el.empty().append(col.render(this.record)).show();
 this.get_editable_el(td)
 .empty()
 .data('widget', null)
diff -r c553b983d10a -r 6d7c2dbd02a4 src/window.js
--- a/src/window.js Wed Jun 17 13:51:41 2020 +0200
+++ b/src/window.js Mon Jun 29 17:29:45 2020 +0200
@@ -1092,7 +1092,7 @@
 for(var i=0; i', {
 'val': this.encodings[i]
-}).html(this.encodings[i]).appendTo(this.el_csv_encoding);
+}).append(this.encodings[i]).appendTo(this.el_csv_encoding);
 }
 
 var enc = 'utf-8';
@@ -1194,7 +1194,7 @@
 var field = el_field.attr('field');
 var node = jQuery('', {
 'field': field,
-}).html(el_field.attr('name')).click(function(e) {
+}).text(el_field.attr('name')).click(function(e) {
 if (e.ctrlKey) {

[tryton-commits] changeset in sao:5.6 Escape external strings

2020-05-26 Thread Cédric Krier
changeset 66678b8f07e0 in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=66678b8f07e0
description:
Escape external strings

issue9351
review301651002
(grafted from 2d55ed2f2bb12fd6fbe387fc768ad4394c00c20a)
diffstat:

 CHANGELOG|   2 +
 src/common.js|  72 ++--
 src/sao.js   |  14 +-
 src/screen.js|   8 ++--
 src/session.js   |   6 ++--
 src/tab.js   |  18 ++--
 src/view/calendar.js |   2 +-
 src/view/form.js |  12 
 src/view/tree.js |   2 +-
 src/window.js|  42 +++---
 src/wizard.js|   2 +-
 11 files changed, 91 insertions(+), 89 deletions(-)

diffs (747 lines):

diff -r a9df34570806 -r 66678b8f07e0 CHANGELOG
--- a/CHANGELOG Sun May 10 11:34:47 2020 +0200
+++ b/CHANGELOG Tue May 26 09:57:34 2020 +0200
@@ -1,3 +1,5 @@
+* Escape external strings (issue9351)
+
 Version 5.6.0 - 2020-05-04
 * Bug fixes (see mercurial logs for details)
 * Support link button on form
diff -r a9df34570806 -r 66678b8f07e0 src/common.js
--- a/src/common.js Sun May 10 11:34:47 2020 +0200
+++ b/src/common.js Tue May 26 09:57:34 2020 +0200
@@ -135,12 +135,12 @@
 jQuery('', {
 'class': 'checkbox'
 }).append(jQuery('')
-.append(jQuery('', {
+.text(' ' + k)
+.prepend(jQuery('', {
 'type': 'radio',
 'name': 'selection',
 'value': i
-}))
-.append(' ' + k))
+})))
 .appendTo(dialog.body);
 });
 dialog.body.find('input').first().prop('checked', true);
@@ -148,14 +148,14 @@
 jQuery('', {
 'class': 'btn btn-link',
 'type': 'button'
-}).append(Sao.i18n.gettext('Cancel')).click(function() {
+}).text(Sao.i18n.gettext('Cancel')).click(function() {
 dialog.modal.modal('hide');
 prm.fail();
 }).appendTo(dialog.footer);
 jQuery('', {
 'class': 'btn btn-primary',
 'type': 'button'
-}).append(Sao.i18n.gettext('OK')).click(function() {
+}).text(Sao.i18n.gettext('OK')).click(function() {
 var i = dialog.body.find('input:checked').attr('value');
 dialog.modal.modal('hide');
 prm.resolve(values[keys[i]]);
@@ -767,7 +767,7 @@
 this.el = jQuery('', {
 title: attributes.string || '',
 });
-this.el.append(attributes.string || '');
+this.el.text(attributes.string || '');
 if (this.attributes.rule) {
 this.el.append(' ').append(jQuery('', {
 'class': 'badge'
@@ -2912,14 +2912,14 @@
 'aria-hidden': true,
 })).append(jQuery('', {
 'class': 'sr-only'
-}).append(Sao.i18n.gettext('Message: '))
+}).text(Sao.i18n.gettext('Message: '))
 ).append(jQuery('')
-.append(message)
+.text(message)
 .css('white-space', 'pre-wrap')));
 jQuery('', {
 'class': 'btn btn-primary',
 'type': 'button'
-}).append(Sao.i18n.gettext('OK')).click(function() {
+}).text(Sao.i18n.gettext('OK')).click(function() {
 this.close(dialog);
 prm.resolve('ok');
 }.bind(this)).appendTo(dialog.footer);
@@ -2944,20 +2944,20 @@
 'aria-hidden': true,
 })).append(jQuery('', {
 'class': 'sr-only'
-}).append(Sao.i18n.gettext('Warning: '))
+}).text(Sao.i18n.gettext('Warning: '))
 ).append(jQuery('')
-.append(title)
+.text(title)
 .css('white-space', 'pre-wrap'));
 if (message) {
 content.append(jQuery('')
-.append(message)
+.text(message)
 .css('white-space', 'pre-wrap'));
 }
 dialog.body.append(content);
 jQuery('', {
 'class': 'btn btn-primary',
 'type': 'button'
-}).append(Sao.i18n.gettext('OK')).click(function() {
+}).text(Sao.i18n.gettext('OK')).click(function() {
 this.close(dialog);
 prm.resolve('ok');
 }.bind(this)).appendTo(dialog.footer);
@@ -2978,7 +2978,7 @@
 'class': 'checkbox',
 }).append(jQuery('')
 .append(always)
-.append(Sao.i18n.gettext('Always ignore this warning.')))
+.text(Sao.i18n.gettext('Always ignore this warning.')))
 );
 dialog.body.append(jQuery('')