Mercurial > dive4elements > gnv-client
diff gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp @ 585:2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
gnv/trunk@736 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 05 Mar 2010 09:33:30 +0000 |
parents | b31e81f35b64 |
children | 8315b0a40329 |
line wrap: on
line diff
--- a/gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp Thu Mar 04 14:27:26 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp Fri Mar 05 09:33:30 2010 +0000 @@ -1,6 +1,12 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<% + String serverPath = (String) request.getAttribute("mapserver"); + String mapfilePath = (String) request.getAttribute("mapfile"); + String layerName = (String) request.getAttribute("layer"); +%> + <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> @@ -23,43 +29,22 @@ var map, layer; function init() { - if (getURLParam("target") == "wms") { - map = new OpenLayers.Map('map'); - layer = new OpenLayers.Layer.WMS( - "MyWMS", - "http://denmark.atlas/cgi-bin/mapserv-gp?MAP=/opt/artifacts/mapfiles/mapfile.map", - { - layers: getURLParam("layer"), - format: 'image/png' - }, - { - singleTile: 'true' - } - ); + map = new OpenLayers.Map('map'); + var server = '<%=serverPath%>?MAP=<%=mapfilePath%>'; + layer = new OpenLayers.Layer.WMS( + "MyWMS", + server, + { + layers: '<%=layerName%>', + format: 'image/png' + }, + { + singleTile: 'true' + } + ); - map.addLayer(layer); - map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); - } - } - - function getURLParam(strParamName){ - var strReturn = ""; - var strHref = window.location.href; - - if ( strHref.indexOf("?") > -1 ){ - var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); - var aQueryString = strQueryString.split("&"); - - for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ - if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ) { - var aParam = aQueryString[iParam].split("="); - strReturn = aParam[1]; - break; - } - } - } - - return strReturn; + map.addLayer(layer); + map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); } </script> </head> @@ -78,7 +63,21 @@ <jsp:include page="index.jsp" /> <jsp:include page="footer.jsp" /> - <div id="map"></div> + <div class="outerMap"> + <div id="wms"> + <table> + <tr> + <td class="parameter"><bean:message key="gnviewer.wms.server.path"/>:</td> + <td class="wmsvalue"><%=serverPath%>?MAP=<%=mapfilePath%></td> + </tr> + <tr> + <td class="parameter"><bean:message key="gnviewer.wms.server.layer"/>:</td> + <td class="wmsvalue"><%=layerName%></td> + </tr> + </table> + </div> + <div id="map"></div> + </div> </div> </body> </html>