diff --git a/package-lock.json b/package-lock.json index afc00aa..7ae18fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2043,7 +2043,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -2205,7 +2205,7 @@ }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", "dev": true }, @@ -2461,7 +2461,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -2498,7 +2498,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -3104,7 +3104,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -3117,7 +3117,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -3218,7 +3218,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -3495,7 +3495,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -5582,7 +5582,7 @@ }, "html-webpack-plugin": { "version": "3.2.0", - "resolved": "http://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", "integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=", "dev": true, "requires": { @@ -6060,7 +6060,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -6613,7 +6613,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, @@ -8014,7 +8014,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -8606,7 +8606,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -9560,7 +9560,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, diff --git a/src/config/settings.js b/src/config/settings.js index c33aa2d..163f1ad 100644 --- a/src/config/settings.js +++ b/src/config/settings.js @@ -64,16 +64,21 @@ export const apiUrls = { } } export const geocache = { - authUrl: 'http://geopeitus.ee', + authUrl: 'https://geopeitus.ee', downloadUrl: { - page: 'http://www.geopeitus.ee/index.php?p=300', - geojson: 'http://www.geopeitus.ee/index.php?p=301&status[]=1&format=2', + page: 'https://www.geopeitus.ee/index.php?p=300', + geojson: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&format=2', gpx: { - gpxActive: 'http://www.geopeitus.ee/index.php?p=301&status[]=1&format=1', - gpxAll: 'http://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=2&status[]=3&format=1' + gpxActive: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=3&format=1', + gpxActiveLogs: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=3&format=1&gpx_events=2', + gpxAll: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=2&status[]=3&format=1' } }, - cacheUrl: 'http://geopeitus.ee/aare/', + cacheUrl: 'https://geopeitus.ee/aare/', + logUrl: { + 'geopeitus.ee': 'https://www.geopeitus.ee/logs/new/c/{id}', + 'geocaching.com': 'https://www.geocaching.com/seek/log.aspx?ID={id}&lcn=1' + }, radiusStyle: { maxResolution: 30, radius: 160 diff --git a/src/config/translations.json b/src/config/translations.json index 6a21b67..74f0a09 100644 --- a/src/config/translations.json +++ b/src/config/translations.json @@ -64,7 +64,7 @@ "Find streetview link and measure tools from context menu.": "Find streetview link and measure tools from context menu.", "Found": "Found", "Geocache importing": "Geocache importing", - "GeocacheList": "Caches", + "GeocacheInfo": "Info", "GeocacheLoader": "", "Geocaches": "Geocaches", "Geocache|Event Cache": "Event Cache", @@ -75,13 +75,14 @@ "Geocache|Unknown Cache": "Unknown Cache", "Geocache|Virtual Cache": "Virtual Cache", "Geocache|Webcam Cache": "Webcam Cache", - "Geocache|Whereigo Cache": "Whereigo Cache", + "Geocache|Wherigo Cache": "Wherigo Cache", "Geop is progressive web application with partial offline support.": "Geop is progressive web application with partial offline support.", "Geotrip": "Geotrip", "Geotrip reordered by optimum path": "Geotrip reordered by optimum path", "Go to": "Go to", "gpxActive": "Active caches", - "gpxAll": "All caches (active, archived, unavailable)", + "gpxActiveLogs": "Active caches with logs", + "gpxAll": "All caches (with archived, w.o logs)", "here": "here", "Hiking": "Hiking", "Imported": "Imported", @@ -100,6 +101,7 @@ "Less than 2 pair of coordinates, aborting!": "Less than 2 pair of coordinates, aborting!", "Limit address search with comma separated list of country codes (ee,fi - Estonia, Finland). Empty means no limit.": "Limit address search with comma separated list of country codes (ee,fi - Estonia, Finland). Empty means no limit.", "Location information is unavailable.": "Location information is unavailable.", + "Logs": "Logs", "Map": "Map", "Measure": "Measure", "Micro": "Micro", @@ -252,7 +254,7 @@ "Find streetview link and measure tools from context menu.": "Parema kliki menüüst leiad tänavavaate ja mõõtmise tööriistad.", "Found": "Leitud", "Geocache importing": "Aarete importimine", - "GeocacheList": "Aarded", + "GeocacheInfo": "Info", "GeocacheLoader": "", "Geocaches": "Aarded", "Geocache|Event Cache": "Sündmusaare", @@ -263,13 +265,14 @@ "Geocache|Unknown Cache": "Mõistatusaare", "Geocache|Virtual Cache": "Virtuaalne aare", "Geocache|Webcam Cache": "Veebikaamera aare", - "Geocache|Whereigo Cache": "Whereigo aare", + "Geocache|Wherigo Cache": "Wherigo aare", "Geop is progressive web application with partial offline support.": "Geop on progressiivne veebirakendus (PWA) osalise võrguta töötamise toega.", "Geotrip": "Geotuur", "Geotrip reordered by optimum path": "Geotuur järjestatud lühima teekonna järgi", "Go to": "Mine", "gpxActive": "Aktiivsed aarded", - "gpxAll": "Kõik aarded (aktiivsed, arhiveeritud, ajutiselt kättesaamatud)", + "gpxActiveLogs": "Aktiivsed aarded koos logidega", + "gpxAll": "Kõik aarded (k.a arhiveeritud, ilma logideta)", "here": "siit", "Hiking": "Matk", "Imported": "Imporditud", @@ -288,6 +291,7 @@ "Less than 2 pair of coordinates, aborting!": "Peab olema vähemalt kaks punkti, lõpetan!", "Limit address search with comma separated list of country codes (ee,fi - Estonia, Finland). Empty means no limit.": "Piira aadressiotsingut riigiti. Mitme riigi otsingu jaoks eralda komaga (ee,fi - Eesti, Soome). Tühi otsib üle maailma.", "Location information is unavailable.": "Asukoha info ei ole kättesaadav.", + "Logs": "Logid", "Map": "Kaart", "Measure": "Mõõda", "Micro": "Mikro", diff --git a/src/geop/components/featureinfo/Popup.js b/src/geop/components/featureinfo/Popup.js index 33157a5..269334f 100644 --- a/src/geop/components/featureinfo/Popup.js +++ b/src/geop/components/featureinfo/Popup.js @@ -89,6 +89,7 @@ class Popup extends Component { popContent.onHide(evt) }) this.el.popover('show') + setState('popup/show', { layerId: hit[0].get('id'), feature: hit[1] }) } open (e) { let coords = e.coordinate diff --git a/src/geop/components/geocache/Geocache.js b/src/geop/components/geocache/Geocache.js index 1c6e088..7f319bc 100644 --- a/src/geop/components/geocache/Geocache.js +++ b/src/geop/components/geocache/Geocache.js @@ -7,7 +7,7 @@ import { toLonLat } from 'ol/proj' import Component from 'Geop/Component' import Sidebar from 'Components/sidebar/Sidebar' import GeocacheLoader from './GeocacheLoader' -import GeocacheList from './GeocacheList' +import GeocacheInfo from './GeocacheInfo' import Filter from './Filter' import Geotrip from './Geotrip' import { createStyle } from 'Components/layer/StyleBuilder' @@ -30,7 +30,6 @@ const state = { layerOnMap: false, styleCache: {}, styleConfig: cacheConf.styles, - currentUser: getState('app/account'), cacheFormatParser: null, stat: { 'Not Found': 'far fa-square', @@ -67,7 +66,7 @@ class Geocache extends Component { position: 'left', components: { GeocacheLoader, - GeocacheList, + GeocacheInfo, Filter, Geotrip }, @@ -111,7 +110,10 @@ class Geocache extends Component { } }) state.layer.getSource().on('clear', listenLayer) - onchange('geocache/filter', listenLayer) + onchange('geocache/filter', () => { + listenLayer() + setState('layerchange', ['overlays', state.layer.get('id')]) + }) listenLayer() } createLayer (layer = null) { @@ -292,7 +294,7 @@ export function importCaches (features, disableLog = false) { features: features, newCacheDays: cacheConf.newCacheDays, mapping: cacheConf.mapping, - user: state.currentUser, + user: getState('app/account'), uid: uid, url: cacheConf.cacheUrl, date: formatDate diff --git a/src/geop/components/geocache/GeocacheGPX.js b/src/geop/components/geocache/GeocacheGPX.js index fcfd014..ba7425d 100644 --- a/src/geop/components/geocache/GeocacheGPX.js +++ b/src/geop/components/geocache/GeocacheGPX.js @@ -1,15 +1,21 @@ export default { test: features => { - const test = features.filter(f => { + return features.filter(f => { return (f.get('wpt') && f.get('wpt')['groundspeak:cache']) - }) - return test.length > 0 + }).length > 0 }, formatFeatures: opts => { const today = new Date() opts.features.forEach(feature => { const wpt = feature.get('wpt') - if (wpt['groundspeak:cache']) { + // format always + if (feature.get('isCache')) { + if (opts.user && opts.user === feature.get('owner')) { + const fstatus = 'Geocache Owner' + feature.set('fstatus', opts.mapping.fstatusGPX[fstatus] || fstatus) + } + } + if (typeof feature.get('isCache') === 'undefined' && wpt['groundspeak:cache']) { const cacheData = {} Object.keys(wpt['groundspeak:cache']).forEach(i => { if (i !== '_text') { @@ -56,12 +62,35 @@ export default { ) const newCache = (feature.get('fstatus') === 'Not Found' && testDate > today) ? 'New Cache' : null feature.set('newCache', newCache) - } else { + // description + if (cacheData.long_description) { + feature.set('description', cacheData.long_description) + } + if (cacheData.logs && cacheData.logs['groundspeak:log']) { + // in case of one log, it is object, not array + if (typeof cacheData.logs['groundspeak:log'] === 'object' && '@id' in cacheData.logs['groundspeak:log']) { + cacheData.logs['groundspeak:log'] = [cacheData.logs['groundspeak:log']] + } + feature.set('logs', cacheData.logs['groundspeak:log'].map(log => { + return { + type: log['groundspeak:type']['_text'], + date: log['groundspeak:date']['_text'], + finder: log['groundspeak:finder']['_text'], + text: log['groundspeak:text']['_text'] + } + })) + } + feature.set('wpt', { + 'groundspeak:cache': true + }) + } + if (typeof feature.get('isCachePoint') === 'undefined' && !wpt['groundspeak:cache']) { // assume waypoint // name feature.set('name', feature.get('type')) // url feature.set('url', wpt.url['_text']) + feature.set('isCachePoint', true) } if (!feature.getId()) { feature.setId(opts.uid()) diff --git a/src/geop/components/geocache/GeocacheInfo.js b/src/geop/components/geocache/GeocacheInfo.js new file mode 100644 index 0000000..ee10831 --- /dev/null +++ b/src/geop/components/geocache/GeocacheInfo.js @@ -0,0 +1,99 @@ +import { t } from 'Utilities/translate' +import { geocache as cacheConf } from 'Conf/settings' +import { onchange } from 'Utilities/store' +import { formatDate } from 'Utilities/util' +import Component from 'Geop/Component' +import './GeocacheInfo.styl' +import $ from 'jquery' + +class GeocacheInfo extends Component { + constructor (target) { + super(target) + this.id = 'tab-cacheinfo' + this.icon = 'fa fa-cube' + this.el = $(` +