<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Problem with adding a WMS dynamically in MapBender 2.4.2</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Hi,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I have MapBender application where users can add WMS dynamically. Map files are generated from user input and geo-data in postgis.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">The MapBender gui is enclosed in a outer iframe (myFrame).</FONT>

<BR><FONT SIZE=2 FACE="Arial">Everything works ok in MapBender 2.1, but not anymore since we migrated to MapBender 2.4.2. We want to make use the extra functionality in MB 2.4.2.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Here is the javascript code where the WMS is added.</FONT>
</P>

<P><I><FONT SIZE=2 FACE="Arial">&lt;script language=&quot;javascript&quot;&gt;</FONT></I>

<BR><I><FONT SIZE=2 FACE="Arial">function addWMS(caps){</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">var oMyFrame=parent.mainCenter.frames['myFrame'];</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">var oLoadData=oMyFrame.self.frames['loadData'];</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">var oTreeGDE=oMyFrame.self.frames['treeGDE'];</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">var oMapframe=oMyFrame.self.frames['mapframe1'];</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">url = &quot;<A HREF="http://mxs092:8081/mapbender/php/mod_createJSObjFromXML.php?caps=">http://mxs092:8081/mapbender/php/mod_createJSObjFromXML.php?caps=</A>&quot; + escape(caps);</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">oLoadData.document.location.href = url;</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">oTreeGDE.document.location.reload();</FONT></I>

<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">oMapframe.parent.mb_mapObjaddWMS['mapframe1'];</FONT></I>

<BR><I><FONT SIZE=2 FACE="Arial">}</FONT></I>

<BR><I><FONT SIZE=2 FACE="Arial">&lt;/script&gt;</FONT></I>
</P>

<P><FONT SIZE=2 FACE="Arial">The above code works ok in MB 2.1</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">In MB 2.4.2 the following error appears</FONT>

<BR><FONT FACE="Arial" SIZE=2 COLOR="#000000">
<IMG SRC="No%20AttachName" alt="ole0.bmp"></FONT><FONT SIZE=2 FACE="Arial">&nbsp;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">It says that &quot;</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial">The property or method is not supported by this object</FONT><FONT SIZE=2 FACE="Arial">&quot;.</FONT>

<BR><FONT SIZE=2 FACE="Arial">The error i think is caused by the call &quot;</FONT><I><FONT SIZE=2 FACE="Arial">parent.mod_addWMS_refresh();</FONT></I><FONT SIZE=2 FACE="Arial">&quot; in the MapBender module</FONT><I> <FONT SIZE=2 FACE="Arial">mod_createJSObjFromXML.php</FONT></I><FONT SIZE=2 FACE="Arial">.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">The parent in this case is the outer iframe which encloses the MapBender gui. This iframe does not know the function mod_addWMS_refresh which is defined in the javascript</FONT><I> <FONT SIZE=2 FACE="Arial">mod_addWMSgeneralFunctions.js.</FONT></I></P>

<P><FONT SIZE=2 FACE="Arial">The function</FONT><I> <FONT SIZE=2 FACE="Arial">mod_addWMS_refresh</FONT></I><FONT SIZE=2 FACE="Arial"> in turn calls another function</FONT><I> <FONT SIZE=2 FACE="Arial">mb_mapObjaddWMS</FONT></I><FONT SIZE=2 FACE="Arial"> defined in</FONT><I> <FONT SIZE=2 FACE="Arial">map.js</FONT></I><FONT SIZE=2 FACE="Arial">, which i think does some housekeeping for adding WMS layers to an internal array of WMS objects.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Can someone tell how i call the external java functions</FONT><I> <FONT SIZE=2 FACE="Arial">mod_addWMS_refresh</FONT></I> <FONT SIZE=2 FACE="Arial">and</FONT><I> <FONT SIZE=2 FACE="Arial">mb_mapObjaddWMS</FONT></I><FONT SIZE=2 FACE="Arial"> outside the MapBender context, for example in a php script, where a request is done like </FONT></P>

<P><FONT SIZE=2 FACE="Arial"><A HREF="http://mxs092:8081/mapbender/php/mod_createJSObjFromXML.php?caps=">http://mxs092:8081/mapbender/php/mod_createJSObjFromXML.php?caps=</A>&quot; + escape(caps)</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">With kind regards,</FONT>
</P>

<P><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">Edgar Lieuw A On</FONT></SPAN>
</P>

<P><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">MX.</FONT></SPAN><SPAN LANG="nl-nl"><I><FONT COLOR="#000000" SIZE=2 FACE="Arial">Systems</FONT></I></SPAN>

<BR><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">Patrijsweg 32, 2289 EX Rijswijk</FONT></SPAN>

<BR><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">tel: 070 3073741</FONT></SPAN>

<BR><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">fax:070 3073700</FONT></SPAN>
</P>

<P><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">website:</FONT></SPAN><SPAN LANG="en-gb"><U></U></SPAN><SPAN LANG="en-gb"><U></U></SPAN><SPAN LANG="en-gb"><U><FONT COLOR="#0000FF" FACE="Times New Roman"><A HREF="http://www.mx-groep.nl/">http://www.mx-groep.nl/</A></FONT></U></SPAN><U><SPAN LANG="nl-nl"></SPAN></U><SPAN LANG="nl-nl"></SPAN><SPAN LANG="nl-nl"></SPAN>

<BR><SPAN LANG="nl-nl"><FONT COLOR="#000000" SIZE=2 FACE="Arial">e-mail:</FONT><U> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><A HREF="mailto:edgar.lieuwaon@mx-groep.nl">mailto:edgar.lieuwaon@mx-groep.nl</A></FONT></U></SPAN>
</P>
<BR>

</BODY>
</HTML>