aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/AttributeFormatter.js6
-rw-r--r--web/app/Style.js6
-rw-r--r--web/app/model/Server.js3
-rw-r--r--web/app/model/User.js3
-rw-r--r--web/app/view/CustomTimeField.js29
-rw-r--r--web/app/view/Devices.js31
-rw-r--r--web/app/view/MapController.js2
-rw-r--r--web/app/view/Report.js9
-rw-r--r--web/app/view/ServerDialog.js5
-rw-r--r--web/app/view/UserDialog.js5
10 files changed, 89 insertions, 10 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 1cbc1cfc0..3432ca1e0 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -40,7 +40,11 @@ Ext.define('Traccar.AttributeFormatter', {
} 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, Traccar.Style.dateTimeFormat);
+ if (Traccar.app.getPreference('twelveHourFormat', false)) {
+ return Ext.Date.format(value, Traccar.Style.dateTimeFormat12);
+ } else {
+ return Ext.Date.format(value, Traccar.Style.dateTimeFormat24);
+ }
}
return value;
},
diff --git a/web/app/Style.js b/web/app/Style.js
index f4868aec3..309a3937e 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -22,8 +22,10 @@ Ext.define('Traccar.Style', {
windowWidth: 640,
windowHeight: 480,
- dateTimeFormat: 'Y-m-d H:i:s',
- timeFormat: 'H:i',
+ dateTimeFormat24: 'Y-m-d H:i:s',
+ dateTimeFormat12: 'Y-m-d g:i:s a',
+ timeFormat24: 'H:i',
+ timeFormat12: 'g:i a',
dateFormat: 'Y-m-d',
weekStartDay: 1,
diff --git a/web/app/model/Server.js b/web/app/model/Server.js
index 9b4b5b2b6..796ff58d6 100644
--- a/web/app/model/Server.js
+++ b/web/app/model/Server.js
@@ -54,6 +54,9 @@ Ext.define('Traccar.model.Server', {
}, {
name: 'zoom',
type: 'int'
+ }, {
+ name: 'twelveHourFormat',
+ type: 'boolean'
}],
proxy: {
diff --git a/web/app/model/User.js b/web/app/model/User.js
index b00918bc8..237a4d269 100644
--- a/web/app/model/User.js
+++ b/web/app/model/User.js
@@ -54,6 +54,9 @@ Ext.define('Traccar.model.User', {
}, {
name: 'zoom',
type: 'int'
+ }, {
+ name: 'twelveHourFormat',
+ type: 'boolean'
}],
proxy: {
diff --git a/web/app/view/CustomTimeField.js b/web/app/view/CustomTimeField.js
new file mode 100644
index 000000000..1bd8c7307
--- /dev/null
+++ b/web/app/view/CustomTimeField.js
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+Ext.define('Traccar.view.CustomTimeField', {
+ extend: 'Ext.form.field.Time',
+ xtype: 'customTimeField',
+
+ constructor: function (config) {
+ if (Traccar.app.getPreference('twelveHourFormat', false)) {
+ config.format = Traccar.Style.timeFormat12;
+ } else {
+ config.format = Traccar.Style.timeFormat24;
+ }
+ this.callParent(arguments);
+ }
+});
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js
index ebe3ca195..b464ed561 100644
--- a/web/app/view/Devices.js
+++ b/web/app/view/Devices.js
@@ -62,6 +62,31 @@ Ext.define('Traccar.view.Devices', {
}]
},
+ bbar: [{
+ xtype: 'tbtext',
+ html: Strings.sharedSearch
+ }, {
+ xtype: 'textfield',
+ listeners: {
+ change: function () {
+ var tree, expr;
+ tree = this.up('treepanel');
+ expr = new RegExp(this.getValue(), 'i');
+ tree.store.filter({
+ id: 'nameFilter',
+ filterFn: function (node) {
+ var children, len, visible, i;
+ children = node.childNodes;
+ len = children && children.length;
+ visible = node.isLeaf() ? expr.test(node.get('name')) : false;
+ for (i = 0; i < len && !(visible = children[i].get('visible')); i++);
+ return visible;
+ }
+ });
+ }
+ }
+ }],
+
listeners: {
selectionchange: 'onSelectionChange',
beforeselect: 'onBeforeSelect'
@@ -89,7 +114,11 @@ Ext.define('Traccar.view.Devices', {
metaData.tdCls = 'status-color-unknown';
break;
}
- return Ext.Date.format(value, Traccar.Style.dateTimeFormat);
+ if (Traccar.app.getPreference('twelveHourFormat', false)) {
+ return Ext.Date.format(value, Traccar.Style.dateTimeFormat12);
+ } else {
+ return Ext.Date.format(value, Traccar.Style.dateTimeFormat24);
+ }
}
}
}]
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index 918f81390..b8b7290b8 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -170,7 +170,7 @@ Ext.define('Traccar.view.MapController', {
style = this.getReportMarker();
style.getImage().setRotation(position.get('course') * Math.PI / 180);
/*style.getText().setText(
- Ext.Date.format(position.get('fixTime'), Traccar.Style.dateTimeFormat));*/
+ Ext.Date.format(position.get('fixTime'), Traccar.Style.dateTimeFormat24));*/
marker.setStyle(style);
diff --git a/web/app/view/Report.js b/web/app/view/Report.js
index 91ccba917..4261b9040 100644
--- a/web/app/view/Report.js
+++ b/web/app/view/Report.js
@@ -19,7 +19,8 @@ Ext.define('Traccar.view.Report', {
xtype: 'reportView',
requires: [
- 'Traccar.view.ReportController'
+ 'Traccar.view.ReportController',
+ 'Traccar.view.CustomTimeField'
],
controller: 'report',
@@ -48,10 +49,9 @@ Ext.define('Traccar.view.Report', {
format: Traccar.Style.dateFormat,
value: new Date(new Date().getTime() - 30 * 60 * 1000)
}, {
- xtype: 'timefield',
+ xtype: 'customTimeField',
reference: 'fromTimeField',
maxWidth: Traccar.Style.reportTime,
- format: Traccar.Style.timeFormat,
value: new Date(new Date().getTime() - 30 * 60 * 1000)
}, '-', {
xtype: 'tbtext',
@@ -63,10 +63,9 @@ Ext.define('Traccar.view.Report', {
format: Traccar.Style.dateFormat,
value: new Date()
}, {
- xtype: 'timefield',
+ xtype: 'customTimeField',
reference: 'toTimeField',
maxWidth: Traccar.Style.reportTime,
- format: Traccar.Style.timeFormat,
value: new Date()
}, '-', {
text: Strings.reportShow,
diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js
index 9fbbed920..67f3a7ab2 100644
--- a/web/app/view/ServerDialog.js
+++ b/web/app/view/ServerDialog.js
@@ -79,6 +79,11 @@ Ext.define('Traccar.view.ServerDialog', {
xtype: 'numberfield',
name: 'zoom',
fieldLabel: Strings.serverZoom
+ }, {
+ xtype: 'checkboxfield',
+ name: 'twelveHourFormat',
+ fieldLabel: Strings.settingsTwelveHourFormat,
+ allowBlank: false
}]
}
});
diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js
index c1ed2fece..d0e8bda52 100644
--- a/web/app/view/UserDialog.js
+++ b/web/app/view/UserDialog.js
@@ -84,6 +84,11 @@ Ext.define('Traccar.view.UserDialog', {
xtype: 'numberfield',
name: 'zoom',
fieldLabel: Strings.serverZoom
+ }, {
+ xtype: 'checkboxfield',
+ name: 'twelveHourFormat',
+ fieldLabel: Strings.settingsTwelveHourFormat,
+ allowBlank: false
}]
}
});