diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-03 21:01:45 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-03 21:01:45 +1300 |
commit | 48f981a2a9755fb0af6497020e499bb0883e0e1f (patch) | |
tree | ac960f950e4f37aec2614a97a706aed34a1fb2db /web/app/view/CommandDialogController.js | |
parent | d16121684ecae7646aa87616a64d60978d087bc0 (diff) | |
download | traccar-server-48f981a2a9755fb0af6497020e499bb0883e0e1f.tar.gz traccar-server-48f981a2a9755fb0af6497020e499bb0883e0e1f.tar.bz2 traccar-server-48f981a2a9755fb0af6497020e499bb0883e0e1f.zip |
Enable JavaScript strict mode
Diffstat (limited to 'web/app/view/CommandDialogController.js')
-rw-r--r-- | web/app/view/CommandDialogController.js | 76 |
1 files changed, 40 insertions, 36 deletions
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(); + } } - } -}); + }); + +})(); |