From 48f981a2a9755fb0af6497020e499bb0883e0e1f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 3 Oct 2015 21:01:45 +1300 Subject: Enable JavaScript strict mode --- web/app/view/CommandDialogController.js | 76 +++++++++++++++++---------------- 1 file changed, 40 insertions(+), 36 deletions(-) (limited to 'web/app/view/CommandDialogController.js') diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index 88e72d6e3..1c6b361a7 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -13,45 +13,49 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +(function () { + 'use strict'; -Ext.define('Traccar.view.CommandDialogController', { - extend: 'Ext.app.ViewController', - alias: 'controller.commandDialog', + Ext.define('Traccar.view.CommandDialogController', { + extend: 'Ext.app.ViewController', + alias: 'controller.commandDialog', - onSelect: function (selected) { - this.lookupReference('paramPositionPeriodic').setHidden( + onSelect: function (selected) { + this.lookupReference('paramPositionPeriodic').setHidden( selected.getValue() !== 'positionPeriodic'); - }, - - onSendClick: function (button) { - var attributes, value, record, form; - - form = button.up('window').down('form'); - form.updateRecord(); - record = form.getRecord(); - - if (record.get('type') === 'positionPeriodic') { - attributes = this.lookupReference('paramPositionPeriodic'); - value = attributes.down('numberfield[name="frequency"]').getValue(); - value *= attributes.down('combobox[name="unit"]').getValue(); - - record.set('attributes', { - frequency: value + }, + + onSendClick: function (button) { + var attributes, value, record, form; + + form = button.up('window').down('form'); + form.updateRecord(); + record = form.getRecord(); + + if (record.get('type') === 'positionPeriodic') { + attributes = this.lookupReference('paramPositionPeriodic'); + value = attributes.down('numberfield[name="frequency"]').getValue(); + value *= attributes.down('combobox[name="unit"]').getValue(); + + record.set('attributes', { + frequency: value + }); + } + + Ext.Ajax.request({ + scope: this, + url: '/api/command/send', + jsonData: record.getData(), + callback: this.onSendResult }); - } + }, - Ext.Ajax.request({ - scope: this, - url: '/api/command/send', - jsonData: record.getData(), - callback: this.onSendResult - }); - }, - - onSendResult: function (options, success, response) { - if (Traccar.ErrorManager.check(success, response)) { - Ext.toast(strings.commandSent); - this.closeView(); + onSendResult: function (options, success, response) { + if (Traccar.ErrorManager.check(success, response)) { + Ext.toast(strings.commandSent); + this.closeView(); + } } - } -}); + }); + +})(); -- cgit v1.2.3