From 97d1cbef1e75714b4a2c68c763b4e137a6fb2d10 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 2 Nov 2018 10:19:53 +1300 Subject: Fix missing strings --- web/app/view/dialog/SavedCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view/dialog/SavedCommand.js') diff --git a/web/app/view/dialog/SavedCommand.js b/web/app/view/dialog/SavedCommand.js index 4759143..a769387 100644 --- a/web/app/view/dialog/SavedCommand.js +++ b/web/app/view/dialog/SavedCommand.js @@ -42,7 +42,7 @@ Ext.define('Traccar.view.dialog.SavedCommand', { name: 'textChannel', inputValue: true, uncheckedValue: false, - fieldLabel: Strings.notificationSms + fieldLabel: Strings.commandSendSms }, { xtype: 'combobox', name: 'type', -- cgit v1.2.3 From 04a92f0fbae8cee0e88b56e736a6c4178d39ca35 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 18 Apr 2019 21:48:40 -0700 Subject: Unescape all text fields (fix #4283) --- web/app/view/UnescapedTextAreaField.js | 29 +++++++++++++++++++++++++++++ web/app/view/UnescapedTextField.js | 29 +++++++++++++++++++++++++++++ web/app/view/dialog/Attribute.js | 5 +++-- web/app/view/dialog/Calendar.js | 5 +++-- web/app/view/dialog/ComputedAttribute.js | 14 +++++--------- web/app/view/dialog/Device.js | 13 +++++++------ web/app/view/dialog/Driver.js | 8 ++++++-- web/app/view/dialog/Geofence.js | 7 ++++--- web/app/view/dialog/Group.js | 5 +++-- web/app/view/dialog/Maintenance.js | 5 +++-- web/app/view/dialog/SavedCommand.js | 5 +++-- web/app/view/dialog/Server.js | 15 +++++---------- web/app/view/dialog/User.js | 13 +++++++------ 13 files changed, 107 insertions(+), 46 deletions(-) create mode 100644 web/app/view/UnescapedTextAreaField.js create mode 100644 web/app/view/UnescapedTextField.js (limited to 'web/app/view/dialog/SavedCommand.js') diff --git a/web/app/view/UnescapedTextAreaField.js b/web/app/view/UnescapedTextAreaField.js new file mode 100644 index 0000000..0eeaf93 --- /dev/null +++ b/web/app/view/UnescapedTextAreaField.js @@ -0,0 +1,29 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.view.UnescapedTextAreaField', { + extend: 'Ext.form.field.TextArea', + xtype: 'unescapedTextAreaField', + + initComponent: function() { + this.callParent(); + this.on('change', this.onValueChange); + }, + + onValueChange: function (field, newValue) { + field.setValue(Ext.String.htmlDecode(newValue)); + } +}); diff --git a/web/app/view/UnescapedTextField.js b/web/app/view/UnescapedTextField.js new file mode 100644 index 0000000..334b068 --- /dev/null +++ b/web/app/view/UnescapedTextField.js @@ -0,0 +1,29 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.view.UnescapedTextField', { + extend: 'Ext.form.field.Text', + xtype: 'unescapedTextField', + + initComponent: function() { + this.callParent(); + this.on('change', this.onValueChange); + }, + + onValueChange: function (field, newValue) { + field.setValue(Ext.String.htmlDecode(newValue)); + } +}); diff --git a/web/app/view/dialog/Attribute.js b/web/app/view/dialog/Attribute.js index 2a45897..a85cad0 100644 --- a/web/app/view/dialog/Attribute.js +++ b/web/app/view/dialog/Attribute.js @@ -21,7 +21,8 @@ Ext.define('Traccar.view.dialog.Attribute', { requires: [ 'Traccar.view.dialog.AttributeController', 'Traccar.view.ColorPicker', - 'Traccar.view.CustomNumberField' + 'Traccar.view.CustomNumberField', + 'Traccar.view.UnescapedTextField' ], controller: 'attribute', @@ -33,7 +34,7 @@ Ext.define('Traccar.view.dialog.Attribute', { validitychange: 'onValidityChange' }, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', reference: 'nameTextField', name: 'name', allowBlank: false, diff --git a/web/app/view/dialog/Calendar.js b/web/app/view/dialog/Calendar.js index 9880d4e..5f00a8b 100644 --- a/web/app/view/dialog/Calendar.js +++ b/web/app/view/dialog/Calendar.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Calendar', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.dialog.CalendarController' + 'Traccar.view.dialog.CalendarController', + 'Traccar.view.UnescapedTextField' ], controller: 'calendar', @@ -32,7 +33,7 @@ Ext.define('Traccar.view.dialog.Calendar', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false diff --git a/web/app/view/dialog/ComputedAttribute.js b/web/app/view/dialog/ComputedAttribute.js index 22cfb82..adae7f7 100644 --- a/web/app/view/dialog/ComputedAttribute.js +++ b/web/app/view/dialog/ComputedAttribute.js @@ -20,7 +20,9 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.dialog.ComputedAttributeController' + 'Traccar.view.dialog.ComputedAttributeController', + 'Traccar.view.UnescapedTextField', + 'Traccar.view.UnescapedTextAreaField' ], controller: 'computedAttribute', @@ -28,14 +30,8 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { items: { xtype: 'form', - listeners: { - afterrender: function (view) { - var field = view.up('panel').lookupReference('expressionField'); - field.setValue(Ext.String.htmlDecode(field.getValue())); - } - }, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'description', fieldLabel: Strings.sharedDescription }, { @@ -49,7 +45,7 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { change: 'onAttributeChange' } }, { - xtype: 'textareafield', + xtype: 'unescapedTextAreaField', reference: 'expressionField', name: 'expression', fieldLabel: Strings.sharedExpression, diff --git a/web/app/view/dialog/Device.js b/web/app/view/dialog/Device.js index 50a5e79..60a8f71 100644 --- a/web/app/view/dialog/Device.js +++ b/web/app/view/dialog/Device.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Device', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.DeviceController' + 'Traccar.view.dialog.DeviceController', + 'Traccar.view.UnescapedTextField' ], controller: 'device', @@ -32,12 +33,12 @@ Ext.define('Traccar.view.dialog.Device', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'uniqueId', fieldLabel: Strings.deviceIdentifier, allowBlank: false @@ -56,15 +57,15 @@ Ext.define('Traccar.view.dialog.Device', { displayField: 'name', valueField: 'id' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'phone', fieldLabel: Strings.sharedPhone }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'model', fieldLabel: Strings.deviceModel }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'contact', fieldLabel: Strings.deviceContact }, { diff --git a/web/app/view/dialog/Driver.js b/web/app/view/dialog/Driver.js index b67e182..9b1c17b 100644 --- a/web/app/view/dialog/Driver.js +++ b/web/app/view/dialog/Driver.js @@ -19,6 +19,10 @@ Ext.define('Traccar.view.dialog.Driver', { extend: 'Traccar.view.dialog.BaseEdit', + requires: [ + 'Traccar.view.UnescapedTextField' + ], + title: Strings.sharedDriver, items: { @@ -27,12 +31,12 @@ Ext.define('Traccar.view.dialog.Driver', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'uniqueId', fieldLabel: Strings.deviceIdentifier, allowBlank: false diff --git a/web/app/view/dialog/Geofence.js b/web/app/view/dialog/Geofence.js index 65c32c0..1e22cd7 100644 --- a/web/app/view/dialog/Geofence.js +++ b/web/app/view/dialog/Geofence.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Geofence', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.GeofenceController' + 'Traccar.view.dialog.GeofenceController', + 'Traccar.view.UnescapedTextField' ], controller: 'geofence', @@ -32,7 +33,7 @@ Ext.define('Traccar.view.dialog.Geofence', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName }] @@ -42,7 +43,7 @@ Ext.define('Traccar.view.dialog.Geofence', { collapsible: true, collapsed: true, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'description', fieldLabel: Strings.sharedDescription }, { diff --git a/web/app/view/dialog/Group.js b/web/app/view/dialog/Group.js index 805b422..61ca193 100644 --- a/web/app/view/dialog/Group.js +++ b/web/app/view/dialog/Group.js @@ -19,7 +19,8 @@ Ext.define('Traccar.view.dialog.Group', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.ClearableComboBox' + 'Traccar.view.ClearableComboBox', + 'Traccar.view.UnescapedTextField' ], title: Strings.groupDialog, @@ -30,7 +31,7 @@ Ext.define('Traccar.view.dialog.Group', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false diff --git a/web/app/view/dialog/Maintenance.js b/web/app/view/dialog/Maintenance.js index 5705278..d844d25 100644 --- a/web/app/view/dialog/Maintenance.js +++ b/web/app/view/dialog/Maintenance.js @@ -21,7 +21,8 @@ Ext.define('Traccar.view.dialog.Maintenance', { requires: [ 'Traccar.view.dialog.MaintenanceController', - 'Traccar.view.CustomNumberField' + 'Traccar.view.CustomNumberField', + 'Traccar.view.UnescapedTextField' ], controller: 'maintenance', @@ -37,7 +38,7 @@ Ext.define('Traccar.view.dialog.Maintenance', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false diff --git a/web/app/view/dialog/SavedCommand.js b/web/app/view/dialog/SavedCommand.js index a769387..b1aeae7 100644 --- a/web/app/view/dialog/SavedCommand.js +++ b/web/app/view/dialog/SavedCommand.js @@ -19,7 +19,8 @@ Ext.define('Traccar.view.dialog.SavedCommand', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.dialog.SavedCommandController' + 'Traccar.view.dialog.SavedCommandController', + 'Traccar.view.UnescapedTextField' ], controller: 'savedCommand', @@ -34,7 +35,7 @@ Ext.define('Traccar.view.dialog.SavedCommand', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'description', fieldLabel: Strings.sharedDescription }, { diff --git a/web/app/view/dialog/Server.js b/web/app/view/dialog/Server.js index 8ff8399..c9729cc 100644 --- a/web/app/view/dialog/Server.js +++ b/web/app/view/dialog/Server.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Server', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.MapPickerController' + 'Traccar.view.dialog.MapPickerController', + 'Traccar.view.UnescapedTextField' ], controller: 'mapPicker', @@ -28,12 +29,6 @@ Ext.define('Traccar.view.dialog.Server', { items: { xtype: 'form', - listeners: { - afterrender: function (view) { - var field = view.up('panel').lookupReference('mapUrlField'); - field.setValue(Ext.String.htmlDecode(field.getValue())); - } - }, items: [{ xtype: 'fieldset', title: Strings.sharedPreferences, @@ -45,11 +40,11 @@ Ext.define('Traccar.view.dialog.Server', { displayField: 'name', valueField: 'key' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'bingKey', fieldLabel: Strings.mapBingKey }, { - xtype: 'textfield', + xtype: 'unescapedTextField', reference: 'mapUrlField', name: 'mapUrl', fieldLabel: Strings.mapCustom @@ -90,7 +85,7 @@ Ext.define('Traccar.view.dialog.Server', { displayField: 'name', valueField: 'key' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'poiLayer', fieldLabel: Strings.mapPoiLayer }] diff --git a/web/app/view/dialog/User.js b/web/app/view/dialog/User.js index 86f9167..917f110 100644 --- a/web/app/view/dialog/User.js +++ b/web/app/view/dialog/User.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.User', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.UserController' + 'Traccar.view.dialog.UserController', + 'Traccar.view.UnescapedTextField' ], controller: 'user', @@ -32,11 +33,11 @@ Ext.define('Traccar.view.dialog.User', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'email', fieldLabel: Strings.userEmail, allowBlank: false @@ -53,7 +54,7 @@ Ext.define('Traccar.view.dialog.User', { collapsible: true, collapsed: true, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'phone', fieldLabel: Strings.sharedPhone }, { @@ -94,7 +95,7 @@ Ext.define('Traccar.view.dialog.User', { displayField: 'name', valueField: 'key' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'poiLayer', fieldLabel: Strings.mapPoiLayer }] @@ -164,7 +165,7 @@ Ext.define('Traccar.view.dialog.User', { disabled: true, reference: 'userLimitField' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'token', reference: 'tokenField', fieldLabel: Strings.userToken, -- cgit v1.2.3