diff options
author | Anton Tananaev <anton@traccar.org> | 2024-04-06 09:17:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-04-06 09:17:52 -0700 |
commit | b392a4af78e01c8e0f50aad5468e9583675b24be (patch) | |
tree | 0a4fd7c4ee020e0829817853469979d4e998a69a /web/app/view/dialog | |
parent | 94cadecda794358a53995c276697919eaf540466 (diff) | |
download | trackermap-web-b392a4af78e01c8e0f50aad5468e9583675b24be.tar.gz trackermap-web-b392a4af78e01c8e0f50aad5468e9583675b24be.tar.bz2 trackermap-web-b392a4af78e01c8e0f50aad5468e9583675b24be.zip |
Move to the legacy folder
Diffstat (limited to 'web/app/view/dialog')
37 files changed, 0 insertions, 2898 deletions
diff --git a/web/app/view/dialog/Attribute.js b/web/app/view/dialog/Attribute.js deleted file mode 100644 index a85cad05..00000000 --- a/web/app/view/dialog/Attribute.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2016 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Attribute', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.AttributeController', - 'Traccar.view.ColorPicker', - 'Traccar.view.CustomNumberField', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'attribute', - title: Strings.sharedAttribute, - - items: { - xtype: 'form', - listeners: { - validitychange: 'onValidityChange' - }, - items: [{ - xtype: 'unescapedTextField', - reference: 'nameTextField', - name: 'name', - allowBlank: false, - fieldLabel: Strings.sharedName - }, { - xtype: 'textfield', - name: 'value', - reference: 'valueField', - allowBlank: false, - fieldLabel: Strings.stateValue - }] - }, - - buttons: [{ - glyph: 'xf00c@FontAwesome', - reference: 'saveButton', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/AttributeController.js b/web/app/view/dialog/AttributeController.js deleted file mode 100644 index 9fd452a4..00000000 --- a/web/app/view/dialog/AttributeController.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2016 - 2018 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.AttributeController', { - extend: 'Ext.app.ViewController', - alias: 'controller.attribute', - - onSaveClick: function (button) { - var dialog, store, record; - dialog = button.up('window').down('form'); - dialog.updateRecord(); - record = dialog.getRecord(); - store = record.store; - if (store) { - if (record.phantom) { - store.add(record); - } - store.sync({ - failure: function (batch) { - store.rejectChanges(); - Traccar.app.showError(batch.exceptions[0].getError().response); - } - }); - } else { - record.save(); - } - button.up('window').close(); - }, - - onValidityChange: function (form, valid) { - this.lookupReference('saveButton').setDisabled(!valid); - }, - - defaultFieldConfig: { - name: 'value', - reference: 'valueField', - allowBlank: false, - fieldLabel: Strings.stateValue - }, - - onNameChange: function (combobox, newValue) { - var config, attribute, valueField = this.lookupReference('valueField'); - attribute = combobox.getStore().getById(newValue); - if (attribute) { - config = Ext.clone(this.defaultFieldConfig); - switch (attribute.get('valueType')) { - case 'number': - config.xtype = 'customNumberField'; - if (attribute.get('allowDecimals') !== undefined) { - config.allowDecimals = attribute.get('allowDecimals'); - } else { - config.allowDecimals = true; - } - config.dataType = attribute.get('dataType'); - config.maxValue = attribute.get('maxValue'); - config.minValue = attribute.get('minValue'); - break; - case 'boolean': - config.xtype = 'checkboxfield'; - config.inputValue = true; - config.uncheckedValue = false; - break; - case 'color': - config.xtype = 'customcolorpicker'; - break; - default: - if (attribute.get('dataType')) { - config.xtype = 'combobox'; - config.queryMode = 'local'; - config.editable = false; - switch (attribute.get('dataType')) { - case 'distanceUnit': - config.store = 'DistanceUnits'; - config.displayField = 'name'; - config.valueField = 'key'; - break; - case 'speedUnit': - config.store = 'SpeedUnits'; - config.displayField = 'name'; - config.valueField = 'key'; - break; - case 'volumeUnit': - config.store = 'VolumeUnits'; - config.displayField = 'fullName'; - config.valueField = 'key'; - break; - case 'timezone': - config.store = 'AllTimezones'; - config.displayField = 'key'; - break; - default: - break; - } - } else { - config.xtype = 'textfield'; - } - break; - } - if (valueField.getXType() !== config.xtype || - config.xtype === 'customNumberField' && valueField.dataType !== config.dataType) { - this.getView().down('form').insert(this.getView().down('form').items.indexOf(valueField), config); - this.getView().down('form').remove(valueField); - } else if (config.xtype === 'customNumberField') { - valueField.setConfig(config); - valueField.validate(); - } else if (config.xtype === 'combobox') { - valueField.setConfig(config); - valueField.setValue(); - } - } - } -}); diff --git a/web/app/view/dialog/Base.js b/web/app/view/dialog/Base.js deleted file mode 100644 index 6affb370..00000000 --- a/web/app/view/dialog/Base.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Base', { - extend: 'Ext.window.Window', - - bodyPadding: Traccar.Style.normalPadding, - resizable: false, - scrollable: true, - constrain: true, - - initComponent: function () { - if (window.innerHeight) { - this.maxHeight = window.innerHeight - Traccar.Style.normalPadding * 2; - } - this.callParent(); - } -}); diff --git a/web/app/view/dialog/BaseEdit.js b/web/app/view/dialog/BaseEdit.js deleted file mode 100644 index 286afba5..00000000 --- a/web/app/view/dialog/BaseEdit.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.BaseEdit', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.BaseEditController' - ], - - controller: 'baseEdit', - - buttons: [{ - text: Strings.sharedAttributes, - handler: 'showAttributesView' - }, { - xtype: 'tbfill' - }, { - glyph: 'xf00c@FontAwesome', - reference: 'saveButton', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/BaseEditController.js b/web/app/view/dialog/BaseEditController.js deleted file mode 100644 index 91379e2d..00000000 --- a/web/app/view/dialog/BaseEditController.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.BaseEditController', { - extend: 'Ext.app.ViewController', - alias: 'controller.baseEdit', - - requires: [ - 'Traccar.view.BaseWindow', - 'Traccar.view.edit.Attributes' - ], - - onSaveClick: function (button) { - var dialog, store, record; - dialog = button.up('window').down('form'); - dialog.updateRecord(); - record = dialog.getRecord(); - store = record.store; - if (store) { - if (record.phantom) { - store.add(record); - } - store.sync({ - failure: function (batch) { - store.rejectChanges(); - Traccar.app.showError(batch.exceptions[0].getError().response); - } - }); - } else { - record.save(); - } - this.closeView(); - }, - - showAttributesView: function (button) { - var dialog, record; - dialog = button.up('window').down('form'); - record = dialog.getRecord(); - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedAttributes, - items: { - xtype: 'attributesView', - record: record - } - }).show(); - } -}); diff --git a/web/app/view/dialog/Calendar.js b/web/app/view/dialog/Calendar.js deleted file mode 100644 index 5f00a8be..00000000 --- a/web/app/view/dialog/Calendar.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Calendar', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.dialog.CalendarController', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'calendar', - title: Strings.sharedCalendar, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName, - allowBlank: false - }, { - xtype: 'filefield', - name: 'file', - fieldLabel: Strings.sharedFile, - allowBlank: false, - buttonConfig: { - glyph: 'xf093@FontAwesome', - text: '', - tooltip: Strings.sharedSelectFile, - tooltipType: 'title', - minWidth: 0 - }, - listeners: { - change: 'onFileChange' - } - }] - }, { - xtype: 'hiddenfield', - name: 'data', - allowBlank: false, - reference: 'dataField' - }] - } -}); diff --git a/web/app/view/dialog/CalendarController.js b/web/app/view/dialog/CalendarController.js deleted file mode 100644 index fb8cbff6..00000000 --- a/web/app/view/dialog/CalendarController.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.CalendarController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.calendar', - - onFileChange: function (fileField) { - var reader; - if (fileField.fileInputEl.dom.files.length > 0) { - reader = new FileReader(); - reader.onload = function (event) { - fileField.up('window').lookupReference('dataField').setValue( - event.target.result.substr(event.target.result.indexOf(',') + 1)); - }; - reader.onerror = function (event) { - Traccar.app.showError(event.target.error); - }; - reader.readAsDataURL(fileField.fileInputEl.dom.files[0]); - } - } -}); diff --git a/web/app/view/dialog/ComputedAttribute.js b/web/app/view/dialog/ComputedAttribute.js deleted file mode 100644 index adae7f7b..00000000 --- a/web/app/view/dialog/ComputedAttribute.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.ComputedAttribute', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.dialog.ComputedAttributeController', - 'Traccar.view.UnescapedTextField', - 'Traccar.view.UnescapedTextAreaField' - ], - - controller: 'computedAttribute', - title: Strings.sharedComputedAttribute, - - items: { - xtype: 'form', - items: [{ - xtype: 'unescapedTextField', - name: 'description', - fieldLabel: Strings.sharedDescription - }, { - xtype: 'combobox', - name: 'attribute', - fieldLabel: Strings.sharedAttribute, - store: 'PositionAttributes', - displayField: 'name', - valueField: 'key', - listeners: { - change: 'onAttributeChange' - } - }, { - xtype: 'unescapedTextAreaField', - reference: 'expressionField', - name: 'expression', - fieldLabel: Strings.sharedExpression, - allowBlank: false - }, { - xtype: 'combobox', - name: 'type', - reference: 'typeComboField', - store: 'AttributeValueTypes', - fieldLabel: Strings.sharedType, - displayField: 'name', - valueField: 'id', - editable: false - }] - }, - - buttons: [{ - glyph: 'xf128@FontAwesome', - tooltip: Strings.sharedCheckComputedAttribute, - tooltipType: 'title', - minWidth: 0, - handler: 'onCheckClick' - }, { - glyph: 'xf00c@FontAwesome', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/ComputedAttributeController.js b/web/app/view/dialog/ComputedAttributeController.js deleted file mode 100644 index f680b1b5..00000000 --- a/web/app/view/dialog/ComputedAttributeController.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.ComputedAttributeController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.computedAttribute', - - requires: [ - 'Traccar.view.dialog.SelectDevice' - ], - - onAttributeChange: function (combobox, newValue) { - var attribute = Ext.getStore('PositionAttributes').getById(newValue); - if (attribute) { - this.getView().lookupReference('typeComboField').setValue(attribute.get('valueType')); - this.getView().lookupReference('typeComboField').setReadOnly(true); - } else { - this.getView().lookupReference('typeComboField').setReadOnly(false); - } - }, - - onCheckClick: function (button) { - var dialog, form; - dialog = Ext.create('Traccar.view.dialog.SelectDevice'); - form = button.up('window').down('form'); - form.updateRecord(); - dialog.record = form.getRecord(); - dialog.show(); - } -}); diff --git a/web/app/view/dialog/Device.js b/web/app/view/dialog/Device.js deleted file mode 100644 index 60a8f716..00000000 --- a/web/app/view/dialog/Device.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Device', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.DeviceController', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'device', - title: Strings.sharedDevice, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName, - allowBlank: false - }, { - xtype: 'unescapedTextField', - name: 'uniqueId', - fieldLabel: Strings.deviceIdentifier, - allowBlank: false - }] - }, { - xtype: 'fieldset', - title: Strings.sharedExtra, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'clearableComboBox', - name: 'groupId', - fieldLabel: Strings.groupParent, - store: 'Groups', - queryMode: 'local', - displayField: 'name', - valueField: 'id' - }, { - xtype: 'unescapedTextField', - name: 'phone', - fieldLabel: Strings.sharedPhone - }, { - xtype: 'unescapedTextField', - name: 'model', - fieldLabel: Strings.deviceModel - }, { - xtype: 'unescapedTextField', - name: 'contact', - fieldLabel: Strings.deviceContact - }, { - xtype: 'combobox', - name: 'category', - fieldLabel: Strings.deviceCategory, - store: 'DeviceImages', - queryMode: 'local', - displayField: 'name', - valueField: 'key', - editable: false, - listConfig: { - getInnerTpl: function () { - return '<table><tr valign="middle" ><td><div align="center" style="width:40px;height:40px;" >' + - '{[new XMLSerializer().serializeToString(Traccar.DeviceImages.getImageSvg(' + - 'Traccar.Style.mapColorOnline, false, 0, values.key))]}</div></td>' + - '<td>{name}</td></tr></table>'; - } - } - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'disabled', - fieldLabel: Strings.sharedDisabled, - hidden: true, - reference: 'disabledField' - }] - }] - } -}); diff --git a/web/app/view/dialog/DeviceAccumulators.js b/web/app/view/dialog/DeviceAccumulators.js deleted file mode 100644 index eaa4e9f5..00000000 --- a/web/app/view/dialog/DeviceAccumulators.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.DeviceAccumulators', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.DeviceAccumulatorsController' - ], - - controller: 'deviceAccumulators', - title: Strings.sharedDeviceAccumulators, - - items: [{ - xtype: 'customNumberField', - dataType: 'distance', - reference: 'totalDistance', - fieldLabel: Strings.deviceTotalDistance - }, { - xtype: 'customNumberField', - dataType: 'hours', - reference: 'hours', - fieldLabel: Strings.positionHours - }], - - buttons: [{ - reference: 'setButton', - glyph: 'xf00c@FontAwesome', - tooltip: Strings.sharedSet, - tooltipType: 'title', - minWidth: 0, - handler: 'onSetClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/DeviceAccumulatorsController.js b/web/app/view/dialog/DeviceAccumulatorsController.js deleted file mode 100644 index 2fdae6c5..00000000 --- a/web/app/view/dialog/DeviceAccumulatorsController.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2018 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.DeviceAccumulatorsController', { - extend: 'Ext.app.ViewController', - alias: 'controller.deviceAccumulators', - - onSetClick: function () { - var totalDistance, hours, data = { - deviceId: this.getView().deviceId - }; - totalDistance = this.lookupReference('totalDistance'); - if (!isNaN(totalDistance.getRawValue())) { - data.totalDistance = totalDistance.getValue(); - } - hours = this.lookupReference('hours'); - if (!isNaN(hours.getRawValue())) { - data.hours = hours.getValue(); - } - Ext.Ajax.request({ - scope: this, - method: 'PUT', - url: 'api/devices/' + data.deviceId + '/accumulators', - jsonData: Ext.util.JSON.encode(data), - callback: function (options, success, response) { - if (!success) { - Traccar.app.showError(response); - } - } - }); - this.closeView(); - } -}); diff --git a/web/app/view/dialog/DeviceController.js b/web/app/view/dialog/DeviceController.js deleted file mode 100644 index d7a4493b..00000000 --- a/web/app/view/dialog/DeviceController.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.DeviceController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.device', - - init: function () { - if (Traccar.app.getUser().get('administrator')) { - this.lookupReference('disabledField').setHidden(false); - } - } - -}); diff --git a/web/app/view/dialog/Driver.js b/web/app/view/dialog/Driver.js deleted file mode 100644 index 9b1c17b5..00000000 --- a/web/app/view/dialog/Driver.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Driver', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.UnescapedTextField' - ], - - title: Strings.sharedDriver, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName, - allowBlank: false - }, { - 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 deleted file mode 100644 index 1e22cd7b..00000000 --- a/web/app/view/dialog/Geofence.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2016 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Geofence', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.GeofenceController', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'geofence', - title: Strings.sharedGeofence, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName - }] - }, { - xtype: 'fieldset', - title: Strings.sharedExtra, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'unescapedTextField', - name: 'description', - fieldLabel: Strings.sharedDescription - }, { - xtype: 'clearableComboBox', - reference: 'calendarCombo', - name: 'calendarId', - store: 'Calendars', - queryMode: 'local', - displayField: 'name', - valueField: 'id', - fieldLabel: Strings.sharedCalendar - }, { - xtype: 'hiddenfield', - name: 'area', - allowBlank: false, - reference: 'areaField' - }] - }] - }, - - buttons: [{ - text: Strings.sharedArea, - glyph: 'xf21d@FontAwesome', - handler: 'onAreaClick' - }, { - text: Strings.sharedAttributes, - handler: 'showAttributesView' - }, { - xtype: 'tbfill' - }, { - glyph: 'xf00c@FontAwesome', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/GeofenceController.js b/web/app/view/dialog/GeofenceController.js deleted file mode 100644 index e4ac5a2e..00000000 --- a/web/app/view/dialog/GeofenceController.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2016 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.GeofenceController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.geofence', - - requires: [ - 'Traccar.view.BaseWindow', - 'Traccar.view.map.GeofenceMap' - ], - - config: { - listen: { - controller: { - '*': { - savearea: 'saveArea' - } - } - } - }, - - init: function () { - this.lookupReference('calendarCombo').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); - }, - - saveArea: function (value) { - this.lookupReference('areaField').setValue(value); - }, - - onAreaClick: function (button) { - var dialog, record; - dialog = button.up('window').down('form'); - record = dialog.getRecord(); - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedArea, - items: { - xtype: 'geofenceMapView', - area: record.get('area') - } - }).show(); - } -}); diff --git a/web/app/view/dialog/Group.js b/web/app/view/dialog/Group.js deleted file mode 100644 index 61ca193d..00000000 --- a/web/app/view/dialog/Group.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2016 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Group', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.ClearableComboBox', - 'Traccar.view.UnescapedTextField' - ], - - title: Strings.groupDialog, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName, - allowBlank: false - }] - }, { - xtype: 'fieldset', - title: Strings.sharedExtra, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'clearableComboBox', - name: 'groupId', - fieldLabel: Strings.groupParent, - store: 'Groups', - queryMode: 'local', - displayField: 'name', - valueField: 'id' - }] - }] - } -}); diff --git a/web/app/view/dialog/Login.js b/web/app/view/dialog/Login.js deleted file mode 100644 index 592efb33..00000000 --- a/web/app/view/dialog/Login.js +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2015 - 2023 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Login', { - extend: 'Traccar.view.dialog.Base', - alias: 'widget.login', - - requires: [ - 'Traccar.view.dialog.LoginController' - ], - - controller: 'login', - - header: false, - closable: false, - - items: { - xtype: 'form', - reference: 'form', - - autoEl: { - tag: 'form', - method: 'POST', - action: 'fake-login.html', - target: 'submitTarget' - }, - - items: [{ - xtype: 'image', - src: 'logo.svg', - alt: Strings.loginLogo, - width: 240, - height: 64, - style: { - display: 'block', - margin: '10px auto 25px' - } - }, { - xtype: 'pickerfield', - fieldLabel: Strings.settingsServer, - editable: false, - value: window.location.host, - hidden: !window.appInterface && !(window.webkit && window.webkit.messageHandlers.appInterface), - createPicker: function () { - var self = this, popup = Ext.create({ - xtype: 'window', - closeAction: 'hide', - referenceHolder: true, - minWidth: 204, - layout: 'form', - header: false, - resizable: true, - items: [{ - xtype: 'textfield', - anchor: '100%', - reference: 'serverAddress', - value: window.location.href - }], - fbar: [{ - text: Strings.sharedSet, - handler: function () { - var message = 'server|' + popup.lookupReference('serverAddress').getValue(); - if (window.webkit && window.webkit.messageHandlers.appInterface) { - window.webkit.messageHandlers.appInterface.postMessage(message); - } - if (window.appInterface) { - window.appInterface.postMessage(message); - } - } - }, { - text: Strings.sharedCancel, - handler: function () { - self.collapse(); - } - }] - }); - return popup; - } - }, { - xtype: 'combobox', - name: 'language', - fieldLabel: Strings.loginLanguage, - store: 'Languages', - displayField: 'name', - valueField: 'code', - editable: false, - submitValue: false, - listeners: { - select: 'onSelectLanguage' - }, - reference: 'languageField' - }, { - xtype: 'textfield', - name: 'email', - reference: 'userField', - fieldLabel: Strings.userEmail, - allowBlank: false, - enableKeyEvents: true, - listeners: { - specialKey: 'onSpecialKey', - afterrender: 'onAfterRender' - }, - inputAttrTpl: ['autocomplete="on" autocapitalize="none"'] - }, { - xtype: 'textfield', - name: 'password', - reference: 'passwordField', - fieldLabel: Strings.userPassword, - inputType: 'password', - allowBlank: false, - enableKeyEvents: true, - listeners: { - specialKey: 'onSpecialKey' - }, - inputAttrTpl: ['autocomplete="on"'] - }, { - xtype: 'component', - html: '<iframe id="submitTarget" name="submitTarget" style="display:none"></iframe>' - }, { - xtype: 'component', - html: '<input type="submit" id="submitButton" style="display:none">' - }] - }, - - buttons: [{ - text: Strings.loginReset, - handler: 'onResetClick', - reference: 'resetButton' - }, { - text: Strings.loginRegister, - handler: 'onRegisterClick', - reference: 'registerButton' - }, { - text: Strings.loginLogin, - handler: 'onLoginClick' - }] -}); diff --git a/web/app/view/dialog/LoginController.js b/web/app/view/dialog/LoginController.js deleted file mode 100644 index a21866eb..00000000 --- a/web/app/view/dialog/LoginController.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2015 - 2023 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.LoginController', { - extend: 'Ext.app.ViewController', - alias: 'controller.login', - - requires: [ - 'Traccar.view.dialog.Register' - ], - - init: function () { - this.lookupReference('resetButton').setHidden(!Traccar.app.getServer().get('emailEnabled')); - this.lookupReference('registerButton').setDisabled(!Traccar.app.getServer().get('registration')); - this.lookupReference('languageField').setValue(Locale.language); - }, - - login: function () { - var form = this.lookupReference('form'); - if (form.isValid()) { - Ext.get('spinner').setVisible(true); - this.getView().setVisible(false); - Ext.Ajax.request({ - scope: this, - method: 'POST', - url: 'api/session', - params: form.getValues(), - callback: function (options, success, response) { - Ext.get('spinner').setVisible(false); - if (success) { - Traccar.app.setUser(Ext.decode(response.responseText)); - this.fireViewEvent('login'); - } else { - this.getView().setVisible(true); - if (response.status === 401) { - Traccar.app.showError(Strings.loginFailed); - } else { - Traccar.app.showError(response.responseText); - } - } - } - }); - } - }, - - logout: function () { - Ext.util.Cookies.clear('user'); - Ext.util.Cookies.clear('password'); - Ext.Ajax.request({ - scope: this, - method: 'DELETE', - url: 'api/session', - callback: function () { - window.location.reload(); - } - }); - }, - - onSelectLanguage: function (selected) { - var paramName, paramValue, url, prefix, suffix; - paramName = 'locale'; - paramValue = selected.getValue(); - url = window.location.href; - if (url.indexOf(paramName + '=') >= 0) { - prefix = url.substring(0, url.indexOf(paramName)); - suffix = url.substring(url.indexOf(paramName)); - suffix = suffix.substring(suffix.indexOf('=') + 1); - suffix = suffix.indexOf('&') >= 0 ? suffix.substring(suffix.indexOf('&')) : ''; - url = prefix + paramName + '=' + paramValue + suffix; - } else if (url.indexOf('?') < 0) { - url += '?' + paramName + '=' + paramValue; - } else { - url += '&' + paramName + '=' + paramValue; - } - window.location.href = url; - }, - - onAfterRender: function (field) { - field.focus(); - }, - - onSpecialKey: function (field, e) { - if (e.getKey() === e.ENTER) { - this.login(); - } - }, - - onLoginClick: function () { - Ext.getElementById('submitButton').click(); - this.login(); - }, - - onRegisterClick: function () { - Ext.create('Traccar.view.dialog.Register').show(); - }, - - onResetClick: function () { - Ext.Msg.prompt(Strings.loginReset, Strings.userEmail, function (btn, text) { - if (btn === 'ok') { - Ext.Ajax.request({ - scope: this, - method: 'POST', - url: 'api/password/reset', - params: { - email: text - }, - callback: function (options, success, response) { - if (success) { - Traccar.app.showToast(Strings.loginResetSuccess); - } else { - Traccar.app.showError(response.responseText); - } - } - }); - } - }); - } -}); diff --git a/web/app/view/dialog/Maintenance.js b/web/app/view/dialog/Maintenance.js deleted file mode 100644 index d844d259..00000000 --- a/web/app/view/dialog/Maintenance.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2018 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Maintenance', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.dialog.MaintenanceController', - 'Traccar.view.CustomNumberField', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'maintenance', - - title: Strings.sharedMaintenance, - - items: { - xtype: 'form', - listeners: { - validitychange: 'onValidityChange' - }, - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName, - allowBlank: false - }, { - xtype: 'combobox', - name: 'type', - reference: 'typeComboField', - fieldLabel: Strings.sharedType, - displayField: 'name', - valueField: 'key', - allowBlank: false, - queryMode: 'local', - store: 'MaintenanceTypes', - listeners: { - change: 'onNameChange' - } - }, { - xtype: 'customNumberField', - name: 'start', - reference: 'startField', - fieldLabel: Strings.maintenanceStart - }, { - xtype: 'customNumberField', - name: 'period', - reference: 'periodField', - allowBlank: false, - fieldLabel: Strings.maintenancePeriod, - validator: function (value) { - return this.parseValue(value) !== 0 ? true : Strings.errorZero; - } - }] - }] - } -}); diff --git a/web/app/view/dialog/MaintenanceController.js b/web/app/view/dialog/MaintenanceController.js deleted file mode 100644 index d5a27b54..00000000 --- a/web/app/view/dialog/MaintenanceController.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2018 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.MaintenanceController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.maintenance', - - init: function () { - this.startConfig = Ext.clone(this.lookupReference('startField').initialConfig); - this.startConfig.value = 0; - this.periodConfig = Ext.clone(this.lookupReference('periodField').initialConfig); - this.periodConfig.value = 0; - this.lookupReference('saveButton').setDisabled(true); - }, - - onValidityChange: function (form, valid) { - this.lookupReference('saveButton').setDisabled(!valid); - }, - - updateFieldConfig: function (fieldReference, initialConfig, newConfig) { - var field = this.lookupReference(fieldReference); - if (field.dataType !== newConfig.dataType) { - this.getView().down('fieldset').insert(this.getView().down('fieldset').items.indexOf(field), - Ext.merge({}, initialConfig, newConfig)); - this.getView().down('fieldset').remove(field); - this.lookupReference(fieldReference).validate(); - } else { - field.setConfig(newConfig); - field.validate(); - } - }, - - onNameChange: function (combobox, newValue) { - var attribute, config = {}; - attribute = combobox.getStore().getById(newValue); - if (attribute) { - if (attribute.get('allowDecimals') !== undefined) { - config.allowDecimals = attribute.get('allowDecimals'); - } else { - config.allowDecimals = true; - } - config.dataType = attribute.get('dataType'); - config.maxValue = attribute.get('maxValue'); - config.minValue = attribute.get('minValue'); - } - - this.updateFieldConfig('startField', this.startConfig, config); - this.updateFieldConfig('periodField', this.periodConfig, config); - } -}); diff --git a/web/app/view/dialog/MapPickerController.js b/web/app/view/dialog/MapPickerController.js deleted file mode 100644 index 8641e377..00000000 --- a/web/app/view/dialog/MapPickerController.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.MapPickerController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.mapPicker', - - config: { - listen: { - controller: { - '*': { - mapstate: 'setMapState' - } - } - } - }, - - getMapState: function () { - this.fireEvent('mapstaterequest'); - }, - - setMapState: function (lat, lon, zoom) { - this.lookupReference('latitude').setValue(lat); - this.lookupReference('longitude').setValue(lon); - this.lookupReference('zoom').setValue(zoom); - } -}); diff --git a/web/app/view/dialog/Notification.js b/web/app/view/dialog/Notification.js deleted file mode 100644 index 51af5b8e..00000000 --- a/web/app/view/dialog/Notification.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Notification', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.NotificationController' - ], - - controller: 'notification', - title: Strings.sharedNotification, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'combobox', - name: 'type', - fieldLabel: Strings.sharedType, - store: 'AllNotificationTypes', - queryMode: 'local', - displayField: 'name', - valueField: 'type', - editable: false, - allowBlank: false, - listeners: { - change: 'onTypeChange' - } - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'always', - fieldLabel: Strings.notificationAlways - }, { - xtype: 'tagfield', - reference: 'alarmsField', - fieldLabel: Strings.sharedAlarms, - maxWidth: Traccar.Style.formFieldWidth, - store: 'AlarmTypes', - valueField: 'key', - displayField: 'name', - queryMode: 'local', - hidden: true, - listeners: { - beforerender: 'onAlarmsLoad', - change: 'onAlarmsChange' - } - }, { - xtype: 'tagfield', - fieldLabel: Strings.notificationNotificators, - name: 'notificators', - maxWidth: Traccar.Style.formFieldWidth, - store: 'AllNotificators', - valueField: 'type', - displayField: 'name', - queryMode: 'local' - }] - }, { - xtype: 'fieldset', - title: Strings.sharedExtra, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'clearableComboBox', - reference: 'calendarCombo', - name: 'calendarId', - store: 'Calendars', - queryMode: 'local', - displayField: 'name', - valueField: 'id', - fieldLabel: Strings.sharedCalendar - }] - }] - } -}); diff --git a/web/app/view/dialog/NotificationController.js b/web/app/view/dialog/NotificationController.js deleted file mode 100644 index 5da669a4..00000000 --- a/web/app/view/dialog/NotificationController.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2018 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.NotificationController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.notification', - - init: function () { - this.lookupReference('calendarCombo').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); - }, - - onTypeChange: function (view, value) { - this.lookupReference('alarmsField').setHidden(value !== 'alarm'); - }, - - onAlarmsLoad: function (view) { - var attributes, record = view.up('form').getRecord(); - attributes = record.get('attributes') || {}; - if (attributes['alarms']) { - view.suspendEvents(false); - view.setValue(attributes['alarms'].split(',')); - view.resumeEvents(); - } - }, - - onAlarmsChange: function (view, value) { - var attributes, record = view.up('window').down('form').getRecord(); - attributes = record.get('attributes') || {}; - - value = value.join(); - if (attributes['alarms'] !== value) { - attributes['alarms'] = value; - record.set('attributes', attributes); - record.dirty = true; - } - } -}); diff --git a/web/app/view/dialog/Register.js b/web/app/view/dialog/Register.js deleted file mode 100644 index f9608cef..00000000 --- a/web/app/view/dialog/Register.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Register', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.RegisterController' - ], - - controller: 'register', - - title: Strings.loginRegister, - - items: { - xtype: 'form', - reference: 'form', - jsonSubmit: true, - - items: [{ - xtype: 'textfield', - name: 'name', - fieldLabel: Strings.sharedName, - allowBlank: false - }, { - xtype: 'textfield', - name: 'email', - fieldLabel: Strings.userEmail, - validator: function (val) { - if (/(.+)@(.+)\.(.{2,})/.test(val)) { - return true; - } else { - return Ext.form.field.VTypes.emailText; - } - }, - allowBlank: false - }, { - xtype: 'textfield', - name: 'password', - fieldLabel: Strings.userPassword, - inputType: 'password', - allowBlank: false - }] - }, - - buttons: [{ - text: Strings.sharedSave, - handler: 'onCreateClick' - }, { - text: Strings.sharedCancel, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/RegisterController.js b/web/app/view/dialog/RegisterController.js deleted file mode 100644 index c102581e..00000000 --- a/web/app/view/dialog/RegisterController.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.RegisterController', { - extend: 'Ext.app.ViewController', - alias: 'controller.register', - - onCreateClick: function () { - var form = this.lookupReference('form'); - if (form.isValid()) { - Ext.Ajax.request({ - scope: this, - method: 'POST', - url: 'api/users', - jsonData: form.getValues(), - callback: this.onCreateReturn - }); - } - }, - - onCreateReturn: function (options, success, response) { - if (success) { - this.closeView(); - Traccar.app.showToast(Strings.loginCreated); - } else { - Traccar.app.showError(response); - } - } - -}); diff --git a/web/app/view/dialog/ReportConfig.js b/web/app/view/dialog/ReportConfig.js deleted file mode 100644 index 35cc95b4..00000000 --- a/web/app/view/dialog/ReportConfig.js +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.ReportConfig', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.ReportConfigController', - 'Traccar.view.CustomTimeField' - ], - - controller: 'reportConfig', - title: Strings.reportConfigure, - - items: [{ - fieldLabel: Strings.reportDevice, - xtype: 'tagfield', - reference: 'deviceField', - maxWidth: Traccar.Style.formFieldWidth, - store: 'Devices', - valueField: 'id', - displayField: 'name', - queryMode: 'local' - }, { - fieldLabel: Strings.reportGroup, - xtype: 'tagfield', - reference: 'groupField', - maxWidth: Traccar.Style.formFieldWidth, - store: 'Groups', - valueField: 'id', - displayField: 'name', - queryMode: 'local' - }, { - fieldLabel: Strings.reportEventTypes, - xtype: 'tagfield', - reference: 'eventTypeField', - maxWidth: Traccar.Style.formFieldWidth, - store: 'ReportEventTypes', - hidden: true, - valueField: 'type', - displayField: 'name', - queryMode: 'local' - }, { - fieldLabel: Strings.reportChartType, - xtype: 'combobox', - reference: 'chartTypeField', - store: 'ReportChartTypes', - hidden: true, - value: 'speed', - valueField: 'key', - displayField: 'name', - queryMode: 'local' - }, { - fieldLabel: Strings.reportShowMarkers, - xtype: 'checkbox', - reference: 'showMarkersField', - inputValue: true, - uncheckedValue: false, - value: false - }, { - fieldLabel: Strings.reportPeriod, - reference: 'periodField', - xtype: 'combobox', - store: 'ReportPeriods', - editable: false, - valueField: 'key', - displayField: 'name', - queryMode: 'local', - listeners: { - change: 'onPeriodChange' - } - }, { - xtype: 'fieldcontainer', - layout: 'vbox', - reference: 'fromContainer', - hidden: true, - fieldLabel: Strings.reportFrom, - items: [{ - xtype: 'datefield', - reference: 'fromDateField', - startDay: Traccar.Style.weekStartDay, - format: Traccar.Style.dateFormat, - value: new Date(new Date().getTime() - 30 * 60 * 1000) - }, { - xtype: 'customTimeField', - reference: 'fromTimeField', - value: new Date(new Date().getTime() - 30 * 60 * 1000) - }] - }, { - xtype: 'fieldcontainer', - layout: 'vbox', - reference: 'toContainer', - hidden: true, - fieldLabel: Strings.reportTo, - items: [{ - xtype: 'datefield', - reference: 'toDateField', - startDay: Traccar.Style.weekStartDay, - format: Traccar.Style.dateFormat, - value: new Date() - }, { - xtype: 'customTimeField', - reference: 'toTimeField', - value: new Date() - }] - }], - - buttons: [{ - glyph: 'xf00c@FontAwesome', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/ReportConfigController.js b/web/app/view/dialog/ReportConfigController.js deleted file mode 100644 index 6d029428..00000000 --- a/web/app/view/dialog/ReportConfigController.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.ReportConfigController', { - extend: 'Ext.app.ViewController', - alias: 'controller.reportConfig', - - requires: [ - 'Traccar.store.ReportEventTypes', - 'Traccar.store.AllNotifications' - ], - - onSaveClick: function (button) { - var eventType, callingPanel; - callingPanel = this.getView().callingPanel; - - callingPanel.deviceId = this.lookupReference('deviceField').getValue(); - callingPanel.groupId = this.lookupReference('groupField').getValue(); - eventType = this.lookupReference('eventTypeField').getValue(); - if (eventType.indexOf(Traccar.store.ReportEventTypes.allEvents) > -1) { - eventType = [Traccar.store.ReportEventTypes.allEvents]; - } else if (eventType.length === this.lookupReference('eventTypeField').getStore().getCount() - 1) { - eventType = [Traccar.store.ReportEventTypes.allEvents]; - } - callingPanel.eventType = eventType; - callingPanel.chartType = this.lookupReference('chartTypeField').getValue(); - callingPanel.showMarkers = this.lookupReference('showMarkersField').getValue(); - callingPanel.fromDate = this.lookupReference('fromDateField').getValue(); - callingPanel.fromTime = this.lookupReference('fromTimeField').getValue(); - callingPanel.toDate = this.lookupReference('toDateField').getValue(); - callingPanel.toTime = this.lookupReference('toTimeField').getValue(); - callingPanel.period = this.lookupReference('periodField').getValue(); - callingPanel.updateButtons(); - button.up('window').close(); - }, - - onPeriodChange: function (combobox, newValue) { - var day, first, from, to, custom = newValue === 'custom'; - this.lookupReference('fromContainer').setHidden(!custom); - this.lookupReference('toContainer').setHidden(!custom); - if (!custom) { - from = new Date(); - to = new Date(); - switch (newValue) { - case 'today': - to.setDate(to.getDate() + 1); - break; - case 'yesterday': - from.setDate(to.getDate() - 1); - break; - case 'thisWeek': - day = from.getDay(); - first = from.getDate() - day + (day === 0 ? -6 : 1); - from.setDate(first); - to.setDate(first + 7); - break; - case 'previousWeek': - day = from.getDay(); - first = from.getDate() - day + (day === 0 ? -6 : 1); - from.setDate(first - 7); - to.setDate(first); - break; - case 'thisMonth': - from.setDate(1); - to.setDate(1); - to.setMonth(from.getMonth() + 1); - break; - case 'previousMonth': - from.setDate(1); - from.setMonth(from.getMonth() - 1); - to.setDate(1); - break; - default: - break; - } - from.setHours(0, 0, 0, 0); - to.setHours(0, 0, 0, 0); - this.lookupReference('fromDateField').setValue(from); - this.lookupReference('fromTimeField').setValue(from); - this.lookupReference('toDateField').setValue(to); - this.lookupReference('toTimeField').setValue(to); - } - } -}); diff --git a/web/app/view/dialog/SavedCommand.js b/web/app/view/dialog/SavedCommand.js deleted file mode 100644 index b1aeae73..00000000 --- a/web/app/view/dialog/SavedCommand.js +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.SavedCommand', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.dialog.SavedCommandController', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'savedCommand', - title: Strings.sharedSavedCommand, - - items: [{ - xtype: 'form', - listeners: { - validitychange: 'onValidityChange' - }, - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'description', - fieldLabel: Strings.sharedDescription - }, { - xtype: 'checkboxfield', - name: 'textChannel', - inputValue: true, - uncheckedValue: false, - fieldLabel: Strings.commandSendSms - }, { - xtype: 'combobox', - name: 'type', - reference: 'commandType', - fieldLabel: Strings.sharedType, - store: 'AllCommandTypes', - queryMode: 'local', - displayField: 'name', - valueField: 'type', - editable: false, - allowBlank: false, - listeners: { - change: 'onTypeChange' - } - }, { - xtype: 'fieldcontainer', - reference: 'parameters' - }] - }] - }], - - buttons: [{ - glyph: 'xf00c@FontAwesome', - reference: 'saveButton', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - disabled: true, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/SavedCommandController.js b/web/app/view/dialog/SavedCommandController.js deleted file mode 100644 index 37c56603..00000000 --- a/web/app/view/dialog/SavedCommandController.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.SavedCommandController', { - extend: 'Traccar.view.dialog.BaseEditController', - alias: 'controller.savedCommand', - - defaultFieldConfig: { - allowBlank: false - }, - - onTypeChange: function (combo, newValue) { - var i, config, command, parameters, parameter, record; - record = combo.up('window').down('form').getRecord(); - this.lookupReference('parameters').removeAll(); - command = Ext.getStore('KnownCommands').getById(newValue); - if (command && command.get('parameters')) { - parameters = command.get('parameters'); - for (i = 0; i < parameters.length; i++) { - parameter = new Traccar.model.KnownAttribute(parameters[i]); - config = Ext.clone(this.defaultFieldConfig); - config.key = parameter.get('key'); - config.fieldLabel = parameter.get('name'); - if (record.get('attributes')) { - config.value = record.get('attributes')[parameter.get('key')]; - } - config.disabled = combo.isDisabled(); - switch (parameter.get('valueType')) { - case 'number': - config.xtype = 'customNumberField'; - if (parameter.get('allowDecimals') !== undefined) { - config.allowDecimals = parameter.get('allowDecimals'); - } else { - config.allowDecimals = true; - } - config.dataType = parameter.get('dataType'); - config.maxValue = parameter.get('maxValue'); - config.minValue = parameter.get('minValue'); - break; - case 'boolean': - config.xtype = 'checkboxfield'; - config.inputValue = true; - config.uncheckedValue = false; - break; - default: - if (parameter.get('dataType') === 'timezone') { - config.xtype = 'combobox'; - config.queryMode = 'local'; - config.displayField = 'key'; - config.editable = false; - config.store = 'AllTimezones'; - } else { - config.xtype = 'textfield'; - } - } - this.lookupReference('parameters').add(config); - } - } - }, - - fillAttributes: function (button) { - var i, form, record, parameters, attributes = {}; - - form = button.up('window').down('form'); - form.updateRecord(); - record = form.getRecord(); - parameters = this.lookupReference('parameters').items.items; - - for (i = 0; i < parameters.length; i++) { - attributes[parameters[i].key] = parameters[i].getValue(); - } - - record.set('attributes', attributes); - }, - - onSaveClick: function (button) { - this.fillAttributes(button); - this.callParent(arguments); - }, - - onValidityChange: function (form, valid) { - this.lookupReference('saveButton').setDisabled(!valid); - } - -}); diff --git a/web/app/view/dialog/SelectDevice.js b/web/app/view/dialog/SelectDevice.js deleted file mode 100644 index 5b11c03f..00000000 --- a/web/app/view/dialog/SelectDevice.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ -Ext.define('Traccar.view.dialog.SelectDevice', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.SelectDeviceController' - ], - - controller: 'selectDevice', - title: Strings.sharedDevice, - - items: { - xtype: 'form', - items: [{ - xtype: 'combobox', - reference: 'deviceField', - store: 'Devices', - queryMode: 'local', - displayField: 'name', - valueField: 'id', - editable: false, - listeners: { - change: 'onDeviceChange' - } - }] - }, - - buttons: [{ - glyph: 'xf00c@FontAwesome', - reference: 'saveButton', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick', - disabled: true - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/SelectDeviceController.js b/web/app/view/dialog/SelectDeviceController.js deleted file mode 100644 index 9437991c..00000000 --- a/web/app/view/dialog/SelectDeviceController.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.SelectDeviceController', { - extend: 'Ext.app.ViewController', - alias: 'controller.selectDevice', - - onSaveClick: function (button) { - var deviceId, record; - deviceId = this.lookupReference('deviceField').getValue(); - record = this.getView().record.data; - Ext.Ajax.request({ - url: 'api/attributes/computed/test?deviceId=' + deviceId, - method: 'POST', - jsonData: Ext.util.JSON.encode(record), - callback: function (options, success, response) { - if (success) { - Ext.Msg.alert(Strings.sharedInfoTitle, response.responseText || response.statusText); - } else { - Traccar.app.showError(response); - } - } - }); - button.up('window').close(); - }, - - onDeviceChange: function (combobox, newValue) { - this.lookupReference('saveButton').setDisabled(newValue === null); - } -}); diff --git a/web/app/view/dialog/SendCommand.js b/web/app/view/dialog/SendCommand.js deleted file mode 100644 index 79954739..00000000 --- a/web/app/view/dialog/SendCommand.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.SendCommand', { - extend: 'Traccar.view.dialog.Base', - - requires: [ - 'Traccar.view.dialog.SendCommandController' - ], - - controller: 'sendCommand', - title: Strings.commandTitle, - - items: [{ - xtype: 'combobox', - reference: 'commandsComboBox', - fieldLabel: Strings.deviceCommand, - displayField: 'description', - valueField: 'id', - store: 'DeviceCommands', - queryMode: 'local', - editable: false, - allowBlank: false, - listeners: { - select: 'onCommandSelect' - } - }, { - xtype: 'form', - listeners: { - validitychange: 'onValidityChange' - }, - items: [{ - xtype: 'fieldset', - reference: 'newCommandFields', - disabled: true, - items: [{ - xtype: 'checkboxfield', - name: 'textChannel', - reference: 'textChannelCheckBox', - inputValue: true, - uncheckedValue: false, - fieldLabel: Strings.commandSendSms, - listeners: { - change: 'onTextChannelChange' - } - }, { - xtype: 'combobox', - name: 'type', - reference: 'commandType', - fieldLabel: Strings.sharedType, - store: 'CommandTypes', - displayField: 'name', - valueField: 'type', - editable: false, - allowBlank: false, - listeners: { - change: 'onTypeChange' - } - }, { - xtype: 'fieldcontainer', - reference: 'parameters' - }] - }] - }], - - buttons: [{ - xtype: 'tbfill' - }, { - glyph: 'xf093@FontAwesome', - tooltip: Strings.sharedSend, - tooltipType: 'title', - minWidth: 0, - disabled: true, - reference: 'sendButton', - handler: 'onSendClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/SendCommandController.js b/web/app/view/dialog/SendCommandController.js deleted file mode 100644 index c6351587..00000000 --- a/web/app/view/dialog/SendCommandController.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.SendCommandController', { - extend: 'Traccar.view.dialog.SavedCommandController', - alias: 'controller.sendCommand', - - requires: [ - 'Traccar.view.permissions.SavedCommands' - ], - - onSendClick: function (button) { - var record; - this.fillAttributes(button); - record = button.up('window').down('form').getRecord(); - - Ext.Ajax.request({ - scope: this, - url: 'api/commands/send', - jsonData: record.getData(), - callback: this.onSendResult - }); - }, - - onValidityChange: function (form, valid) { - this.lookupReference('sendButton').setDisabled(!valid || - this.lookupReference('commandsComboBox').getValue() === null); - }, - - onTextChannelChange: function (checkbox, newValue) { - var typesStore = this.lookupReference('commandType').getStore(); - typesStore.getProxy().setExtraParam('textChannel', newValue); - typesStore.reload(); - }, - - onCommandSelect: function (selected) { - var record, form, command = selected.getStore().getById(selected.getValue()); - command.set('deviceId', this.getView().deviceId); - form = selected.up('window').down('form'); - record = form.getRecord(); - form.loadRecord(command); - if (record && command.get('type') === record.get('type')) { - this.onTypeChange(this.lookupReference('commandType'), command.get('type')); - } - - this.lookupReference('newCommandFields').setDisabled(command.getId() !== 0); - this.lookupReference('sendButton').setDisabled(command.getId() === 0); - }, - - onSendResult: function (options, success, response) { - if (success) { - this.closeView(); - Traccar.app.showToast(response.status === 202 ? Strings.commandQueued : Strings.commandSent); - } else { - Traccar.app.showError(response); - } - }, - - closeView: function () { - this.lookupReference('commandsComboBox').getStore().removeAll(); - this.callParent(arguments); - } -}); diff --git a/web/app/view/dialog/Server.js b/web/app/view/dialog/Server.js deleted file mode 100644 index 6ee250b6..00000000 --- a/web/app/view/dialog/Server.js +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2015 - 2018 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.Server', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.MapPickerController', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'mapPicker', - title: Strings.serverTitle, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedPreferences, - items: [{ - xtype: 'clearableComboBox', - name: 'map', - fieldLabel: Strings.mapLayer, - store: 'MapTypes', - displayField: 'name', - valueField: 'key' - }, { - xtype: 'unescapedTextField', - name: 'bingKey', - fieldLabel: Strings.mapBingKey - }, { - xtype: 'unescapedTextField', - reference: 'mapUrlField', - name: 'mapUrl', - fieldLabel: Strings.mapCustomLabel - }, { - xtype: 'numberfield', - reference: 'latitude', - name: 'latitude', - fieldLabel: Strings.positionLatitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - reference: 'longitude', - name: 'longitude', - fieldLabel: Strings.positionLongitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - reference: 'zoom', - name: 'zoom', - fieldLabel: Strings.serverZoom - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'twelveHourFormat', - fieldLabel: Strings.settingsTwelveHourFormat - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'forceSettings', - fieldLabel: Strings.serverForceSettings - }, { - xtype: 'clearableComboBox', - name: 'coordinateFormat', - fieldLabel: Strings.settingsCoordinateFormat, - store: 'CoordinateFormats', - displayField: 'name', - valueField: 'key' - }, { - xtype: 'unescapedTextField', - name: 'poiLayer', - fieldLabel: Strings.mapPoiLayer - }, { - xtype: 'unescapedTextField', - name: 'announcement', - fieldLabel: Strings.serverAnnouncement - }] - }, { - xtype: 'fieldset', - title: Strings.sharedPermissions, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'registration', - fieldLabel: Strings.serverRegistration - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'readonly', - fieldLabel: Strings.serverReadonly - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'deviceReadonly', - fieldLabel: Strings.userDeviceReadonly - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'limitCommands', - fieldLabel: Strings.userLimitCommands - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'disableReports', - fieldLabel: Strings.userDisableReports - }] - }] - }, - - buttons: [{ - text: Strings.sharedAttributes, - handler: 'showAttributesView' - }, { - glyph: 'xf041@FontAwesome', - minWidth: 0, - handler: 'getMapState', - tooltip: Strings.sharedGetMapState, - tooltipType: 'title' - }, { - xtype: 'tbfill' - }, { - glyph: 'xf00c@FontAwesome', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/User.js b/web/app/view/dialog/User.js deleted file mode 100644 index 5da56424..00000000 --- a/web/app/view/dialog/User.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright 2015 - 2018 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.User', { - extend: 'Traccar.view.dialog.BaseEdit', - - requires: [ - 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.UserController', - 'Traccar.view.UnescapedTextField' - ], - - controller: 'user', - title: Strings.settingsUser, - - items: { - xtype: 'form', - items: [{ - xtype: 'fieldset', - title: Strings.sharedRequired, - items: [{ - xtype: 'unescapedTextField', - name: 'name', - fieldLabel: Strings.sharedName - }, { - xtype: 'unescapedTextField', - name: 'email', - fieldLabel: Strings.userEmail, - allowBlank: false - }, { - xtype: 'textfield', - name: 'password', - fieldLabel: Strings.userPassword, - inputType: 'password', - allowBlank: false - }] - }, { - xtype: 'fieldset', - title: Strings.sharedPreferences, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'unescapedTextField', - name: 'phone', - fieldLabel: Strings.sharedPhone - }, { - xtype: 'clearableComboBox', - name: 'map', - fieldLabel: Strings.mapLayer, - store: 'MapTypes', - displayField: 'name', - valueField: 'key' - }, { - xtype: 'numberfield', - reference: 'latitude', - name: 'latitude', - fieldLabel: Strings.positionLatitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - reference: 'longitude', - name: 'longitude', - fieldLabel: Strings.positionLongitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - reference: 'zoom', - name: 'zoom', - fieldLabel: Strings.serverZoom - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'twelveHourFormat', - fieldLabel: Strings.settingsTwelveHourFormat - }, { - xtype: 'clearableComboBox', - name: 'coordinateFormat', - fieldLabel: Strings.settingsCoordinateFormat, - store: 'CoordinateFormats', - displayField: 'name', - valueField: 'key' - }, { - xtype: 'unescapedTextField', - name: 'poiLayer', - fieldLabel: Strings.mapPoiLayer - }] - }, { - xtype: 'fieldset', - title: Strings.sharedPermissions, - collapsible: true, - collapsed: true, - items: [{ - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'disabled', - fieldLabel: Strings.sharedDisabled, - disabled: true, - reference: 'disabledField' - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'administrator', - fieldLabel: Strings.userAdmin, - disabled: true, - reference: 'adminField' - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'readonly', - fieldLabel: Strings.serverReadonly, - disabled: true, - reference: 'readonlyField' - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'deviceReadonly', - fieldLabel: Strings.userDeviceReadonly, - disabled: true, - reference: 'deviceReadonlyField' - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'limitCommands', - fieldLabel: Strings.userLimitCommands, - disabled: true, - reference: 'limitCommandsField' - }, { - xtype: 'checkboxfield', - inputValue: true, - uncheckedValue: false, - name: 'disableReports', - fieldLabel: Strings.userDisableReports, - disabled: true, - reference: 'disableReportsField' - }, { - xtype: 'datefield', - name: 'expirationTime', - fieldLabel: Strings.userExpirationTime, - disabled: true, - reference: 'expirationTimeField', - startDay: Traccar.Style.weekStartDay, - format: Traccar.Style.dateFormat - }, { - xtype: 'numberfield', - name: 'deviceLimit', - fieldLabel: Strings.userDeviceLimit, - disabled: true, - reference: 'deviceLimitField' - }, { - xtype: 'numberfield', - name: 'userLimit', - fieldLabel: Strings.userUserLimit, - disabled: true, - reference: 'userLimitField' - }] - }] - }, - - buttons: [{ - text: Strings.sharedAttributes, - handler: 'showAttributesView' - }, { - glyph: 'xf041@FontAwesome', - minWidth: 0, - handler: 'getMapState', - tooltip: Strings.sharedGetMapState, - tooltipType: 'title' - }, { - glyph: 'xf003@FontAwesome', - minWidth: 0, - handler: 'testNotification', - hidden: true, - reference: 'testNotificationButton', - tooltip: Strings.sharedTestNotification, - tooltipType: 'title' - }, { - xtype: 'tbfill' - }, { - glyph: 'xf00c@FontAwesome', - tooltip: Strings.sharedSave, - tooltipType: 'title', - minWidth: 0, - handler: 'onSaveClick' - }, { - glyph: 'xf00d@FontAwesome', - tooltip: Strings.sharedCancel, - tooltipType: 'title', - minWidth: 0, - handler: 'closeView' - }] -}); diff --git a/web/app/view/dialog/UserController.js b/web/app/view/dialog/UserController.js deleted file mode 100644 index 0d620614..00000000 --- a/web/app/view/dialog/UserController.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2015 - 2017 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 <http://www.gnu.org/licenses/>. - */ - -Ext.define('Traccar.view.dialog.UserController', { - extend: 'Traccar.view.dialog.MapPickerController', - alias: 'controller.user', - - init: function () { - if (Traccar.app.getUser().get('administrator')) { - this.lookupReference('adminField').setDisabled(false); - this.lookupReference('deviceLimitField').setDisabled(false); - this.lookupReference('userLimitField').setDisabled(false); - } - if (Traccar.app.getUser().get('administrator') || !this.getView().selfEdit) { - this.lookupReference('readonlyField').setDisabled(false); - this.lookupReference('disabledField').setDisabled(false); - this.lookupReference('expirationTimeField').setDisabled(false); - this.lookupReference('deviceReadonlyField').setDisabled(false); - this.lookupReference('limitCommandsField').setDisabled(false); - this.lookupReference('disableReportsField').setDisabled(false); - } - }, - - testNotification: function () { - Ext.Ajax.request({ - url: 'api/notifications/test', - method: 'POST', - failure: function (response) { - Traccar.app.showError(response); - } - }); - }, - - onSaveClick: function (button) { - var dialog, record, store; - dialog = button.up('window').down('form'); - dialog.updateRecord(); - record = dialog.getRecord(); - if (record === Traccar.app.getUser()) { - record.save(); - } else { - store = Ext.getStore('Users'); - if (record.phantom) { - store.add(record); - } - store.sync({ - failure: function (batch) { - store.rejectChanges(); - Traccar.app.showError(batch.exceptions[0].getError().response); - } - }); - } - button.up('window').close(); - } -}); |