You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2017/11/02 15:05:34 UTC
[myfaces-tobago] 05/05: Demo: fix embedded maps * replacing Google
Maps with openstreetmap OSM,
because its free to use and no API Key is needed for tracking/analysis.
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 87368de59fa9bb0e9389f7ddb588544e1bd91710
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Nov 2 16:05:00 2017 +0100
Demo: fix embedded maps
* replacing Google Maps with openstreetmap OSM, because its free to use and no API Key is needed for tracking/analysis.
---
.../src/main/webapp/WEB-INF/tobago-config.xml | 2 +-
.../content/20-component/020-output/60-object/object.js | 14 ++++++++++----
.../content/20-component/020-output/60-object/object.xhtml | 12 +++++++-----
.../webapp/content/20-component/020-output/output.xhtml | 7 ++++---
4 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
index e2f8dc4..fedf697 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
@@ -50,7 +50,7 @@
XXX because of JSF-AJAX we need 'unsafe-eval' -->
<!--<directive name="script-src">'self' 'unsafe-eval'</directive>-->
<!-- needed for <tc:object> -->
- <directive name="child-src">https://maps.google.com</directive>
+ <directive name="child-src">https://www.openstreetmap.org</directive>
<directive name="child-src">https://*.apache.org</directive>
<!-- needed for the test suite -->
<directive name="child-src">'self'</directive>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.js b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.js
index cede006..57ae9f7 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.js
@@ -21,8 +21,11 @@
$.widget("demo.maps", {
options: {
- position: "11.249123,-60.687103", // tobago
- zoom: 2 // global
+ position: { // tobago
+ x: -60.687103,
+ y: 11.249123
+ },
+ zoom: 0.2
},
_create: function () {
@@ -37,8 +40,11 @@
zoom = this.options.zoom;
}
var target = this.element.data("maps-target");
- var url = 'https://maps.google.com/maps?'
- + 'ie=UTF8&ll=' + position + '&t=h&z=' + zoom + '&output=embed&f=q&cd=1';
+ var url = 'https://www.openstreetmap.org/export/embed.html?bbox='
+ + (position.x - zoom) + ','
+ + (position.y - zoom) + ','
+ + (position.x + zoom) + ','
+ + (position.y + zoom);
jQuery(Tobago.Utils.escapeClientId(target)).attr('src', url);
}
});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.xhtml
index 565e77d..8e48135 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/60-object/object.xhtml
@@ -31,15 +31,15 @@
<tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png"
link="#{demoBundle.tagDocUrl}/#{info.stableVersion}/tld/tc/object.html"/>
<tc:section label="Basics">
- <pre><code class="language-markup"><tc:object src="https://www.google.com/maps/..."/></code></pre>
+ <pre><code class="language-markup"><tc:object src="https://www.openstreetmap.org/..."/></code></pre>
<tc:object id="o1"
- src="https://www.google.com/maps/embed?pb=!1m10!1m8!1m3!1d137123.69440217633!2d-60.687103!3d11.249123!3m2!1i1024!2i768!4f13.1!5e1!3m2!1sde!2sus!4v1458208065829"/>
+ src="https://www.openstreetmap.org/export/embed.html?bbox=-60.75,11.15,-60.6,11.35"/>
</tc:section>
<tc:section label="Style">
<p>A <code class="language-markup"><tc:object/></code> tag can contain a style tag.
In this case it's <code class="language-markup"><tc:style width="100%"/></code>.</p>
<tc:object id="o2"
- src="https://www.google.com/maps/embed?pb=!1m13!1m11!1m3!1d99967845.2048925!2d-60.68710300000001!3d11.249123!2m2!1f0!2f0!3m2!1i1024!2i768!4f13.1!5e1!3m2!1sde!2sus!4v1458208366973">
+ src="https://www.openstreetmap.org/export/embed.html?bbox=-60.75,11.15,-60.6,11.35">
<tc:style width="100%"/>
</tc:object>
</tc:section>
@@ -70,11 +70,13 @@
</tc:box>
<tc:buttons id="t1">
<tc:button id="c1" label="Show Tobago" omit="true">
- <tc:dataAttribute name="maps-position" value="11.249123,-60.687103"/>
- <tc:dataAttribute name="maps-zoom" value="12"/>
+ <tc:dataAttribute name="maps-position" value='{"x":-60.687103,"y":11.249123}'/>
+ <tc:dataAttribute name="maps-zoom" value="0.1"/>
<tc:dataAttribute name="maps-target" value="page:mainForm:map"/>
</tc:button>
<tc:button id="c2" label="Show World" omit="true">
+ <tc:dataAttribute name="maps-position" value='{"x":0.0,"y":0.0}'/>
+ <tc:dataAttribute name="maps-zoom" value="70"/>
<tc:dataAttribute name="maps-target" value="page:mainForm:map"/>
</tc:button>
</tc:buttons>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/output.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/output.xhtml
index 50820fe..8fcdb3f 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/output.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/output.xhtml
@@ -54,8 +54,9 @@
</tc:section>
<tc:section label="#{demoBundle.object}">
- <pre><code class="language-markup"><tc:object src="https://www.google.com/maps/..."/></code></pre>
- <tc:object
- src="https://www.google.com/maps/embed?pb=!1m10!1m8!1m3!1d137123.69440217633!2d-60.687103!3d11.249123!3m2!1i1024!2i768!4f13.1!5e1!3m2!1sde!2sus!4v1458208065829"/>
+ <pre><code class="language-markup"><tc:object src="https://www.openstreetmap.org/..."/></code></pre>
+ <tc:object src="https://www.openstreetmap.org/export/embed.html?bbox=-60.75,11.15,-60.6,11.35">
+ <tc:style width="100%" height="50vmin"/>
+ </tc:object>
</tc:section>
</ui:composition>
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.