diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/app/view/GeofenceDialog.js | 48 | ||||
-rw-r--r-- | web/app/view/SettingsMenuController.js | 4 | ||||
-rw-r--r-- | web/app/view/UserDialog.js | 12 | ||||
-rw-r--r-- | web/app/view/UserDialogController.js | 11 | ||||
-rw-r--r-- | web/app/view/UsersController.js | 9 |
5 files changed, 49 insertions, 35 deletions
diff --git a/web/app/view/GeofenceDialog.js b/web/app/view/GeofenceDialog.js index f55a8b2e..4c2781e5 100644 --- a/web/app/view/GeofenceDialog.js +++ b/web/app/view/GeofenceDialog.js @@ -28,26 +28,36 @@ Ext.define('Traccar.view.GeofenceDialog', { items: { xtype: 'form', items: [{ - xtype: 'textfield', - name: 'name', - fieldLabel: Strings.sharedName + xtype: 'fieldset', + title: Strings.sharedRequired, + items: [{ + xtype: 'textfield', + name: 'name', + fieldLabel: Strings.sharedName + }] }, { - xtype: 'textfield', - name: 'description', - fieldLabel: Strings.sharedDescription - }, { - xtype: 'combobox', - name: 'calendarId', - store: 'Calendars', - queryMode: 'local', - displayField: 'name', - valueField: 'id', - fieldLabel: Strings.sharedCalendar - }, { - xtype: 'hiddenfield', - name: 'area', - allowBlank: false, - reference: 'areaField' + xtype: 'fieldset', + title: Strings.sharedExtra, + collapsible: true, + collapsed: true, + items: [{ + xtype: 'textfield', + name: 'description', + fieldLabel: Strings.sharedDescription + }, { + xtype: 'combobox', + name: 'calendarId', + store: 'Calendars', + queryMode: 'local', + displayField: 'name', + valueField: 'id', + fieldLabel: Strings.sharedCalendar + }, { + xtype: 'hiddenfield', + name: 'area', + allowBlank: false, + reference: 'areaField' + }] }] }, diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 41867f61..8d1e5634 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -61,7 +61,9 @@ Ext.define('Traccar.view.SettingsMenuController', { }, onUserClick: function () { - var dialog = Ext.create('Traccar.view.UserDialog'); + var dialog = Ext.create('Traccar.view.UserDialog', { + selfEdit: true + }); dialog.down('form').loadRecord(Traccar.app.getUser()); dialog.lookupReference('testNotificationButton').setHidden(false); dialog.show(); diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 5e4e00a8..d4235e9e 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -123,7 +123,7 @@ Ext.define('Traccar.view.UserDialog', { uncheckedValue: false, name: 'disabled', fieldLabel: Strings.userDisabled, - hidden: true, + disabled: true, reference: 'disabledField' }, { xtype: 'checkboxfield', @@ -131,8 +131,7 @@ Ext.define('Traccar.view.UserDialog', { uncheckedValue: false, name: 'admin', fieldLabel: Strings.userAdmin, - allowBlank: false, - hidden: true, + disabled: true, reference: 'adminField' }, { xtype: 'checkboxfield', @@ -140,8 +139,7 @@ Ext.define('Traccar.view.UserDialog', { uncheckedValue: false, name: 'readonly', fieldLabel: Strings.serverReadonly, - allowBlank: false, - hidden: true, + disabled: true, reference: 'readonlyField' }, { xtype: 'checkboxfield', @@ -186,10 +184,6 @@ Ext.define('Traccar.view.UserDialog', { }] }, - listeners: { - show: 'onShow' - }, - buttons: [{ text: Strings.sharedAttributes, handler: 'showAttributesView' diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index d187dec0..f001dead 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -19,16 +19,15 @@ Ext.define('Traccar.view.UserDialogController', { extend: 'Traccar.view.MapPickerDialogController', alias: 'controller.userDialog', - onShow: function () { + init: function () { if (Traccar.app.getUser().get('admin')) { - this.lookupReference('adminField').setHidden(false); + this.lookupReference('adminField').setDisabled(false); this.lookupReference('deviceLimitField').setDisabled(false); this.lookupReference('userLimitField').setDisabled(false); } - if (Traccar.app.getUser().get('admin') || - Traccar.app.getUser().getId() !== this.getView().down('form').getRecord().getId()) { - this.lookupReference('readonlyField').setHidden(false); - this.lookupReference('disabledField').setHidden(false); + if (Traccar.app.getUser().get('admin') || !this.getView().selfEdit) { + this.lookupReference('readonlyField').setDisabled(false); + this.lookupReference('disabledField').setDisabled(false); this.lookupReference('expirationTimeField').setDisabled(false); this.lookupReference('deviceReadonlyField').setDisabled(false); } diff --git a/web/app/view/UsersController.js b/web/app/view/UsersController.js index 2744be74..a79f9586 100644 --- a/web/app/view/UsersController.js +++ b/web/app/view/UsersController.js @@ -41,6 +41,15 @@ Ext.define('Traccar.view.UsersController', { this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('admin')); }, + onEditClick: function () { + var dialog, user = this.getView().getSelectionModel().getSelection()[0]; + dialog = Ext.create('Traccar.view.UserDialog', { + 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'); |