aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-03 21:01:45 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-03 21:01:45 +1300
commit48f981a2a9755fb0af6497020e499bb0883e0e1f (patch)
treeac960f950e4f37aec2614a97a706aed34a1fb2db /web/app
parentd16121684ecae7646aa87616a64d60978d087bc0 (diff)
downloadtraccar-server-48f981a2a9755fb0af6497020e499bb0883e0e1f.tar.gz
traccar-server-48f981a2a9755fb0af6497020e499bb0883e0e1f.tar.bz2
traccar-server-48f981a2a9755fb0af6497020e499bb0883e0e1f.zip
Enable JavaScript strict mode
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Application.js2
-rw-r--r--web/app/AttributeFormatter.js92
-rw-r--r--web/app/ErrorManager.js46
-rw-r--r--web/app/LoginManager.js78
-rw-r--r--web/app/controller/Root.js114
-rw-r--r--web/app/model/Attribute.js30
-rw-r--r--web/app/model/Command.js30
-rw-r--r--web/app/model/Device.js32
-rw-r--r--web/app/model/Position.js96
-rw-r--r--web/app/model/Server.js94
-rw-r--r--web/app/model/User.js100
-rw-r--r--web/app/store/Attributes.js18
-rw-r--r--web/app/store/CommandTypes.js38
-rw-r--r--web/app/store/Devices.js44
-rw-r--r--web/app/store/DistanceUnits.js46
-rw-r--r--web/app/store/Languages.js34
-rw-r--r--web/app/store/LatestPositions.js12
-rw-r--r--web/app/store/MapTypes.js38
-rw-r--r--web/app/store/Positions.js26
-rw-r--r--web/app/store/SpeedUnits.js46
-rw-r--r--web/app/store/TimeUnits.js32
-rw-r--r--web/app/store/Users.js44
-rw-r--r--web/app/view/BaseDialog.js16
-rw-r--r--web/app/view/BaseEditDialog.js24
-rw-r--r--web/app/view/BaseEditDialogController.js56
-rw-r--r--web/app/view/CommandDialog.js88
-rw-r--r--web/app/view/CommandDialogController.js76
-rw-r--r--web/app/view/Device.js144
-rw-r--r--web/app/view/DeviceController.js222
-rw-r--r--web/app/view/DeviceDialog.js48
-rw-r--r--web/app/view/Login.js138
-rw-r--r--web/app/view/LoginController.js150
-rw-r--r--web/app/view/Main.js76
-rw-r--r--web/app/view/MainMobile.js62
-rw-r--r--web/app/view/Map.js123
-rw-r--r--web/app/view/MapController.js350
-rw-r--r--web/app/view/Register.js78
-rw-r--r--web/app/view/RegisterController.js46
-rw-r--r--web/app/view/Report.js196
-rw-r--r--web/app/view/ReportController.js104
-rw-r--r--web/app/view/ServerDialog.js120
-rw-r--r--web/app/view/State.js46
-rw-r--r--web/app/view/StateController.js212
-rw-r--r--web/app/view/User.js92
-rw-r--r--web/app/view/UserController.js122
-rw-r--r--web/app/view/UserDialog.js138
-rw-r--r--web/app/view/UserDialogController.js58
47 files changed, 2034 insertions, 1843 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index a0e61338f..c3f10fb42 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -14,7 +14,7 @@
* limitations under the License.
*/
(function () {
- "use strict";
+ 'use strict';
Ext.define('Traccar.Application', {
extend: 'Ext.app.Application',
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index b4720be61..fe50e0d99 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -13,49 +13,53 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.AttributeFormatter', {
- singleton: true,
-
- coordinateFormatter: function (value) {
- return value.toFixed(6);
- },
-
- speedFormatter: function (value) {
- return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit'));
- },
-
- courseFormatter: function (value) {
- var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
- return courseValues[Math.floor(value / 45)];
- },
-
- distanceFormatter: function (value) {
- return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit'));
- },
-
- defaultFormatter: function (value) {
- if (typeof value === 'number') {
- return value.toFixed(2);
- } else if (typeof value === 'boolean') {
- return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no;
- } else if (value instanceof Date) {
- return Ext.Date.format(value, styles.dateTimeFormat);
- }
- return value;
- },
-
- getFormatter: function (key) {
- if (key === 'latitude' || key === 'longitude') {
- return this.coordinateFormatter;
- } else if (key === 'speed') {
- return this.speedFormatter;
- } else if (key === 'course') {
- return this.courseFormatter;
- } else if (key === 'distance' || key === 'odometer') {
- return this.distanceFormatter;
- } else {
- return this.defaultFormatter;
+ Ext.define('Traccar.AttributeFormatter', {
+ singleton: true,
+
+ coordinateFormatter: function (value) {
+ return value.toFixed(6);
+ },
+
+ speedFormatter: function (value) {
+ return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit'));
+ },
+
+ courseFormatter: function (value) {
+ var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
+ return courseValues[Math.floor(value / 45)];
+ },
+
+ distanceFormatter: function (value) {
+ return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit'));
+ },
+
+ defaultFormatter: function (value) {
+ if (typeof value === 'number') {
+ return value.toFixed(2);
+ } else if (typeof value === 'boolean') {
+ return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no;
+ } else if (value instanceof Date) {
+ return Ext.Date.format(value, styles.dateTimeFormat);
+ }
+ return value;
+ },
+
+ getFormatter: function (key) {
+ if (key === 'latitude' || key === 'longitude') {
+ return this.coordinateFormatter;
+ } else if (key === 'speed') {
+ return this.speedFormatter;
+ } else if (key === 'course') {
+ return this.courseFormatter;
+ } else if (key === 'distance' || key === 'odometer') {
+ return this.distanceFormatter;
+ } else {
+ return this.defaultFormatter;
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/ErrorManager.js b/web/app/ErrorManager.js
index e809fa382..2a787fdea 100644
--- a/web/app/ErrorManager.js
+++ b/web/app/ErrorManager.js
@@ -13,32 +13,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.ErrorManager', {
- singleton: true,
+ Ext.define('Traccar.ErrorManager', {
+ singleton: true,
- check: function (success, response) {
- var result;
- if (success) {
- result = Ext.decode(response.responseText);
- if (result.success || result.error === undefined) {
- return true;
+ check: function (success, response) {
+ var result;
+ if (success) {
+ result = Ext.decode(response.responseText);
+ if (result.success || result.error === undefined) {
+ return true;
+ } else {
+ Ext.Msg.alert(strings.errorTitle, result.error);
+ return false;
+ }
} else {
- Ext.Msg.alert(strings.errorTitle, result.error);
+ if (response.statusText) {
+ Ext.Msg.alert(strings.errorTitle, response.statusText);
+ } else {
+ Ext.Msg.alert(strings.errorTitle, response.status.toString()); // TODO: text message
+ }
return false;
}
- } else {
- if (response.statusText) {
- Ext.Msg.alert(strings.errorTitle, response.statusText);
- } else {
- Ext.Msg.alert(strings.errorTitle, response.status.toString()); // TODO: text message
- }
- return false;
+ },
+
+ error: function (message) {
+ Ext.Msg.alert(strings.errorTitle, message);
}
- },
- error: function (message) {
- Ext.Msg.alert(strings.errorTitle, message);
- }
+ });
-});
+})();
diff --git a/web/app/LoginManager.js b/web/app/LoginManager.js
index 07445fc15..02e6e835b 100644
--- a/web/app/LoginManager.js
+++ b/web/app/LoginManager.js
@@ -13,48 +13,52 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.LoginManager', {
- singleton: true,
+ Ext.define('Traccar.LoginManager', {
+ singleton: true,
- server: function (options) {
- Ext.Ajax.request({
- scope: this,
- url: '/api/server/get',
- callback: this.onServerReturn,
- original: options
- });
- },
+ server: function (options) {
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/server/get',
+ callback: this.onServerReturn,
+ original: options
+ });
+ },
- onServerReturn: function (options, success, response) {
- options = options.original;
- if (Traccar.ErrorManager.check(success, response)) {
- var result = Ext.decode(response.responseText);
- if (result.success) {
- Traccar.app.setServer(result.data);
+ onServerReturn: function (options, success, response) {
+ options = options.original;
+ if (Traccar.ErrorManager.check(success, response)) {
+ var result = Ext.decode(response.responseText);
+ if (result.success) {
+ Traccar.app.setServer(result.data);
+ }
+ Ext.callback(options.callback, options.scope, [result.success]);
}
- Ext.callback(options.callback, options.scope, [result.success]);
- }
- },
+ },
- session: function (options) {
- Ext.Ajax.request({
- scope: this,
- url: '/api/session',
- callback: this.onSessionReturn,
- original: options
- });
- },
+ session: function (options) {
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/session',
+ callback: this.onSessionReturn,
+ original: options
+ });
+ },
- onSessionReturn: function (options, success, response) {
- var result;
- options = options.original;
- if (Traccar.ErrorManager.check(success, response)) {
- result = Ext.decode(response.responseText);
- if (result.success) {
- Traccar.app.setUser(result.data);
+ onSessionReturn: function (options, success, response) {
+ var result;
+ options = options.original;
+ if (Traccar.ErrorManager.check(success, response)) {
+ result = Ext.decode(response.responseText);
+ if (result.success) {
+ Traccar.app.setUser(result.data);
+ }
+ Ext.callback(options.callback, options.scope, [result.success]);
}
- Ext.callback(options.callback, options.scope, [result.success]);
}
- }
-});
+ });
+
+})();
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index aa2682708..3d2a82d48 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -13,64 +13,68 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.controller.Root', {
- extend: 'Ext.app.Controller',
-
- requires: [
- 'Traccar.LoginManager',
- 'Traccar.view.Login',
- 'Traccar.view.Main',
- 'Traccar.view.MainMobile'
- ],
+ Ext.define('Traccar.controller.Root', {
+ extend: 'Ext.app.Controller',
- init: function () {
- var indicator = document.createElement('div');
- indicator.className = 'state-indicator';
- document.body.appendChild(indicator);
- this.isPhone = parseInt(window.getComputedStyle(indicator).getPropertyValue('z-index'), 10) !== 0;
- },
-
- onLaunch: function () {
- Traccar.LoginManager.server({
- scope: this,
- callback: 'onServer'
- });
- },
+ requires: [
+ 'Traccar.LoginManager',
+ 'Traccar.view.Login',
+ 'Traccar.view.Main',
+ 'Traccar.view.MainMobile'
+ ],
- onServer: function () {
- Traccar.LoginManager.session({
- scope: this,
- callback: 'onSession'
- });
- },
-
- onSession: function (success) {
- if (success) {
- this.loadApp();
- } else {
- this.login = Ext.create('widget.login', {
- listeners: {
- scope: this,
- login: 'onLogin'
- }
+ init: function () {
+ var indicator = document.createElement('div');
+ indicator.className = 'state-indicator';
+ document.body.appendChild(indicator);
+ this.isPhone = parseInt(window.getComputedStyle(indicator).getPropertyValue('z-index'), 10) !== 0;
+ },
+
+ onLaunch: function () {
+ Traccar.LoginManager.server({
+ scope: this,
+ callback: 'onServer'
});
- this.login.show();
- }
- },
+ },
+
+ onServer: function () {
+ Traccar.LoginManager.session({
+ scope: this,
+ callback: 'onSession'
+ });
+ },
- onLogin: function () {
- this.login.close();
- this.loadApp();
- },
-
- loadApp: function () {
- Ext.getStore('Devices').load();
- Ext.getBody().empty();
- if (this.isPhone) {
- Ext.create('widget.mainMobile');
- } else {
- Ext.create('widget.main');
+ onSession: function (success) {
+ if (success) {
+ this.loadApp();
+ } else {
+ this.login = Ext.create('widget.login', {
+ listeners: {
+ scope: this,
+ login: 'onLogin'
+ }
+ });
+ this.login.show();
+ }
+ },
+
+ onLogin: function () {
+ this.login.close();
+ this.loadApp();
+ },
+
+ loadApp: function () {
+ Ext.getStore('Devices').load();
+ Ext.getBody().empty();
+ if (this.isPhone) {
+ Ext.create('widget.mainMobile');
+ } else {
+ Ext.create('widget.main');
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/model/Attribute.js b/web/app/model/Attribute.js
index 78acdb1d9..df53d02f0 100644
--- a/web/app/model/Attribute.js
+++ b/web/app/model/Attribute.js
@@ -13,18 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.model.Attribute', {
- extend: 'Ext.data.Model',
+ Ext.define('Traccar.model.Attribute', {
+ extend: 'Ext.data.Model',
- fields: [{
- name: 'priority',
- type: 'int'
- }, {
- name: 'name',
- type: 'string'
- }, {
- name: 'value',
- type: 'string'
- }]
-});
+ fields: [{
+ name: 'priority',
+ type: 'int'
+ }, {
+ name: 'name',
+ type: 'string'
+ }, {
+ name: 'value',
+ type: 'string'
+ }]
+ });
+
+})();
diff --git a/web/app/model/Command.js b/web/app/model/Command.js
index 3e848b57d..0eb17ec40 100644
--- a/web/app/model/Command.js
+++ b/web/app/model/Command.js
@@ -13,18 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.model.Command', {
- extend: 'Ext.data.Model',
- identifier: 'negative',
+ Ext.define('Traccar.model.Command', {
+ extend: 'Ext.data.Model',
+ identifier: 'negative',
- fields: [{
- name: 'deviceId',
- type: 'int'
- }, {
- name: 'type',
- type: 'string'
- }, {
- name: 'attributes'
- }]
-});
+ fields: [{
+ name: 'deviceId',
+ type: 'int'
+ }, {
+ name: 'type',
+ type: 'string'
+ }, {
+ name: 'attributes'
+ }]
+ });
+
+})();
diff --git a/web/app/model/Device.js b/web/app/model/Device.js
index e9ed1f680..f3fb885ba 100644
--- a/web/app/model/Device.js
+++ b/web/app/model/Device.js
@@ -13,19 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.model.Device', {
- extend: 'Ext.data.Model',
- identifier: 'negative',
+ Ext.define('Traccar.model.Device', {
+ extend: 'Ext.data.Model',
+ identifier: 'negative',
- fields: [{
- name: 'id',
- type: 'int'
- }, {
- name: 'name',
- type: 'string'
- }, {
- name: 'uniqueId',
- type: 'string'
- }]
-});
+ fields: [{
+ name: 'id',
+ type: 'int'
+ }, {
+ name: 'name',
+ type: 'string'
+ }, {
+ name: 'uniqueId',
+ type: 'string'
+ }]
+ });
+
+})();
diff --git a/web/app/model/Position.js b/web/app/model/Position.js
index 365b06115..be525c1d8 100644
--- a/web/app/model/Position.js
+++ b/web/app/model/Position.js
@@ -13,51 +13,55 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.model.Position', {
- extend: 'Ext.data.Model',
- identifier: 'negative',
+ Ext.define('Traccar.model.Position', {
+ extend: 'Ext.data.Model',
+ identifier: 'negative',
- fields: [{
- name: 'id',
- type: 'int'
- }, {
- name: 'protocol',
- type: 'string'
- }, {
- name: 'deviceId',
- type: 'int'
- }, {
- name: 'serverTime',
- type: 'date'
- }, {
- name: 'deviceTime',
- type: 'date'
- }, {
- name: 'fixTime',
- type: 'date'
- }, {
- name: 'valid',
- type: 'boolean'
- }, {
- name: 'latitude',
- type: 'float'
- }, {
- name: 'longitude',
- type: 'float'
- }, {
- name: 'altitude',
- type: 'float'
- }, {
- name: 'speed',
- type: 'float'
- }, {
- name: 'course',
- type: 'float'
- }, {
- name: 'address',
- type: 'string'
- }, {
- name: 'attributes'
- }]
-});
+ fields: [{
+ name: 'id',
+ type: 'int'
+ }, {
+ name: 'protocol',
+ type: 'string'
+ }, {
+ name: 'deviceId',
+ type: 'int'
+ }, {
+ name: 'serverTime',
+ type: 'date'
+ }, {
+ name: 'deviceTime',
+ type: 'date'
+ }, {
+ name: 'fixTime',
+ type: 'date'
+ }, {
+ name: 'valid',
+ type: 'boolean'
+ }, {
+ name: 'latitude',
+ type: 'float'
+ }, {
+ name: 'longitude',
+ type: 'float'
+ }, {
+ name: 'altitude',
+ type: 'float'
+ }, {
+ name: 'speed',
+ type: 'float'
+ }, {
+ name: 'course',
+ type: 'float'
+ }, {
+ name: 'address',
+ type: 'string'
+ }, {
+ name: 'attributes'
+ }]
+ });
+
+})();
diff --git a/web/app/model/Server.js b/web/app/model/Server.js
index 2ed2c456f..1cf687a90 100644
--- a/web/app/model/Server.js
+++ b/web/app/model/Server.js
@@ -13,52 +13,56 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.model.Server', {
- extend: 'Ext.data.Model',
- identifier: 'negative',
+ Ext.define('Traccar.model.Server', {
+ extend: 'Ext.data.Model',
+ identifier: 'negative',
- fields: [{
- name: 'id',
- type: 'int'
- }, {
- name: 'registration',
- type: 'boolean'
- }, {
- name: 'map',
- type: 'string'
- }, {
- name: 'bingKey',
- type: 'string'
- }, {
- name: 'mapUrl',
- type: 'string'
- }, {
- name: 'language',
- type: 'string'
- }, {
- name: 'distanceUnit',
- type: 'string'
- }, {
- name: 'speedUnit',
- type: 'string'
- }, {
- name: 'latitude',
- type: 'float'
- }, {
- name: 'longitude',
- type: 'float'
- }, {
- name: 'zoom',
- type: 'int'
- }],
+ fields: [{
+ name: 'id',
+ type: 'int'
+ }, {
+ name: 'registration',
+ type: 'boolean'
+ }, {
+ name: 'map',
+ type: 'string'
+ }, {
+ name: 'bingKey',
+ type: 'string'
+ }, {
+ name: 'mapUrl',
+ type: 'string'
+ }, {
+ name: 'language',
+ type: 'string'
+ }, {
+ name: 'distanceUnit',
+ type: 'string'
+ }, {
+ name: 'speedUnit',
+ type: 'string'
+ }, {
+ name: 'latitude',
+ type: 'float'
+ }, {
+ name: 'longitude',
+ type: 'float'
+ }, {
+ name: 'zoom',
+ type: 'int'
+ }],
- proxy: {
- type: 'ajax',
- url: '/api/server/update',
- writer: {
- type: 'json',
- writeAllFields: true
+ proxy: {
+ type: 'ajax',
+ url: '/api/server/update',
+ writer: {
+ type: 'json',
+ writeAllFields: true
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/model/User.js b/web/app/model/User.js
index d0a6e5e14..9d062862c 100644
--- a/web/app/model/User.js
+++ b/web/app/model/User.js
@@ -13,55 +13,59 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.model.User', {
- extend: 'Ext.data.Model',
- identifier: 'negative',
+ Ext.define('Traccar.model.User', {
+ extend: 'Ext.data.Model',
+ identifier: 'negative',
- fields: [{
- name: 'id',
- type: 'int'
- }, {
- name: 'name',
- type: 'string'
- }, {
- name: 'email',
- type: 'string'
- }, {
- name: 'password',
- type: 'string'
- }, {
- name: 'admin',
- type: 'boolean'
- }, {
- name: 'map',
- type: 'string'
- }, {
- name: 'language',
- type: 'string'
- }, {
- name: 'distanceUnit',
- type: 'string'
- }, {
- name: 'speedUnit',
- type: 'string'
- }, {
- name: 'latitude',
- type: 'float'
- }, {
- name: 'longitude',
- type: 'float'
- }, {
- name: 'zoom',
- type: 'int'
- }],
+ fields: [{
+ name: 'id',
+ type: 'int'
+ }, {
+ name: 'name',
+ type: 'string'
+ }, {
+ name: 'email',
+ type: 'string'
+ }, {
+ name: 'password',
+ type: 'string'
+ }, {
+ name: 'admin',
+ type: 'boolean'
+ }, {
+ name: 'map',
+ type: 'string'
+ }, {
+ name: 'language',
+ type: 'string'
+ }, {
+ name: 'distanceUnit',
+ type: 'string'
+ }, {
+ name: 'speedUnit',
+ type: 'string'
+ }, {
+ name: 'latitude',
+ type: 'float'
+ }, {
+ name: 'longitude',
+ type: 'float'
+ }, {
+ name: 'zoom',
+ type: 'int'
+ }],
- proxy: {
- type: 'ajax',
- url: '/api/user/update',
- writer: {
- type: 'json',
- writeAllFields: true
+ proxy: {
+ type: 'ajax',
+ url: '/api/user/update',
+ writer: {
+ type: 'json',
+ writeAllFields: true
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/store/Attributes.js b/web/app/store/Attributes.js
index 2019582e5..a63701fdc 100644
--- a/web/app/store/Attributes.js
+++ b/web/app/store/Attributes.js
@@ -13,12 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.Attributes', {
- extend: 'Ext.data.Store',
- model: 'Traccar.model.Attribute',
+ Ext.define('Traccar.store.Attributes', {
+ extend: 'Ext.data.Store',
+ model: 'Traccar.model.Attribute',
- sorters: [{
- property: 'priority'
- }]
-});
+ sorters: [{
+ property: 'priority'
+ }]
+ });
+
+})();
diff --git a/web/app/store/CommandTypes.js b/web/app/store/CommandTypes.js
index 8ff78b5df..ed47d6d68 100644
--- a/web/app/store/CommandTypes.js
+++ b/web/app/store/CommandTypes.js
@@ -13,22 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.CommandTypes', {
- extend: 'Ext.data.Store',
- fields: ['key', 'name'],
+ Ext.define('Traccar.store.CommandTypes', {
+ extend: 'Ext.data.Store',
+ fields: ['key', 'name'],
- data: [{
- key: 'positionPeriodic',
- name: strings.commandPositionPeriodic
- }, {
- key: 'positionStop',
- name: strings.commandPositionStop
- }, {
- key: 'engineStop',
- name: strings.commandEngineStop
- }, {
- key: 'engineResume',
- name: strings.commandEngineResume
- }]
-});
+ data: [{
+ key: 'positionPeriodic',
+ name: strings.commandPositionPeriodic
+ }, {
+ key: 'positionStop',
+ name: strings.commandPositionStop
+ }, {
+ key: 'engineStop',
+ name: strings.commandEngineStop
+ }, {
+ key: 'engineResume',
+ name: strings.commandEngineResume
+ }]
+ });
+
+})();
diff --git a/web/app/store/Devices.js b/web/app/store/Devices.js
index 24777de5a..05da6a194 100644
--- a/web/app/store/Devices.js
+++ b/web/app/store/Devices.js
@@ -13,26 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.Devices', {
- extend: 'Ext.data.Store',
- model: 'Traccar.model.Device',
+ Ext.define('Traccar.store.Devices', {
+ extend: 'Ext.data.Store',
+ model: 'Traccar.model.Device',
- proxy: {
- type: 'ajax',
- api: {
- create: '/api/device/add',
- read: '/api/device/get',
- update: '/api/device/update',
- destroy: '/api/device/remove'
- },
- reader: {
- type: 'json',
- rootProperty: 'data'
- },
- writer: {
- type: 'json',
- writeAllFields: true
+ proxy: {
+ type: 'ajax',
+ api: {
+ create: '/api/device/add',
+ read: '/api/device/get',
+ update: '/api/device/update',
+ destroy: '/api/device/remove'
+ },
+ reader: {
+ type: 'json',
+ rootProperty: 'data'
+ },
+ writer: {
+ type: 'json',
+ writeAllFields: true
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js
index bcccc0703..59e7f6396 100644
--- a/web/app/store/DistanceUnits.js
+++ b/web/app/store/DistanceUnits.js
@@ -13,28 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.DistanceUnits', {
- extend: 'Ext.data.Store',
- fields: ['key', 'name', 'factor'],
+ Ext.define('Traccar.store.DistanceUnits', {
+ extend: 'Ext.data.Store',
+ fields: ['key', 'name', 'factor'],
- data: [{
- key: 'km',
- name: strings.sharedKm,
- factor: 0.001
- }, {
- key: 'mi',
- name: strings.sharedMi,
- factor: 0.00621371
- }],
+ data: [{
+ key: 'km',
+ name: strings.sharedKm,
+ factor: 0.001
+ }, {
+ key: 'mi',
+ name: strings.sharedMi,
+ factor: 0.00621371
+ }],
- formatValue: function (value, unit) {
- var model;
- if (unit) {
- model = this.findRecord('key', unit);
- return (value * model.get('factor')).toFixed(2) + ' ' + model.get('name');
- } else {
- return value;
+ formatValue: function (value, unit) {
+ var model;
+ if (unit) {
+ model = this.findRecord('key', unit);
+ return (value * model.get('factor')).toFixed(2) + ' ' + model.get('name');
+ } else {
+ return value;
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/store/Languages.js b/web/app/store/Languages.js
index 22685173a..66d3e6176 100644
--- a/web/app/store/Languages.js
+++ b/web/app/store/Languages.js
@@ -13,21 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.Languages', {
- extend: 'Ext.data.Store',
- fields: ['code', 'name'],
+ Ext.define('Traccar.store.Languages', {
+ extend: 'Ext.data.Store',
+ fields: ['code', 'name'],
- data: (function () {
- var code, data = [];
- for (code in availableLanguages) {
- if (availableLanguages.hasOwnProperty(code)) {
- data.push({
- code: code,
- name: availableLanguages[code].name
- });
+ data: (function () {
+ var code, data = [];
+ for (code in availableLanguages) {
+ if (availableLanguages.hasOwnProperty(code)) {
+ data.push({
+ code: code,
+ name: availableLanguages[code].name
+ });
+ }
}
- }
- return data;
- }())
-});
+ return data;
+ }())
+ });
+
+})();
diff --git a/web/app/store/LatestPositions.js b/web/app/store/LatestPositions.js
index c656bdcb8..3bd58bd04 100644
--- a/web/app/store/LatestPositions.js
+++ b/web/app/store/LatestPositions.js
@@ -13,8 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.LatestPositions', {
- extend: 'Ext.data.Store',
- model: 'Traccar.model.Position'
-});
+ Ext.define('Traccar.store.LatestPositions', {
+ extend: 'Ext.data.Store',
+ model: 'Traccar.model.Position'
+ });
+
+})();
diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js
index 5f83940c9..ba241504e 100644
--- a/web/app/store/MapTypes.js
+++ b/web/app/store/MapTypes.js
@@ -13,22 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.MapTypes', {
- extend: 'Ext.data.Store',
- fields: ['key', 'name'],
+ Ext.define('Traccar.store.MapTypes', {
+ extend: 'Ext.data.Store',
+ fields: ['key', 'name'],
- data: [{
- key: 'osm',
- name: strings.mapOsm
- }, {
- key: 'bingRoad',
- name: strings.mapBingRoad
- }, {
- key: 'bingAerial',
- name: strings.mapBingAerial
- }, {
- key: 'custom',
- name: strings.mapCustom
- }]
-});
+ data: [{
+ key: 'osm',
+ name: strings.mapOsm
+ }, {
+ key: 'bingRoad',
+ name: strings.mapBingRoad
+ }, {
+ key: 'bingAerial',
+ name: strings.mapBingAerial
+ }, {
+ key: 'custom',
+ name: strings.mapCustom
+ }]
+ });
+
+})();
diff --git a/web/app/store/Positions.js b/web/app/store/Positions.js
index 7de54a8d2..415e26cbe 100644
--- a/web/app/store/Positions.js
+++ b/web/app/store/Positions.js
@@ -13,17 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.Positions', {
- extend: 'Ext.data.Store',
- model: 'Traccar.model.Position',
+ Ext.define('Traccar.store.Positions', {
+ extend: 'Ext.data.Store',
+ model: 'Traccar.model.Position',
- proxy: {
- type: 'ajax',
- url: '/api/position/get',
- reader: {
- type: 'json',
- rootProperty: 'data'
+ proxy: {
+ type: 'ajax',
+ url: '/api/position/get',
+ reader: {
+ type: 'json',
+ rootProperty: 'data'
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js
index 00d2e1aba..1ff6cd50e 100644
--- a/web/app/store/SpeedUnits.js
+++ b/web/app/store/SpeedUnits.js
@@ -13,28 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.SpeedUnits', {
- extend: 'Ext.data.Store',
- fields: ['key', 'name', 'factor'],
+ Ext.define('Traccar.store.SpeedUnits', {
+ extend: 'Ext.data.Store',
+ fields: ['key', 'name', 'factor'],
- data: [{
- key: 'kmh',
- name: strings.sharedKmh,
- factor: 1.852
- }, {
- key: 'mph',
- name: strings.sharedMph,
- factor: 1.15078
- }],
+ data: [{
+ key: 'kmh',
+ name: strings.sharedKmh,
+ factor: 1.852
+ }, {
+ key: 'mph',
+ name: strings.sharedMph,
+ factor: 1.15078
+ }],
- formatValue: function (value, unit) {
- var model;
- if (unit) {
- model = this.findRecord('key', unit);
- return (value * model.get('factor')).toFixed(1) + ' ' + model.get('name');
- } else {
- return value;
+ formatValue: function (value, unit) {
+ var model;
+ if (unit) {
+ model = this.findRecord('key', unit);
+ return (value * model.get('factor')).toFixed(1) + ' ' + model.get('name');
+ } else {
+ return value;
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/store/TimeUnits.js b/web/app/store/TimeUnits.js
index 047fd6016..61246c520 100644
--- a/web/app/store/TimeUnits.js
+++ b/web/app/store/TimeUnits.js
@@ -13,19 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.TimeUnits', {
- extend: 'Ext.data.Store',
- fields: ['name', 'factor'],
+ Ext.define('Traccar.store.TimeUnits', {
+ extend: 'Ext.data.Store',
+ fields: ['name', 'factor'],
- data: [{
- name: strings.sharedSecond,
- factor: 1
- }, {
- name: strings.sharedMinute,
- factor: 60
- }, {
- name: strings.sharedHour,
- factor: 3600
- }]
-});
+ data: [{
+ name: strings.sharedSecond,
+ factor: 1
+ }, {
+ name: strings.sharedMinute,
+ factor: 60
+ }, {
+ name: strings.sharedHour,
+ factor: 3600
+ }]
+ });
+
+})();
diff --git a/web/app/store/Users.js b/web/app/store/Users.js
index 004dc727e..908e8eaf9 100644
--- a/web/app/store/Users.js
+++ b/web/app/store/Users.js
@@ -13,26 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.store.Users', {
- extend: 'Ext.data.Store',
- model: 'Traccar.model.User',
+ Ext.define('Traccar.store.Users', {
+ extend: 'Ext.data.Store',
+ model: 'Traccar.model.User',
- proxy: {
- type: 'ajax',
- api: {
- create: '/api/user/add',
- read: '/api/user/get',
- update: '/api/user/update',
- destroy: '/api/user/remove'
- },
- reader: {
- type: 'json',
- rootProperty: 'data'
- },
- writer: {
- type: 'json',
- writeAllFields: true
+ proxy: {
+ type: 'ajax',
+ api: {
+ create: '/api/user/add',
+ read: '/api/user/get',
+ update: '/api/user/update',
+ destroy: '/api/user/remove'
+ },
+ reader: {
+ type: 'json',
+ rootProperty: 'data'
+ },
+ writer: {
+ type: 'json',
+ writeAllFields: true
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/BaseDialog.js b/web/app/view/BaseDialog.js
index d875e14c9..2a8084698 100644
--- a/web/app/view/BaseDialog.js
+++ b/web/app/view/BaseDialog.js
@@ -13,11 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.BaseDialog', {
- extend: 'Ext.window.Window',
+ Ext.define('Traccar.view.BaseDialog', {
+ extend: 'Ext.window.Window',
- bodyPadding: styles.panelPadding,
- resizable: false,
- modal: true
-});
+ bodyPadding: styles.panelPadding,
+ resizable: false,
+ modal: true
+ });
+
+})();
diff --git a/web/app/view/BaseEditDialog.js b/web/app/view/BaseEditDialog.js
index 0788c30d2..81831e2fb 100644
--- a/web/app/view/BaseEditDialog.js
+++ b/web/app/view/BaseEditDialog.js
@@ -13,15 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.BaseEditDialog', {
- extend: 'Traccar.view.BaseDialog',
+ Ext.define('Traccar.view.BaseEditDialog', {
+ extend: 'Traccar.view.BaseDialog',
- buttons: [{
- text: strings.sharedSave,
- handler: 'onSaveClick'
- }, {
- text: strings.sharedCancel,
- handler: 'closeView'
- }]
-});
+ buttons: [{
+ text: strings.sharedSave,
+ handler: 'onSaveClick'
+ }, {
+ text: strings.sharedCancel,
+ handler: 'closeView'
+ }]
+ });
+
+})();
diff --git a/web/app/view/BaseEditDialogController.js b/web/app/view/BaseEditDialogController.js
index 3b43cacf3..1820d9c9a 100644
--- a/web/app/view/BaseEditDialogController.js
+++ b/web/app/view/BaseEditDialogController.js
@@ -13,33 +13,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.BaseEditDialogController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.baseEditDialog',
+ Ext.define('Traccar.view.BaseEditDialogController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.baseEditDialog',
- 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({
- success: function () {
- store.reload(); // workaround for selection problem
- },
- failure: function (batch) {
- store.rejectChanges();
- Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
+ 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);
}
- });
- } else {
- record.save();
+ store.sync({
+ success: function () {
+ store.reload(); // workaround for selection problem
+ },
+ failure: function (batch) {
+ store.rejectChanges();
+ Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
+ }
+ });
+ } else {
+ record.save();
+ }
+ button.up('window').close();
}
- button.up('window').close();
- }
-});
+ });
+
+})();
diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js
index 5d37f3173..388c0afce 100644
--- a/web/app/view/CommandDialog.js
+++ b/web/app/view/CommandDialog.js
@@ -13,55 +13,59 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.CommandDialog', {
- extend: 'Traccar.view.BaseDialog',
+ Ext.define('Traccar.view.CommandDialog', {
+ extend: 'Traccar.view.BaseDialog',
- requires: [
- 'Traccar.view.CommandDialogController'
- ],
+ requires: [
+ 'Traccar.view.CommandDialogController'
+ ],
- controller: 'commandDialog',
- title: strings.commandTitle,
-
- items: {
- xtype: 'form',
- items: [{
- xtype: 'combobox',
- name: 'type',
- fieldLabel: strings.commandType,
- store: 'CommandTypes',
- displayField: 'name',
- valueField: 'key',
- listeners: {
- select: 'onSelect'
- }
- }, {
- xtype: 'fieldcontainer',
- reference: 'paramPositionPeriodic',
- name: 'attributes',
- hidden: true,
+ controller: 'commandDialog',
+ title: strings.commandTitle,
+ items: {
+ xtype: 'form',
items: [{
- xtype: 'numberfield',
- fieldLabel: strings.commandFrequency,
- name: 'frequency'
- }, {
xtype: 'combobox',
- fieldLabel: strings.commandUnit,
- name: 'unit',
- store: 'TimeUnits',
+ name: 'type',
+ fieldLabel: strings.commandType,
+ store: 'CommandTypes',
displayField: 'name',
- valueField: 'factor'
+ valueField: 'key',
+ listeners: {
+ select: 'onSelect'
+ }
+ }, {
+ xtype: 'fieldcontainer',
+ reference: 'paramPositionPeriodic',
+ name: 'attributes',
+ hidden: true,
+
+ items: [{
+ xtype: 'numberfield',
+ fieldLabel: strings.commandFrequency,
+ name: 'frequency'
+ }, {
+ xtype: 'combobox',
+ fieldLabel: strings.commandUnit,
+ name: 'unit',
+ store: 'TimeUnits',
+ displayField: 'name',
+ valueField: 'factor'
+ }]
}]
+ },
+
+ buttons: [{
+ text: strings.commandSend,
+ handler: 'onSendClick'
+ }, {
+ text: strings.sharedCancel,
+ handler: 'closeView'
}]
- },
+ });
- buttons: [{
- text: strings.commandSend,
- handler: 'onSendClick'
- }, {
- text: strings.sharedCancel,
- handler: 'closeView'
- }]
-});
+})();
diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js
index 88e72d6e3..1c6b361a7 100644
--- a/web/app/view/CommandDialogController.js
+++ b/web/app/view/CommandDialogController.js
@@ -13,45 +13,49 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.CommandDialogController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.commandDialog',
+ Ext.define('Traccar.view.CommandDialogController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.commandDialog',
- onSelect: function (selected) {
- this.lookupReference('paramPositionPeriodic').setHidden(
+ onSelect: function (selected) {
+ this.lookupReference('paramPositionPeriodic').setHidden(
selected.getValue() !== 'positionPeriodic');
- },
-
- onSendClick: function (button) {
- var attributes, value, record, form;
-
- form = button.up('window').down('form');
- form.updateRecord();
- record = form.getRecord();
-
- if (record.get('type') === 'positionPeriodic') {
- attributes = this.lookupReference('paramPositionPeriodic');
- value = attributes.down('numberfield[name="frequency"]').getValue();
- value *= attributes.down('combobox[name="unit"]').getValue();
-
- record.set('attributes', {
- frequency: value
+ },
+
+ onSendClick: function (button) {
+ var attributes, value, record, form;
+
+ form = button.up('window').down('form');
+ form.updateRecord();
+ record = form.getRecord();
+
+ if (record.get('type') === 'positionPeriodic') {
+ attributes = this.lookupReference('paramPositionPeriodic');
+ value = attributes.down('numberfield[name="frequency"]').getValue();
+ value *= attributes.down('combobox[name="unit"]').getValue();
+
+ record.set('attributes', {
+ frequency: value
+ });
+ }
+
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/command/send',
+ jsonData: record.getData(),
+ callback: this.onSendResult
});
- }
+ },
- Ext.Ajax.request({
- scope: this,
- url: '/api/command/send',
- jsonData: record.getData(),
- callback: this.onSendResult
- });
- },
-
- onSendResult: function (options, success, response) {
- if (Traccar.ErrorManager.check(success, response)) {
- Ext.toast(strings.commandSent);
- this.closeView();
+ onSendResult: function (options, success, response) {
+ if (Traccar.ErrorManager.check(success, response)) {
+ Ext.toast(strings.commandSent);
+ this.closeView();
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/Device.js b/web/app/view/Device.js
index de2c7ed4c..ce9d24659 100644
--- a/web/app/view/Device.js
+++ b/web/app/view/Device.js
@@ -13,81 +13,85 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.Device', {
- extend: 'Ext.grid.Panel',
- xtype: 'deviceView',
+ Ext.define('Traccar.view.Device', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'deviceView',
- requires: [
- 'Traccar.view.DeviceController'
- ],
-
- controller: 'device',
- store: 'Devices',
+ requires: [
+ 'Traccar.view.DeviceController'
+ ],
- title: strings.deviceTitle,
- selType: 'rowmodel',
-
- tbar: [{
- handler: 'onAddClick',
- reference: 'deviceAddButton',
- glyph: 'xf067@FontAwesome',
- tooltip: strings.sharedAdd,
- tooltipType: 'title'
- }, {
- disabled: true,
- handler: 'onEditClick',
- reference: 'deviceEditButton',
- glyph: 'xf040@FontAwesome',
- tooltip: strings.sharedEdit,
- tooltipType: 'title'
- }, {
- disabled: true,
- handler: 'onRemoveClick',
- reference: 'deviceRemoveButton',
- glyph: 'xf00d@FontAwesome',
- tooltip: strings.sharedRemove,
- tooltipType: 'title'
- }, {
- disabled: true,
- handler: 'onCommandClick',
- reference: 'deviceCommandButton',
- glyph: 'xf093@FontAwesome',
- tooltip: strings.deviceCommand,
- tooltipType: 'title'
- }, {
- xtype: 'tbfill'
- }, {
- text: strings.settingsTitle,
- menu: [{
- text: strings.settingsUser,
- handler: 'onUserClick'
+ controller: 'device',
+ store: 'Devices',
+
+ title: strings.deviceTitle,
+ selType: 'rowmodel',
+
+ tbar: [{
+ handler: 'onAddClick',
+ reference: 'deviceAddButton',
+ glyph: 'xf067@FontAwesome',
+ tooltip: strings.sharedAdd,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onEditClick',
+ reference: 'deviceEditButton',
+ glyph: 'xf040@FontAwesome',
+ tooltip: strings.sharedEdit,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onRemoveClick',
+ reference: 'deviceRemoveButton',
+ glyph: 'xf00d@FontAwesome',
+ tooltip: strings.sharedRemove,
+ tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onCommandClick',
+ reference: 'deviceCommandButton',
+ glyph: 'xf093@FontAwesome',
+ tooltip: strings.deviceCommand,
+ tooltipType: 'title'
}, {
- text: strings.settingsServer,
- hidden: true,
- handler: 'onServerClick',
- reference: 'settingsServerButton'
+ xtype: 'tbfill'
+ }, {
+ text: strings.settingsTitle,
+ menu: [{
+ text: strings.settingsUser,
+ handler: 'onUserClick'
+ }, {
+ text: strings.settingsServer,
+ hidden: true,
+ handler: 'onServerClick',
+ reference: 'settingsServerButton'
+ }, {
+ text: strings.settingsUsers,
+ hidden: true,
+ handler: 'onUsersClick',
+ reference: 'settingsUsersButton'
+ }]
+ }, {
+ text: strings.loginLogout,
+ handler: 'onLogoutClick'
+ }],
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: [{
+ text: strings.deviceName,
+ dataIndex: 'name', flex: 1
}, {
- text: strings.settingsUsers,
- hidden: true,
- handler: 'onUsersClick',
- reference: 'settingsUsersButton'
+ text: strings.deviceIdentifier,
+ dataIndex: 'uniqueId', flex: 1
}]
- }, {
- text: strings.loginLogout,
- handler: 'onLogoutClick'
- }],
- listeners: {
- selectionchange: 'onSelectionChange'
- },
-
- columns: [{
- text: strings.deviceName,
- dataIndex: 'name', flex: 1
- }, {
- text: strings.deviceIdentifier,
- dataIndex: 'uniqueId', flex: 1
- }]
+ });
-});
+})();
diff --git a/web/app/view/DeviceController.js b/web/app/view/DeviceController.js
index 2e2fdb2a6..748ebabe6 100644
--- a/web/app/view/DeviceController.js
+++ b/web/app/view/DeviceController.js
@@ -13,126 +13,130 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.DeviceController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.device',
-
- requires: [
- 'Traccar.view.CommandDialog',
- 'Traccar.view.DeviceDialog',
- 'Traccar.view.UserDialog',
- 'Traccar.view.User',
- 'Traccar.view.LoginController'
- ],
+ Ext.define('Traccar.view.DeviceController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.device',
- config: {
- listen: {
- controller: {
- '*': {
- selectReport: 'selectReport'
+ requires: [
+ 'Traccar.view.CommandDialog',
+ 'Traccar.view.DeviceDialog',
+ 'Traccar.view.UserDialog',
+ 'Traccar.view.User',
+ 'Traccar.view.LoginController'
+ ],
+
+ config: {
+ listen: {
+ controller: {
+ '*': {
+ selectReport: 'selectReport'
+ }
}
}
- }
- },
+ },
- init: function () {
- if (Traccar.app.getUser().get('admin')) {
- this.lookupReference('settingsServerButton').setHidden(false);
- this.lookupReference('settingsUsersButton').setHidden(false);
- }
- },
-
- onLogoutClick: function () {
- Ext.create('Traccar.view.LoginController').logout();
- },
-
- onAddClick: function () {
- var device, dialog;
- device = Ext.create('Traccar.model.Device');
- device.store = this.getView().getStore();
- dialog = Ext.create('Traccar.view.DeviceDialog');
- dialog.down('form').loadRecord(device);
- dialog.show();
- },
-
- onEditClick: function () {
- var device, dialog;
- device = this.getView().getSelectionModel().getSelection()[0];
- dialog = Ext.create('Traccar.view.DeviceDialog');
- dialog.down('form').loadRecord(device);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var device = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: strings.deviceDialog,
- message: strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: strings.sharedRemove,
- no: strings.sharedCancel
- },
- fn: function (btn) {
- var store;
- if (btn === 'yes') {
- store = Ext.getStore('Devices');
- store.remove(device);
- store.sync();
- }
+ init: function () {
+ if (Traccar.app.getUser().get('admin')) {
+ this.lookupReference('settingsServerButton').setHidden(false);
+ this.lookupReference('settingsUsersButton').setHidden(false);
}
- });
- },
+ },
- onCommandClick: function () {
- var device, command, dialog;
- device = this.getView().getSelectionModel().getSelection()[0];
- command = Ext.create('Traccar.model.Command');
- command.set('deviceId', device.get('id'));
- dialog = Ext.create('Traccar.view.CommandDialog');
- dialog.down('form').loadRecord(command);
- dialog.show();
- },
+ onLogoutClick: function () {
+ Ext.create('Traccar.view.LoginController').logout();
+ },
- onSelectionChange: function (selected) {
- var empty = selected.getCount() === 0;
- this.lookupReference('deviceEditButton').setDisabled(empty);
- this.lookupReference('deviceRemoveButton').setDisabled(empty);
- this.lookupReference('deviceCommandButton').setDisabled(empty);
- if (!empty) {
- this.fireEvent("selectDevice", selected.getLastSelected());
- }
- },
+ onAddClick: function () {
+ var device, dialog;
+ device = Ext.create('Traccar.model.Device');
+ device.store = this.getView().getStore();
+ dialog = Ext.create('Traccar.view.DeviceDialog');
+ dialog.down('form').loadRecord(device);
+ dialog.show();
+ },
+
+ onEditClick: function () {
+ var device, dialog;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ dialog = Ext.create('Traccar.view.DeviceDialog');
+ dialog.down('form').loadRecord(device);
+ dialog.show();
+ },
- onUserClick: function () {
- var dialog = Ext.create('Traccar.view.UserDialog');
- dialog.down('form').loadRecord(Traccar.app.getUser());
- dialog.show();
- },
+ onRemoveClick: function () {
+ var device = this.getView().getSelectionModel().getSelection()[0];
+ Ext.Msg.show({
+ title: strings.deviceDialog,
+ message: strings.sharedRemoveConfirm,
+ buttons: Ext.Msg.YESNO,
+ buttonText: {
+ yes: strings.sharedRemove,
+ no: strings.sharedCancel
+ },
+ fn: function (btn) {
+ var store;
+ if (btn === 'yes') {
+ store = Ext.getStore('Devices');
+ store.remove(device);
+ store.sync();
+ }
+ }
+ });
+ },
- onServerClick: function () {
- var dialog = Ext.create('Traccar.view.ServerDialog');
- dialog.down('form').loadRecord(Traccar.app.getServer());
- dialog.show();
- },
+ onCommandClick: function () {
+ var device, command, dialog;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ command = Ext.create('Traccar.model.Command');
+ command.set('deviceId', device.get('id'));
+ dialog = Ext.create('Traccar.view.CommandDialog');
+ dialog.down('form').loadRecord(command);
+ dialog.show();
+ },
- onUsersClick: function () {
- Ext.create('Ext.window.Window', {
- title: strings.settingsUsers,
- width: styles.windowWidth,
- height: styles.windowHeight,
- layout: 'fit',
- modal: true,
- items: {
- xtype: 'userView'
+ onSelectionChange: function (selected) {
+ var empty = selected.getCount() === 0;
+ this.lookupReference('deviceEditButton').setDisabled(empty);
+ this.lookupReference('deviceRemoveButton').setDisabled(empty);
+ this.lookupReference('deviceCommandButton').setDisabled(empty);
+ if (!empty) {
+ this.fireEvent("selectDevice", selected.getLastSelected());
}
- }).show();
- },
+ },
- selectReport: function (position) {
- if (position !== undefined) {
- this.getView().getSelectionModel().deselectAll();
+ onUserClick: function () {
+ var dialog = Ext.create('Traccar.view.UserDialog');
+ dialog.down('form').loadRecord(Traccar.app.getUser());
+ dialog.show();
+ },
+
+ onServerClick: function () {
+ var dialog = Ext.create('Traccar.view.ServerDialog');
+ dialog.down('form').loadRecord(Traccar.app.getServer());
+ dialog.show();
+ },
+
+ onUsersClick: function () {
+ Ext.create('Ext.window.Window', {
+ title: strings.settingsUsers,
+ width: styles.windowWidth,
+ height: styles.windowHeight,
+ layout: 'fit',
+ modal: true,
+ items: {
+ xtype: 'userView'
+ }
+ }).show();
+ },
+
+ selectReport: function (position) {
+ if (position !== undefined) {
+ this.getView().getSelectionModel().deselectAll();
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/DeviceDialog.js b/web/app/view/DeviceDialog.js
index 759fade6d..012048b8a 100644
--- a/web/app/view/DeviceDialog.js
+++ b/web/app/view/DeviceDialog.js
@@ -13,29 +13,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.DeviceDialog', {
- extend: 'Traccar.view.BaseEditDialog',
+ Ext.define('Traccar.view.DeviceDialog', {
+ extend: 'Traccar.view.BaseEditDialog',
- requires: [
- 'Traccar.view.BaseEditDialogController'
- ],
+ requires: [
+ 'Traccar.view.BaseEditDialogController'
+ ],
- controller: 'baseEditDialog',
- title: strings.deviceDialog,
+ controller: 'baseEditDialog',
+ title: strings.deviceDialog,
- items: {
- xtype: 'form',
- items: [{
- xtype: 'textfield',
- name: 'name',
- fieldLabel: strings.deviceName,
- allowBlank: false
- }, {
- xtype: 'textfield',
- name: 'uniqueId',
- fieldLabel: strings.deviceIdentifier,
- allowBlank: false
- }]
- }
-});
+ items: {
+ xtype: 'form',
+ items: [{
+ xtype: 'textfield',
+ name: 'name',
+ fieldLabel: strings.deviceName,
+ allowBlank: false
+ }, {
+ xtype: 'textfield',
+ name: 'uniqueId',
+ fieldLabel: strings.deviceIdentifier,
+ allowBlank: false
+ }]
+ }
+ });
+
+})();
diff --git a/web/app/view/Login.js b/web/app/view/Login.js
index 23f813c66..b68f80b07 100644
--- a/web/app/view/Login.js
+++ b/web/app/view/Login.js
@@ -13,79 +13,83 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.Login', {
- extend: 'Traccar.view.BaseDialog',
- alias: 'widget.login',
-
- requires: [
- 'Traccar.view.LoginController'
- ],
-
- controller: 'login',
+ Ext.define('Traccar.view.Login', {
+ extend: 'Traccar.view.BaseDialog',
+ alias: 'widget.login',
- closable: false,
+ requires: [
+ 'Traccar.view.LoginController'
+ ],
- items: {
- xtype: 'form',
- reference: 'form',
+ controller: 'login',
- autoEl: {
- tag: 'form',
- method: 'POST',
- action: 'blank',
- target: 'submitTarget'
- },
+ closable: false,
- items: [{
- xtype: 'combobox',
- name: 'language',
- fieldLabel: strings.loginLanguage,
- store: 'Languages',
- displayField: 'name',
- valueField: 'code',
- submitValue: false,
- listeners: {
- select: 'onSelectLanguage'
- },
- reference: 'languageField'
- }, {
- xtype: 'textfield',
- name: 'email',
- fieldLabel: strings.userEmail,
- allowBlank: false,
- enableKeyEvents: true,
- listeners: {
- specialKey: 'onSpecialKey',
- afterrender: 'onAfterRender'
- },
- inputAttrTpl: ['autocomplete="on"']
- }, {
- xtype: 'textfield',
- name: 'password',
- fieldLabel: strings.userPassword,
- inputType: 'password',
- allowBlank: false,
- enableKeyEvents: true,
- listeners: {
- specialKey: 'onSpecialKey'
+ items: {
+ xtype: 'form',
+ reference: 'form',
+
+ autoEl: {
+ tag: 'form',
+ method: 'POST',
+ action: 'blank',
+ target: 'submitTarget'
},
- inputAttrTpl: ['autocomplete="on"']
- }, {
- xtype: 'component',
- html: '<iframe id="submitTarget" name="submitTarget" style="display:none"></iframe>'
+
+ items: [{
+ xtype: 'combobox',
+ name: 'language',
+ fieldLabel: strings.loginLanguage,
+ store: 'Languages',
+ displayField: 'name',
+ valueField: 'code',
+ submitValue: false,
+ listeners: {
+ select: 'onSelectLanguage'
+ },
+ reference: 'languageField'
+ }, {
+ xtype: 'textfield',
+ name: 'email',
+ fieldLabel: strings.userEmail,
+ allowBlank: false,
+ enableKeyEvents: true,
+ listeners: {
+ specialKey: 'onSpecialKey',
+ afterrender: 'onAfterRender'
+ },
+ inputAttrTpl: ['autocomplete="on"']
+ }, {
+ xtype: 'textfield',
+ name: 'password',
+ 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.loginRegister,
+ handler: 'onRegisterClick',
+ reference: 'registerButton'
}, {
- xtype: 'component',
- html: '<input type="submit" id="submitButton" style="display:none">'
+ text: strings.loginLogin,
+ handler: 'onLoginClick'
}]
- },
+ });
- buttons: [{
- text: strings.loginRegister,
- handler: 'onRegisterClick',
- reference: 'registerButton'
- }, {
- text: strings.loginLogin,
- handler: 'onLoginClick'
- }]
-});
+})();
diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js
index bc73661ed..011fddc25 100644
--- a/web/app/view/LoginController.js
+++ b/web/app/view/LoginController.js
@@ -13,92 +13,96 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.LoginController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.login',
-
- requires: [
- 'Traccar.view.Register'
- ],
+ Ext.define('Traccar.view.LoginController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.login',
- init: function () {
- this.lookupReference('registerButton').setDisabled(
- !Traccar.app.getServer().get('registration'));
- this.lookupReference('languageField').setValue(language);
- },
+ requires: [
+ 'Traccar.view.Register'
+ ],
- login: function () {
- var form = this.lookupReference('form');
- if (form.isValid()) {
- Ext.getBody().mask(strings.sharedLoading);
- Ext.Ajax.request({
- scope: this,
- url: '/api/login',
- params: form.getValues(),
- callback: function (options, success, response) {
- Ext.getBody().unmask();
- if (Traccar.ErrorManager.check(success, response)) {
- var result = Ext.decode(response.responseText);
- if (result.success) {
- Traccar.app.setUser(result.data);
- this.fireViewEvent('login');
- } else {
- Traccar.ErrorManager.error(strings.loginFailed);
+ init: function () {
+ this.lookupReference('registerButton').setDisabled(
+ !Traccar.app.getServer().get('registration'));
+ this.lookupReference('languageField').setValue(language);
+ },
+
+ login: function () {
+ var form = this.lookupReference('form');
+ if (form.isValid()) {
+ Ext.getBody().mask(strings.sharedLoading);
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/login',
+ params: form.getValues(),
+ callback: function (options, success, response) {
+ Ext.getBody().unmask();
+ if (Traccar.ErrorManager.check(success, response)) {
+ var result = Ext.decode(response.responseText);
+ if (result.success) {
+ Traccar.app.setUser(result.data);
+ this.fireViewEvent('login');
+ } else {
+ Traccar.ErrorManager.error(strings.loginFailed);
+ }
}
+
}
+ });
+ }
+ },
+ logout: function () {
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/logout',
+ callback: function () {
+ window.location.reload();
}
});
- }
- },
+ },
- logout: function () {
- Ext.Ajax.request({
- scope: this,
- url: '/api/logout',
- callback: function () {
- window.location.reload();
- }
- });
- },
-
- onSelectLanguage: function (selected) {
- var paramName = 'locale';
- var paramValue = selected.getValue();
- var url = window.location.href;
- if (url.indexOf(paramName + '=') >= 0) {
- var prefix = url.substring(0, url.indexOf(paramName));
- var 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;
+ onSelectLanguage: function (selected) {
+ var paramName = 'locale';
+ var paramValue = selected.getValue();
+ var url = window.location.href;
+ if (url.indexOf(paramName + '=') >= 0) {
+ var prefix = url.substring(0, url.indexOf(paramName));
+ var 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 {
- url += '&' + paramName + '=' + paramValue;
+ if (url.indexOf('?') < 0) {
+ url += '?' + paramName + '=' + paramValue;
+ } else {
+ url += '&' + paramName + '=' + paramValue;
+ }
}
- }
- window.location.href = url;
- },
+ window.location.href = url;
+ },
- onAfterRender: function (field) {
- field.focus();
- },
+ onAfterRender: function (field) {
+ field.focus();
+ },
- onSpecialKey: function (field, e) {
- if (e.getKey() === e.ENTER) {
+ 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.login.Register').show();
}
- },
-
- onLoginClick: function () {
- Ext.getElementById('submitButton').click();
- this.login();
- },
+ });
- onRegisterClick: function () {
- Ext.create('Traccar.view.login.Register').show();
- }
-});
+})();
diff --git a/web/app/view/Main.js b/web/app/view/Main.js
index ee1073e92..1ad61d73f 100644
--- a/web/app/view/Main.js
+++ b/web/app/view/Main.js
@@ -13,51 +13,55 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.Main', {
- extend: 'Ext.container.Viewport',
- alias: 'widget.main',
+ Ext.define('Traccar.view.Main', {
+ extend: 'Ext.container.Viewport',
+ alias: 'widget.main',
- requires: [
- 'Traccar.view.Device',
- 'Traccar.view.State',
- 'Traccar.view.Report',
- 'Traccar.view.Map'
- ],
+ requires: [
+ 'Traccar.view.Device',
+ 'Traccar.view.State',
+ 'Traccar.view.Report',
+ 'Traccar.view.Map'
+ ],
- layout: 'border',
-
- defaults: {
- header: false,
- collapsible: true,
- split: true
- },
-
- items: [{
- region:'west',
layout: 'border',
- width: styles.deviceWidth,
defaults: {
- split: true,
- flex: 1
+ header: false,
+ collapsible: true,
+ split: true
},
items: [{
- region: 'center',
- xtype: 'deviceView'
+ region: 'west',
+ layout: 'border',
+ width: styles.deviceWidth,
+
+ defaults: {
+ split: true,
+ flex: 1
+ },
+
+ items: [{
+ region: 'center',
+ xtype: 'deviceView'
+ }, {
+ region: 'south',
+ xtype: 'stateView'
+ }]
}, {
region: 'south',
- xtype: 'stateView'
+ xtype: 'reportView',
+ height: styles.reportHeight
+ }, {
+ region: 'center',
+ xtype: 'mapView',
+ header: true,
+ collapsible: false
}]
- }, {
- region: 'south',
- xtype: 'reportView',
- height: styles.reportHeight
- }, {
- region: 'center',
- xtype: 'mapView',
- header: true,
- collapsible: false
- }]
-});
+ });
+
+})();
diff --git a/web/app/view/MainMobile.js b/web/app/view/MainMobile.js
index e42fc7f7f..d822f4978 100644
--- a/web/app/view/MainMobile.js
+++ b/web/app/view/MainMobile.js
@@ -13,37 +13,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.MainMobile', {
- extend: 'Ext.container.Viewport',
- alias: 'widget.mainMobile',
+ Ext.define('Traccar.view.MainMobile', {
+ extend: 'Ext.container.Viewport',
+ alias: 'widget.mainMobile',
- requires: [
- 'Traccar.view.Device',
- 'Traccar.view.State',
- 'Traccar.view.Map'
- ],
+ requires: [
+ 'Traccar.view.Device',
+ 'Traccar.view.State',
+ 'Traccar.view.Map'
+ ],
- layout: 'border',
+ layout: 'border',
- defaults: {
- header: false,
- collapsible: true,
- split: true
- },
+ defaults: {
+ header: false,
+ collapsible: true,
+ split: true
+ },
- items: [{
- region: 'east',
- xtype: 'stateView',
- flex: 4
- }, {
- region: 'center',
- xtype: 'mapView',
- collapsible: false,
- flex: 2
- }, {
- region: 'south',
- xtype: 'deviceView',
- flex: 1
- }]
-});
+ items: [{
+ region: 'east',
+ xtype: 'stateView',
+ flex: 4
+ }, {
+ region: 'center',
+ xtype: 'mapView',
+ collapsible: false,
+ flex: 2
+ }, {
+ region: 'south',
+ xtype: 'deviceView',
+ flex: 1
+ }]
+ });
+
+})();
diff --git a/web/app/view/Map.js b/web/app/view/Map.js
index f7a763b9d..e356c4678 100644
--- a/web/app/view/Map.js
+++ b/web/app/view/Map.js
@@ -13,73 +13,84 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.Map', {
- extend: 'Ext.form.Panel',
- xtype: 'mapView',
+ Ext.define('Traccar.view.Map', {
+ extend: 'Ext.form.Panel',
+ xtype: 'mapView',
- requires: [
- 'Traccar.view.MapController'
- ],
+ requires: [
+ 'Traccar.view.MapController'
+ ],
- controller: 'map',
+ controller: 'map',
- title: strings.mapTitle,
- layout: 'fit',
+ title: strings.mapTitle,
+ layout: 'fit',
- listeners: {
- afterrender: function () {
- var user = Traccar.app.getUser();
- var server = Traccar.app.getServer();
+ listeners: {
+ afterrender: function () {
+ var user = Traccar.app.getUser();
+ var server = Traccar.app.getServer();
- var layer;
- var mapLayer = user.get('map') || server.get('map');
+ var layer;
+ var mapLayer = user.get('map') || server.get('map');
- var bingKey = server.get('bingKey');
+ var bingKey = server.get('bingKey');
- if (mapLayer === 'custom') {
- layer = new ol.layer.Tile({ source: new ol.source.XYZ({
- url: server.get('mapUrl')
- })});
- } else if (mapLayer === 'bingRoad') {
- layer = new ol.layer.Tile({ source: new ol.source.BingMaps({
- key: bingKey,
- imagerySet: 'Road'
- })});
- } else if (mapLayer === 'bingAerial') {
- layer = new ol.layer.Tile({ source: new ol.source.BingMaps({
- key: bingKey,
- imagerySet: 'Aerial'
- })});
- } else {
- layer = new ol.layer.Tile({ source: new ol.source.OSM({
- })});
- }
+ if (mapLayer === 'custom') {
+ layer = new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ url: server.get('mapUrl')
+ })
+ });
+ } else if (mapLayer === 'bingRoad') {
+ layer = new ol.layer.Tile({
+ source: new ol.source.BingMaps({
+ key: bingKey,
+ imagerySet: 'Road'
+ })
+ });
+ } else if (mapLayer === 'bingAerial') {
+ layer = new ol.layer.Tile({
+ source: new ol.source.BingMaps({
+ key: bingKey,
+ imagerySet: 'Aerial'
+ })
+ });
+ } else {
+ layer = new ol.layer.Tile({
+ source: new ol.source.OSM({})
+ });
+ }
- this.vectorSource = new ol.source.Vector({});
- var vectorLayer = new ol.layer.Vector({
- source: this.vectorSource
- });
+ this.vectorSource = new ol.source.Vector({});
+ var vectorLayer = new ol.layer.Vector({
+ source: this.vectorSource
+ });
- var lat = user.get('latitude') || server.get('latitude') || styles.mapDefaultLat;
- var lon = user.get('longitude') || server.get('longitude') || styles.mapDefaultLon;
- var zoom = user.get('zoom') || server.get('zoom') || styles.mapDefaultZoom;
+ var lat = user.get('latitude') || server.get('latitude') || styles.mapDefaultLat;
+ var lon = user.get('longitude') || server.get('longitude') || styles.mapDefaultLon;
+ var zoom = user.get('zoom') || server.get('zoom') || styles.mapDefaultZoom;
- this.mapView = new ol.View({
- center: ol.proj.fromLonLat([lon, lat]),
- zoom: zoom,
- maxZoom: styles.mapMaxZoom
- });
+ this.mapView = new ol.View({
+ center: ol.proj.fromLonLat([lon, lat]),
+ zoom: zoom,
+ maxZoom: styles.mapMaxZoom
+ });
- this.map = new ol.Map({
- target: this.body.dom.id,
- layers: [layer, vectorLayer],
- view: this.mapView
- });
- },
+ this.map = new ol.Map({
+ target: this.body.dom.id,
+ layers: [layer, vectorLayer],
+ view: this.mapView
+ });
+ },
- resize: function () {
- this.map.updateSize();
+ resize: function () {
+ this.map.updateSize();
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index 66cbe6b31..cca746a20 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -13,202 +13,206 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-Ext.define('Traccar.view.MapController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.map',
-
- config: {
- listen: {
- controller: {
- '*': {
- reportShow: 'reportShow',
- reportClear: 'reportClear',
- selectDevice: 'selectDevice',
- selectReport: 'selectReport'
+(function () {
+ 'use strict';
+
+ Ext.define('Traccar.view.MapController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.map',
+
+ config: {
+ listen: {
+ controller: {
+ '*': {
+ reportShow: 'reportShow',
+ reportClear: 'reportClear',
+ selectDevice: 'selectDevice',
+ selectReport: 'selectReport'
+ }
}
}
- }
- },
-
- init: function () {
- this.liveData = {};
- this.update(true);
- },
-
- update: function (first) {
- Ext.Ajax.request({
- scope: this,
- url: '/api/async',
- params: {
- first: first
- },
- success: function (response) {
- var data = Ext.decode(response.responseText).data;
-
- var i;
- for (i = 0; i < data.length; i++) {
-
- var store = Ext.getStore('LatestPositions');
-
- var found = store.query('deviceId', data[i].deviceId);
- if (found.getCount() > 0) {
- found.first().set(data[i]);
- } else {
- store.add(Ext.create('Traccar.model.Position', data[i]));
+ },
+
+ init: function () {
+ this.liveData = {};
+ this.update(true);
+ },
+
+ update: function (first) {
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/async',
+ params: {
+ first: first
+ },
+ success: function (response) {
+ var data = Ext.decode(response.responseText).data;
+
+ var i;
+ for (i = 0; i < data.length; i++) {
+
+ var store = Ext.getStore('LatestPositions');
+
+ var found = store.query('deviceId', data[i].deviceId);
+ if (found.getCount() > 0) {
+ found.first().set(data[i]);
+ } else {
+ store.add(Ext.create('Traccar.model.Position', data[i]));
+ }
+
+ var geometry = new ol.geom.Point(ol.proj.fromLonLat([
+ data[i].longitude,
+ data[i].latitude
+ ]));
+
+ if (data[i].deviceId in this.liveData) {
+ this.liveData[data[i].deviceId].setGeometry(geometry);
+ } else {
+ var style = this.getMarkerStyle(styles.mapLiveRadius, styles.mapLiveColor);
+ var marker = new ol.Feature({
+ geometry: geometry,
+ originalStyle: style
+ });
+ marker.setStyle(style);
+ this.getView().vectorSource.addFeature(marker);
+ this.liveData[data[i].deviceId] = marker;
+ }
}
- var geometry = new ol.geom.Point(ol.proj.fromLonLat([
- data[i].longitude,
- data[i].latitude
- ]));
-
- if (data[i].deviceId in this.liveData) {
- this.liveData[data[i].deviceId].setGeometry(geometry);
- } else {
- var style = this.getMarkerStyle(styles.mapLiveRadius, styles.mapLiveColor);
- var marker = new ol.Feature({
- geometry: geometry,
- originalStyle: style
- });
- marker.setStyle(style);
- this.getView().vectorSource.addFeature(marker);
- this.liveData[data[i].deviceId] = marker;
- }
+ this.update(false);
+ },
+ failure: function () {
+ // TODO: error
}
-
- this.update(false);
- },
- failure: function () {
- // TODO: error
- }
- });
- },
-
- getLineStyle: function () {
- return new ol.style.Style({
- stroke: new ol.style.Stroke({
- color: styles.mapStrokeColor,
- width: styles.mapRouteWidth
- })
- });
- },
-
- getMarkerStyle: function (radius, color) {
- /*return new ol.style.Style({
- text: new ol.style.Text({
- text: '\uf041',
- font: 'normal 32px FontAwesome',
- textBaseline: 'Bottom',
- fill: new ol.style.Fill({
- color: color
- }),
- stroke: new ol.style.Stroke({
- color: 'black',
- width: 2
- })
- })
- });*/
- return new ol.style.Style({
- image: new ol.style.Circle({
- radius: radius,
- fill: new ol.style.Fill({
- color: color
- }),
+ });
+ },
+
+ getLineStyle: function () {
+ return new ol.style.Style({
stroke: new ol.style.Stroke({
color: styles.mapStrokeColor,
- width: styles.mapMarkerStroke
+ width: styles.mapRouteWidth
})
- })
- });
- },
-
- reportShow: function () {
- this.reportClear();
-
- var vectorSource = this.getView().vectorSource;
-
- var data = Ext.getStore('Positions').getData();
-
- var index;
- var positions = [];
- this.reportRoutePoints = {};
-
- for (index = 0; index < data.getCount(); index++) {
- var point = ol.proj.fromLonLat([
- data.getAt(index).data.longitude,
- data.getAt(index).data.latitude
- ]);
- positions.push(point);
-
- var style = this.getMarkerStyle(styles.mapReportRadius, styles.mapReportColor);
- var feature = new ol.Feature({
- geometry: new ol.geom.Point(positions[index]),
- originalStyle: style
});
- feature.setStyle(style);
- this.reportRoutePoints[data.getAt(index).get('id')] = feature;
- }
+ },
+
+ getMarkerStyle: function (radius, color) {
+ /*return new ol.style.Style({
+ text: new ol.style.Text({
+ text: '\uf041',
+ font: 'normal 32px FontAwesome',
+ textBaseline: 'Bottom',
+ fill: new ol.style.Fill({
+ color: color
+ }),
+ stroke: new ol.style.Stroke({
+ color: 'black',
+ width: 2
+ })
+ })
+ });*/
+ return new ol.style.Style({
+ image: new ol.style.Circle({
+ radius: radius,
+ fill: new ol.style.Fill({
+ color: color
+ }),
+ stroke: new ol.style.Stroke({
+ color: styles.mapStrokeColor,
+ width: styles.mapMarkerStroke
+ })
+ })
+ });
+ },
- this.reportRoute = new ol.Feature({
- geometry: new ol.geom.LineString(positions)
- });
- this.reportRoute.setStyle(this.getLineStyle());
- vectorSource.addFeature(this.reportRoute);
+ reportShow: function () {
+ this.reportClear();
- for (var key in this.reportRoutePoints) {
- if (this.reportRoutePoints.hasOwnProperty(key)) {
- vectorSource.addFeature(this.reportRoutePoints[key]);
- }
- }
- },
+ var vectorSource = this.getView().vectorSource;
- reportClear: function () {
- var index;
- var vectorSource = this.getView().vectorSource;
+ var data = Ext.getStore('Positions').getData();
- if (this.reportRoute !== undefined) {
- vectorSource.removeFeature(this.reportRoute);
- this.reportRoute = undefined;
- }
+ var index;
+ var positions = [];
+ this.reportRoutePoints = {};
+
+ for (index = 0; index < data.getCount(); index++) {
+ var point = ol.proj.fromLonLat([
+ data.getAt(index).data.longitude,
+ data.getAt(index).data.latitude
+ ]);
+ positions.push(point);
+
+ var style = this.getMarkerStyle(styles.mapReportRadius, styles.mapReportColor);
+ var feature = new ol.Feature({
+ geometry: new ol.geom.Point(positions[index]),
+ originalStyle: style
+ });
+ feature.setStyle(style);
+ this.reportRoutePoints[data.getAt(index).get('id')] = feature;
+ }
+
+ this.reportRoute = new ol.Feature({
+ geometry: new ol.geom.LineString(positions)
+ });
+ this.reportRoute.setStyle(this.getLineStyle());
+ vectorSource.addFeature(this.reportRoute);
- if (this.reportRoutePoints !== undefined) {
for (var key in this.reportRoutePoints) {
if (this.reportRoutePoints.hasOwnProperty(key)) {
- vectorSource.removeFeature(this.reportRoutePoints[key]);
+ vectorSource.addFeature(this.reportRoutePoints[key]);
}
}
- this.reportRoutePoints = {};
- }
- },
+ },
- selectPosition: function (feature) {
- if (this.currentFeature !== undefined) {
- this.currentFeature.setStyle(this.currentFeature.get('originalStyle'));
- }
+ reportClear: function () {
+ var index;
+ var vectorSource = this.getView().vectorSource;
- if (feature !== undefined) {
- feature.setStyle(this.getMarkerStyle(styles.mapSelectRadius, styles.mapSelectColor));
+ if (this.reportRoute !== undefined) {
+ vectorSource.removeFeature(this.reportRoute);
+ this.reportRoute = undefined;
+ }
- var pan = ol.animation.pan({
- duration: styles.mapDelay,
- source: this.getView().mapView.getCenter()
- });
- this.getView().map.beforeRender(pan);
- this.getView().mapView.setCenter(feature.getGeometry().getCoordinates());
- }
+ if (this.reportRoutePoints !== undefined) {
+ for (var key in this.reportRoutePoints) {
+ if (this.reportRoutePoints.hasOwnProperty(key)) {
+ vectorSource.removeFeature(this.reportRoutePoints[key]);
+ }
+ }
+ this.reportRoutePoints = {};
+ }
+ },
- this.currentFeature = feature;
- },
+ selectPosition: function (feature) {
+ if (this.currentFeature !== undefined) {
+ this.currentFeature.setStyle(this.currentFeature.get('originalStyle'));
+ }
- selectDevice: function (device) {
- this.selectPosition(this.liveData[device.get('id')]);
- },
+ if (feature !== undefined) {
+ feature.setStyle(this.getMarkerStyle(styles.mapSelectRadius, styles.mapSelectColor));
+
+ var pan = ol.animation.pan({
+ duration: styles.mapDelay,
+ source: this.getView().mapView.getCenter()
+ });
+ this.getView().map.beforeRender(pan);
+ this.getView().mapView.setCenter(feature.getGeometry().getCoordinates());
+ }
- selectReport: function (position) {
- if (this.reportRoutePoints[position.get('id')] !== undefined) {
- this.selectPosition(this.reportRoutePoints[position.get('id')]);
+ this.currentFeature = feature;
+ },
+
+ selectDevice: function (device) {
+ this.selectPosition(this.liveData[device.get('id')]);
+ },
+
+ selectReport: function (position) {
+ if (this.reportRoutePoints[position.get('id')] !== undefined) {
+ this.selectPosition(this.reportRoutePoints[position.get('id')]);
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/Register.js b/web/app/view/Register.js
index 464b7bb1f..c8fbf0722 100644
--- a/web/app/view/Register.js
+++ b/web/app/view/Register.js
@@ -13,46 +13,50 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.Register', {
- extend: 'Traccar.view.BaseDialog',
-
- requires: [
- 'Traccar.view.RegisterController'
- ],
-
- controller: 'register',
+ Ext.define('Traccar.view.Register', {
+ extend: 'Traccar.view.BaseDialog',
- items: {
- xtype: 'form',
- reference: 'form',
- jsonSubmit: true,
+ requires: [
+ 'Traccar.view.RegisterController'
+ ],
- items: [{
- xtype: 'textfield',
- name: 'name',
- fieldLabel: strings.userName,
- allowBlank: false
- }, {
- xtype: 'textfield',
- name: 'email',
- fieldLabel: strings.userEmail,
- vtype: 'email',
- allowBlank: false
+ controller: 'register',
+
+ items: {
+ xtype: 'form',
+ reference: 'form',
+ jsonSubmit: true,
+
+ items: [{
+ xtype: 'textfield',
+ name: 'name',
+ fieldLabel: strings.userName,
+ allowBlank: false
+ }, {
+ xtype: 'textfield',
+ name: 'email',
+ fieldLabel: strings.userEmail,
+ vtype: 'email',
+ allowBlank: false
+ }, {
+ xtype: 'textfield',
+ name: 'password',
+ fieldLabel: strings.userPassword,
+ inputType: 'password',
+ allowBlank: false
+ }]
+ },
+
+ buttons: [{
+ text: strings.sharedSave,
+ handler: 'onCreateClick'
}, {
- xtype: 'textfield',
- name: 'password',
- fieldLabel: strings.userPassword,
- inputType: 'password',
- allowBlank: false
+ text: strings.sharedCancel,
+ handler: 'closeView'
}]
- },
+ });
- buttons: [{
- text: strings.sharedSave,
- handler: 'onCreateClick'
- }, {
- text: strings.sharedCancel,
- handler: 'closeView'
- }]
-});
+})();
diff --git a/web/app/view/RegisterController.js b/web/app/view/RegisterController.js
index 2547d631c..94238acf3 100644
--- a/web/app/view/RegisterController.js
+++ b/web/app/view/RegisterController.js
@@ -13,28 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.RegisterController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.register',
+ Ext.define('Traccar.view.RegisterController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.register',
- onCreateClick: function () {
- var form = this.lookupReference('form');
- if (form.isValid()) {
- Ext.Ajax.request({
- scope: this,
- url: '/api/register',
- jsonData: form.getValues(),
- callback: this.onCreateReturn
- });
- }
- },
-
- onCreateReturn: function (options, success, response) {
- if (Traccar.ErrorManager.check(success, response)) {
- this.closeView();
- Ext.toast(strings.loginCreated);
+ onCreateClick: function () {
+ var form = this.lookupReference('form');
+ if (form.isValid()) {
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/register',
+ jsonData: form.getValues(),
+ callback: this.onCreateReturn
+ });
+ }
+ },
+
+ onCreateReturn: function (options, success, response) {
+ if (Traccar.ErrorManager.check(success, response)) {
+ this.closeView();
+ Ext.toast(strings.loginCreated);
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/Report.js b/web/app/view/Report.js
index 060c9c46a..73ba6e12b 100644
--- a/web/app/view/Report.js
+++ b/web/app/view/Report.js
@@ -13,106 +13,110 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.Report', {
- extend: 'Ext.grid.Panel',
- xtype: 'reportView',
+ Ext.define('Traccar.view.Report', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'reportView',
- requires: [
- 'Traccar.view.ReportController'
- ],
+ requires: [
+ 'Traccar.view.ReportController'
+ ],
- controller: 'report',
- store: 'Positions',
+ controller: 'report',
+ store: 'Positions',
- title: strings.reportTitle,
+ title: strings.reportTitle,
- tbar: [{
- xtype: 'tbtext',
- html: strings.reportDevice
- }, {
- xtype: 'combobox',
- reference: 'deviceField',
- store: 'Devices',
- valueField: 'id',
- displayField: 'name',
- typeAhead: true,
- queryMode: 'local'
- }, '-', {
- xtype: 'tbtext',
- html: strings.reportFrom
- }, {
- xtype: 'datefield',
- reference: 'fromDateField',
- startDay: styles.weekStartDay,
- value: new Date(new Date().getTime() - 30 * 60 * 1000)
- }, {
- xtype: 'timefield',
- reference: 'fromTimeField',
- maxWidth: styles.reportTime,
- format: styles.timeFormat,
- value: new Date(new Date().getTime() - 30 * 60 * 1000)
- }, '-', {
- xtype: 'tbtext',
- html: strings.reportTo
- }, {
- xtype: 'datefield',
- reference: 'toDateField',
- startDay: styles.weekStartDay,
- value: new Date()
- }, {
- xtype: 'timefield',
- reference: 'toTimeField',
- maxWidth: styles.reportTime,
- format: styles.timeFormat,
- value: new Date()
- }, '-', {
- text: strings.reportShow,
- handler: 'onShowClick'
- }, {
- text: strings.reportClear,
- handler: 'onClearClick'
- }],
+ tbar: [{
+ xtype: 'tbtext',
+ html: strings.reportDevice
+ }, {
+ xtype: 'combobox',
+ reference: 'deviceField',
+ store: 'Devices',
+ valueField: 'id',
+ displayField: 'name',
+ typeAhead: true,
+ queryMode: 'local'
+ }, '-', {
+ xtype: 'tbtext',
+ html: strings.reportFrom
+ }, {
+ xtype: 'datefield',
+ reference: 'fromDateField',
+ startDay: styles.weekStartDay,
+ value: new Date(new Date().getTime() - 30 * 60 * 1000)
+ }, {
+ xtype: 'timefield',
+ reference: 'fromTimeField',
+ maxWidth: styles.reportTime,
+ format: styles.timeFormat,
+ value: new Date(new Date().getTime() - 30 * 60 * 1000)
+ }, '-', {
+ xtype: 'tbtext',
+ html: strings.reportTo
+ }, {
+ xtype: 'datefield',
+ reference: 'toDateField',
+ startDay: styles.weekStartDay,
+ value: new Date()
+ }, {
+ xtype: 'timefield',
+ reference: 'toTimeField',
+ maxWidth: styles.reportTime,
+ format: styles.timeFormat,
+ value: new Date()
+ }, '-', {
+ text: strings.reportShow,
+ handler: 'onShowClick'
+ }, {
+ text: strings.reportClear,
+ handler: 'onClearClick'
+ }],
- listeners: {
- selectionchange: 'onSelectionChange'
- },
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
- columns: [{
- text: strings.positionValid,
- dataIndex: 'valid',
- flex: 1,
- renderer: Traccar.AttributeFormatter.getFormatter('valid')
- }, {
- text: strings.positionTime,
- dataIndex: 'fixTime',
- flex: 1,
- xtype: 'datecolumn',
- renderer: Traccar.AttributeFormatter.getFormatter('fixTime')
- }, {
- text: strings.positionLatitude,
- dataIndex: 'latitude',
- flex: 1,
- renderer: Traccar.AttributeFormatter.getFormatter('latitude')
- }, {
- text: strings.positionLongitude,
- dataIndex: 'longitude',
- flex: 1,
- renderer: Traccar.AttributeFormatter.getFormatter('latitude')
- }, {
- text: strings.positionAltitude,
- dataIndex: 'altitude',
- flex: 1,
- renderer: Traccar.AttributeFormatter.getFormatter('altitude')
- }, {
- text: strings.positionSpeed,
- dataIndex: 'speed',
- flex: 1,
- renderer: Traccar.AttributeFormatter.getFormatter('speed')
- }, {
- text: strings.positionAddress,
- dataIndex: 'address',
- flex: 1,
- renderer: Traccar.AttributeFormatter.getFormatter('address')
- }]
-});
+ columns: [{
+ text: strings.positionValid,
+ dataIndex: 'valid',
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('valid')
+ }, {
+ text: strings.positionTime,
+ dataIndex: 'fixTime',
+ flex: 1,
+ xtype: 'datecolumn',
+ renderer: Traccar.AttributeFormatter.getFormatter('fixTime')
+ }, {
+ text: strings.positionLatitude,
+ dataIndex: 'latitude',
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('latitude')
+ }, {
+ text: strings.positionLongitude,
+ dataIndex: 'longitude',
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('latitude')
+ }, {
+ text: strings.positionAltitude,
+ dataIndex: 'altitude',
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('altitude')
+ }, {
+ text: strings.positionSpeed,
+ dataIndex: 'speed',
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('speed')
+ }, {
+ text: strings.positionAddress,
+ dataIndex: 'address',
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('address')
+ }]
+ });
+
+})();
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 99c1a9b07..8653784ab 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -13,68 +13,72 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.ReportController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.report',
+ Ext.define('Traccar.view.ReportController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.report',
- config: {
- listen: {
- controller: {
- '*': {
- selectDevice: 'selectDevice'
+ config: {
+ listen: {
+ controller: {
+ '*': {
+ selectDevice: 'selectDevice'
+ }
}
}
- }
- },
+ },
- onShowClick: function () {
- var deviceId, fromDate, fromTime, from, toDate, toTime, to, store;
+ onShowClick: function () {
+ var deviceId, fromDate, fromTime, from, toDate, toTime, to, store;
- deviceId = this.lookupReference('deviceField').getValue();
+ deviceId = this.lookupReference('deviceField').getValue();
- fromDate = this.lookupReference('fromDateField').getValue();
- fromTime = this.lookupReference('fromTimeField').getValue();
+ fromDate = this.lookupReference('fromDateField').getValue();
+ fromTime = this.lookupReference('fromTimeField').getValue();
- from = new Date(
- fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(),
- fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds());
+ from = new Date(
+ fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(),
+ fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds());
- toDate = this.lookupReference('toDateField').getValue();
- toTime = this.lookupReference('toTimeField').getValue();
+ toDate = this.lookupReference('toDateField').getValue();
+ toTime = this.lookupReference('toTimeField').getValue();
- to = new Date(
- toDate.getFullYear(), toDate.getMonth(), toDate.getDate(),
- toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds());
+ to = new Date(
+ toDate.getFullYear(), toDate.getMonth(), toDate.getDate(),
+ toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds());
- store = Ext.getStore('Positions');
- store.load({
- params:{
- deviceId: deviceId,
- from: from.toISOString(),
- to: to.toISOString()
- },
- scope: this,
- callback: function () {
- this.fireEvent("reportShow");
- }
- });
- },
+ store = Ext.getStore('Positions');
+ store.load({
+ params: {
+ deviceId: deviceId,
+ from: from.toISOString(),
+ to: to.toISOString()
+ },
+ scope: this,
+ callback: function () {
+ this.fireEvent("reportShow");
+ }
+ });
+ },
- onClearClick: function () {
- Ext.getStore('Positions').removeAll();
- this.fireEvent("reportClear");
- },
+ onClearClick: function () {
+ Ext.getStore('Positions').removeAll();
+ this.fireEvent("reportClear");
+ },
- onSelectionChange: function (selected) {
- if (selected.getCount() > 0) {
- this.fireEvent("selectReport", selected.getLastSelected());
- }
- },
+ onSelectionChange: function (selected) {
+ if (selected.getCount() > 0) {
+ this.fireEvent("selectReport", selected.getLastSelected());
+ }
+ },
- selectDevice: function (device) {
- if (device !== undefined) {
- this.getView().getSelectionModel().deselectAll();
+ selectDevice: function (device) {
+ if (device !== undefined) {
+ this.getView().getSelectionModel().deselectAll();
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js
index 1339786ab..a9751d647 100644
--- a/web/app/view/ServerDialog.js
+++ b/web/app/view/ServerDialog.js
@@ -13,65 +13,69 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.ServerDialog', {
- extend: 'Traccar.view.BaseEditDialog',
+ Ext.define('Traccar.view.ServerDialog', {
+ extend: 'Traccar.view.BaseEditDialog',
- requires: [
- 'Traccar.view.BaseEditDialogController'
- ],
+ requires: [
+ 'Traccar.view.BaseEditDialogController'
+ ],
- controller: 'baseEditDialog',
- title: strings.serverTitle,
+ controller: 'baseEditDialog',
+ title: strings.serverTitle,
- items: {
- xtype: 'form',
- items: [{
- xtype: 'checkboxfield',
- name: 'registration',
- fieldLabel: strings.serverRegistration,
- allowBlank: false
- }, {
- xtype: 'combobox',
- name: 'map',
- fieldLabel: strings.mapLayer,
- store: 'MapTypes',
- displayField: 'name',
- valueField: 'key'
- }, {
- xtype: 'textfield',
- name: 'bingKey',
- fieldLabel: strings.mapBingKey
- }, {
- xtype: 'textfield',
- name: 'mapUrl',
- fieldLabel: strings.mapCustom
- }, {
- 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
- }]
- }
-});
+ items: {
+ xtype: 'form',
+ items: [{
+ xtype: 'checkboxfield',
+ name: 'registration',
+ fieldLabel: strings.serverRegistration,
+ allowBlank: false
+ }, {
+ xtype: 'combobox',
+ name: 'map',
+ fieldLabel: strings.mapLayer,
+ store: 'MapTypes',
+ displayField: 'name',
+ valueField: 'key'
+ }, {
+ xtype: 'textfield',
+ name: 'bingKey',
+ fieldLabel: strings.mapBingKey
+ }, {
+ xtype: 'textfield',
+ name: 'mapUrl',
+ fieldLabel: strings.mapCustom
+ }, {
+ 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
+ }]
+ }
+ });
+
+})();
diff --git a/web/app/view/State.js b/web/app/view/State.js
index 0804234f9..5cb31c676 100644
--- a/web/app/view/State.js
+++ b/web/app/view/State.js
@@ -13,27 +13,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.State', {
- extend: 'Ext.grid.Panel',
- xtype: 'stateView',
-
- requires: [
- 'Traccar.view.StateController'
- ],
-
- controller: 'state',
- store: 'Attributes',
+ Ext.define('Traccar.view.State', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'stateView',
- title: strings.stateTitle,
+ requires: [
+ 'Traccar.view.StateController'
+ ],
- columns: [{
- text: strings.stateName,
- dataIndex: 'name',
- flex: 1
- }, {
- text: strings.stateValue,
- dataIndex: 'value',
- flex: 1
- }]
-});
+ controller: 'state',
+ store: 'Attributes',
+
+ title: strings.stateTitle,
+
+ columns: [{
+ text: strings.stateName,
+ dataIndex: 'name',
+ flex: 1
+ }, {
+ text: strings.stateValue,
+ dataIndex: 'value',
+ flex: 1
+ }]
+ });
+
+})();
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index ce9a21af4..489662ee7 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -13,125 +13,129 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.StateController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.state',
+ Ext.define('Traccar.view.StateController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.state',
- config: {
- listen: {
- controller: {
- '*': {
- selectDevice: 'selectDevice'
+ config: {
+ listen: {
+ controller: {
+ '*': {
+ selectDevice: 'selectDevice'
+ }
}
}
- }
- },
-
- init: function () {
- var store = Ext.getStore('LatestPositions');
- store.on('add', this.add, this);
- store.on('update', this.update, this);
- },
-
- keys: {
- fixTime: {
- priority: 1,
- name: strings.positionTime
- },
- latitude: {
- priority: 2,
- name: strings.positionLatitude
- },
- longitude: {
- priority: 3,
- name: strings.positionLongitude
- },
- valid: {
- priority: 4,
- name: strings.positionValid
- },
- altitude: {
- priority: 5,
- name: strings.positionAltitude
- },
- speed: {
- priority: 6,
- name: strings.positionSpeed
},
- course: {
- priority: 7,
- name: strings.positionCourse
- },
- address: {
- priority: 8,
- name: strings.positionAddress
- },
- protocol: {
- priority: 9,
- name: strings.positionProtocol
- }
- },
- formatValue: function (value) {
- if (typeof(id) === 'number') {
- return value.toFixed(2);
- } else {
- return value;
- }
- },
+ init: function () {
+ var store = Ext.getStore('LatestPositions');
+ store.on('add', this.add, this);
+ store.on('update', this.update, this);
+ },
- updatePosition: function (position) {
- var attributes, value, unit, store, key;
- store = Ext.getStore('Attributes');
- store.removeAll();
+ keys: {
+ fixTime: {
+ priority: 1,
+ name: strings.positionTime
+ },
+ latitude: {
+ priority: 2,
+ name: strings.positionLatitude
+ },
+ longitude: {
+ priority: 3,
+ name: strings.positionLongitude
+ },
+ valid: {
+ priority: 4,
+ name: strings.positionValid
+ },
+ altitude: {
+ priority: 5,
+ name: strings.positionAltitude
+ },
+ speed: {
+ priority: 6,
+ name: strings.positionSpeed
+ },
+ course: {
+ priority: 7,
+ name: strings.positionCourse
+ },
+ address: {
+ priority: 8,
+ name: strings.positionAddress
+ },
+ protocol: {
+ priority: 9,
+ name: strings.positionProtocol
+ }
+ },
- for (key in position.data) {
- if (position.data.hasOwnProperty(key) && this.keys[key] !== undefined) {
- store.add(Ext.create('Traccar.model.Attribute', {
- priority: this.keys[key].priority,
- name: this.keys[key].name,
- value: Traccar.AttributeFormatter.getFormatter(key)(position.get(key))
- }));
+ formatValue: function (value) {
+ if (typeof(id) === 'number') {
+ return value.toFixed(2);
+ } else {
+ return value;
}
- }
+ },
+
+ updatePosition: function (position) {
+ var attributes, value, unit, store, key;
+ store = Ext.getStore('Attributes');
+ store.removeAll();
- attributes = position.get('attributes');
- if (attributes instanceof Object) {
- for (key in attributes) {
- if (attributes.hasOwnProperty(key)) {
+ for (key in position.data) {
+ if (position.data.hasOwnProperty(key) && this.keys[key] !== undefined) {
store.add(Ext.create('Traccar.model.Attribute', {
- priority: 1024,
- name: key.replace(/^./, function (match) {
- return match.toUpperCase();
- }),
- value: Traccar.AttributeFormatter.getFormatter(key)(attributes[key])
+ priority: this.keys[key].priority,
+ name: this.keys[key].name,
+ value: Traccar.AttributeFormatter.getFormatter(key)(position.get(key))
}));
}
}
- }
- },
- selectDevice: function (device) {
- var found;
- this.deviceId = device.get('id');
- found = Ext.getStore('LatestPositions').query('deviceId', this.deviceId);
- if (found.getCount() > 0) {
- this.updatePosition(found.first());
- } else {
- Ext.getStore('Attributes').removeAll();
- }
- },
+ attributes = position.get('attributes');
+ if (attributes instanceof Object) {
+ for (key in attributes) {
+ if (attributes.hasOwnProperty(key)) {
+ store.add(Ext.create('Traccar.model.Attribute', {
+ priority: 1024,
+ name: key.replace(/^./, function (match) {
+ return match.toUpperCase();
+ }),
+ value: Traccar.AttributeFormatter.getFormatter(key)(attributes[key])
+ }));
+ }
+ }
+ }
+ },
- add: function (store, data) {
- if (this.deviceId === data[0].get('deviceId')) {
- this.updatePosition(data[0]);
- }
- },
+ selectDevice: function (device) {
+ var found;
+ this.deviceId = device.get('id');
+ found = Ext.getStore('LatestPositions').query('deviceId', this.deviceId);
+ if (found.getCount() > 0) {
+ this.updatePosition(found.first());
+ } else {
+ Ext.getStore('Attributes').removeAll();
+ }
+ },
- update: function (store, data) {
- if (this.deviceId === data.get('deviceId')) {
- this.updatePosition(data);
+ add: function (store, data) {
+ if (this.deviceId === data[0].get('deviceId')) {
+ this.updatePosition(data[0]);
+ }
+ },
+
+ update: function (store, data) {
+ if (this.deviceId === data.get('deviceId')) {
+ this.updatePosition(data);
+ }
}
- }
-});
+ });
+
+})();
diff --git a/web/app/view/User.js b/web/app/view/User.js
index 807095ebe..61ff01ab5 100644
--- a/web/app/view/User.js
+++ b/web/app/view/User.js
@@ -13,48 +13,52 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.User', {
- extend: 'Ext.grid.Panel',
- xtype: 'userView',
-
- requires: [
- 'Traccar.view.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 }
- ]
-});
+ Ext.define('Traccar.view.User', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'userView',
+
+ requires: [
+ 'Traccar.view.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/UserController.js b/web/app/view/UserController.js
index f541914e4..670565dcb 100644
--- a/web/app/view/UserController.js
+++ b/web/app/view/UserController.js
@@ -13,72 +13,76 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.UserController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.user',
+ Ext.define('Traccar.view.UserController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.user',
- requires: [
- 'Traccar.view.UserDialog'
- ],
+ requires: [
+ 'Traccar.view.UserDialog'
+ ],
- init: function () {
- Ext.getStore('Users').load();
- },
+ init: function () {
+ Ext.getStore('Users').load();
+ },
- onAddClick: function () {
- var user = Ext.create('Traccar.model.User');
- var dialog = Ext.create('Traccar.view.UserDialog');
- dialog.down('form').loadRecord(user);
- dialog.show();
- },
+ onAddClick: function () {
+ var user = Ext.create('Traccar.model.User');
+ var dialog = Ext.create('Traccar.view.UserDialog');
+ dialog.down('form').loadRecord(user);
+ dialog.show();
+ },
- onEditClick: function () {
- var user = this.getView().getSelectionModel().getSelection()[0];
- var dialog = Ext.create('Traccar.view.UserDialog');
- dialog.down('form').loadRecord(user);
- dialog.show();
- },
+ onEditClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ var dialog = Ext.create('Traccar.view.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();
+ 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();*/
- },
+ 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);
- }
+ 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/UserDialog.js b/web/app/view/UserDialog.js
index 0c5914ce0..2048051be 100644
--- a/web/app/view/UserDialog.js
+++ b/web/app/view/UserDialog.js
@@ -13,75 +13,79 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.UserDialog', {
- extend: 'Traccar.view.BaseEditDialog',
+ Ext.define('Traccar.view.UserDialog', {
+ extend: 'Traccar.view.BaseEditDialog',
- requires: [
- 'Traccar.view.UserDialogController'
- ],
+ requires: [
+ 'Traccar.view.UserDialogController'
+ ],
- controller: 'userDialog',
+ controller: 'userDialog',
- title: strings.settingsUser,
+ title: strings.settingsUser,
- 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
- }]
- }
-});
+ 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
+ }]
+ }
+ });
+
+})();
diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js
index 0bd9d87e3..6dbd44fa7 100644
--- a/web/app/view/UserDialogController.js
+++ b/web/app/view/UserDialogController.js
@@ -13,35 +13,39 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+(function () {
+ 'use strict';
-Ext.define('Traccar.view.UserDialogController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.userDialog',
+ Ext.define('Traccar.view.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);
+ init: function () {
+ if (Traccar.app.getUser().get('admin')) {
+ this.lookupReference('adminField').setDisabled(false);
}
- store.sync({
- failure: function (batch) {
- store.rejectChanges(); // TODO
- Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
+ },
+
+ 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();
}
- button.up('window').close();
- }
-});
+ });
+
+})();