[Mapbender-commits] r10250 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Sep 13 04:58:04 PDT 2019
Author: armin11
Date: 2019-09-13 04:58:04 -0700 (Fri, 13 Sep 2019)
New Revision: 10250
Modified:
trunk/mapbender/http/plugins/kmlTree.php
Log:
New options to build nicer guis ;-) - thanx to karl owesny
Modified: trunk/mapbender/http/plugins/kmlTree.php
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.php 2019-09-13 11:50:41 UTC (rev 10249)
+++ trunk/mapbender/http/plugins/kmlTree.php 2019-09-13 11:58:04 UTC (rev 10250)
@@ -329,7 +329,7 @@
isPublic = data;
if (isPublic == 1){
- alert('To publicate a WMC is not allowed for the Guest-User!'+
+ alert('The Guest-User is not allowed to publish a WMC!'+
'If you want to use this function, please create an account.');
return false;
}
@@ -871,6 +871,48 @@
}
return data;
};
+ // 'area', 'boundary-length', 'track-length'
+ var featureInfoFilter = ['title', 'marker-size', 'marker-symbol', 'marker-color',
+ 'marker-offset-x', 'marker-offset-y', 'stroke', 'stroke-opacity',
+ 'stroke-width', 'fill', 'fill-opacity'];
+
+ function escapeHTML(text) {
+ return text
+ .toString()
+ .replace(/&/g, '&')
+ .replace(/</g, '<')
+ .replace(/>/g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''')
+ .replace(/\//g, '/');
+ }
+
+ function createFeatureInfoContent(props) {
+ var $table = $("<table>")
+ .attr("border", 1);
+ for (var key in props) {
+ if (props.hasOwnProperty(key) && featureInfoFilter.indexOf(key) < 0) {
+ $table
+ .append($("<tr>")
+ .append($("<td>").html(escapeHTML(key)))
+ .append($("<td>").html(escapeHTML(props[key]))))
+ }
+ }
+ return $table.attr('outerHTML');
+ }
+
+ this.getFeatureInfos = function (click) {
+ var map = Mapbender.modules.mapframe1;
+ var kml = $('#mapframe1').data('kml');
+ return kml.findFeaturesAtClick(click)
+ .map(function (locator) {
+ var kmlLayer = map.kmls[locator.url];
+ return {
+ title: kmlLayer.data.title,
+ content: createFeatureInfoContent(kmlLayer.data.features[locator.id].properties)
+ }
+ });
+ };
};
Mapbender.events.init.register(function() {
More information about the Mapbender_commits
mailing list