aboutsummaryrefslogtreecommitdiff
path: root/legacy/web/app/view/edit
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/web/app/view/edit')
-rw-r--r--legacy/web/app/view/edit/Attributes.js65
-rw-r--r--legacy/web/app/view/edit/AttributesController.js124
-rw-r--r--legacy/web/app/view/edit/Calendars.js50
-rw-r--r--legacy/web/app/view/edit/CalendarsController.js31
-rw-r--r--legacy/web/app/view/edit/ComputedAttributes.js80
-rw-r--r--legacy/web/app/view/edit/ComputedAttributesController.js31
-rw-r--r--legacy/web/app/view/edit/Devices.js161
-rw-r--r--legacy/web/app/view/edit/DevicesController.js139
-rw-r--r--legacy/web/app/view/edit/Drivers.js54
-rw-r--r--legacy/web/app/view/edit/DriversController.js31
-rw-r--r--legacy/web/app/view/edit/Geofences.js63
-rw-r--r--legacy/web/app/view/edit/GeofencesController.js30
-rw-r--r--legacy/web/app/view/edit/Groups.js109
-rw-r--r--legacy/web/app/view/edit/GroupsController.js141
-rw-r--r--legacy/web/app/view/edit/Maintenances.js77
-rw-r--r--legacy/web/app/view/edit/MaintenancesController.js31
-rw-r--r--legacy/web/app/view/edit/Notifications.js111
-rw-r--r--legacy/web/app/view/edit/NotificationsController.js31
-rw-r--r--legacy/web/app/view/edit/SavedCommands.js65
-rw-r--r--legacy/web/app/view/edit/SavedCommandsController.js31
-rw-r--r--legacy/web/app/view/edit/Toolbar.js49
-rw-r--r--legacy/web/app/view/edit/ToolbarController.js70
-rw-r--r--legacy/web/app/view/edit/Users.js156
-rw-r--r--legacy/web/app/view/edit/UsersController.js244
24 files changed, 1974 insertions, 0 deletions
diff --git a/legacy/web/app/view/edit/Attributes.js b/legacy/web/app/view/edit/Attributes.js
new file mode 100644
index 00000000..af4f5a90
--- /dev/null
+++ b/legacy/web/app/view/edit/Attributes.js
@@ -0,0 +1,65 @@
+/*
+ * 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.edit.Attributes', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'attributesView',
+
+ requires: [
+ 'Traccar.view.edit.AttributesController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'attributes',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string',
+ renderer: function (value) {
+ var attribute;
+ if (this.attributesStore) {
+ attribute = Ext.getStore(this.attributesStore).getById(value);
+ }
+ return attribute && attribute.get('name') || value;
+ }
+ }, {
+ text: Strings.stateValue,
+ dataIndex: 'value',
+ renderer: function (value, metaData, record) {
+ var attribute;
+ if (this.attributesStore) {
+ attribute = Ext.getStore(this.attributesStore).getById(record.get('name'));
+ }
+ return Traccar.AttributeFormatter.renderAttribute(value, attribute);
+ }
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/AttributesController.js b/legacy/web/app/view/edit/AttributesController.js
new file mode 100644
index 00000000..84ff6adf
--- /dev/null
+++ b/legacy/web/app/view/edit/AttributesController.js
@@ -0,0 +1,124 @@
+/*
+ * 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.edit.AttributesController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.attributes',
+
+ requires: [
+ 'Traccar.view.dialog.Attribute',
+ 'Traccar.store.Attributes',
+ 'Traccar.model.Attribute'
+ ],
+
+ removeTitle: Strings.stateName,
+
+ init: function () {
+ var store, propertyName, i = 0, attributes;
+ store = Ext.create('Traccar.store.Attributes');
+ store.setProxy(Ext.create('Ext.data.proxy.Memory'));
+ if (typeof this.getView().record.get('attributes') === 'undefined') {
+ this.getView().record.set('attributes', {});
+ }
+ attributes = this.getView().record.get('attributes');
+ for (propertyName in attributes) {
+ if (attributes.hasOwnProperty(propertyName)) {
+ store.add(Ext.create('Traccar.model.Attribute', {
+ priority: i++,
+ name: propertyName,
+ value: attributes[propertyName]
+ }));
+ }
+ }
+ store.addListener('add', function (store, records) {
+ var i, view;
+ view = this.getView();
+ for (i = 0; i < records.length; i++) {
+ view.record.get('attributes')[records[i].get('name')] = records[i].get('value');
+ }
+ view.record.dirty = true;
+ }, this);
+ store.addListener('update', function (store, record, operation) {
+ var view;
+ view = this.getView();
+ if (operation === Ext.data.Model.EDIT) {
+ if (record.modified.name !== record.get('name')) {
+ delete view.record.get('attributes')[record.modified.name];
+ }
+ view.record.get('attributes')[record.get('name')] = record.get('value');
+ view.record.dirty = true;
+ }
+ }, this);
+ store.addListener('remove', function (store, records) {
+ var i, view;
+ view = this.getView();
+ for (i = 0; i < records.length; i++) {
+ delete view.record.get('attributes')[records[i].get('name')];
+ }
+ view.record.dirty = true;
+ }, this);
+
+ this.getView().setStore(store);
+ if (this.getView().record instanceof Traccar.model.Device) {
+ this.getView().attributesStore = 'DeviceAttributes';
+ } else if (this.getView().record instanceof Traccar.model.Geofence) {
+ this.getView().attributesStore = 'GeofenceAttributes';
+ } else if (this.getView().record instanceof Traccar.model.Group) {
+ this.getView().attributesStore = 'GroupAttributes';
+ } else if (this.getView().record instanceof Traccar.model.Server) {
+ this.getView().attributesStore = 'ServerAttributes';
+ } else if (this.getView().record instanceof Traccar.model.User) {
+ this.getView().attributesStore = 'UserAttributes';
+ }
+ },
+
+ comboConfig: {
+ xtype: 'combobox',
+ reference: 'nameComboField',
+ name: 'name',
+ fieldLabel: Strings.sharedName,
+ displayField: 'name',
+ valueField: 'key',
+ allowBlank: false,
+ queryMode: 'local',
+ listeners: {
+ change: 'onNameChange'
+ }
+ },
+
+ initDialog: function (record) {
+ var nameTextField, dialog = Ext.create('Traccar.view.dialog.Attribute');
+ if (this.getView().attributesStore) {
+ this.comboConfig.store = this.getView().attributesStore;
+ nameTextField = dialog.lookupReference('nameTextField');
+ dialog.down('form').insert(0, this.comboConfig);
+ dialog.down('form').remove(nameTextField);
+ }
+ dialog.down('form').loadRecord(record);
+ dialog.show();
+ },
+
+ onAddClick: function () {
+ var objectInstance = Ext.create('Traccar.model.Attribute');
+ objectInstance.store = this.getView().getStore();
+ this.initDialog(objectInstance);
+ },
+
+ onEditClick: function () {
+ this.initDialog(this.getView().getSelectionModel().getSelection()[0]);
+ }
+});
diff --git a/legacy/web/app/view/edit/Calendars.js b/legacy/web/app/view/edit/Calendars.js
new file mode 100644
index 00000000..23f20e25
--- /dev/null
+++ b/legacy/web/app/view/edit/Calendars.js
@@ -0,0 +1,50 @@
+/*
+ * 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.edit.Calendars', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'calendarsView',
+
+ requires: [
+ 'Traccar.view.edit.CalendarsController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'calendars',
+ store: 'Calendars',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/CalendarsController.js b/legacy/web/app/view/edit/CalendarsController.js
new file mode 100644
index 00000000..d11ec379
--- /dev/null
+++ b/legacy/web/app/view/edit/CalendarsController.js
@@ -0,0 +1,31 @@
+/*
+ * 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.edit.CalendarsController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.calendars',
+
+ requires: [
+ 'Traccar.view.dialog.Calendar',
+ 'Traccar.model.Calendar'
+ ],
+
+ objectModel: 'Traccar.model.Calendar',
+ objectDialog: 'Traccar.view.dialog.Calendar',
+ removeTitle: Strings.sharedCalendar
+});
diff --git a/legacy/web/app/view/edit/ComputedAttributes.js b/legacy/web/app/view/edit/ComputedAttributes.js
new file mode 100644
index 00000000..9f0b9396
--- /dev/null
+++ b/legacy/web/app/view/edit/ComputedAttributes.js
@@ -0,0 +1,80 @@
+/*
+ * 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.edit.ComputedAttributes', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'computedAttributesView',
+
+ requires: [
+ 'Traccar.view.edit.ComputedAttributesController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'computedAttributes',
+ store: 'ComputedAttributes',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedDescription,
+ dataIndex: 'description',
+ filter: 'string'
+ }, {
+ text: Strings.sharedAttribute,
+ dataIndex: 'attribute',
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'PositionAttributes'
+ },
+ renderer: function (value) {
+ return Ext.getStore('PositionAttributes').getAttributeName(value);
+ }
+ }, {
+ text: Strings.sharedExpression,
+ dataIndex: 'expression'
+ }, {
+ text: Strings.sharedType,
+ dataIndex: 'type',
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'AttributeValueTypes'
+ },
+ renderer: function (value) {
+ var type = Ext.getStore('AttributeValueTypes').getById(value);
+ if (type) {
+ return type.get('name');
+ } else {
+ return value;
+ }
+ }
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/ComputedAttributesController.js b/legacy/web/app/view/edit/ComputedAttributesController.js
new file mode 100644
index 00000000..6ae14102
--- /dev/null
+++ b/legacy/web/app/view/edit/ComputedAttributesController.js
@@ -0,0 +1,31 @@
+/*
+ * 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.edit.ComputedAttributesController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.computedAttributes',
+
+ requires: [
+ 'Traccar.view.dialog.ComputedAttribute',
+ 'Traccar.model.ComputedAttribute'
+ ],
+
+ objectModel: 'Traccar.model.ComputedAttribute',
+ objectDialog: 'Traccar.view.dialog.ComputedAttribute',
+ removeTitle: Strings.sharedComputedAttribute
+});
diff --git a/legacy/web/app/view/edit/Devices.js b/legacy/web/app/view/edit/Devices.js
new file mode 100644
index 00000000..5f54202a
--- /dev/null
+++ b/legacy/web/app/view/edit/Devices.js
@@ -0,0 +1,161 @@
+/*
+ * 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.edit.Devices', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'devicesView',
+
+ requires: [
+ 'Traccar.AttributeFormatter',
+ 'Traccar.view.edit.DevicesController',
+ 'Traccar.view.ArrayListFilter',
+ 'Traccar.view.DeviceMenu'
+ ],
+
+ controller: 'devices',
+
+ store: 'VisibleDevices',
+
+ stateful: true,
+ stateId: 'devices-grid',
+
+ tbar: {
+ componentCls: 'toolbar-header-style',
+ defaults: {
+ xtype: 'button',
+ disabled: true,
+ tooltipType: 'title'
+ },
+ items: [{
+ xtype: 'tbtext',
+ html: Strings.deviceTitle,
+ baseCls: 'x-panel-header-title-default'
+ }, {
+ xtype: 'tbfill',
+ disabled: false
+ }, {
+ handler: 'onAddClick',
+ reference: 'toolbarAddButton',
+ glyph: 'xf067@FontAwesome',
+ tooltip: Strings.sharedAdd
+ }, {
+ handler: 'onEditClick',
+ reference: 'toolbarEditButton',
+ glyph: 'xf040@FontAwesome',
+ tooltip: Strings.sharedEdit
+ }, {
+ handler: 'onRemoveClick',
+ reference: 'toolbarRemoveButton',
+ glyph: 'xf00d@FontAwesome',
+ tooltip: Strings.sharedRemove
+ }, {
+ handler: 'onCommandClick',
+ reference: 'deviceCommandButton',
+ glyph: 'xf093@FontAwesome',
+ tooltip: Strings.deviceCommand
+ }, {
+ xtype: 'deviceMenu',
+ reference: 'toolbarDeviceMenu',
+ enableToggle: false
+ }]
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ viewConfig: {
+ enableTextSelection: true,
+ getRowClass: function (record) {
+ var result = '', status = record.get('status');
+ if (record.get('disabled')) {
+ result = 'view-item-disabled ';
+ }
+ if (status) {
+ result += Ext.getStore('DeviceStatuses').getById(status).get('color');
+ }
+ return result;
+ }
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.deviceIdentifier,
+ dataIndex: 'uniqueId',
+ hidden: true,
+ filter: 'string'
+ }, {
+ text: Strings.sharedPhone,
+ dataIndex: 'phone',
+ hidden: true
+ }, {
+ text: Strings.deviceModel,
+ dataIndex: 'model',
+ hidden: true
+ }, {
+ text: Strings.deviceContact,
+ dataIndex: 'contact',
+ hidden: true
+ }, {
+ text: Strings.groupDialog,
+ dataIndex: 'groupId',
+ hidden: true,
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'Groups'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('groupId')
+ }, {
+ text: Strings.sharedDisabled,
+ dataIndex: 'disabled',
+ renderer: Traccar.AttributeFormatter.getFormatter('disabled'),
+ hidden: true,
+ filter: 'boolean'
+ }, {
+ text: Strings.deviceStatus,
+ dataIndex: 'status',
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'DeviceStatuses'
+ },
+ renderer: function (value) {
+ var status;
+ if (value) {
+ status = Ext.getStore('DeviceStatuses').getById(value);
+ if (status) {
+ return status.get('name');
+ }
+ }
+ return null;
+ }
+ }, {
+ text: Strings.deviceLastUpdate,
+ dataIndex: 'lastUpdate',
+ renderer: Traccar.AttributeFormatter.getFormatter('lastUpdate')
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/DevicesController.js b/legacy/web/app/view/edit/DevicesController.js
new file mode 100644
index 00000000..16e54b21
--- /dev/null
+++ b/legacy/web/app/view/edit/DevicesController.js
@@ -0,0 +1,139 @@
+/*
+ * 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.edit.DevicesController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.devices',
+
+ requires: [
+ 'Traccar.view.dialog.SendCommand',
+ 'Traccar.view.dialog.Device',
+ 'Traccar.view.permissions.Geofences',
+ 'Traccar.view.permissions.ComputedAttributes',
+ 'Traccar.view.permissions.Drivers',
+ 'Traccar.view.permissions.SavedCommands',
+ 'Traccar.view.BaseWindow',
+ 'Traccar.model.Device',
+ 'Traccar.model.Command'
+ ],
+
+ config: {
+ listen: {
+ controller: {
+ '*': {
+ selectreport: 'deselectDevice',
+ selectevent: 'deselectDevice'
+ },
+ 'root': {
+ selectdevice: 'selectDevice'
+ },
+ 'map': {
+ selectdevice: 'selectDevice',
+ deselectfeature: 'deselectFeature'
+ }
+ },
+ store: {
+ '#Devices': {
+ update: 'onUpdateDevice'
+ }
+ }
+ }
+ },
+
+ objectModel: 'Traccar.model.Device',
+ objectDialog: 'Traccar.view.dialog.Device',
+ removeTitle: Strings.sharedDevice,
+
+ init: function () {
+ var self = this, readonly, deviceReadonly;
+ deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('administrator');
+ readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('administrator');
+ this.lookupReference('toolbarAddButton').setDisabled(readonly || deviceReadonly);
+ this.lookupReference('toolbarDeviceMenu').setHidden(readonly || deviceReadonly);
+
+ setInterval(function () {
+ self.getView().getView().refresh();
+ }, Traccar.Style.refreshPeriod);
+ },
+
+ onCommandClick: function () {
+ var device, deviceId, dialog, typesStore, commandsStore;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ deviceId = device.get('id');
+
+ dialog = Ext.create('Traccar.view.dialog.SendCommand');
+ dialog.deviceId = deviceId;
+
+ commandsStore = dialog.lookupReference('commandsComboBox').getStore();
+ commandsStore.getProxy().setExtraParam('deviceId', deviceId);
+ if (!Traccar.app.getPreference('limitCommands', false)) {
+ commandsStore.add({
+ id: 0,
+ description: Strings.sharedNew
+ });
+ }
+ commandsStore.load({
+ addRecords: true
+ });
+
+ typesStore = dialog.lookupReference('commandType').getStore();
+ typesStore.getProxy().setExtraParam('deviceId', deviceId);
+ typesStore.load();
+
+ dialog.show();
+ },
+
+ updateButtons: function (selected) {
+ var readonly, deviceReadonly, empty, deviceMenu;
+ deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('administrator');
+ readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('administrator');
+ empty = selected.length === 0;
+ this.lookupReference('toolbarEditButton').setDisabled(empty || readonly || deviceReadonly);
+ this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly);
+ deviceMenu = this.lookupReference('toolbarDeviceMenu');
+ deviceMenu.device = empty ? null : selected[0];
+ deviceMenu.setDisabled(empty);
+ this.lookupReference('deviceCommandButton').setDisabled(empty || readonly);
+ },
+
+ onSelectionChange: function (el, records) {
+ if (records && records.length) {
+ this.updateButtons(records);
+ this.fireEvent('selectdevice', records[0], true);
+ }
+ },
+
+ selectDevice: function (device) {
+ this.getView().getSelectionModel().select([device], false, true);
+ this.updateButtons(this.getView().getSelectionModel().getSelected().items);
+ this.getView().getView().focusRow(device);
+ },
+
+ deselectDevice: function (object) {
+ if (object) {
+ this.deselectFeature();
+ }
+ },
+
+ onUpdateDevice: function () {
+ this.updateButtons(this.getView().getSelectionModel().getSelected().items);
+ },
+
+ deselectFeature: function () {
+ this.getView().getSelectionModel().deselectAll();
+ }
+});
diff --git a/legacy/web/app/view/edit/Drivers.js b/legacy/web/app/view/edit/Drivers.js
new file mode 100644
index 00000000..7bd10a68
--- /dev/null
+++ b/legacy/web/app/view/edit/Drivers.js
@@ -0,0 +1,54 @@
+/*
+ * 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.edit.Drivers', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'driversView',
+
+ requires: [
+ 'Traccar.view.edit.DriversController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'drivers',
+ store: 'Drivers',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.deviceIdentifier,
+ dataIndex: 'uniqueId',
+ filter: 'string'
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/DriversController.js b/legacy/web/app/view/edit/DriversController.js
new file mode 100644
index 00000000..6c8a63cc
--- /dev/null
+++ b/legacy/web/app/view/edit/DriversController.js
@@ -0,0 +1,31 @@
+/*
+ * 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.edit.DriversController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.drivers',
+
+ requires: [
+ 'Traccar.view.dialog.Driver',
+ 'Traccar.model.Driver'
+ ],
+
+ objectModel: 'Traccar.model.Driver',
+ objectDialog: 'Traccar.view.dialog.Driver',
+ removeTitle: Strings.sharedDriver
+});
diff --git a/legacy/web/app/view/edit/Geofences.js b/legacy/web/app/view/edit/Geofences.js
new file mode 100644
index 00000000..0e1e6773
--- /dev/null
+++ b/legacy/web/app/view/edit/Geofences.js
@@ -0,0 +1,63 @@
+/*
+ * 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.edit.Geofences', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'geofencesView',
+
+ requires: [
+ 'Traccar.view.edit.GeofencesController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'geofences',
+ store: 'Geofences',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.sharedDescription,
+ dataIndex: 'description',
+ filter: 'string'
+ }, {
+ text: Strings.sharedCalendar,
+ dataIndex: 'calendarId',
+ hidden: true,
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'AllCalendars'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('calendarId')
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/GeofencesController.js b/legacy/web/app/view/edit/GeofencesController.js
new file mode 100644
index 00000000..73d367ac
--- /dev/null
+++ b/legacy/web/app/view/edit/GeofencesController.js
@@ -0,0 +1,30 @@
+/*
+ * 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.edit.GeofencesController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.geofences',
+
+ requires: [
+ 'Traccar.view.dialog.Geofence',
+ 'Traccar.model.Geofence'
+ ],
+
+ objectModel: 'Traccar.model.Geofence',
+ objectDialog: 'Traccar.view.dialog.Geofence',
+ removeTitle: Strings.sharedGeofence
+});
diff --git a/legacy/web/app/view/edit/Groups.js b/legacy/web/app/view/edit/Groups.js
new file mode 100644
index 00000000..8b09316c
--- /dev/null
+++ b/legacy/web/app/view/edit/Groups.js
@@ -0,0 +1,109 @@
+/*
+ * 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.edit.Groups', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'groupsView',
+
+ requires: [
+ 'Traccar.AttributeFormatter',
+ 'Traccar.view.edit.GroupsController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'groups',
+ store: 'Groups',
+
+ tbar: {
+ xtype: 'editToolbar',
+ items: [{
+ xtype: 'button',
+ disabled: true,
+ handler: 'onGeofencesClick',
+ reference: 'toolbarGeofencesButton',
+ glyph: 'xf21d@FontAwesome',
+ tooltip: Strings.sharedGeofences,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onAttributesClick',
+ reference: 'toolbarAttributesButton',
+ glyph: 'xf0ae@FontAwesome',
+ tooltip: Strings.sharedComputedAttributes,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onDriversClick',
+ reference: 'toolbarDriversButton',
+ glyph: 'xf084@FontAwesome',
+ tooltip: Strings.sharedDrivers,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onCommandsClick',
+ reference: 'toolbarCommandsButton',
+ glyph: 'xf093@FontAwesome',
+ tooltip: Strings.sharedSavedCommands,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onNotificationsClick',
+ reference: 'toolbarNotificationsButton',
+ glyph: 'xf003@FontAwesome',
+ tooltip: Strings.sharedNotifications,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onMaintenancesClick',
+ reference: 'toolbarMaintenancesButton',
+ glyph: 'xf0ad@FontAwesome',
+ tooltip: Strings.sharedMaintenance,
+ tooltipType: 'title'
+ }]
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.groupDialog,
+ dataIndex: 'groupId',
+ hidden: true,
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'AllGroups'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('groupId')
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/GroupsController.js b/legacy/web/app/view/edit/GroupsController.js
new file mode 100644
index 00000000..ae96a248
--- /dev/null
+++ b/legacy/web/app/view/edit/GroupsController.js
@@ -0,0 +1,141 @@
+/*
+ * 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.edit.GroupsController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.groups',
+
+ requires: [
+ 'Traccar.view.dialog.Group',
+ 'Traccar.view.permissions.Geofences',
+ 'Traccar.view.permissions.ComputedAttributes',
+ 'Traccar.view.permissions.Drivers',
+ 'Traccar.view.permissions.SavedCommands',
+ 'Traccar.view.permissions.Maintenances',
+ 'Traccar.view.BaseWindow',
+ 'Traccar.model.Group'
+ ],
+
+ objectModel: 'Traccar.model.Group',
+ objectDialog: 'Traccar.view.dialog.Group',
+ removeTitle: Strings.groupDialog,
+
+ init: function () {
+ this.lookupReference('toolbarDriversButton').setHidden(
+ Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers'));
+ this.lookupReference('toolbarAttributesButton').setHidden(
+ Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes'));
+ this.lookupReference('toolbarCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false));
+ this.lookupReference('toolbarMaintenancesButton').setHidden(
+ Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance'));
+ },
+
+ onGeofencesClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedGeofences,
+ items: {
+ xtype: 'linkGeofencesView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'geofenceId',
+ storeName: 'Geofences',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
+ onAttributesClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedComputedAttributes,
+ items: {
+ xtype: 'linkComputedAttributesView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'attributeId',
+ storeName: 'ComputedAttributes',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
+ onDriversClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedDrivers,
+ items: {
+ xtype: 'linkDriversView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'driverId',
+ storeName: 'Drivers',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
+ onCommandsClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedSavedCommands,
+ items: {
+ xtype: 'linkSavedCommandsView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'commandId',
+ storeName: 'Commands',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
+ onNotificationsClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedNotifications,
+ items: {
+ xtype: 'linkNotificationsView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'notificationId',
+ storeName: 'Notifications',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
+ onMaintenancesClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedMaintenance,
+ items: {
+ xtype: 'linkMaintenancesView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'maintenanceId',
+ storeName: 'Maintenances',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
+ onSelectionChange: function (selection, selected) {
+ var disabled = selected.length === 0;
+ this.lookupReference('toolbarGeofencesButton').setDisabled(disabled);
+ this.lookupReference('toolbarAttributesButton').setDisabled(disabled);
+ this.lookupReference('toolbarDriversButton').setDisabled(disabled);
+ this.lookupReference('toolbarCommandsButton').setDisabled(disabled);
+ this.lookupReference('toolbarNotificationsButton').setDisabled(disabled);
+ this.lookupReference('toolbarMaintenancesButton').setDisabled(disabled);
+ this.callParent(arguments);
+ }
+});
diff --git a/legacy/web/app/view/edit/Maintenances.js b/legacy/web/app/view/edit/Maintenances.js
new file mode 100644
index 00000000..da129154
--- /dev/null
+++ b/legacy/web/app/view/edit/Maintenances.js
@@ -0,0 +1,77 @@
+/*
+ * 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.edit.Maintenances', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'maintenancesView',
+
+ requires: [
+ 'Traccar.view.edit.MaintenancesController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'maintenances',
+ store: 'Maintenances',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.sharedType,
+ dataIndex: 'type',
+ filter: {
+ type: 'list',
+ idField: 'key',
+ labelField: 'name',
+ store: 'MaintenanceTypes'
+ },
+ renderer: function (value) {
+ var attribute = Ext.getStore('MaintenanceTypes').getById(value);
+ return attribute && attribute.get('name') || value;
+ }
+ }, {
+ text: Strings.maintenanceStart,
+ dataIndex: 'start',
+ renderer: function (value, metaData, record) {
+ return Traccar.AttributeFormatter.renderAttribute(
+ value, Ext.getStore('MaintenanceTypes').getById(record.get('type')));
+ }
+ }, {
+ text: Strings.maintenancePeriod,
+ dataIndex: 'period',
+ renderer: function (value, metaData, record) {
+ return Traccar.AttributeFormatter.renderAttribute(
+ value, Ext.getStore('MaintenanceTypes').getById(record.get('type')));
+ }
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/MaintenancesController.js b/legacy/web/app/view/edit/MaintenancesController.js
new file mode 100644
index 00000000..19762e61
--- /dev/null
+++ b/legacy/web/app/view/edit/MaintenancesController.js
@@ -0,0 +1,31 @@
+/*
+ * 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.edit.MaintenancesController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.maintenances',
+
+ requires: [
+ 'Traccar.view.dialog.Maintenance',
+ 'Traccar.model.Maintenance'
+ ],
+
+ objectModel: 'Traccar.model.Maintenance',
+ objectDialog: 'Traccar.view.dialog.Maintenance',
+ removeTitle: Strings.sharedMaintenance
+});
diff --git a/legacy/web/app/view/edit/Notifications.js b/legacy/web/app/view/edit/Notifications.js
new file mode 100644
index 00000000..9cf97b19
--- /dev/null
+++ b/legacy/web/app/view/edit/Notifications.js
@@ -0,0 +1,111 @@
+/*
+ * 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.edit.Notifications', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'notificationsView',
+
+ requires: [
+ 'Traccar.view.edit.NotificationsController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'notifications',
+ store: 'Notifications',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.notificationType,
+ dataIndex: 'type',
+ flex: 2,
+ renderer: function (value) {
+ return Traccar.app.getEventString(value);
+ },
+ filter: {
+ type: 'list',
+ idField: 'type',
+ labelField: 'name',
+ store: 'AllNotificationTypes'
+ }
+ }, {
+ text: Strings.notificationAlways,
+ dataIndex: 'always',
+ renderer: Traccar.AttributeFormatter.getFormatter('always'),
+ filter: 'boolean'
+ }, {
+ text: Strings.sharedAlarms,
+ dataIndex: 'attributes',
+ renderer: function (value) {
+ var i, key, result = '', alarms = value && value['alarms'];
+ if (alarms) {
+ alarms = alarms.split(',');
+ for (i = 0; i < alarms.length; i++) {
+ key = 'alarm' + alarms[i].charAt(0).toUpperCase() + alarms[i].slice(1);
+ if (result) {
+ result += ', ';
+ }
+ result += Strings[key] || key;
+ }
+ }
+ return result;
+ }
+ }, {
+ text: Strings.notificationNotificators,
+ dataIndex: 'notificators',
+ flex: 2,
+ filter: {
+ type: 'arraylist',
+ idField: 'type',
+ labelField: 'name',
+ store: 'AllNotificators'
+ },
+ renderer: function (value) {
+ var result = '', i, notificators;
+ if (value) {
+ notificators = value.split(/[ ,]+/).filter(Boolean);
+ for (i = 0; i < notificators.length; i++) {
+ result += Traccar.app.getNotificatorString(notificators[i]) + (i < notificators.length - 1 ? ', ' : '');
+ }
+ }
+ return result;
+ }
+ }, {
+ text: Strings.sharedCalendar,
+ dataIndex: 'calendarId',
+ hidden: true,
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'AllCalendars'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('calendarId')
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/NotificationsController.js b/legacy/web/app/view/edit/NotificationsController.js
new file mode 100644
index 00000000..ad22a686
--- /dev/null
+++ b/legacy/web/app/view/edit/NotificationsController.js
@@ -0,0 +1,31 @@
+/*
+ * 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.edit.NotificationsController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.notifications',
+
+ requires: [
+ 'Traccar.view.dialog.Notification',
+ 'Traccar.model.Notification'
+ ],
+
+ objectModel: 'Traccar.model.Notification',
+ objectDialog: 'Traccar.view.dialog.Notification',
+ removeTitle: Strings.sharedNotification
+});
diff --git a/legacy/web/app/view/edit/SavedCommands.js b/legacy/web/app/view/edit/SavedCommands.js
new file mode 100644
index 00000000..9e5f4869
--- /dev/null
+++ b/legacy/web/app/view/edit/SavedCommands.js
@@ -0,0 +1,65 @@
+/*
+ * 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.edit.SavedCommands', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'savedCommandsView',
+
+ requires: [
+ 'Traccar.view.edit.SavedCommandsController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'savedCommands',
+ store: 'Commands',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedDescription,
+ dataIndex: 'description',
+ filter: 'string'
+ }, {
+ text: Strings.sharedType,
+ dataIndex: 'type',
+ filter: {
+ type: 'list',
+ idField: 'type',
+ labelField: 'name',
+ store: 'AllCommandTypes'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('commandType')
+ }, {
+ text: Strings.commandSendSms,
+ dataIndex: 'textChannel',
+ renderer: Traccar.AttributeFormatter.getFormatter('textChannel'),
+ filter: 'boolean'
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/SavedCommandsController.js b/legacy/web/app/view/edit/SavedCommandsController.js
new file mode 100644
index 00000000..1511661e
--- /dev/null
+++ b/legacy/web/app/view/edit/SavedCommandsController.js
@@ -0,0 +1,31 @@
+/*
+ * 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.edit.SavedCommandsController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.savedCommands',
+
+ requires: [
+ 'Traccar.view.dialog.SavedCommand',
+ 'Traccar.model.Command'
+ ],
+
+ objectModel: 'Traccar.model.Command',
+ objectDialog: 'Traccar.view.dialog.SavedCommand',
+ removeTitle: Strings.sharedSavedCommand
+});
diff --git a/legacy/web/app/view/edit/Toolbar.js b/legacy/web/app/view/edit/Toolbar.js
new file mode 100644
index 00000000..6999030b
--- /dev/null
+++ b/legacy/web/app/view/edit/Toolbar.js
@@ -0,0 +1,49 @@
+/*
+ * 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.edit.Toolbar', {
+ extend: 'Ext.toolbar.Toolbar',
+ xtype: 'editToolbar',
+
+ initComponent: function () {
+ this.callParent(arguments);
+ this.add(0, [{
+ xtype: 'button',
+ handler: 'onAddClick',
+ reference: 'toolbarAddButton',
+ glyph: 'xf067@FontAwesome',
+ tooltip: Strings.sharedAdd,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onEditClick',
+ reference: 'toolbarEditButton',
+ glyph: 'xf040@FontAwesome',
+ tooltip: Strings.sharedEdit,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onRemoveClick',
+ reference: 'toolbarRemoveButton',
+ glyph: 'xf00d@FontAwesome',
+ tooltip: Strings.sharedRemove,
+ tooltipType: 'title'
+ }]);
+ }
+});
diff --git a/legacy/web/app/view/edit/ToolbarController.js b/legacy/web/app/view/edit/ToolbarController.js
new file mode 100644
index 00000000..d3ca9de6
--- /dev/null
+++ b/legacy/web/app/view/edit/ToolbarController.js
@@ -0,0 +1,70 @@
+/*
+ * 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.edit.ToolbarController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.toolbarController',
+
+ onAddClick: function () {
+ var dialog, objectInstance = Ext.create(this.objectModel);
+ objectInstance.store = this.getView().getStore();
+ if (objectInstance.store instanceof Ext.data.ChainedStore) {
+ objectInstance.store = objectInstance.store.getSource();
+ }
+ dialog = Ext.create(this.objectDialog);
+ dialog.down('form').loadRecord(objectInstance);
+ dialog.show();
+ },
+
+ onEditClick: function () {
+ var dialog, objectInstance = this.getView().getSelectionModel().getSelection()[0];
+ dialog = Ext.create(this.objectDialog);
+ dialog.down('form').loadRecord(objectInstance);
+ dialog.show();
+ },
+
+ onRemoveClick: function () {
+ var objectInstance = this.getView().getSelectionModel().getSelection()[0];
+ Ext.Msg.show({
+ title: this.removeTitle,
+ message: Strings.sharedRemoveConfirm,
+ buttons: Ext.Msg.YESNO,
+ buttonText: {
+ yes: Strings.sharedRemove,
+ no: Strings.sharedCancel
+ },
+ fn: function (btn) {
+ var store = objectInstance.store;
+ if (btn === 'yes') {
+ store.remove(objectInstance);
+ store.sync({
+ failure: function (batch) {
+ store.rejectChanges();
+ Traccar.app.showError(batch.exceptions[0].getError().response);
+ }
+ });
+ }
+ }
+ });
+ },
+
+ onSelectionChange: function (selection, selected) {
+ var disabled = selected.length === 0;
+ this.lookupReference('toolbarEditButton').setDisabled(disabled);
+ this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
+ }
+});
diff --git a/legacy/web/app/view/edit/Users.js b/legacy/web/app/view/edit/Users.js
new file mode 100644
index 00000000..5d9a14f0
--- /dev/null
+++ b/legacy/web/app/view/edit/Users.js
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2015 - 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.edit.Users', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'usersView',
+
+ requires: [
+ 'Traccar.view.edit.UsersController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'users',
+ store: 'Users',
+
+ tbar: {
+ xtype: 'editToolbar',
+ scrollable: true,
+ items: [{
+ disabled: true,
+ handler: 'onGeofencesClick',
+ reference: 'userGeofencesButton',
+ glyph: 'xf21d@FontAwesome',
+ tooltip: Strings.sharedGeofences,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onDevicesClick',
+ reference: 'userDevicesButton',
+ glyph: 'xf248@FontAwesome',
+ tooltip: Strings.deviceTitle,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onGroupsClick',
+ reference: 'userGroupsButton',
+ glyph: 'xf247@FontAwesome',
+ tooltip: Strings.settingsGroups,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onUsersClick',
+ reference: 'userUsersButton',
+ glyph: 'xf0c0@FontAwesome',
+ tooltip: Strings.settingsUsers,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onNotificationsClick',
+ reference: 'userNotificationsButton',
+ glyph: 'xf003@FontAwesome',
+ tooltip: Strings.sharedNotifications,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onCalendarsClick',
+ reference: 'userCalendarsButton',
+ glyph: 'xf073@FontAwesome',
+ tooltip: Strings.sharedCalendars,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onAttributesClick',
+ reference: 'userAttributesButton',
+ glyph: 'xf0ae@FontAwesome',
+ tooltip: Strings.sharedComputedAttributes,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onDriversClick',
+ reference: 'userDriversButton',
+ glyph: 'xf084@FontAwesome',
+ tooltip: Strings.sharedDrivers,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onCommandsClick',
+ reference: 'userCommandsButton',
+ glyph: 'xf093@FontAwesome',
+ tooltip: Strings.sharedSavedCommands,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onMaintenancesClick',
+ reference: 'userMaintenancesButton',
+ glyph: 'xf0ad@FontAwesome',
+ tooltip: Strings.sharedMaintenance,
+ tooltipType: 'title'
+ }]
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.userEmail,
+ dataIndex: 'email',
+ filter: 'string'
+ }, {
+ text: Strings.userAdmin,
+ dataIndex: 'administrator',
+ renderer: Traccar.AttributeFormatter.getFormatter('administrator'),
+ filter: 'boolean'
+ }, {
+ text: Strings.serverReadonly,
+ dataIndex: 'readonly',
+ hidden: true,
+ renderer: Traccar.AttributeFormatter.getFormatter('readonly'),
+ filter: 'boolean'
+ }, {
+ text: Strings.userDeviceReadonly,
+ dataIndex: 'deviceReadonly',
+ renderer: Traccar.AttributeFormatter.getFormatter('deviceReadonly'),
+ hidden: true,
+ filter: 'boolean'
+ }, {
+ text: Strings.sharedDisabled,
+ dataIndex: 'disabled',
+ renderer: Traccar.AttributeFormatter.getFormatter('disabled'),
+ filter: 'boolean'
+ }, {
+ text: Strings.userExpirationTime,
+ dataIndex: 'expirationTime',
+ hidden: true,
+ renderer: Traccar.AttributeFormatter.getFormatter('expirationTime'),
+ filter: 'date'
+ }]
+ }
+});
diff --git a/legacy/web/app/view/edit/UsersController.js b/legacy/web/app/view/edit/UsersController.js
new file mode 100644
index 00000000..9e810435
--- /dev/null
+++ b/legacy/web/app/view/edit/UsersController.js
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2015 - 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.edit.UsersController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.users',
+
+ requires: [
+ 'Traccar.view.dialog.User',
+ 'Traccar.view.permissions.Devices',
+ 'Traccar.view.permissions.Groups',
+ 'Traccar.view.permissions.Geofences',
+ 'Traccar.view.permissions.Calendars',
+ 'Traccar.view.permissions.Users',
+ 'Traccar.view.permissions.ComputedAttributes',
+ 'Traccar.view.permissions.Drivers',
+ 'Traccar.view.permissions.SavedCommands',
+ 'Traccar.view.permissions.Notifications',
+ 'Traccar.view.permissions.Maintenances',
+ 'Traccar.view.BaseWindow',
+ 'Traccar.model.User'
+ ],
+
+ objectModel: 'Traccar.model.User',
+ objectDialog: 'Traccar.view.dialog.User',
+ removeTitle: Strings.settingsUser,
+
+ init: function () {
+ Ext.getStore('Users').load();
+ this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('administrator'));
+ this.lookupReference('userDriversButton').setHidden(
+ Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers'));
+ this.lookupReference('userAttributesButton').setHidden(
+ Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes'));
+ this.lookupReference('userCalendarsButton').setHidden(
+ Traccar.app.getBooleanAttributePreference('ui.disableCalendars'));
+ this.lookupReference('userCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false));
+ this.lookupReference('userMaintenancesButton').setHidden(
+ Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance'));
+ },
+
+ onEditClick: function () {
+ var dialog, user = this.getView().getSelectionModel().getSelection()[0];
+ dialog = Ext.create('Traccar.view.dialog.User', {
+ selfEdit: user.get('id') === Traccar.app.getUser().get('id')
+ });
+ dialog.down('form').loadRecord(user);
+ dialog.show();
+ },
+
+ onAddClick: function () {
+ var user, dialog;
+ user = Ext.create('Traccar.model.User');
+ if (Traccar.app.getUser().get('administrator')) {
+ user.set('deviceLimit', -1);
+ }
+ if (Traccar.app.getUser().get('expirationTime')) {
+ user.set('expirationTime', Traccar.app.getUser().get('expirationTime'));
+ }
+ dialog = Ext.create('Traccar.view.dialog.User');
+ dialog.down('form').loadRecord(user);
+ dialog.show();
+ },
+
+ onDevicesClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.getStore('AllGroups').load();
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.deviceTitle,
+ items: {
+ xtype: 'linkDevicesView',
+ baseObjectName: 'userId',
+ linkObjectName: 'deviceId',
+ storeName: 'AllDevices',
+ linkStoreName: 'Devices',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onGroupsClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.settingsGroups,
+ items: {
+ xtype: 'linkGroupsView',
+ baseObjectName: 'userId',
+ linkObjectName: 'groupId',
+ storeName: 'AllGroups',
+ linkStoreName: 'Groups',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onGeofencesClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedGeofences,
+ items: {
+ xtype: 'linkGeofencesView',
+ baseObjectName: 'userId',
+ linkObjectName: 'geofenceId',
+ storeName: 'AllGeofences',
+ linkStoreName: 'Geofences',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onNotificationsClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedNotifications,
+ items: {
+ xtype: 'linkNotificationsView',
+ baseObjectName: 'userId',
+ linkObjectName: 'notificationId',
+ storeName: 'AllNotifications',
+ linkStoreName: 'Notifications',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onCalendarsClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedCalendars,
+ items: {
+ xtype: 'linkCalendarsView',
+ baseObjectName: 'userId',
+ linkObjectName: 'calendarId',
+ storeName: 'AllCalendars',
+ linkStoreName: 'Calendars',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onUsersClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.settingsUsers,
+ items: {
+ xtype: 'linkUsersView',
+ baseObjectName: 'userId',
+ linkObjectName: 'managedUserId',
+ storeName: 'Users',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onAttributesClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedComputedAttributes,
+ items: {
+ xtype: 'linkComputedAttributesView',
+ baseObjectName: 'userId',
+ linkObjectName: 'attributeId',
+ storeName: 'AllComputedAttributes',
+ linkStoreName: 'ComputedAttributes',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onDriversClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedDrivers,
+ items: {
+ xtype: 'linkDriversView',
+ baseObjectName: 'userId',
+ linkObjectName: 'driverId',
+ storeName: 'AllDrivers',
+ linkStoreName: 'Drivers',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onCommandsClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedSavedCommands,
+ items: {
+ xtype: 'linkSavedCommandsView',
+ baseObjectName: 'userId',
+ linkObjectName: 'commandId',
+ storeName: 'AllCommands',
+ linkStoreName: 'Commands',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onMaintenancesClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedMaintenance,
+ items: {
+ xtype: 'linkMaintenancesView',
+ baseObjectName: 'userId',
+ linkObjectName: 'maintenanceId',
+ storeName: 'AllMaintenances',
+ linkStoreName: 'Maintenances',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onSelectionChange: function (selection, selected) {
+ var disabled = selected.length === 0;
+ this.lookupReference('userDevicesButton').setDisabled(disabled);
+ this.lookupReference('userGroupsButton').setDisabled(disabled);
+ this.lookupReference('userGeofencesButton').setDisabled(disabled);
+ this.lookupReference('userNotificationsButton').setDisabled(disabled);
+ this.lookupReference('userCalendarsButton').setDisabled(disabled);
+ this.lookupReference('userAttributesButton').setDisabled(disabled);
+ this.lookupReference('userDriversButton').setDisabled(disabled);
+ this.lookupReference('userCommandsButton').setDisabled(disabled);
+ this.lookupReference('userMaintenancesButton').setDisabled(disabled);
+ this.lookupReference('userUsersButton').setDisabled(disabled || selected[0].get('userLimit') === 0);
+ this.callParent(arguments);
+ }
+});