From b7403aaadd130bf1496b97c07667842813d99550 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 5 Sep 2016 14:27:30 +0500 Subject: Implement retrieving map center from current map --- web/app/Style.js | 4 +++- web/app/view/MapController.js | 11 ++++++++- web/app/view/ServerDialog.js | 39 +++++++++++++++++++------------ web/app/view/ServerDialogController.js | 42 ++++++++++++++++++++++++++++++++++ web/app/view/UserDialog.js | 35 +++++++++++++++++----------- web/app/view/UserDialogController.js | 2 +- web/l10n/en.json | 2 ++ 7 files changed, 104 insertions(+), 31 deletions(-) create mode 100644 web/app/view/ServerDialogController.js diff --git a/web/app/Style.js b/web/app/Style.js index b3b296b75..034d2fb0b 100644 --- a/web/app/Style.js +++ b/web/app/Style.js @@ -75,5 +75,7 @@ Ext.define('Traccar.Style', { coordinatePrecision: 6, numberPrecision: 2, - reportTagfieldWidth: 375 + reportTagfieldWidth: 375, + + inFormButtonMargin: '0 0 9 0' }); diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index bc6a5d404..288593dab 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -23,7 +23,8 @@ Ext.define('Traccar.view.MapController', { controller: { '*': { selectDevice: 'selectDevice', - selectReport: 'selectReport' + selectReport: 'selectReport', + getMapCenter: 'getMapCenter' } }, store: { @@ -304,5 +305,13 @@ Ext.define('Traccar.view.MapController', { this.fireEvent('selectReport', record, false); } } + }, + + getMapCenter: function () { + var zoom, center, projection; + projection = this.getView().getMapView().getProjection(); + center = ol.proj.transform(this.getView().getMapView().getCenter(), projection, 'EPSG:4326'); + zoom = this.getView().getMapView().getZoom(); + this.fireEvent('setCenterFromMap', center[1], center[0], zoom); } }); diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js index dd4579168..0f8dbd2eb 100644 --- a/web/app/view/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -18,10 +18,10 @@ Ext.define('Traccar.view.ServerDialog', { extend: 'Traccar.view.BaseEditDialog', requires: [ - 'Traccar.view.BaseEditDialogController' + 'Traccar.view.ServerDialogController' ], - controller: 'baseEditDialog', + controller: 'serverEditDialog', title: Strings.serverTitle, items: { @@ -66,19 +66,28 @@ Ext.define('Traccar.view.ServerDialog', { displayField: 'name', valueField: 'key' }, { - xtype: 'numberfield', - name: 'latitude', - fieldLabel: Strings.positionLatitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - name: 'longitude', - fieldLabel: Strings.positionLongitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - name: 'zoom', - fieldLabel: Strings.serverZoom + xtype: 'fieldset', + reference: 'mapCenter', + title: Strings.sharedMapCenter, + defaultType: 'numberfield', + items: [{ + name: 'latitude', + fieldLabel: Strings.positionLatitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + name: 'longitude', + fieldLabel: Strings.positionLongitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + name: 'zoom', + fieldLabel: Strings.serverZoom + }, { + xtype: 'button', + margin: Traccar.Style.inFormButtonMargin, + enableToggle: false, + text: Strings.sharedGetFromMap, + handler: 'getFromMap' + }] }, { xtype: 'checkboxfield', name: 'twelveHourFormat', diff --git a/web/app/view/ServerDialogController.js b/web/app/view/ServerDialogController.js new file mode 100644 index 000000000..42760ca58 --- /dev/null +++ b/web/app/view/ServerDialogController.js @@ -0,0 +1,42 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) + * + * 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.ServerDialogController', { + extend: 'Traccar.view.BaseEditDialogController', + alias: 'controller.serverEditDialog', + + config: { + listen: { + controller: { + '*': { + setCenterFromMap: 'setCenterFromMap' + } + } + } + }, + + getFromMap: function (button) { + this.fireEvent('getMapCenter'); + }, + + setCenterFromMap: function (lat, lon, zoom) { + var mapCenter = this.lookupReference('mapCenter'); + mapCenter.down('numberfield[name="latitude"]').setValue(lat); + mapCenter.down('numberfield[name="longitude"]').setValue(lon); + mapCenter.down('numberfield[name="zoom"]').setValue(zoom); + } +}); diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 07fc1431f..c6b732513 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -70,19 +70,28 @@ Ext.define('Traccar.view.UserDialog', { displayField: 'name', valueField: 'key' }, { - xtype: 'numberfield', - name: 'latitude', - fieldLabel: Strings.positionLatitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - name: 'longitude', - fieldLabel: Strings.positionLongitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - xtype: 'numberfield', - name: 'zoom', - fieldLabel: Strings.serverZoom + xtype: 'fieldset', + reference: 'mapCenter', + title: Strings.sharedMapCenter, + defaultType: 'numberfield', + items: [{ + name: 'latitude', + fieldLabel: Strings.positionLatitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + name: 'longitude', + fieldLabel: Strings.positionLongitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + name: 'zoom', + fieldLabel: Strings.serverZoom + }, { + xtype: 'button', + margin: Traccar.Style.inFormButtonMargin, + enableToggle: false, + text: Strings.sharedGetFromMap, + handler: 'getFromMap' + }] }, { xtype: 'checkboxfield', name: 'twelveHourFormat', diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index c3a4ca62d..5e541c870 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -15,7 +15,7 @@ */ Ext.define('Traccar.view.UserDialogController', { - extend: 'Traccar.view.BaseEditDialogController', + extend: 'Traccar.view.ServerDialogController', alias: 'controller.userDialog', init: function () { diff --git a/web/l10n/en.json b/web/l10n/en.json index 563a37b18..e06daad93 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -28,6 +28,8 @@ "sharedDistance": "Distance", "sharedHourAbbreviation": "h", "sharedMinuteAbbreviation": "m", + "sharedMapCenter": "Map Center", + "sharedGetFromMap": "Get from Map", "errorTitle": "Error", "errorUnknown": "Unknown error", "errorConnection": "Connection error", -- cgit v1.2.3 From 0affb8110de3c53942c85a220babc859e2a7727d Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 6 Sep 2016 09:24:33 +0500 Subject: Move button to bottom bar --- web/app/Style.js | 4 +--- web/app/view/ServerDialog.js | 30 +++++++++++++++++++++--------- web/app/view/UserDialog.js | 30 +++++++++++++++++++++--------- web/l10n/en.json | 1 - 4 files changed, 43 insertions(+), 22 deletions(-) diff --git a/web/app/Style.js b/web/app/Style.js index 034d2fb0b..b3b296b75 100644 --- a/web/app/Style.js +++ b/web/app/Style.js @@ -75,7 +75,5 @@ Ext.define('Traccar.Style', { coordinatePrecision: 6, numberPrecision: 2, - reportTagfieldWidth: 375, - - inFormButtonMargin: '0 0 9 0' + reportTagfieldWidth: 375 }); diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js index 0f8dbd2eb..83f9c47f2 100644 --- a/web/app/view/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -66,9 +66,8 @@ Ext.define('Traccar.view.ServerDialog', { displayField: 'name', valueField: 'key' }, { - xtype: 'fieldset', + xtype: 'fieldcontainer', reference: 'mapCenter', - title: Strings.sharedMapCenter, defaultType: 'numberfield', items: [{ name: 'latitude', @@ -81,12 +80,6 @@ Ext.define('Traccar.view.ServerDialog', { }, { name: 'zoom', fieldLabel: Strings.serverZoom - }, { - xtype: 'button', - margin: Traccar.Style.inFormButtonMargin, - enableToggle: false, - text: Strings.sharedGetFromMap, - handler: 'getFromMap' }] }, { xtype: 'checkboxfield', @@ -94,5 +87,24 @@ Ext.define('Traccar.view.ServerDialog', { fieldLabel: Strings.settingsTwelveHourFormat, allowBlank: false }] - } + }, + + buttons: [{ + text: Strings.sharedAttributes, + handler: 'showAttributesView' + }, { + glyph: 'xf276@FontAwesome', + minWidth: 0, + handler: 'getFromMap', + tooltip: Strings.sharedGetFromMap, + tooltipType: 'title' + }, { + xtype: 'tbfill' + }, { + text: Strings.sharedSave, + handler: 'onSaveClick' + }, { + text: Strings.sharedCancel, + handler: 'closeView' + }] }); diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index c6b732513..46b86dd5d 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -24,7 +24,7 @@ Ext.define('Traccar.view.UserDialog', { controller: 'userDialog', title: Strings.settingsUser, - items: [{ + items: { xtype: 'form', items: [{ xtype: 'textfield', @@ -70,9 +70,8 @@ Ext.define('Traccar.view.UserDialog', { displayField: 'name', valueField: 'key' }, { - xtype: 'fieldset', + xtype: 'fieldcontainer', reference: 'mapCenter', - title: Strings.sharedMapCenter, defaultType: 'numberfield', items: [{ name: 'latitude', @@ -85,12 +84,6 @@ Ext.define('Traccar.view.UserDialog', { }, { name: 'zoom', fieldLabel: Strings.serverZoom - }, { - xtype: 'button', - margin: Traccar.Style.inFormButtonMargin, - enableToggle: false, - text: Strings.sharedGetFromMap, - handler: 'getFromMap' }] }, { xtype: 'checkboxfield', @@ -98,5 +91,24 @@ Ext.define('Traccar.view.UserDialog', { fieldLabel: Strings.settingsTwelveHourFormat, allowBlank: false }] + }, + + buttons: [{ + text: Strings.sharedAttributes, + handler: 'showAttributesView' + }, { + glyph: 'xf276@FontAwesome', + minWidth: 0, + handler: 'getFromMap', + tooltip: Strings.sharedGetFromMap, + tooltipType: 'title' + }, { + xtype: 'tbfill' + }, { + text: Strings.sharedSave, + handler: 'onSaveClick' + }, { + text: Strings.sharedCancel, + handler: 'closeView' }] }); diff --git a/web/l10n/en.json b/web/l10n/en.json index e06daad93..88f572e33 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -28,7 +28,6 @@ "sharedDistance": "Distance", "sharedHourAbbreviation": "h", "sharedMinuteAbbreviation": "m", - "sharedMapCenter": "Map Center", "sharedGetFromMap": "Get from Map", "errorTitle": "Error", "errorUnknown": "Unknown error", -- cgit v1.2.3 From 97e80ec49fddec3d56880bae47bd070474fa8fa3 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 6 Sep 2016 15:58:03 +0500 Subject: - Remove field container - Renamed functions and strings --- web/app/view/MapController.js | 6 +++--- web/app/view/ServerDialog.js | 37 +++++++++++++++++----------------- web/app/view/ServerDialogController.js | 15 +++++++------- web/app/view/UserDialog.js | 37 +++++++++++++++++----------------- web/l10n/en.json | 2 +- 5 files changed, 49 insertions(+), 48 deletions(-) diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index 288593dab..c0ac2c534 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -24,7 +24,7 @@ Ext.define('Traccar.view.MapController', { '*': { selectDevice: 'selectDevice', selectReport: 'selectReport', - getMapCenter: 'getMapCenter' + mapstaterequest: 'getMapState' } }, store: { @@ -307,11 +307,11 @@ Ext.define('Traccar.view.MapController', { } }, - getMapCenter: function () { + getMapState: function () { var zoom, center, projection; projection = this.getView().getMapView().getProjection(); center = ol.proj.transform(this.getView().getMapView().getCenter(), projection, 'EPSG:4326'); zoom = this.getView().getMapView().getZoom(); - this.fireEvent('setCenterFromMap', center[1], center[0], zoom); + this.fireEvent('mapstate', center[1], center[0], zoom); } }); diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js index 83f9c47f2..40afa4ec3 100644 --- a/web/app/view/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -66,21 +66,22 @@ Ext.define('Traccar.view.ServerDialog', { displayField: 'name', valueField: 'key' }, { - xtype: 'fieldcontainer', - reference: 'mapCenter', - defaultType: 'numberfield', - items: [{ - name: 'latitude', - fieldLabel: Strings.positionLatitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - name: 'longitude', - fieldLabel: Strings.positionLongitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - name: 'zoom', - fieldLabel: Strings.serverZoom - }] + xtype: 'numberfield', + reference: 'latitude', + name: 'latitude', + fieldLabel: Strings.positionLatitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + xtype: 'numberfield', + reference: 'longitude', + name: 'longitude', + fieldLabel: Strings.positionLongitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + xtype: 'numberfield', + reference: 'zoom', + name: 'zoom', + fieldLabel: Strings.serverZoom }, { xtype: 'checkboxfield', name: 'twelveHourFormat', @@ -93,10 +94,10 @@ Ext.define('Traccar.view.ServerDialog', { text: Strings.sharedAttributes, handler: 'showAttributesView' }, { - glyph: 'xf276@FontAwesome', + glyph: 'xf041@FontAwesome', minWidth: 0, - handler: 'getFromMap', - tooltip: Strings.sharedGetFromMap, + handler: 'getMapState', + tooltip: Strings.sharedGetMapState, tooltipType: 'title' }, { xtype: 'tbfill' diff --git a/web/app/view/ServerDialogController.js b/web/app/view/ServerDialogController.js index 42760ca58..55f49f676 100644 --- a/web/app/view/ServerDialogController.js +++ b/web/app/view/ServerDialogController.js @@ -23,20 +23,19 @@ Ext.define('Traccar.view.ServerDialogController', { listen: { controller: { '*': { - setCenterFromMap: 'setCenterFromMap' + mapstate: 'setMapState' } } } }, - getFromMap: function (button) { - this.fireEvent('getMapCenter'); + getMapState: function (button) { + this.fireEvent('mapstaterequest'); }, - setCenterFromMap: function (lat, lon, zoom) { - var mapCenter = this.lookupReference('mapCenter'); - mapCenter.down('numberfield[name="latitude"]').setValue(lat); - mapCenter.down('numberfield[name="longitude"]').setValue(lon); - mapCenter.down('numberfield[name="zoom"]').setValue(zoom); + setMapState: function (lat, lon, zoom) { + this.getView().lookupReference('latitude').setValue(lat); + this.getView().lookupReference('longitude').setValue(lon); + this.getView().lookupReference('zoom').setValue(zoom); } }); diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 46b86dd5d..f9e704ee5 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -70,21 +70,22 @@ Ext.define('Traccar.view.UserDialog', { displayField: 'name', valueField: 'key' }, { - xtype: 'fieldcontainer', - reference: 'mapCenter', - defaultType: 'numberfield', - items: [{ - name: 'latitude', - fieldLabel: Strings.positionLatitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - name: 'longitude', - fieldLabel: Strings.positionLongitude, - decimalPrecision: Traccar.Style.coordinatePrecision - }, { - name: 'zoom', - fieldLabel: Strings.serverZoom - }] + xtype: 'numberfield', + reference: 'latitude', + name: 'latitude', + fieldLabel: Strings.positionLatitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + xtype: 'numberfield', + reference: 'longitude', + name: 'longitude', + fieldLabel: Strings.positionLongitude, + decimalPrecision: Traccar.Style.coordinatePrecision + }, { + xtype: 'numberfield', + reference: 'zoom', + name: 'zoom', + fieldLabel: Strings.serverZoom }, { xtype: 'checkboxfield', name: 'twelveHourFormat', @@ -97,10 +98,10 @@ Ext.define('Traccar.view.UserDialog', { text: Strings.sharedAttributes, handler: 'showAttributesView' }, { - glyph: 'xf276@FontAwesome', + glyph: 'xf041@FontAwesome', minWidth: 0, - handler: 'getFromMap', - tooltip: Strings.sharedGetFromMap, + handler: 'getMapState', + tooltip: Strings.sharedGetMapState, tooltipType: 'title' }, { xtype: 'tbfill' diff --git a/web/l10n/en.json b/web/l10n/en.json index 88f572e33..e61710523 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -28,7 +28,7 @@ "sharedDistance": "Distance", "sharedHourAbbreviation": "h", "sharedMinuteAbbreviation": "m", - "sharedGetFromMap": "Get from Map", + "sharedGetMapState": "Get Map State", "errorTitle": "Error", "errorUnknown": "Unknown error", "errorConnection": "Connection error", -- cgit v1.2.3 From 68d284f3023d49c0c3ae9879c5c75c9b152eda3b Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 6 Sep 2016 16:09:11 +0500 Subject: Rename other events to lowercase --- web/app/view/BaseMap.js | 2 +- web/app/view/DevicesController.js | 8 ++++---- web/app/view/GeofenceDialogController.js | 2 +- web/app/view/GeofenceMapController.js | 2 +- web/app/view/MapController.js | 10 +++++----- web/app/view/ReportController.js | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/web/app/view/BaseMap.js b/web/app/view/BaseMap.js index 77646cbef..62b2c5735 100644 --- a/web/app/view/BaseMap.js +++ b/web/app/view/BaseMap.js @@ -100,7 +100,7 @@ Ext.define('Traccar.view.BaseMap', { this.map.on('click', function (e) { this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { - this.fireEvent('selectFeature', feature); + this.fireEvent('selectfeature', feature); }, this); }, this); }, diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index 6dcc45448..68dd16025 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -31,8 +31,8 @@ Ext.define('Traccar.view.DevicesController', { listen: { controller: { '*': { - selectDevice: 'selectDevice', - selectReport: 'selectReport' + selectdevice: 'selectDevice', + selectreport: 'selectReport' } }, store: { @@ -121,7 +121,7 @@ Ext.define('Traccar.view.DevicesController', { var device; if (pressed) { device = this.getView().getSelectionModel().getSelection()[0]; - this.fireEvent('selectDevice', device, true); + this.fireEvent('selectdevice', device, true); } }, @@ -136,7 +136,7 @@ Ext.define('Traccar.view.DevicesController', { onSelectionChange: function (selected) { this.updateButtons(selected); if (selected.getCount() > 0) { - this.fireEvent('selectDevice', selected.getLastSelected(), true); + this.fireEvent('selectdevice', selected.getLastSelected(), true); } }, diff --git a/web/app/view/GeofenceDialogController.js b/web/app/view/GeofenceDialogController.js index b04935b9c..5638db362 100644 --- a/web/app/view/GeofenceDialogController.js +++ b/web/app/view/GeofenceDialogController.js @@ -26,7 +26,7 @@ Ext.define('Traccar.view.GeofenceDialogController', { listen: { controller: { '*': { - saveArea: 'saveArea' + savearea: 'saveArea' } } } diff --git a/web/app/view/GeofenceMapController.js b/web/app/view/GeofenceMapController.js index d643c89e4..c508127d7 100644 --- a/web/app/view/GeofenceMapController.js +++ b/web/app/view/GeofenceMapController.js @@ -27,7 +27,7 @@ Ext.define('Traccar.view.GeofenceMapController', { if (this.getView().getFeatures().getLength() > 0) { geometry = this.getView().getFeatures().pop().getGeometry(); projection = this.getView().getMapView().getProjection(); - this.fireEvent('saveArea', Traccar.GeofenceConverter.geometryToWkt(projection, geometry)); + this.fireEvent('savearea', Traccar.GeofenceConverter.geometryToWkt(projection, geometry)); button.up('window').close(); } }, diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index c0ac2c534..3b0db6b07 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -22,8 +22,8 @@ Ext.define('Traccar.view.MapController', { listen: { controller: { '*': { - selectDevice: 'selectDevice', - selectReport: 'selectReport', + selectdevice: 'selectDevice', + selectreport: 'selectReport', mapstaterequest: 'getMapState' } }, @@ -43,7 +43,7 @@ Ext.define('Traccar.view.MapController', { }, component: { '#': { - selectFeature: 'selectFeature' + selectfeature: 'selectFeature' } } } @@ -300,9 +300,9 @@ Ext.define('Traccar.view.MapController', { var record = feature.get('record'); if (record) { if (record instanceof Traccar.model.Device) { - this.fireEvent('selectDevice', record, false); + this.fireEvent('selectdevice', record, false); } else { - this.fireEvent('selectReport', record, false); + this.fireEvent('selectreport', record, false); } } }, diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 3a3345d83..a6253952a 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -29,8 +29,8 @@ Ext.define('Traccar.view.ReportController', { listen: { controller: { '*': { - selectDevice: 'selectDevice', - selectReport: 'selectReport' + selectdevice: 'selectDevice', + selectreport: 'selectReport' } } } @@ -116,7 +116,7 @@ Ext.define('Traccar.view.ReportController', { onSelectionChange: function (selected) { if (selected.getCount() > 0) { - this.fireEvent('selectReport', selected.getLastSelected(), true); + this.fireEvent('selectreport', selected.getLastSelected(), true); } }, -- cgit v1.2.3 From d7afbb815c7d185df9143f886a7494cb73a69ac1 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 6 Sep 2016 16:31:13 +0500 Subject: - Rename ServerDialogController to MapPickerDialogController - removed getView() --- web/app/view/MapPickerDialogController.js | 41 +++++++++++++++++++++++++++++++ web/app/view/ServerDialog.js | 4 +-- web/app/view/ServerDialogController.js | 41 ------------------------------- web/app/view/UserDialogController.js | 2 +- 4 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 web/app/view/MapPickerDialogController.js delete mode 100644 web/app/view/ServerDialogController.js diff --git a/web/app/view/MapPickerDialogController.js b/web/app/view/MapPickerDialogController.js new file mode 100644 index 000000000..4f202d195 --- /dev/null +++ b/web/app/view/MapPickerDialogController.js @@ -0,0 +1,41 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) + * + * 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.MapPickerDialogController', { + extend: 'Traccar.view.BaseEditDialogController', + alias: 'controller.mapPickerDialog', + + config: { + listen: { + controller: { + '*': { + mapstate: 'setMapState' + } + } + } + }, + + getMapState: function (button) { + this.fireEvent('mapstaterequest'); + }, + + setMapState: function (lat, lon, zoom) { + this.lookupReference('latitude').setValue(lat); + this.lookupReference('longitude').setValue(lon); + this.lookupReference('zoom').setValue(zoom); + } +}); diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js index 40afa4ec3..46c76ffa8 100644 --- a/web/app/view/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -18,10 +18,10 @@ Ext.define('Traccar.view.ServerDialog', { extend: 'Traccar.view.BaseEditDialog', requires: [ - 'Traccar.view.ServerDialogController' + 'Traccar.view.MapPickerDialogController' ], - controller: 'serverEditDialog', + controller: 'mapPickerDialog', title: Strings.serverTitle, items: { diff --git a/web/app/view/ServerDialogController.js b/web/app/view/ServerDialogController.js deleted file mode 100644 index 55f49f676..000000000 --- a/web/app/view/ServerDialogController.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) - * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) - * - * 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.ServerDialogController', { - extend: 'Traccar.view.BaseEditDialogController', - alias: 'controller.serverEditDialog', - - config: { - listen: { - controller: { - '*': { - mapstate: 'setMapState' - } - } - } - }, - - getMapState: function (button) { - this.fireEvent('mapstaterequest'); - }, - - setMapState: function (lat, lon, zoom) { - this.getView().lookupReference('latitude').setValue(lat); - this.getView().lookupReference('longitude').setValue(lon); - this.getView().lookupReference('zoom').setValue(zoom); - } -}); diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index 5e541c870..52d649b9c 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -15,7 +15,7 @@ */ Ext.define('Traccar.view.UserDialogController', { - extend: 'Traccar.view.ServerDialogController', + extend: 'Traccar.view.MapPickerDialogController', alias: 'controller.userDialog', init: function () { -- cgit v1.2.3