diff --git a/build.gradle b/build.gradle index 883a3813..08843bad 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } } -version "2.0.0" +version "2.1.0" group "au.org.ala" apply plugin:"eclipse" @@ -105,9 +105,10 @@ dependencies { exclude group: 'org.slf4j', module: 'slf4j-nop' } implementation "org.grails.plugins:ala-admin-plugin:2.3.0" - implementation "org.grails.plugins:ala-auth:6.0.0" + implementation "org.grails.plugins:ala-auth:$alaSecurityLibsVersion" + implementation "org.grails.plugins:ala-ws-plugin:$alaSecurityLibsVersion" - implementation "org.grails.plugins:ala-bootstrap3:4.1.0" + implementation "org.grails.plugins:ala-bootstrap3:4.4.0" implementation "au.org.ala.plugins.grails:ala-charts-plugin:2.3.0-ANGULAR-SNAPSHOT" runtimeOnly 'org.grails.plugins:sandbox-hub:1.0' diff --git a/gradle.properties b/gradle.properties index 0506158a..00c1447e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,5 @@ seleniumVersion=3.14.0 webdriverBinariesVersion=2.6 #chromeDriverVersion=2.45.0 geckodriverVersion=0.24.0 -seleniumSafariDriverVersion=3.14.0 \ No newline at end of file +seleniumSafariDriverVersion=3.14.0 +alaSecurityLibsVersion=6.2.0 diff --git a/grails-app/assets/compile/spAppModules.js b/grails-app/assets/compile/spAppModules.js index 6a8ae6fd..0ae47478 100644 --- a/grails-app/assets/compile/spAppModules.js +++ b/grails-app/assets/compile/spAppModules.js @@ -1,2 +1,2 @@ /* Do not edit. This file built at compile by _Events.groovy */ -$spAppModules = ["tool-add-layer-service","tool-export-checklist-service","sandbox-service","lists-service","layers-service","http-service","colour-service","i18n-service","tool-export-sample-service","species-auto-complete-service","logger-service","menu-service","doi-service","tool-export-doi-service","layout-service","tool-add-facet-service","phylo-service","url-params-service","popup-service","facet-auto-complete-service","tool-export-area-service","gaz-auto-complete-service","layer-distances-service","keep-alive-service","tool-area-report-service","poi-service","bie-service","event-service","predefined-layer-lists-service","sessions-service","tool-add-species-service","tools-service","predefined-areas-service","tool-export-map-service","biocache-service","flickr-service","workflow-service","map-service","select-area-directive","facet-editor-directive","select-date-range-directive","i18n-directive","sp-percent-directive","sp-options-directive","sp-legend-directive","layer-list-upload-directive","lists-list-directive","species-auto-complete-directive","envelope-directive","select-multiple-area-directive","nearest-locality-directive","sp-menu-directive","sandbox-list-directive","http-ui-directive","draw-area-directive","workflow-annotation-directive","point-comparison-directive","species-options-directive","leaflet-quick-links-directive","select-phylo-directive","doi-auto-complete-directive","google-places-directive","lifeform-select-directive","playback-directive","layer-auto-complete-directive","layer-list-select-directive","select-facet-directive","select-species-directive","workflow-item-directive","area-list-select-directive","sp-map-directive","select-layers-directive","biocache-chart-directive","gaz-auto-complete-directive","modal-iframe-instance-ctrl","species-info-ctrl","facet-ctrl","workflow-ctrl","add-d-o-i-ctrl","tabulate-ctrl","layout-ctrl","area-report-ctrl","add-w-m-s-ctrl","tool-ctrl","leaflet-map-controller","sand-box-ctrl","sessions-ctrl","create-species-list-ctrl","csv-ctrl","facet-editor-modal-ctrl","add-area-ctrl","log-ctrl","analysis-ctrl","export-bccvl-ctrl"]; \ No newline at end of file +$spAppModules = ["tool-add-layer-service","tool-export-checklist-service","sandbox-service","lists-service","layers-service","http-service","colour-service","i18n-service","tool-export-sample-service","species-auto-complete-service","logger-service","menu-service","doi-service","tool-export-doi-service","layout-service","tool-add-facet-service","url-params-service","popup-service","facet-auto-complete-service","tool-export-area-service","gaz-auto-complete-service","layer-distances-service","keep-alive-service","tool-area-report-service","poi-service","bie-service","event-service","predefined-layer-lists-service","sessions-service","tool-add-species-service","tools-service","predefined-areas-service","tool-export-map-service","biocache-service","flickr-service","workflow-service","map-service","select-area-directive","facet-editor-directive","select-date-range-directive","i18n-directive","sp-percent-directive","sp-options-directive","sp-legend-directive","layer-list-upload-directive","lists-list-directive","species-auto-complete-directive","envelope-directive","select-multiple-area-directive","nearest-locality-directive","sp-menu-directive","sandbox-list-directive","http-ui-directive","draw-area-directive","workflow-annotation-directive","point-comparison-directive","species-options-directive","leaflet-quick-links-directive","doi-auto-complete-directive","google-places-directive","lifeform-select-directive","playback-directive","layer-auto-complete-directive","layer-list-select-directive","select-facet-directive","select-species-directive","workflow-item-directive","area-list-select-directive","sp-map-directive","select-layers-directive","biocache-chart-directive","gaz-auto-complete-directive","modal-iframe-instance-ctrl","species-info-ctrl","facet-ctrl","workflow-ctrl","add-d-o-i-ctrl","tabulate-ctrl","layout-ctrl","area-report-ctrl","add-w-m-s-ctrl","tool-ctrl","leaflet-map-controller","sand-box-ctrl","sessions-ctrl","create-species-list-ctrl","csv-ctrl","facet-editor-modal-ctrl","add-area-ctrl","log-ctrl","analysis-ctrl"]; \ No newline at end of file diff --git a/grails-app/assets/javascripts/spApp/controller/addAreaCtrl.js b/grails-app/assets/javascripts/spApp/controller/addAreaCtrl.js index afe6f839..c128f975 100644 --- a/grails-app/assets/javascripts/spApp/controller/addAreaCtrl.js +++ b/grails-app/assets/javascripts/spApp/controller/addAreaCtrl.js @@ -379,6 +379,7 @@ if (data.data === undefined || data.data.id === undefined || !data.data.indb) { LayersService.getWkt(pid).then(function (wkt) { $scope.selectedArea.wkt = wkt.data + $scope.selectedArea.obj.wkt = wkt.data if (mapNow) { $scope.addToMapAndClose(); } @@ -426,4 +427,4 @@ $scope.isLoggedIn = $scope.isLoggedIn = $SH.userId !== undefined && $SH.userId !== null && $SH.userId.length > 0; $scope.isNotLoggedIn = !$scope.isLoggedIn; }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/controller/areaReportCtrl.js b/grails-app/assets/javascripts/spApp/controller/areaReportCtrl.js index d45d23bf..c46d392f 100644 --- a/grails-app/assets/javascripts/spApp/controller/areaReportCtrl.js +++ b/grails-app/assets/javascripts/spApp/controller/areaReportCtrl.js @@ -262,7 +262,7 @@ name: $i18n(365, "Number of species - spatially valid only"), query: {q: areaQ.q, bs: areaQ.bs, ws: areaQ.ws, wkt: areaQ.wkt, qid: areaQ.qid}, map: false, - extraQ: ["geospatial_kosher:true"] + extraQ: ["spatiallyValid:true"] }, { name: $i18n(366, "Number of endemic species"), @@ -275,7 +275,7 @@ endemic: true, query: {q: areaQ.q, bs: areaQ.bs, ws: areaQ.ws, wkt: areaQ.wkt, qid: areaQ.qid}, map: false, - extraQ: ["geospatial_kosher:true"] + extraQ: ["spatiallyValid:true"] }]; // TODO: move this into config and retrieve from $SH @@ -289,7 +289,7 @@ name: $i18n(368, "Occurrences - spatially valid only"), query: {q: areaQ.q, bs: areaQ.bs, ws: areaQ.ws, wkt: areaQ.wkt, qid: areaQ.qid}, occurrences: true, - extraQ: ["geospatial_kosher:true"] + extraQ: ["spatiallyValid:true"] }, { name: $i18n(356, "Expert distributions"), @@ -512,8 +512,8 @@ overrideValues: { ToolExportSampleService: { input: { - species: {constraints: {'default': query, disable: true}}, - area: {constraints: {'default': area, disable: true}} + species: {constraints: {'defaultValue': query, disable: true}}, + area: {constraints: {'defaultValue': area, disable: true}} } } }, diff --git a/grails-app/assets/javascripts/spApp/controller/createSpeciesListCtrl.js b/grails-app/assets/javascripts/spApp/controller/createSpeciesListCtrl.js index 094aa5bc..03497ced 100644 --- a/grails-app/assets/javascripts/spApp/controller/createSpeciesListCtrl.js +++ b/grails-app/assets/javascripts/spApp/controller/createSpeciesListCtrl.js @@ -47,7 +47,7 @@ $scope.newListName = $i18n(375, "My species list"); $scope.newListDescription = ''; $scope.newItems = ''; - $scope.makePrivate = false; + $scope.makePrivate = true; // new lists are private by default $scope.newListType = $scope.listTypes[0] $scope.selectedQ = { @@ -227,4 +227,4 @@ }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/controller/exportBccvlCtrl.js b/grails-app/assets/javascripts/spApp/controller/exportBccvlCtrl.js deleted file mode 100644 index f89e11eb..00000000 --- a/grails-app/assets/javascripts/spApp/controller/exportBccvlCtrl.js +++ /dev/null @@ -1,122 +0,0 @@ -(function (angular) { - 'use strict'; - /** - * @memberof spApp - * @ngdoc controller - * @name ExportBccvlCtrl - * @description - * Manage export of occurrence layers to BCCVL - */ - angular.module('export-bccvl-ctrl', ['map-service']).controller('ExportBccvlCtrl', ['$scope', 'MapService', - '$timeout', 'LayoutService', 'BiocacheService', '$window', '$uibModalInstance', 'SessionsService', '$http', - '$q', 'LoggerService', 'data', - function ($scope, MapService, $timeout, LayoutService, BiocacheService, $window, $uibModalInstance, - SessionsService, $http, $q, LoggerService, config) { - - $scope.stepNames = ['Select species']; - - $scope.isSpeciesList = false; - $scope.includeSpeciesList = true; - - $scope._httpDescription = function (method, httpconfig) { - if (httpconfig === undefined) { - httpconfig = {}; - } - httpconfig.service = 'ExportBccvlCtrl'; - httpconfig.method = method; - - return httpconfig; - }; - - if (config && config.selectedQ) { - $scope.selectedQs = config.selectedQs - } else { - $scope.selectedQs = [] - } - - if (config && config.step) { - $scope.step = config.step - } else { - $scope.step = 1 - } - - $scope.bccvlOpenUrl = ''; - - LayoutService.addToSave($scope); - - $scope.setQ = function (query) { - if (query.species_list) { - $scope.isSpeciesList = true; - } - }; - - $scope.ok = function () { - if ($scope.step === 1) { - $scope.step = $scope.step + 1 - } else if ($scope.step === 2) { - var promises = []; - var url = $SH.bccvlPostUrl; - var data = []; - $.each($scope.selectedQs, function (i) { - var q = $scope.selectedQs[i]; - promises.push(BiocacheService.registerQuery(q).then(function (response) { - if (response == null) { - return $q.when(false) - } - return BiocacheService.facet('taxon_name', response).then(function (facets) { - if ($scope.includeSpeciesList && q.species_list) { - var species = []; - facets && facets.forEach(function (facet) { - if (facet && facet.count > 0 && facet.name) { - speices.push(facet.name) - } - }); - - data.push({ - name: q.name, - query: response.qid, - url: q.bs, - trait: q.species_list, - species_list: species - }); - } else { - data.push({name: q.name, query: response.qid, url: q.bs}); - } - - return true - }) - })); - }); - $q.all(promises).then(function () { - var authorizationToken = "Bearer " + window.location.hash.split('&')[0].split('=')[1]; - var config = {headers: {Accept: 'application/json', Authorization: authorizationToken}}; - - $http.post(url, {data: data}, $scope._httpDescription('export', config)).then(function (response) { - $scope.bccvlOpenUrl = response.headers('location'); - - LoggerService.log('Export', 'exportBccvl', JSON.stringify({ - data: data, - bccvlOpenUrl: $scope.bccvlOpenUrl - })) - }); - }); - $scope.step = $scope.step + 1 - } - }; - - $scope.isDisabled = function () { - return $scope.selectedQs.length === 0; - }; - - $scope.bccvlLogin = function () { - var bccvlExportTool = encodeURIComponent("&tool=exportBccvl&toolParameters=" + encodeURIComponent('{"step":2}')); - - //save session and open BCCVL login page - SessionsService.saveAndLogin(SessionsService.current(), $SH.bccvlLoginUrl + '$url' + bccvlExportTool, true, true) - }; - - if ($scope.step === 1) { - $scope.bccvlLogin() - } - }]) -}(angular)); \ No newline at end of file diff --git a/grails-app/assets/javascripts/spApp/controller/leafletMapController.js b/grails-app/assets/javascripts/spApp/controller/leafletMapController.js index f1baf505..561cf084 100644 --- a/grails-app/assets/javascripts/spApp/controller/leafletMapController.js +++ b/grails-app/assets/javascripts/spApp/controller/leafletMapController.js @@ -484,7 +484,7 @@ if (data[pt] instanceof Array) { g = [data[pt][1], data[pt][2]]; } else { - g = data[pt].geometry.replace("POINT(", "").replace(")", "").split(" "); + g = data[pt].geometry.replace("POINT (", "").replace(")", "").split(" "); } var m = L.marker([g[1], g[0]]) .bindLabel(data[pt].name, {noHide: true}); @@ -772,4 +772,4 @@ }, 0) }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/controller/toolCtrl.js b/grails-app/assets/javascripts/spApp/controller/toolCtrl.js index a1f5059e..968b8d8b 100644 --- a/grails-app/assets/javascripts/spApp/controller/toolCtrl.js +++ b/grails-app/assets/javascripts/spApp/controller/toolCtrl.js @@ -159,7 +159,6 @@ selected: false }) } - // } else if (value.type === 'phylogeneticTree') { // } else if (value.type === 'text') { } else if (value.type === 'speciesOptions') { if (value.constraints['areaIncludes'] === undefined) value.constraints['areaIncludes'] = false; @@ -211,12 +210,12 @@ if (value.constraints['defaultToWorld'] === undefined) value.constraints['defaultToWorld'] = true; if (value.constraints['max'] === undefined) value.constraints['max'] = 1000; - if (value.constraints['default'] !== undefined) { + if (value.constraints['defaultValue'] !== undefined) { // getInputs returns the .area array which is inconsistent with the value - if (value.constraints['default'] instanceof Array) { - v = {area: value.constraints['default']} + if (value.constraints['defaultValue'] instanceof Array) { + v = {area: value.constraints['defaultValue']} } else { - v = value.constraints['default'] + v = value.constraints['defaultValue'] } } else { v = {area: []} @@ -234,7 +233,7 @@ if (value.constraints['searchSpecies'] === undefined) value.constraints['searchSpecies'] = true; if (value.constraints['allSpecies'] === undefined) value.constraints['allSpecies'] = true; - if (value.constraints['default'] !== undefined) v = value.constraints['default']; + if (value.constraints['defaultValue'] !== undefined) v = value.constraints['defaultValue']; else if (value.constraints['speciesOption'] === 'allSpecies') { //specify allSpecies default v = { @@ -253,50 +252,47 @@ } else if (value.type === 'date') { v = {fq: []} } else if (value.type === 'layer') { - if (value.constraints['default'] !== undefined) { + if (value.constraints['defaultValue'] !== undefined) { // getInputs returns the .area array which is inconsistent with the value - if (value.constraints['default'] instanceof Array) { + if (value.constraints['defaultValue'] instanceof Array) { v = {layers: []}; - $.map(value.constraints['default'], function (layer) { + $.map(value.constraints['defaultValue'], function (layer) { v.layers.push(LayersService.getLayer(layer)) }) } else { - v = LayersService.getLayer(value.constraints['default']); + v = LayersService.getLayer(value.constraints['defaultValue']); } } else v = {layers: []} } else if (value.type === 'boolean') { - v = value.constraints['default'] + v = value.constraints['defaultValue'] } else if (value.type === 'int') { - v = value.constraints['default'] + v = value.constraints['defaultValue'] } else if (value.type === 'double') { - v = value.constraints['default'] + v = value.constraints['defaultValue'] } else if (value.type === 'list') { if (value.constraints.selection !== 'single') { - v = value.constraints['default']; + v = value.constraints['defaultValue']; if (v == undefined) { v = []; } } else { - v = value.constraints['default']; + v = value.constraints['defaultValue']; } - } else if (value.type === 'phylogeneticTree') { - if (value.constraints['default'] !== undefined) v = value.constraints['default']; - else v = [] } else if (value.type === 'text') { - v = value.constraints['default'] + v = value.constraints['defaultValue'] } else if (value.type === 'speciesOptions') { if (value.constraints['areaIncludes'] === undefined) value.constraints['areaIncludes'] = false; if (value.constraints['kosherIncludes'] === undefined) value.constraints['kosherIncludes'] = true; if (value.constraints['endemicIncludes'] === undefined) value.constraints['endemicIncludes'] = false; - if (value.constraints['default'] !== undefined) v = value.constraints['default']; + if (value.constraints['defaultValue'] !== undefined) v = value.constraints['defaultValue']; else v = {} } else if (value.type === 'facet') { - if (value.constraints['default'] !== undefined) v = value.constraints['default']; + if (value.constraints['defaultValue'] !== undefined) v = value.constraints['defaultValue']; else v = [] - } else if (value.constraints !== undefined && value.constraints['default'] !== undefined) { - v = value.constraints['default'] + } else if (value.constraints !== undefined && value.constraints['defaultValue'] !== undefined) { + v = value.constraints['defaultValue'] } else { v = null } @@ -351,8 +347,6 @@ return $scope.values[i] === undefined } else if (value.type === 'list' && value.constraints.selection !== 'single') { return $scope.values[i].length === 0 - } else if (value.type === 'phylogeneticTree') { - return $scope.values[i].length === 0 } else if (value.type === 'text') { return $scope.values[i] < value.constraints.min || $scope.values[i] > value.constraints.max } else if (value.type === 'speciesOptions') { @@ -523,4 +517,4 @@ } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/controller/workflowCtrl.js b/grails-app/assets/javascripts/spApp/controller/workflowCtrl.js index 2a86fd91..3a1df05c 100644 --- a/grails-app/assets/javascripts/spApp/controller/workflowCtrl.js +++ b/grails-app/assets/javascripts/spApp/controller/workflowCtrl.js @@ -170,7 +170,7 @@ var input = [] $.map(item.data, function (v, k) { - input[k] = {constraints: {default: v}} + input[k] = {constraints: {defaultValue: v}} }) var ov = {}; @@ -366,4 +366,4 @@ $scope.editing = -1; } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/envelope.js b/grails-app/assets/javascripts/spApp/directive/envelope.js index 64ff0b37..ee059abd 100644 --- a/grails-app/assets/javascripts/spApp/directive/envelope.js +++ b/grails-app/assets/javascripts/spApp/directive/envelope.js @@ -38,7 +38,7 @@ input: { envelope: { constraints: { - 'default': scope.getFq() + 'defaultValue': scope.getFq() } } } @@ -192,4 +192,4 @@ }; }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/leafletQuickLinks.js b/grails-app/assets/javascripts/spApp/directive/leafletQuickLinks.js index 20a85ad9..d7a0e815 100644 --- a/grails-app/assets/javascripts/spApp/directive/leafletQuickLinks.js +++ b/grails-app/assets/javascripts/spApp/directive/leafletQuickLinks.js @@ -11,7 +11,7 @@ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * Created by Temi on 8/09/2016. */ (function (angular) { @@ -45,7 +45,7 @@ if (data.overrideValues.input === undefined) data.overrideValues.input = {}; if (data.overrideValues.input[key] === undefined) data.overrideValues.input[key] = {}; if (data.overrideValues.input[key].constraints === undefined) data.overrideValues.input[key].constraints = {}; - data.overrideValues.input[key].constraints['default'] = value; + data.overrideValues.input[key].constraints['defaultValue'] = value; }; $scope.open = function (name, data, includeSpecies, includeArea) { @@ -227,4 +227,4 @@ }] } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/nearestLocality.js b/grails-app/assets/javascripts/spApp/directive/nearestLocality.js index 491ea1ad..14d7b2c1 100644 --- a/grails-app/assets/javascripts/spApp/directive/nearestLocality.js +++ b/grails-app/assets/javascripts/spApp/directive/nearestLocality.js @@ -128,7 +128,7 @@ var header = $i18n(409, "Longitude") + "," + scope.point.longitude + "\n" + $i18n(410, "Latitude") + "," + scope.point.latitude + "\n\n" + - $i18n(160, "Feature") + "," + $i18n(161, "Location") + "," + $i18n(162, "Distance (km)") + "," + $i18n(163, "Heading (deg)"); + $i18n(160, "Feature") + "," + $i18n(161, "Location") + "," + $i18n(162, "Distance (m)") + "," + $i18n(163, "Heading (deg)"); var blob = new Blob([header + rows], {type: 'text/plain'}); scope.exportUrl = (window.URL || window.webkitURL).createObjectURL(blob); @@ -173,4 +173,4 @@ } } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/selectArea.js b/grails-app/assets/javascripts/spApp/directive/selectArea.js index a3c8488e..c8f3d87d 100644 --- a/grails-app/assets/javascripts/spApp/directive/selectArea.js +++ b/grails-app/assets/javascripts/spApp/directive/selectArea.js @@ -17,7 +17,8 @@ _selectedArea: '=selectedArea', _includeDefaultAreas: '=includeDefaultAreas', _uniqueId: '=uniqueId', - _defaultToWorld: '=?defaultToWorld' + _defaultToWorld: '=?defaultToWorld', + _excludeWorld: '=?excludeWorld' }, link: function (scope, element, attrs) { @@ -63,7 +64,7 @@ scope.defaultAreas = []; if (scope._includeDefaultAreas !== false) { - scope.defaultAreas = $.map(PredefinedAreasService.getList(), function (x, idx) { + scope.defaultAreas = $.map(PredefinedAreasService.getList(scope._excludeWorld), function (x, idx) { return x }) } @@ -115,4 +116,4 @@ } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/selectFacet.js b/grails-app/assets/javascripts/spApp/directive/selectFacet.js index 10a88965..6fcba39c 100644 --- a/grails-app/assets/javascripts/spApp/directive/selectFacet.js +++ b/grails-app/assets/javascripts/spApp/directive/selectFacet.js @@ -34,16 +34,16 @@ }); //Watch special options update - //fq=geospatial_kosher:true&fq=-occurrence_status:absent + //fq=spatiallyValid:true&fq=-occurrence_status:absent scope.$on("speciesOptionsChange",function (event, value) { scope.fqsOfSpeciesOptions = []; /* - spatially-valid = geospatial_kosher:true - spatially-suspect = geospatial_kosher:false - spatially-unknown = -geospatial_kosher:* + spatially-valid = spatiallyValid:true + spatially-suspect = spatiallyValid:false + spatially-unknown = -spatiallyValid:* If we want include VALID and MISSING(UNKNOWN) spatial data - fq=(geospatial_kosher:true OR -geospatial_kosher:*) BS(solr) does not support '-' in complicated query + fq=(spatiallyValid:true OR -spatiallyValid:*) BS(solr) does not support '-' in complicated query */ if (value.spatiallyUnknown) { //include UNKNOWN (MISSING) spatial data records @@ -53,20 +53,20 @@ } else if (value.spatiallyValid) { //spatially-unknown && spatiallyValid //-> rule out of spatiallySuspect - scope.fqsOfSpeciesOptions.push('-geospatial_kosher:false'); + scope.fqsOfSpeciesOptions.push('-spatiallyValid:false'); }else if (value.spatiallySuspect) { //spatially-unknown && spatiallySuspect //-> rule out of spatiallyValid - scope.fqsOfSpeciesOptions.push('-geospatial_kosher:true'); + scope.fqsOfSpeciesOptions.push('-spatiallyValid:true'); } } else { //spatially-valid and spatially-suspect if (value.spatiallyValid && value.spatiallySuspect) { - scope.fqsOfSpeciesOptions.push('geospatial_kosher:*'); + scope.fqsOfSpeciesOptions.push('spatiallyValid:*'); } else if (value.spatiallyValid) { - scope.fqsOfSpeciesOptions.push('geospatial_kosher:true'); + scope.fqsOfSpeciesOptions.push('spatiallyValid:true'); } else if (value.spatiallySuspect) { - scope.fqsOfSpeciesOptions.push('geospatial_kosher:false'); + scope.fqsOfSpeciesOptions.push('spatiallyValid:false'); } } @@ -413,4 +413,4 @@ } } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/selectMultipleArea.js b/grails-app/assets/javascripts/spApp/directive/selectMultipleArea.js index 24166598..c7dd7ae2 100644 --- a/grails-app/assets/javascripts/spApp/directive/selectMultipleArea.js +++ b/grails-app/assets/javascripts/spApp/directive/selectMultipleArea.js @@ -103,11 +103,29 @@ a.splice(i, 1); } } + scope.pickInOutLayerName = ""; + scope.pickInOutLayerVisible = true; }; + scope.updatePickInOutLayer = function () { + if (!scope.pickInOutLayer) { + scope.removeInOutLayer() + } + } + + scope.updatePickContextualLayer = function () { + if (!scope.pickContextualLayer) { + scope.removeContextualLayer() + } + } + + scope.removeInOut = true scope.$watch('selectedInOutLayer.layers.length', function (newValue, oldValue) { //remove all inOutLayers - scope.removeInOutLayer(); + if (scope.removeInOut) { + scope.removeInOutLayer(); + } + scope.removeInOut = true; //add selected var a = scope.selectedInOutLayer.layers; @@ -134,19 +152,19 @@ }; scope._selectedArea.area.push(areaOut); + scope.removeInOut = false scope.selectedInOutLayer.layers.splice(0, scope.selectedInOutLayer.layers.length); } }); scope.updateSelection = function (area) { - if (!area) { - if (!scope.pickInOutLayer) { - scope.removeInOutLayer(); - } - if (!scope.pickContextualLayer) { - scope.removeContextualLayer(); - } - } else { + if (!scope.pickInOutLayer) { + scope.removeInOutLayer(); + } + if (!scope.pickContextualLayer) { + scope.removeContextualLayer(); + } + if (area) { if (area.selected) { scope._selectedArea.area.push(area) } else { @@ -172,11 +190,17 @@ a.splice(i, 1); } } + scope.pickContextualLayerName = ""; + scope.pickContextualLayerVisible = true; }; + scope.removeContextual = true scope.$watch('selectedLayer.layers.length', function (newValue, oldValue) { //remove all inOutLayers - scope.removeContextualLayer(); + if (scope.removeContextual) { + scope.removeContextualLayer(); + } + scope.removeContextual = true; //add selected var a = scope.selectedLayer.layers; @@ -196,6 +220,7 @@ //TODO: Make the corresponding spatial-service change to recognise this aggregation. scope._selectedArea.area.push(area); + scope.removeContextual = false scope.selectedLayer.layers.splice(0, scope.selectedLayer.layers.length); } }); @@ -227,4 +252,4 @@ } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/selectPhylo.js b/grails-app/assets/javascripts/spApp/directive/selectPhylo.js deleted file mode 100644 index 87f8afd3..00000000 --- a/grails-app/assets/javascripts/spApp/directive/selectPhylo.js +++ /dev/null @@ -1,83 +0,0 @@ -(function (angular) { - 'use strict'; - /** - * @memberof spApp - * @ngdoc directive - * @name selectPhylo - * @description - * Table with selectable phylogenetic trees from phylolink - */ - angular.module('select-phylo-directive', ['phylo-service']) - .directive('selectPhylo', ['$http', 'PhyloService', 'LayoutService', '$timeout', - function ($http, PhyloService, LayoutService, $timeout) { - - return { - templateUrl: '/spApp/selectPhyloCtrl.htm', - scope: { - _selection: "=selectedPhylo" - }, - link: function (scope, element, attrs) { - - scope.name = 'selectPhylo'; - LayoutService.addToSave(scope); - - scope.trees = []; - scope.loading = true; - - scope.change = function (tree) { - if (tree.checked) { - var found = false; - for (var k in scope._selection) { - if (scope._selection.hasOwnProperty(k)) { - if (scope._selection[k].id === tree.id) { - found = true - } - } - } - if (!found) scope._selection.push(tree.id) - } else { - for (k in scope._selection) { - if (scope._selection.hasOwnProperty(k)) { - if (scope._selection[k].id === tree.id) { - scope._selection.splice(k, 1) - } - } - } - } - }; - - scope.clearSelection = function () { - for (var i in scope.trees) { - scope.trees[i].selected = false - } - while (scope._selection.length) { - scope._selection.pop() - } - }; - - - scope.init = function () { - PhyloService.getExpertTrees().then(function (data) { - for (var k in data.data) { - if (data.data.hasOwnProperty(k)) { - scope.trees.push({ - id: data.data[k].studyId, - group: data.data[k].focalClade, - name: data.data[k].studyName, - leaves: data.data[k].numberOfLeaves, - checked: false - }) - } - } - }).finally(function () { - scope.loading = false; - }); - - }; - - $timeout(scope.init, 0); - } - } - }]) -}(angular)); - diff --git a/grails-app/assets/javascripts/spApp/directive/selectSpecies.js b/grails-app/assets/javascripts/spApp/directive/selectSpecies.js index 6eea7e59..175ee5b4 100644 --- a/grails-app/assets/javascripts/spApp/directive/selectSpecies.js +++ b/grails-app/assets/javascripts/spApp/directive/selectSpecies.js @@ -236,12 +236,12 @@ if (pos >= 0) query.q.splice(pos, 1) } /* - spatially-valid = geospatial_kosher:true - spatially-suspect = geospatial_kosher:false - spatially-unknown = -geospatial_kosher:* + spatially-valid = spatiallyValid:true + spatially-suspect = spatiallyValid:false + spatially-unknown = -spatiallyValid:* If we want include VALID and MISSING(UNKNOWN) spatial data - fq=(geospatial_kosher:true OR -geospatial_kosher:*) BS(solr) does not support '-' in complicated query + fq=(spatiallyValid:true OR -spatiallyValid:*) BS(solr) does not support '-' in complicated query */ var gs = ["-*:*"]; // select nothing if (scope.spatiallyUnknown) { //include UNKNOWN (MISSING) spatial data records @@ -251,23 +251,23 @@ } else if (scope.spatiallyValid) { // spatially-unknown && spatiallyValid // Solution -> rule out of spatiallySuspect - gs = ['-geospatial_kosher:false']; + gs = ['-spatiallyValid:false']; } else if (scope.spatiallySuspect) { // spatially-unknown && spatiallySuspect // -> rule out of spatiallyValid - gs = ['-geospatial_kosher:true']; + gs = ['-spatiallyValid:true']; } else { //return records without spatial - gs = ['-geospatial_kosher:*']; + gs = ['-spatiallyValid:*']; } } else { //spatially-valid and spatially-suspect if (scope.spatiallyValid && scope.spatiallySuspect) { - gs = ['geospatial_kosher:*']; + gs = ['spatiallyValid:*']; } else if (scope.spatiallyValid){ - gs = ['geospatial_kosher:true']; + gs = ['spatiallyValid:true']; } else if (scope.spatiallySuspect){ - gs = ['geospatial_kosher:false']; + gs = ['spatiallyValid:false']; } else { // No records returned by default } @@ -490,4 +490,4 @@ } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/spLegend.js b/grails-app/assets/javascripts/spApp/directive/spLegend.js index e1f49b8a..57b2880f 100644 --- a/grails-app/assets/javascripts/spApp/directive/spLegend.js +++ b/grails-app/assets/javascripts/spApp/directive/spLegend.js @@ -302,7 +302,7 @@ var selectedStyle = currentLayer.style //Raster style - if(selectedStyle == 'non-linear') selectedStyle = currentLayer.defaultStyle //e.g geomacs_gmean + if (selectedStyle == 'non-linear') selectedStyle = currentLayer.defaultStyle //e.g geomacs_gmean if (selectedStyle == 'linear') selectedStyle = currentLayer.defaultStyle + '_linear' //Vector sytle if (selectedStyle == 'default') selectedStyle = currentLayer.defaultStyle //e.g cl1084 @@ -1287,4 +1287,4 @@ } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/directive/spMenu.js b/grails-app/assets/javascripts/spApp/directive/spMenu.js index 5dd03f42..3d3f19ee 100644 --- a/grails-app/assets/javascripts/spApp/directive/spMenu.js +++ b/grails-app/assets/javascripts/spApp/directive/spMenu.js @@ -70,7 +70,7 @@ scope.exportMap = function () { scope.open('tool', { processName: 'ToolExportMapService', - overrideValues: {ToolExportMapService: {input: {caption: {constraints: {default: (new Date())}}}}} + overrideValues: {ToolExportMapService: {input: {caption: {constraints: {defaultValue: (new Date())}}}}} }) }; @@ -79,4 +79,4 @@ } }; }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/service/biocacheService.js b/grails-app/assets/javascripts/spApp/service/biocacheService.js index e86caa7a..17452443 100644 --- a/grails-app/assets/javascripts/spApp/service/biocacheService.js +++ b/grails-app/assets/javascripts/spApp/service/biocacheService.js @@ -38,7 +38,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Ouput: * 10 @@ -74,7 +74,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Ouput: * 2 @@ -115,7 +115,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * - config * Ouput: * "names_and_lsid","Species Name","Scientific Name Authorship","Taxon Rank","Kingdom","Phylum","Class","Order","Family","Genus","Vernacular Name","Number of records","Conservation","Invasive" @@ -148,10 +148,10 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: - * "https://biocache-ws.ala.org.au/ws/occurrences/facets/download?facets=names_and_lsid&lookup=true&count=true&lists=true&q=Macropus&fq=geospatial_kosher:true" + * "https://biocache-ws.ala.org.au/ws/occurrences/facets/download?facets=names_and_lsid&lookup=true&count=true&lists=true&q=Macropus&fq=spatiallyValid:true" */ speciesListUrl: function (query, fqs) { var fqList = (fqs === undefined ? '' : '&fq=' + this.joinAndEncode(fqs)); @@ -178,7 +178,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: * ``` @@ -213,7 +213,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: * "http://biocache.ala.org.au/ws/explore/endemic/species/1234.csv?facets=names_and_lsid&lookup=true&count=true&lists=true" @@ -251,7 +251,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: * [] @@ -284,7 +284,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: * 500 @@ -322,7 +322,7 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: * "Macropus" @@ -364,10 +364,10 @@ * "ws": "https://biocache.ala.org.au" * } * - fqs - * ["geospatial_kosher:true"] + * ["spatiallyValid:true"] * * Output: - * "http://biocache-ws.ala.org.au/ws/occurrences/search?q=Macropus&fq=geospatial_kosher:true&pageSize=1&offset=0&facet=false" + * "http://biocache-ws.ala.org.au/ws/occurrences/search?q=Macropus&fq=spatiallyValid:true&pageSize=1&offset=0&facet=false" */ constructSearchResultUrl: function (query, fqs, pageSize, offset, facet) { facet = facet || false; diff --git a/grails-app/assets/javascripts/spApp/service/flickrService.js b/grails-app/assets/javascripts/spApp/service/flickrService.js index 00db59d6..60b1d4f2 100644 --- a/grails-app/assets/javascripts/spApp/service/flickrService.js +++ b/grails-app/assets/javascripts/spApp/service/flickrService.js @@ -21,15 +21,16 @@ return { getPhotos: function (bbox) { var url = $SH.flickrUrl + $SH.flickrSearchPhotos - + '&api_key=' + $SH.flickrApiKey + '&extras=' + encodeURIComponent($SH.flickrExtra) - + '&tags=' + encodeURIComponent($SH.flickrTags) - + '&geo_context=' + encodeURIComponent($SH.flickrGeoContext) - + '&content_type=' + encodeURIComponent($SH.flickrContentType) - + $SH.flickrFilter + + '&api_key=' + $SH.flickrApiKey + '&per_page=' + $SH.flickrNbrOfPhotosToDisplay - + '&format=json&nojsoncallback=1&bbox='; + + '&format=json&nojsoncallback=1&bbox=' + bbox; + if ($SH.flickrExtra != '') url += '&extras=' + encodeURIComponent($SH.flickrExtra) + if ($SH.flickrTags != '') url += '&tags=' + encodeURIComponent($SH.flickrTags) + if ($SH.flickrGeoContext != '') url += '&geo_context=' + encodeURIComponent($SH.flickrGeoContext) + if ($SH.flickrContentType != '') url += '&content_type=' + encodeURIComponent($SH.flickrContentType) + if ($SH.flickrFilter != '') url += $SH.flickrFilter - return $http.get(url + bbox, _httpDescription('getPhotos')).then(function (response) { + return $http.get(url, _httpDescription('getPhotos')).then(function (response) { return response.data; }); }, diff --git a/grails-app/assets/javascripts/spApp/service/layersService.js b/grails-app/assets/javascripts/spApp/service/layersService.js index 2faa6705..9961e79d 100644 --- a/grails-app/assets/javascripts/spApp/service/layersService.js +++ b/grails-app/assets/javascripts/spApp/service/layersService.js @@ -561,4 +561,4 @@ return thiz; }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/service/mapService.js b/grails-app/assets/javascripts/spApp/service/mapService.js index 9250af8d..537a1f97 100644 --- a/grails-app/assets/javascripts/spApp/service/mapService.js +++ b/grails-app/assets/javascripts/spApp/service/mapService.js @@ -731,9 +731,12 @@ var url = layer.layer.displaypath url = url.replace(/\?.*/, '') + var source = 'analysis' if (layer.id.startsWith("el") || id.layertype == 'gridAsContextual') { + source = 'environmental' id.defaultStyle = layer.layer.name } else if (layer.id.startsWith("cl")) { + source = 'contextual' id.defaultStyle = layer.id } @@ -751,14 +754,17 @@ opacity: id.opacity / 100.0, url: url, layertype: id.layertype, + source: source, layerParams: { opacity: id.opacity / 100.0, layers: 'ALA:' + layer.layer.name, format: 'image/png', - transparent: true, - styles: style + transparent: true } }; + if (source != 'analysis' && !style) { + newLayer.layerParams.styles = style || id.id + } if (id.layertype === 'scatterplotEnvelope') { var layer2 = LayersService.getLayer(id.layer2); @@ -1014,4 +1020,4 @@ return MapService }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/service/phyloService.js b/grails-app/assets/javascripts/spApp/service/phyloService.js deleted file mode 100644 index a0647e0f..00000000 --- a/grails-app/assets/javascripts/spApp/service/phyloService.js +++ /dev/null @@ -1,58 +0,0 @@ -(function (angular) { - 'use strict'; - /** - * @memberof spApp - * @ngdoc service - * @name PhyloService - * @description - * Access to phylolink services - */ - angular.module('phylo-service', []) - .factory('PhyloService', ['$http', function ($http) { - - var _httpDescription = function (method, httpconfig) { - if (httpconfig === undefined) { - httpconfig = {}; - } - httpconfig.service = 'PhyloService'; - httpconfig.method = method; - - return httpconfig; - }; - - return { - /** - * Get phylolink tree list - * - * @memberof PhyloService - * @returns {List} list of public expert trees - * - * @example: - * Output: - * [{ - "studyId": 92, - "focalClade": "Acacia", - "treeFormat": "newick", - "studyName": "Miller, J. T., Murphy, D. J., Brown, G. K., Richardson, D. M. and González-Orozco, C. E. (2011), The evolution and phylogenetic placement of invasive Australian Acacia species. Diversity and Distributions, 17: 848–860. doi: 10.1111/j.1472-4642.2011.00780.x", - "year": 2011, - "authors": "Acacia – Miller et al 2012", - "doi": "http://onlinelibrary.wiley.com/doi/10.1111/j.1472-4642.2011.00780.x/full", - "numberOfLeaves": 510, - "numberOfInternalNodes": 509, - "treeId": null, - "notes": null, - "treeViewUrl": "http://phylolink.ala.org.au/phylo/getTree?studyId=92&treeId=null" - }] - */ - getExpertTrees: function () { - //TODO: add parameter to exclude "tree" - var url = $SH.phylolinkUrl + "/phylo/getExpertTrees?noTreeText=true"; - return $http.get(url, _httpDescription('search', { - headers: { - 'Content-Type': 'application/json' - } - })) - } - }; - }]) -}(angular)); \ No newline at end of file diff --git a/grails-app/assets/javascripts/spApp/service/predefinedAreasService.js b/grails-app/assets/javascripts/spApp/service/predefinedAreasService.js index 2fb967da..e029d5b9 100644 --- a/grails-app/assets/javascripts/spApp/service/predefinedAreasService.js +++ b/grails-app/assets/javascripts/spApp/service/predefinedAreasService.js @@ -15,13 +15,13 @@ * * @returns {Array.} list of default areas. */ - getList: function () { + getList: function (excludeWorld) { var extents = MapService.getExtents(); var defaultAreas = []; for (var i in $SH.defaultAreas) { - if ($SH.defaultAreas.hasOwnProperty(i)) { + if ($SH.defaultAreas.hasOwnProperty(i) && (!excludeWorld || $SH.defaultAreas[i].name != 'World')) { var area = $SH.defaultAreas[i]; var geoArea = undefined if (area.areaSqKm) { @@ -53,4 +53,4 @@ } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/service/predefinedLayerListsService.js b/grails-app/assets/javascripts/spApp/service/predefinedLayerListsService.js index 4edca5a0..ecd446b9 100644 --- a/grails-app/assets/javascripts/spApp/service/predefinedLayerListsService.js +++ b/grails-app/assets/javascripts/spApp/service/predefinedLayerListsService.js @@ -16,17 +16,9 @@ { label: "BIOCLIM 1960 best 5", value: "el882,el889,el887,el894,el865" - }, - { - label: "Williams 1960 best 5", - value: "el720,el726,el718,el766,el708" - }, - { - label: "Williams 2030 best 5", - value: "el1002,el1019,el1037,el1036,el1013" } ] } } }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/service/toolAddFacetService.js b/grails-app/assets/javascripts/spApp/service/toolAddFacetService.js index 102686b1..7fbdd5ca 100644 --- a/grails-app/assets/javascripts/spApp/service/toolAddFacetService.js +++ b/grails-app/assets/javascripts/spApp/service/toolAddFacetService.js @@ -52,12 +52,12 @@ var q = facet; if (speciesOptions.spatiallyUnknown) { if (speciesOptions.spatiallyValid && speciesOptions.spatiallySuspect) { /* do nothing */ - } else if (speciesOptions.spatiallyValid) q.push('-geospatial_kosher:false'); - else if (speciesOptions.spatiallySuspect) q.push('-geospatial_kosher:true'); + } else if (speciesOptions.spatiallyValid) q.push('-spatiallyValid:false'); + else if (speciesOptions.spatiallySuspect) q.push('-spatiallyValid:true'); } else { - if (speciesOptions.spatiallyValid && speciesOptions.spatiallySuspect) q.push('geospatial_kosher:*'); - else if (speciesOptions.spatiallyValid) q.push('geospatial_kosher:true'); - else if (speciesOptions.spatiallySuspect) q.push('geospatial_kosher:false'); + if (speciesOptions.spatiallyValid && speciesOptions.spatiallySuspect) q.push('spatiallyValid:*'); + else if (speciesOptions.spatiallyValid) q.push('spatiallyValid:true'); + else if (speciesOptions.spatiallySuspect) q.push('spatiallyValid:false'); } if (!speciesOptions.includeAbsences) { diff --git a/grails-app/assets/javascripts/spApp/service/toolAreaReportService.js b/grails-app/assets/javascripts/spApp/service/toolAreaReportService.js index e1c85200..589a702f 100644 --- a/grails-app/assets/javascripts/spApp/service/toolAreaReportService.js +++ b/grails-app/assets/javascripts/spApp/service/toolAreaReportService.js @@ -20,7 +20,8 @@ "constraints": { "min": 1, "max": 1, - "optional": false + "optional": false, + "excludeWorld": true } }], "description": $i18n("Area Report") diff --git a/grails-app/assets/javascripts/spApp/service/toolExportAreaService.js b/grails-app/assets/javascripts/spApp/service/toolExportAreaService.js index 2c3aff34..b7117efc 100644 --- a/grails-app/assets/javascripts/spApp/service/toolExportAreaService.js +++ b/grails-app/assets/javascripts/spApp/service/toolExportAreaService.js @@ -28,7 +28,7 @@ "description": $i18n(421,"Filetype."), "type": "list", "constraints": { - "default": "Shapefile", + "defaultValue": "Shapefile", "selection": "single", "content": [ "Shapefile", diff --git a/grails-app/assets/javascripts/spApp/service/toolExportChecklistService.js b/grails-app/assets/javascripts/spApp/service/toolExportChecklistService.js index 86042ced..571f2d81 100644 --- a/grails-app/assets/javascripts/spApp/service/toolExportChecklistService.js +++ b/grails-app/assets/javascripts/spApp/service/toolExportChecklistService.js @@ -8,8 +8,8 @@ * Client side tool to export list of species in an occurrence layer */ angular.module('tool-export-checklist-service', []) - .factory("ToolExportChecklistService", ["$http", "$q", "MapService", "BiocacheService", "LayoutService", - function ($http, $q, MapService, BiocacheService, LayoutService) { + .factory("ToolExportChecklistService", ["$http", "$q", "MapService", "BiocacheService", "LayoutService", "LayersService", + function ($http, $q, MapService, BiocacheService, LayoutService, LayersService) { var _this = { // Override text with view-config.json spec: { @@ -52,19 +52,25 @@ var wkt = undefined; if (area[0].q && (area[0].q.length > 0)) { q = area[0].q - } else if (area[0].wkt.length > 0) { + } else if (area[0].wkt && area[0].wkt.length > 0) { q = ['*:*']; wkt = area[0].wkt; + } else { + LayersService.getWkt(area[0].pid).then(function (wkt) { + inputs[0][0].wkt = wkt.data + _this.execute(inputs) + }) + return } if (speciesOptions.spatiallyUnknown) { if (speciesOptions.spatiallyValid && speciesOptions.spatiallySuspect) { /* do nothing */ - } else if (speciesOptions.spatiallyValid) q.push('-geospatial_kosher:false'); - else if (speciesOptions.spatiallySuspect) q.push('-geospatial_kosher:true'); + } else if (speciesOptions.spatiallyValid) q.push('-spatiallyValid:false'); + else if (speciesOptions.spatiallySuspect) q.push('-spatiallyValid:true'); } else { - if (speciesOptions.spatiallyValid && speciesOptions.spatiallySuspect) q.push('geospatial_kosher:*'); - else if (speciesOptions.spatiallyValid) q.push('geospatial_kosher:true'); - else if (speciesOptions.spatiallySuspect) q.push('geospatial_kosher:false'); + if (speciesOptions.spatiallyValid && speciesOptions.spatiallySuspect) q.push('spatiallyValid:*'); + else if (speciesOptions.spatiallyValid) q.push('spatiallyValid:true'); + else if (speciesOptions.spatiallySuspect) q.push('spatiallyValid:false'); } if (!speciesOptions.includeAbsences) { diff --git a/grails-app/assets/javascripts/spApp/service/toolExportMapService.js b/grails-app/assets/javascripts/spApp/service/toolExportMapService.js index 3e7fecc0..cc4cbfb5 100644 --- a/grails-app/assets/javascripts/spApp/service/toolExportMapService.js +++ b/grails-app/assets/javascripts/spApp/service/toolExportMapService.js @@ -28,7 +28,7 @@ "description": "Select an image format.", "type": "list", "constraints": { - "default": "png", + "defaultValue": "png", "selection": "single", "content": [ "png", @@ -88,13 +88,13 @@ data.overrideValues = { MapImage: { input: { - outputType: {constraints: {'default': outputType}}, - resolution: {constraints: {'default': resolution}}, - bbox: {constraints: {'default': bbox}}, - windowSize: {constraints: {'default': windowSize}}, - comment: {constraints: {'default': comment}}, - baseMap: {constraints: {'default': baseMap}}, - mapLayers: {constraints: {'default': mapLayers}} + outputType: {constraints: {'defaultValue': outputType}}, + resolution: {constraints: {'defaultValue': resolution}}, + bbox: {constraints: {'defaultValue': bbox}}, + windowSize: {constraints: {'defaultValue': windowSize}}, + comment: {constraints: {'defaultValue': comment}}, + baseMap: {constraints: {'defaultValue': baseMap}}, + mapLayers: {constraints: {'defaultValue': mapLayers}} } }, 'stage': 'execute' diff --git a/grails-app/assets/javascripts/spApp/service/toolExportSampleService.js b/grails-app/assets/javascripts/spApp/service/toolExportSampleService.js index 4e702026..969d741b 100644 --- a/grails-app/assets/javascripts/spApp/service/toolExportSampleService.js +++ b/grails-app/assets/javascripts/spApp/service/toolExportSampleService.js @@ -73,7 +73,7 @@ //include redirect to biocache-service/occurrences/search page var sampleUrl = _this.species.ws + '/download/options1?searchParams=' + - encodeURIComponent('q=' + query.qid) + + encodeURIComponent('?q=' + encodeURIComponent(query.qid)) + "&targetUri=/occurrences/search%3F&downloadType=records"; if (_this.layers && (_this.layers.length > 0)) { diff --git a/grails-app/assets/javascripts/spApp/service/toolsService.js b/grails-app/assets/javascripts/spApp/service/toolsService.js index 5f0e8970..00caee9f 100644 --- a/grails-app/assets/javascripts/spApp/service/toolsService.js +++ b/grails-app/assets/javascripts/spApp/service/toolsService.js @@ -213,7 +213,7 @@ displayname: name } }); - } else if (d.name === 'area') { + } else if (d.name === 'area' || d.name === 'AREA') { if (d.file.indexOf("{") === 0) { // parse JSON response // ENVELOPE is the only output of this type @@ -239,7 +239,7 @@ return MapService.add(data.data) })) } - } else if (d.name === 'species') { + } else if (d.name === 'species' || d.name === 'SPECIES') { var q = jQuery.parseJSON(d.file); if (!q.qid) { @@ -252,7 +252,7 @@ q.log = false // The task is logged, no need to log adding the layer promises.push(MapService.add(q)) - } else if (d.name === 'nextprocess') { + } else if (d.name === 'nextprocess' || d.name === 'NEXTPROCESS') { var nextinput = jQuery.parseJSON(d.file); // format 'nextprocess' output for LayoutService.openModal diff --git a/grails-app/assets/javascripts/spApp/service/urlParamsService.js b/grails-app/assets/javascripts/spApp/service/urlParamsService.js index 661df53b..0f34f321 100644 --- a/grails-app/assets/javascripts/spApp/service/urlParamsService.js +++ b/grails-app/assets/javascripts/spApp/service/urlParamsService.js @@ -22,17 +22,17 @@ * - ```ws```: biocache-hub URL for any layers added with this method. e.g. ```ws=https://biocache.ala.org.au``` * - ```bs```: biocache-service URL for any layers added with this method. e.g. ```bs=https://biocache.ala.org.au/ws``` * * Global to the whole session - * - ```wmscache```: ON/OFF for the current session (TODO: implement this) + * - ```wmscache```: ON/OFF for the current session * * Map control * - ```bbox```: zoom to this area with Min Lng, Min Lat, Max Lng, Max Lat. e.g. ```bbox=112,-42,154,-9``` * * Open a tool - * - ```tool```: name of tool to open. This can be any client side or spatial-service tool (TODO: support more than phylogeneticdiversity and exportBCCVL). e.g. ```tool=exportBCCVL``` + * - ```tool```: name of tool to open. This can be any client side or spatial-service tool * - ```toolParameters```: JSON Map of inputName:value for 'tool'. e.g. ```toolParameters={}``` * * Add one species layer * - ```qname```: display name for the 'q' layer. e.g. ```qname=My URL layer``` * - ```q```: biocache-service q term for occurrences layer to add. e.g. ```q=state:Queensland``` * - ```species_lsid```: LSID for occurrences layer to add. e.g. ```species_lsid=urn:lsid:biodiversity.org.au:afd.taxon:e6aff6af-ff36-4ad5-95f2-2dfdcca8caff``` - * - ```fq```: biocache-service fq term for occurrences layer to add. e.g. ```fq=geospatial_kosher:true``` + * - ```fq```: biocache-service fq term for occurrences layer to add. e.g. ```fq=spatiallyValid:true``` * - ```qc```: biocache-service fq term for occurrences layer to add. e.g. ```qc=data_hub_uid:dh1``` * - ```qualityProfile```: biocache-service qualityProfile param for data quality profile to apply * - ```disableAllQualityFilters```: biocache-service disableAllQualityFilters param to disable all data quality filters on this request @@ -275,9 +275,6 @@ var parameters = {}; if (toolParameters) parameters = JSON.parse(toolParameters); - if (tool === 'phylogeneticdiversity') { - //TODO: translate SpatialPortal phylogenetic diversity input parameters to SpatialHub format - } if (LayoutService.isPanel(tool)) { // is panel @@ -400,4 +397,4 @@ return _this; }]) -}(angular)); \ No newline at end of file +}(angular)); diff --git a/grails-app/assets/javascripts/spApp/templates/exportBccvlContent.tpl.htm b/grails-app/assets/javascripts/spApp/templates/exportBccvlContent.tpl.htm deleted file mode 100644 index c560c6d0..00000000 --- a/grails-app/assets/javascripts/spApp/templates/exportBccvlContent.tpl.htm +++ /dev/null @@ -1,53 +0,0 @@ -
{{pickContextualLayerName}}
-- | Group | -# Leaves | -Study name | -Study Id | - - -
- | {{tree.group}} | -{{tree.leaves}} | -{{tree.name}} | -{{tree.id}} | -
Minimum one spatially related option is required! See this support article for more information
+Minimum one spatially related option is required! See this support article for more information
Minimum one spatially related option is required! See this support article for more information
Minimum one spatially related option is required! See this support article for more information