aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/user
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/user')
-rw-r--r--web/app/view/user/User.js61
-rw-r--r--web/app/view/user/UserController.js84
-rw-r--r--web/app/view/user/UserDialog.js99
-rw-r--r--web/app/view/user/UserDialogController.js52
4 files changed, 0 insertions, 296 deletions
diff --git a/web/app/view/user/User.js b/web/app/view/user/User.js
deleted file mode 100644
index b5d216aea..000000000
--- a/web/app/view/user/User.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-Ext.define('Traccar.view.user.User', {
- extend: 'Ext.grid.Panel',
- xtype: 'userView',
-
- requires: [
- 'Traccar.view.user.UserController'
- ],
-
- controller: 'user',
- store: 'Users',
-
- selType: 'rowmodel',
-
- tbar: [{
- text: strings.sharedAdd,
- handler: 'onAddClick',
- reference: 'deviceAddButton'
- }, {
- text: strings.sharedEdit,
- disabled: true,
- handler: 'onEditClick',
- reference: 'userEditButton'
- }, {
- text: strings.sharedRemove,
- disabled: true,
- handler: 'onRemoveClick',
- reference: 'userRemoveButton'
- }, {
- text: strings.deviceTitle,
- disabled: true,
- handler: 'onDevicesClick',
- reference: 'userDevicesButton'
- }],
-
- listeners: {
- selectionchange: 'onSelectionChange'
- },
-
- columns: [
- { text: strings.userName, dataIndex: 'name', flex: 1 },
- { text: strings.userEmail, dataIndex: 'email', flex: 1 },
- { text: strings.userAdmin, dataIndex: 'admin', flex: 1 }
- ]
-
-});
diff --git a/web/app/view/user/UserController.js b/web/app/view/user/UserController.js
deleted file mode 100644
index 507fd5a5c..000000000
--- a/web/app/view/user/UserController.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-Ext.define('Traccar.view.user.UserController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.user',
-
- requires: [
- 'Traccar.view.user.UserDialog'
- ],
-
- init: function () {
- Ext.getStore('Users').load();
- },
-
- onAddClick: function () {
- var user = Ext.create('Traccar.model.User');
- var dialog = Ext.create('Traccar.view.user.UserDialog');
- dialog.down('form').loadRecord(user);
- dialog.show();
- },
-
- onEditClick: function () {
- var user = this.getView().getSelectionModel().getSelection()[0];
- var dialog = Ext.create('Traccar.view.user.UserDialog');
- dialog.down('form').loadRecord(user);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var user = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: strings.settingsUser,
- message: strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: strings.sharedRemove,
- no: strings.sharedCancel
- },
- fn: function (btn) {
- if (btn === 'yes') {
- var store = Ext.getStore('Users');
- store.remove(user);
- store.sync();
- }
- }
- });
- },
-
- onDevicesClick: function () {
- // TODO show devices
- /*Ext.create('Ext.window.Window', {
- title: strings.settingsUsers,
- width: styles.windowWidth,
- height: styles.windowHeight,
- layout: 'fit',
- modal: true,
- items: {
- xtype: 'userView'
- }
- }).show();*/
- },
-
- onSelectionChange: function (selected) {
- var disabled = selected.length > 0;
- this.lookupReference('userEditButton').setDisabled(disabled);
- this.lookupReference('userRemoveButton').setDisabled(disabled);
- this.lookupReference('userDevicesButton').setDisabled(disabled);
- }
-
-});
diff --git a/web/app/view/user/UserDialog.js b/web/app/view/user/UserDialog.js
deleted file mode 100644
index d1bc68f96..000000000
--- a/web/app/view/user/UserDialog.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-Ext.define('Traccar.view.user.UserDialog', {
- extend: 'Ext.window.Window',
-
- requires: [
- 'Traccar.view.user.UserDialogController'
- ],
-
- controller: 'userDialog',
-
- bodyPadding: styles.panelPadding,
- title: strings.settingsUser,
- resizable: false,
- modal: true,
-
- items: {
- xtype: 'form',
- items: [{
- xtype: 'textfield',
- name: 'name',
- fieldLabel: strings.userName
- }, {
- xtype: 'textfield',
- name: 'email',
- fieldLabel: strings.userEmail,
- allowBlank: false
- }, {
- xtype: 'textfield',
- name: 'password',
- fieldLabel: strings.userPassword,
- inputType: 'password',
- allowBlank: false
- }, {
- xtype: 'checkboxfield',
- name: 'admin',
- fieldLabel: strings.userAdmin,
- allowBlank: false,
- disabled: true,
- reference: 'adminField'
- }, {
- xtype: 'combobox',
- name: 'map',
- fieldLabel: strings.mapLayer,
- store: 'MapTypes',
- displayField: 'name',
- valueField: 'key'
- }, {
- xtype: 'combobox',
- name: 'distanceUnit',
- fieldLabel: strings.settingsDistanceUnit,
- store: 'DistanceUnits',
- displayField: 'name',
- valueField: 'key'
- }, {
- xtype: 'combobox',
- name: 'speedUnit',
- fieldLabel: strings.settingsSpeedUnit,
- store: 'SpeedUnits',
- displayField: 'name',
- valueField: 'key'
- }, {
- xtype: 'numberfield',
- name: 'latitude',
- fieldLabel: strings.positionLatitude
- }, {
- xtype: 'numberfield',
- name: 'longitude',
- fieldLabel: strings.positionLongitude
- }, {
- xtype: 'numberfield',
- name: 'zoom',
- fieldLabel: strings.serverZoom
- }]
- },
-
- buttons: [{
- text: strings.sharedSave,
- handler: 'onSaveClick'
- }, {
- text: strings.sharedCancel,
- handler: 'onCancelClick'
- }]
-
-});
diff --git a/web/app/view/user/UserDialogController.js b/web/app/view/user/UserDialogController.js
deleted file mode 100644
index 40f938b5c..000000000
--- a/web/app/view/user/UserDialogController.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-Ext.define('Traccar.view.user.UserDialogController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.userDialog',
-
- init: function () {
- if (Traccar.app.getUser().get('admin')) {
- this.lookupReference('adminField').setDisabled(false);
- }
- },
-
- onSaveClick: function (button) {
- var dialog = button.up('window').down('form');
- dialog.updateRecord();
- var record = dialog.getRecord();
- if (record === Traccar.app.getUser()) {
- record.save();
- } else {
- var store = Ext.getStore('Users');
- if (record.phantom) {
- store.add(record);
- }
- store.sync({
- failure: function (batch) {
- store.rejectChanges(); // TODO
- Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
- }
- });
- }
- button.up('window').close();
- },
-
- onCancelClick: function (button) {
- button.up('window').close();
- }
-
-});