Salve!
It's been a while since last posting here, but I ran into something I can't solve by myself or by searching the forum:
I set up a page displaying a google map, where one can choose what kind of markers are to be displayed. This works all very fine.
Now, I use nested_pages and created a "page" (for the menu, so it just points to somewhere else) that links to said map. I would like to change the URL of the map and therefore chose "masquerade" within the pointer settings.
When I now select something in the sidebar to change the map the flash variables will not be saved, therefore the map doesn't change. As everything works fine when I choose "redirect" I can only assume that this is an issue with flash variables and masquerading. Is there some way to fix that?
It's been a while since last posting here, but I ran into something I can't solve by myself or by searching the forum:
I set up a page displaying a google map, where one can choose what kind of markers are to be displayed. This works all very fine.
Now, I use nested_pages and created a "page" (for the menu, so it just points to somewhere else) that links to said map. I would like to change the URL of the map and therefore chose "masquerade" within the pointer settings.
When I now select something in the sidebar to change the map the flash variables will not be saved, therefore the map doesn't change. As everything works fine when I choose "redirect" I can only assume that this is an issue with flash variables and masquerading. Is there some way to fix that?
- Code: Select all
<!-- Main -->
<section class="main">
<article>
<header>
<h1>
Cryogenics Map
</h1>
</header>
<cms:set map_display="<cms:get_flash 'map_display' />" />
<cms:set map_categories="<cms:get_flash 'map_categories' />" />
<div id="map"></div>
<script>
function initMap() {
var locations = [
<cms:if map_display && map_categories>
<cms:pages folder=map_display custom_field="map_category=<cms:show map_categories/>">['<strong><cms:show k_page_title/></strong><br/><cms:show map_info/><br/><a href="<cms:show map_url/>"><cms:show map_url/></a>', '<cms:if map_category="uni">U<cms:else_if map_category="ins"/>I<cms:else_if map_category="rcg"/>R<cms:else_if map_category="ass"/>A</cms:if>', <cms:show map_lat/>, <cms:show map_long/>, 0],</cms:pages>
<cms:else_if map_display/>
<cms:if map_display='www'>
<cms:pages>['<strong><cms:show k_page_title/></strong><br/><cms:show map_info/><br/><a href="<cms:show map_url/>"><cms:show map_url/></a>', '<cms:if map_category="uni">U<cms:else_if map_category="ins"/>I<cms:else_if map_category="rcg"/>R<cms:else_if map_category="ass"/>A</cms:if>', <cms:show map_lat/>, <cms:show map_long/>, 0],</cms:pages>
<cms:else />
<cms:pages folder=map_display>['<strong><cms:show k_page_title/></strong><br/><cms:show map_info/><br/><a href="<cms:show map_url/>"><cms:show map_url/></a>', '<cms:if map_category="uni">U<cms:else_if map_category="ins"/>I<cms:else_if map_category="rcg"/>R<cms:else_if map_category="ass"/>A</cms:if>', <cms:show map_lat/>, <cms:show map_long/>, 0],</cms:pages>
</cms:if>
<cms:else/>
<cms:pages folder='europe'>['<strong><cms:show k_page_title/></strong><br/><cms:show map_info/><br/><a href="<cms:show map_url/>"><cms:show map_url/></a>', '<cms:if map_category="uni">U<cms:else_if map_category="ins"/>I<cms:else_if map_category="rcg"/>R<cms:else_if map_category="ass"/>A</cms:if>', <cms:show map_lat/>, <cms:show map_long/>, 0],</cms:pages>
</cms:if>
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: <cms:if map_display='www'>1<cms:else/>3</cms:if>,
center: new google.maps.LatLng(<cms:if map_display='usa'>39.337336, -95.961341<cms:else/>49.011913, 8.416848</cms:if>),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow({});
var marker, i;
var image = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][2], locations[i][3]),
label: (locations[i][1]),
map: map,
});
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCANSocqvHxej5TY5tuaJBWA-_6QgzFQiw&callback=initMap">
</script>
</article>
</section>
<!-- Sidebar -->
<aside class="sidebar">
<section>
<cms:form anchor='0' method='post'>
<cms:if k_success >
<cms:if frm_display='-'>
<cms:else/>
<cms:set_flash name='map_display' value=frm_display />
<cms:set_flash name='map_categories' value=frm_categories />
</cms:if>
<cms:redirect k_page_link />
</cms:if>
<cms:input name="display" type='radio' opt_values='<span></span>Worldwide=www | <span></span>Europe=europe | <span></span>USA=usa' opt_selected="<cms:if map_display><cms:show map_display/><cms:else/>europe</cms:if>" />
<cms:input name="categories" type='checkbox' opt_values='<span></span>Institutes=ins , <span></span>Research Centers/Groups=rcg , <span></span>Universities=uni , <span></span>Associations=ass' separator=',' opt_selected="<cms:if map_categories><cms:show map_categories/><cms:else/>ins , rcg , uni , ass</cms:if>" />
<cms:input type="submit" value="Show selected" name="submit"/>
</cms:form>
</section>
</aside>