From aaa16c01263847221c7cfec95d722b283dcfd35e Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 19 Aug 2016 19:49:11 +0500 Subject: - Added commands to WialonProtocol - Added more additional fields to CommandDialog --- web/app/view/CommandDialog.js | 33 +++++++++++++++++++++++++++++ web/app/view/CommandDialogController.js | 37 ++++++++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index 8e9a80dbf..d9c3beeb3 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -54,6 +54,39 @@ Ext.define('Traccar.view.CommandDialog', { displayField: 'name', valueField: 'factor' }] + }, { + xtype: 'fieldcontainer', + reference: 'paramOutputControl', + name: 'attributes', + hidden: true, + + items: [{ + xtype: 'numberfield', + fieldLabel: Strings.commandIndex, + name: 'index', + allowBlank: false + }, { + xtype: 'textfield', + fieldLabel: Strings.commandData, + name: 'data' + }] + }, { + xtype: 'fieldcontainer', + reference: 'paramSendSmsUssd', + name: 'attributes', + hidden: true, + + items: [{ + xtype: 'textfield', + fieldLabel: Strings.commandPhoneNumber, + name: 'phoneNumber' + }, { + xtype: 'textfield', + reference: 'paramSmsMessage', + fieldLabel: Strings.commandMessage, + name: 'message', + hidden: true + }] }, { xtype: 'textfield', reference: 'paramCustom', diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index 9da5bd42e..120854df1 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -21,12 +21,18 @@ Ext.define('Traccar.view.CommandDialogController', { onSelect: function (selected) { this.lookupReference('paramPositionPeriodic').setHidden( selected.getValue() !== 'positionPeriodic'); + this.lookupReference('paramOutputControl').setHidden( + selected.getValue() !== 'outputControl'); + this.lookupReference('paramSendSmsUssd').setHidden( + selected.getValue() !== 'sendSms' && selected.getValue() !== 'sendUssd'); + this.lookupReference('paramSmsMessage').setHidden( + selected.getValue() !== 'sendSms'); this.lookupReference('paramCustom').setHidden( selected.getValue() !== 'custom'); }, onSendClick: function (button) { - var attributes, value, record, form; + var attributes, value, record, form, index, phoneNumber; form = button.up('window').down('form'); form.updateRecord(); @@ -42,6 +48,35 @@ Ext.define('Traccar.view.CommandDialogController', { }); } + if (record.get('type') === 'outputControl') { + attributes = this.lookupReference('paramOutputControl'); + index = attributes.down('numberfield[name="index"]').getValue(); + value = attributes.down('textfield[name="data"]').getValue(); + + record.set('attributes', { + index: index, + data: value + }); + } + + if (record.get('type') === 'sendUssd') { + attributes = this.lookupReference('paramSendSmsUssd'); + phoneNumber = attributes.down('textfield[name="phoneNumber"]').getValue(); + record.set('attributes', { + phoneNumber: phoneNumber + }); + } + + if (record.get('type') === 'sendSms') { + attributes = this.lookupReference('paramSendSmsUssd'); + phoneNumber = attributes.down('textfield[name="phoneNumber"]').getValue(); + value = attributes.down('textfield[name="message"]').getValue(); + record.set('attributes', { + phoneNumber: phoneNumber, + message: value + }); + } + if (record.get('type') === 'custom') { value = this.lookupReference('paramCustom').getValue(); record.set('attributes', { -- cgit v1.2.3