Loading grunt/config/handlebars.js +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ module.exports = function(grunt) { qualityControl: true, GroupIcon: true, GroupIconInspire: true, Legend: true, Image: true, URL: true, UrlWebcam: true, Loading Loading @@ -75,6 +74,7 @@ module.exports = function(grunt) { ActivityResources: true, ActivityStarred: true, ServiceOGCAttribution: true, ServiceOGCLegend: true, // string Capitalize: true Loading src/Helpers/customParser.js +48 −2 Original line number Diff line number Diff line define([ 'handlebars/handlebars.min' 'dojo/_base/lang' , 'handlebars/handlebars.min' ], function( handlebars lang , handlebars ) { 'use strict'; Loading Loading @@ -100,6 +102,50 @@ define([ } return new handlebars.SafeString(result); }, ServiceOGCLegend: function(layer) { var imgClass = 'detailsPhoto', noImgUrl = '/resources/images/noIMG.png', legendOptsParam = 'legend_options=fontAntiAliasing:true;dpi:100', imgUrl; if (!layer || !(layer.legend || layer.stylesLayer)) { imgUrl = noImgUrl; } else if (layer.legend) { imgUrl = layer.legend + '&' + legendOptsParam; } else { var fixedStyles = layer.styles, firstStyle; if (fixedStyles) { var firstFixedStyleName = fixedStyles.split(',')[0], firstStyleNameSplit = firstFixedStyleName.split(':'), styleWithoutWorkspace = firstStyleNameSplit[firstStyleNameSplit.length - 1]; var stylesFound = layer.stylesLayer.filter(lang.partial(function(style, item) { return item.name === style; }, styleWithoutWorkspace)); if (stylesFound.length) { firstStyle = stylesFound[0]; } else { imgUrl = noImgUrl; } } else { firstStyle = layer.stylesLayer[0]; } if (firstStyle) { imgUrl = firstStyle.url + '&' + legendOptsParam; } } var imgElement = '<img src="' + imgUrl + '" class="' + imgClass + '" />'; return new handlebars.SafeString(imgElement); } }; }); src/Helpers/legacy.js +0 −66 Original line number Diff line number Diff line Loading @@ -331,31 +331,6 @@ define([ return new handlebars.SafeString(content + "'></i>"); }, 'Legend': function(url) { var content; if (url) { var params = { legend_options: "fontAntiAliasing:true;dpi:100" }; var paramsStr = L.Util.getParamString(params); if (url.indexOf("?") >= 0) { paramsStr = "&" + paramsStr.substr(1, paramsStr.length); } url = url + paramsStr; content = "<img src='" + url + "' class='detailsPhoto' /><br>"; } else { content = "<img src='/resources/images/noIMG.png' class='detailsPhoto' /><br>"; } return new handlebars.SafeString(content); }, 'Image': function(image, urlDefault) { var content; Loading Loading @@ -834,47 +809,6 @@ define([ return new handlebars.SafeString(content); }, 'DownloadServiceOGC': function(urlSource, name) { var urlSourceSplitted = urlSource.split('/'); urlSourceSplitted.pop(); var workspace = urlSourceSplitted[urlSourceSplitted.length - 1]; urlSourceSplitted.push('ows'); var urlCommonParams = 'service=WFS&version=1.0.0&request=GetFeature&typeName=' + workspace + ':' + name, urlCommonPrefix = urlSourceSplitted.join('/') + '?' + urlCommonParams, content = '', downloadFormats = [{ name: 'CSV', descriptor: 'csv' },{ name: 'Shapefile', descriptor: 'shape-zip' },{ name: 'GeoJSON', descriptor: 'application/json' },{ name: 'KML', descriptor: 'application/vnd.google-earth.kml%2Bxml' },{ name: 'GML 3.2', descriptor: 'application/gml%2Bxml; version=3.2' }]; for (var i = 0; i < downloadFormats.length; i++) { var format = downloadFormats[i], formatName = format.name, descriptor = format.descriptor, downloadUrl = '<span><a href="' + urlCommonPrefix + '&outputFormat=' + descriptor + '" target="_blank">' + formatName + '</a></span>'; content += downloadUrl; } return new handlebars.SafeString(content); }, 'breaklines': breaklines, 'textOrSpace': function(text) { Loading src/ServiceOGC/Image.hbs +1 −1 Original line number Diff line number Diff line {{Legend data.styleLayer.url}} {{ServiceOGCLegend data}} src/ServiceOGC/SourceInfo.hbs +1 −1 Original line number Diff line number Diff line Loading @@ -183,7 +183,7 @@ <span title="{{i18n.urlSource}}">{{i18n.urlSource}}</span> </div> <div class="{{RowColServiceOGCCatalog 'right'}}"> {{data.urlSource}} <p>{{data.urlSource}}</p> </div> </div> {{/if}} Loading Loading
grunt/config/handlebars.js +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ module.exports = function(grunt) { qualityControl: true, GroupIcon: true, GroupIconInspire: true, Legend: true, Image: true, URL: true, UrlWebcam: true, Loading Loading @@ -75,6 +74,7 @@ module.exports = function(grunt) { ActivityResources: true, ActivityStarred: true, ServiceOGCAttribution: true, ServiceOGCLegend: true, // string Capitalize: true Loading
src/Helpers/customParser.js +48 −2 Original line number Diff line number Diff line define([ 'handlebars/handlebars.min' 'dojo/_base/lang' , 'handlebars/handlebars.min' ], function( handlebars lang , handlebars ) { 'use strict'; Loading Loading @@ -100,6 +102,50 @@ define([ } return new handlebars.SafeString(result); }, ServiceOGCLegend: function(layer) { var imgClass = 'detailsPhoto', noImgUrl = '/resources/images/noIMG.png', legendOptsParam = 'legend_options=fontAntiAliasing:true;dpi:100', imgUrl; if (!layer || !(layer.legend || layer.stylesLayer)) { imgUrl = noImgUrl; } else if (layer.legend) { imgUrl = layer.legend + '&' + legendOptsParam; } else { var fixedStyles = layer.styles, firstStyle; if (fixedStyles) { var firstFixedStyleName = fixedStyles.split(',')[0], firstStyleNameSplit = firstFixedStyleName.split(':'), styleWithoutWorkspace = firstStyleNameSplit[firstStyleNameSplit.length - 1]; var stylesFound = layer.stylesLayer.filter(lang.partial(function(style, item) { return item.name === style; }, styleWithoutWorkspace)); if (stylesFound.length) { firstStyle = stylesFound[0]; } else { imgUrl = noImgUrl; } } else { firstStyle = layer.stylesLayer[0]; } if (firstStyle) { imgUrl = firstStyle.url + '&' + legendOptsParam; } } var imgElement = '<img src="' + imgUrl + '" class="' + imgClass + '" />'; return new handlebars.SafeString(imgElement); } }; });
src/Helpers/legacy.js +0 −66 Original line number Diff line number Diff line Loading @@ -331,31 +331,6 @@ define([ return new handlebars.SafeString(content + "'></i>"); }, 'Legend': function(url) { var content; if (url) { var params = { legend_options: "fontAntiAliasing:true;dpi:100" }; var paramsStr = L.Util.getParamString(params); if (url.indexOf("?") >= 0) { paramsStr = "&" + paramsStr.substr(1, paramsStr.length); } url = url + paramsStr; content = "<img src='" + url + "' class='detailsPhoto' /><br>"; } else { content = "<img src='/resources/images/noIMG.png' class='detailsPhoto' /><br>"; } return new handlebars.SafeString(content); }, 'Image': function(image, urlDefault) { var content; Loading Loading @@ -834,47 +809,6 @@ define([ return new handlebars.SafeString(content); }, 'DownloadServiceOGC': function(urlSource, name) { var urlSourceSplitted = urlSource.split('/'); urlSourceSplitted.pop(); var workspace = urlSourceSplitted[urlSourceSplitted.length - 1]; urlSourceSplitted.push('ows'); var urlCommonParams = 'service=WFS&version=1.0.0&request=GetFeature&typeName=' + workspace + ':' + name, urlCommonPrefix = urlSourceSplitted.join('/') + '?' + urlCommonParams, content = '', downloadFormats = [{ name: 'CSV', descriptor: 'csv' },{ name: 'Shapefile', descriptor: 'shape-zip' },{ name: 'GeoJSON', descriptor: 'application/json' },{ name: 'KML', descriptor: 'application/vnd.google-earth.kml%2Bxml' },{ name: 'GML 3.2', descriptor: 'application/gml%2Bxml; version=3.2' }]; for (var i = 0; i < downloadFormats.length; i++) { var format = downloadFormats[i], formatName = format.name, descriptor = format.descriptor, downloadUrl = '<span><a href="' + urlCommonPrefix + '&outputFormat=' + descriptor + '" target="_blank">' + formatName + '</a></span>'; content += downloadUrl; } return new handlebars.SafeString(content); }, 'breaklines': breaklines, 'textOrSpace': function(text) { Loading
src/ServiceOGC/Image.hbs +1 −1 Original line number Diff line number Diff line {{Legend data.styleLayer.url}} {{ServiceOGCLegend data}}
src/ServiceOGC/SourceInfo.hbs +1 −1 Original line number Diff line number Diff line Loading @@ -183,7 +183,7 @@ <span title="{{i18n.urlSource}}">{{i18n.urlSource}}</span> </div> <div class="{{RowColServiceOGCCatalog 'right'}}"> {{data.urlSource}} <p>{{data.urlSource}}</p> </div> </div> {{/if}} Loading