aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-11 10:53:33 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-11 10:53:33 +0500
commitf8e90b20d08bbd00cd7d5657c91c364b47288ae6 (patch)
treeacb2473f07a7cb02f5f7d8cdcd3f06cc2f6abce6
parent2eeb2a1bdc6a11a115a6774a49a21d88abb63056 (diff)
downloadtrackermap-web-f8e90b20d08bbd00cd7d5657c91c364b47288ae6.tar.gz
trackermap-web-f8e90b20d08bbd00cd7d5657c91c364b47288ae6.tar.bz2
trackermap-web-f8e90b20d08bbd00cd7d5657c91c364b47288ae6.zip
- Pass selfEdit parameter to UserDialog
- Group Geofence fields
-rw-r--r--web/app/view/GeofenceDialog.js48
-rw-r--r--web/app/view/SettingsMenuController.js4
-rw-r--r--web/app/view/UserDialog.js12
-rw-r--r--web/app/view/UserDialogController.js11
-rw-r--r--web/app/view/UsersController.js9
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');