<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Not in PHP, but a javascript like this should do it:<br>
top.location.reload();<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Arnaud De Groof skrev:
<blockquote
 cite="mid:22E55E9B9202984A9BE3AD4D1114465E54E066@spb-lge-mx01.spb.spacebel.be"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
  <style>
<!--
 
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
h4
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;
        font-weight:bold;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle25
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
 
 @list l0
        {mso-list-id:83428067;
        mso-list-template-ids:-1221969374;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:?;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
  </style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  <div class="Section1">
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">OK, in fact
my comprehension of the &#8220;target&#8221;
was incorrect. It was not necessary to use the target to view the new
temporary
Weblayout; a simple refresh allows it.</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Is it
possible to refresh directly the
viewer by adding a line in the php code? I saw a RefreshMap.js.</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Regards,</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Arnaud De
Groof</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <div>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt; color: windowtext;">
  <hr align="center" size="2"></span></font></div>
  <p class="MsoNormal"><b><font color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;">From:</span></font></b><font
 color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext;">
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a class="moz-txt-link-freetext" href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>] <b><span
 style="font-weight: bold;">On Behalf Of </span></b>Kenneth Skovhede,
GEOGRAF A/S<br>
  <b><span style="font-weight: bold;">Sent:</span></b> mardi 6 janvier
2009 13:58<br>
  <b><span style="font-weight: bold;">To:</span></b> MapGuide Users
Mail List<br>
  <b><span style="font-weight: bold;">Subject:</span></b> Re:
[mapguide-users]
create a temporary !Mapdefinition and add a layer</span></font><font
 color="black"><span style="color: windowtext;"></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">The
"Target"
stuff refers to clicking on a link on a feature.<br>
  <br>
The PHP code below only relocates the current page.<br>
This means that the new window is created *before* the <br>
code below is being run. Try locating that spot,<br>
and change the target to "_top" or "_self".<br>
  <br>
For explanation on the targets, look here:<br>
  <a moz-do-not-send="true"
 href="http://www.codetoad.com/html/frames/specifying_frames.asp">http://www.codetoad.com/html/frames/specifying_frames.asp</a><br>
  <br>
If you are actually modifying the WebLayout when clicking a feature,<br>
the target should probably be set to "_parent" in Maestro.<br>
After setting the target, press the "View Xml" button to<br>
see what changes your code has to make to achieve the same.</span></font></p>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">Regards, Kenneth Skovhede, GEOGRAF A/S</span></font></pre>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><br>
  <br>
Arnaud De Groof skrev: </span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><!--[if gte mso 9]><xml>
 <u1:shapedefaults u2:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <u3:shapelayout u4:ext="edit">
  <u3:idmap u4:ext="edit" data="1"/>
 </u3:shapelayout>
</xml><![endif]-->Hi
Kenneth,</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Thanks to
your precisions, all the code is
correct. </span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">I have a
specific question. The new
temporary WebLayout appears in a new window. Is it possible to update
only the
current viewer with this new temporary WebLayout? I don&#8217;t find specific
command in Maestro for it. </span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Invoke URL
command:</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">-&gt; Extra
properties</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Target : </span></font></p>
  <ul style="margin-top: 0cm;" type="square">
    <li class="MsoNormal" style="color: navy;"><font color="navy"
 face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">NewWindow = WebLayout in
a new window </span></font></li>
    <li class="MsoNormal" style="color: navy;"><font color="navy"
 face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">SpecifiedFrame =
WebLayout in a new window (I have used the &#8220;id&#8221; of the Viewer Frame)</span></font></li>
    <li class="MsoNormal" style="color: navy;"><font color="navy"
 face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">TaskPane = WebLayout in
the Taskpane </span></font></li>
  </ul>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Thanks </span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Arnaud De
Groof</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">The new code:</span></font></p>
  <p class="MsoNormal"><font color="red" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">&lt;?php</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Vital
includes.</span></font></p>
  <p class="MsoNormal"><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">include</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"../../mapviewerphp/constants.php"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">include</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"../../mapviewerphp/common.php"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$args</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$_SERVER</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">[</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">'REQUEST_METHOD'</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">]</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">==</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"POST"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">)</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">?</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$_POST</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">:</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$_GET</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionId</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$args</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">[</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">'SESSION'</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">];</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">$mapName
=
$args['MAPNAME'];</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$layerName1</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">'YYY'</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$rlLayerResourceId</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Library://</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">XXX</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">/</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$layerName1</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">.LayerDefinition"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">InitializeWebTier();</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$userInfo</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgUserInformation(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$siteConnection</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgSiteConnection();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$siteConnection</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;Open(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$userInfo</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$resourceService</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$siteConnection</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;CreateService(MgServiceType::ResourceService);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Read the
MapDefinition into an XML DOM document object.</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$md</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
Library://XXX/$mapName.MapDefinition</span></font><font color="#008200"
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">
"</span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">// </span></font><b><font
 color="#7ca5d5" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(124, 165, 213); font-weight: bold;">TODO</span></font></b><font
 color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">
Constant!</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdResourceId</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgResourceIdentifier(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$md</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdReader</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$resourceService</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetResourceContent(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdXml</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdReader</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;ToString();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DOMDocument::loadXML(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Add a new
MapLayer</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$targetNode</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;getElementsByTagName(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"MapLayer"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">)-&gt;item(</span></font><font
 color="red" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">0</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$targetNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;parentNode-&gt;insertBefore(</span></font><font
 color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DOMElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"MapLayer"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">),</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$targetNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Name"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$layerName1</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"ResourceId"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$rlLayerResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Selectable"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"false"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"ShowInLegend"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"false"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"LegendLabel"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"ExpandInLegend"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"false"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span style="font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Visible"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"true"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$newNode</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;appendChild(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;createElement(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Group"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Save the
updated MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$updatedXml</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;saveXML();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$byteSource</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgByteSource(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$updatedXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">strlen(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$updatedXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Create the
temporary MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionMapName</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetName();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionMapDefinition</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Session:</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionId</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">//</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionMapName</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">.MapDefinition"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionResourceId</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgResourceIdentifier(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionMapDefinition</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Write the
updated MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$resourceService</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;SetResource(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$byteSource</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetReader(),</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">null);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//Test
the
updated MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$md1</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Session:</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionId</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">//X.MapDefinition"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdResourceId2</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgResourceIdentifier(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$md1</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdReader2</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$resourceService</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetResourceContent(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdResourceId2</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdXml2</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdReader2</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;ToString();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdDomDoc2</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DOMDocument::loadXML(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdXml2</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Read the
WebLayout into an XML DOM document object.</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wl</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">Library://XXX/XXX.WebLayout</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">// </span></font><b><font
 color="#7ca5d5" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(124, 165, 213); font-weight: bold;">TODO</span></font></b><font
 color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">
Constant!</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlResourceId</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgResourceIdentifier(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wl</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlReader</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$resourceService</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetResourceContent(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlXml</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlReader</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;ToString();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlDomDoc</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DOMDocument::loadXML(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Now, update
the MapDefinition.</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mapdef</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;getElementsByTagName(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"ResourceId"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">)-&gt;item(</span></font><font
 color="red" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">0</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mapdef</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;nodeValue</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$md1</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Prepare the
updated XML to be written out to the session.</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlupdatedXml</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlDomDoc</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;saveXML();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlbyteSource</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgByteSource(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlupdatedXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">strlen(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlupdatedXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Create a
temporary WebLayout</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionMapName</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetName();</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionWebLayout</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Session:</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionId</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">//</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionMapName</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">.WebLayout"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionResourceId</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">new</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">MgResourceIdentifier(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionWebLayout</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Write the
updated WebLayout to the session.</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$resourceService</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;SetResource(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionResourceId</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlbyteSource</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">-&gt;GetReader(),</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">null);</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Redirect to
the Ajax
viewer.</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$redirectTo</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"mapguide/mapviewerajax/?SESSION=</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$sessionId</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">&amp;WEBLAYOUT=</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlsessionWebLayout</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$host</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$_SERVER</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">[</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"HTTP_HOST"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">];</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$url</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"<a
 moz-do-not-send="true" href="http://">http://</a></span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$host</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">/</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$redirectTo</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//Test</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$f</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">'test.txt'</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$handle</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">=</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">fopen(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$f</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"w"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">fwrite(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$handle</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">,</span></font><font
 color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">
  </span></font><font color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"test1:&lt;"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$mdXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"&gt;\r\ntest
2 :&lt;"</span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$updatedXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"&gt;\r\ntest
3 :&lt;"</span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"&gt;\r\ntest
4 :&lt;"</span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$wlupdatedXml</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"&gt;\r\ntest
5 :&lt;"</span></font><font face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$url</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">.</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"&gt;"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">fclose(</span></font><font
 color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$handle</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="gray" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">//
Redirect!</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">header(</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"Location:
  </span></font><font color="#660000" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(102, 0, 0);">$url</span></font><font
 color="#008200" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 130, 0);">"</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">);</span></font></p>
  <p class="MsoNormal"><font color="blue" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">exit</span></font><font
 face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="red" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">?&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <div>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt; color: windowtext;">
  <hr align="center" size="2"></span></font></div>
  <p class="MsoNormal"><b><font color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;">From:</span></font></b><font
 color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext;"> <a
 moz-do-not-send="true"
 href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a moz-do-not-send="true"
 href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>]
  <b><span style="font-weight: bold;">On Behalf Of </span></b>Kenneth
Skovhede,
GEOGRAF A/S<br>
  <b><span style="font-weight: bold;">Sent:</span></b> dimanche 28
d&eacute;cembre 2008
12:34<br>
  <b><span style="font-weight: bold;">To:</span></b> MapGuide Users
Mail List<br>
  <b><span style="font-weight: bold;">Subject:</span></b> Re:
[mapguide-users]
create a temporary !Mapdefinition and add a layer</span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">You
must also make a
temporary WebLayout. <br>
This WebLayout must then point to the temporary MapDefinition.<br>
  <br>
In one of the last lines, you redirect to the temporary WebLayout.<br>
If that temporary WebLayout points to the temporary MapDefinition,<br>
all should be good. (Assuming layer is visible, in range, on top, etc.).</span></font></p>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">Regards, Kenneth Skovhede, GEOGRAF A/S</span></font></pre>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><br>
  <br>
Arnaud De Groof skrev: </span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><!--[if gte mso 9]><xml>
 <u1:shapedefaults u2:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <u3:shapelayout u4:ext="edit">
  <u3:idmap u4:ext="edit" data="1"/>
 </u3:shapelayout>
</xml><![endif]-->Hi,</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">I have found
my error. In fact, I used the
command &#8220;SetRessource&#8221; with a WebLayout in place of a
MapDefinition. Now the script seems ok.</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">How to load
the WebLayout with the new MapDefinition
(with the new layer) and not the MapDefinition coming from the library
(without
the new layer)?</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">New code:</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&lt;?php</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">include
"../../mapviewerphp/constants.php";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">include
"../../mapviewerphp/common.php";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Initialize</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
MgInitializeWebTier($webconfigFilePath);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$args = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$sessionId = $args['SESSION'];</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$mapName = $args['MAPNAME'];</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$layerName1 = 'YYY';</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
  </span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$userInfo = new MgUserInformation($sessionId);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$siteConnection = new MgSiteConnection();</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$siteConnection-&gt;Open($userInfo);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$resourceService =
$siteConnection-&gt;CreateService(MgServiceType::ResourceService);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$wl = "Library://XXX/XXX.WebLayout"; // TODO Constant!</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Build a
string pointing to the new layer in the Session</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp;
$rlLayerResourceId =
"Session:$sessionId//$layerName1.LayerDefinition";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Read the
XML of the Library Map Definition</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$md ="Library://XXX/$mapName.MapDefinition";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdResourceId = new MgResourceIdentifier($md);&nbsp; </span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdReader = $resourceService-&gt;GetResourceContent($mdResourceId);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdXml = $mdReader-&gt;ToString();</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdDomDoc = DOMDocument::loadXML($mdXml); </span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Insert
the layer in the MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$targetNode =
$mdDomDoc-&gt;getElementsByTagName("MapLayer")-&gt;item(0);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode = $targetNode-&gt;parentNode-&gt;insertBefore(new
DOMElement("MapLayer"), $targetNode); </span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("Name",
$layerName1));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("ResourceId",
$rlLayerResourceId));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("Selectable",
"false"));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("ShowInLegend",
"false"));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("LegendLabel"));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("ExpandInLegend",
"false"));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("Visible",
"true"));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$newNode-&gt;appendChild($mdDomDoc-&gt;createElement("Group"));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Write
the XML out to form the Session MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$updatedXml = $mdDomDoc-&gt;saveXML();</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$byteSource = new MgByteSource($updatedXml, strlen($updatedXml));</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Create a
new MapDefinition (session repository).</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$sessionMapName = $mdResourceId-&gt;GetName();</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$sessionMapDefinition =
"Session:$sessionId//$sessionMapName.MapDefinition";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$sessionResourceId = new MgResourceIdentifier($sessionMapDefinition);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Write
the updated MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$resourceService-&gt;SetResource($sessionResourceId,
$byteSource-&gt;GetReader(), null);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Test the
new MapDefinition</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdtest = "Session:$sessionId///$mapName.MapDefinition";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdResourceIdtest = new MgResourceIdentifier($mdtest);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdReadertest =
$resourceService-&gt;GetResourceContent($mdResourceIdtest);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdXmltest = $mdReader2-&gt;ToString();</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$mdDomDoctest = DOMDocument::loadXML($mdXmltest);</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Redirect
to the Ajax
viewer pointing at the map at the desired coordinates.</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$redirectTo =
"mapguide/mapviewerajax/?WEBLAYOUT=$sessionWebLayout&amp;SESSION=$sessionId";</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$host = $_SERVER["HTTP_HOST"];</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
$url = <a moz-do-not-send="true" href="http://$host/$redirectTo">"http://$host/$redirectTo"</a>;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">//
Redirect!</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
header("Location: $url");</span></font></p>
  <p class="MsoNormal"><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;
exit;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Thanks,</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Arnaud De
Groof</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <div>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt; color: windowtext;">
  <hr align="center" size="2"></span></font></div>
  <p class="MsoNormal"><b><font color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;">From:</span></font></b><font
 color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext;"> <a
 moz-do-not-send="true"
 href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a moz-do-not-send="true"
 href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>]
  <b><span style="font-weight: bold;">On Behalf Of </span></b>Kenneth
Skovhede,
GEOGRAF A/S<br>
  <b><span style="font-weight: bold;">Sent:</span></b> mardi 23
d&eacute;cembre 2008 8:15<br>
  <b><span style="font-weight: bold;">To:</span></b> MapGuide Users
Mail List<br>
  <b><span style="font-weight: bold;">Subject:</span></b> Re:
[mapguide-users]
create a temporary !Mapdefinition and add a layer</span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">The
previous error you
had indicated that the xml was invalid.<br>
  <br>
This is likely because you are not sending the entire xml document to
the
server.<br>
Perhaps someone with better PHP skills can help you out.</span></font></p>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">Regards, Kenneth Skovhede, GEOGRAF A/S</span></font></pre>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><br>
  <br>
Arnaud De Groof skrev: </span></font></p>
  <pre><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><!--[if gte mso 9]><xml>
 <u1:shapedefaults u2:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <u3:shapelayout u4:ext="edit">
  <u3:idmap u4:ext="edit" data="1"/>
 </u3:shapelayout>
</xml><![endif]-->I have changed the line: &#8220;</span></font>$byteSource = new MgByteSource($updatedXml, strlen($updatedXml));&#8221; <font
 color="navy" face="Arial"><span
 style="font-family: Arial; color: navy;">by &#8220;</span></font>$byteSource = new MgByteSource($updatedXml, mb_strlen($updatedXml));&#8221;<font
 color="navy" face="Arial"><span
 style="font-family: Arial; color: navy;">&nbsp; without success.</span></font></pre>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">The xml code
coming from the initial
MapDefinition was carried out thanks to Maestro. I join here the result
of the
$updatedXml:</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&lt;?xml
version="1.0"
encoding="utf-8"?&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&lt;MapDefinition
xmlns:xsi=<a moz-do-not-send="true"
 href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:xsd=<a moz-do-not-send="true"
 href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd"&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;Name&gt;New Map&lt;/Name&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;CoordinateSystem&gt;PROJCS["WGS 84 / UTM zone
48N",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",105],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32648"]]&lt;/CoordinateSystem&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;Extents&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp;
&lt;MinX&gt;608404.999984747&lt;/MinX&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp;
&lt;MaxX&gt;641160.000015253&lt;/MaxX&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp;
&lt;MinY&gt;1121406.87752137&lt;/MinY&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp;
&lt;MaxY&gt;1142427.99990895&lt;/MaxY&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;/Extents&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;BackgroundColor&gt;ffffffff&lt;/BackgroundColor&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;Metadata/&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;
&lt;MapLayer&gt;&lt;Name&gt;YYY&lt;/Name&gt;&lt;ResourceId&gt;Session:92b640a0-ffff-ffff-8002-001aa0d22567_fr_7F0000010AFC0AFB0AFA//</span></font>
  <font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">YYY.LayerDefinition&lt;/ResourceId&gt;&lt;Selectable&gt;false&lt;/Selectable&gt;&lt;ShowInLegend&gt;false&lt;/ShowInLegend&gt;&lt;LegendLabel/&gt;&lt;ExpandInLegend&gt;false&lt;/ExpandInLegend&gt;&lt;Visible&gt;true&lt;/Visible&gt;&lt;Group/&gt;&lt;/MapLayer&gt;&lt;MapLayer&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp;
&lt;Name&gt;Station&lt;/Name&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp;
&lt;ResourceId&gt;Library://XXX/Station.LayerDefinition&lt;/ResourceId&gt;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp; &lt;&#8230;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Thanks for
your help.</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Regards,</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Arnaud De
Groof</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp; </span></font></pre>
  <p class="MsoNormal" style="text-align: center;" align="center"><strong><b><font
 color="blue" face="Tahoma" size="3"><span
 style="font-size: 12pt; font-family: Tahoma; color: blue; font-weight: normal;">&lt;hr<!--[object_id=#spacebel.be#]-->
size=2
width="100%" align=center&gt; </span></font></b></strong></p>
  <p class="MsoNormal"><strong><b><font color="blue" face="Tahoma"
 size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: blue;">E-MAIL
DISCLAIMER</span></font></b></strong></p>
  <p><font color="blue" face="Arial" size="1"><span
 style="font-size: 7.5pt; font-family: Arial; color: blue;">The present
message may contain confidential and/or legally
privileged information. If you are not the intended addressee and in
case of a transmission
error, please notify the sender immediately and destroy this E-mail.
Disclosure, reproduction or distribution of this document and its
possible
attachments is strictly forbidden.</span></font></p>
  <p><font color="blue" face="Arial" size="1"><span
 style="font-size: 7.5pt; font-family: Arial; color: blue;">SPACEBEL
denies all liability for incomplete, improper,
inaccurate, intercepted, (partly) destroyed, lost and/or belated
transmission
of the current information given that unencrypted electronic
transmission
cannot currently be guaranteed to be secure or error free.<br>
Upon request or in conformity with formal, contractual agreements, an
originally signed hard copy will be sent to you to confirm the
information
contained in this E-mail.</span></font></p>
  <p><font color="blue" face="Arial" size="1"><span
 style="font-size: 7.5pt; font-family: Arial; color: blue;">SPACEBEL
denies all liability where E-mail is used for
private use.</span></font></p>
  <p><font color="blue" face="Arial" size="1"><span
 style="font-size: 7.5pt; font-family: Arial; color: blue;">SPACEBEL
cannot be held responsible for possible viruses that
might corrupt this message and/or your computer system.</span></font></p>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="blue" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: blue;">
  <hr align="center" size="2"></span></font></div>
  <pre wrap=""><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">

<hr align="center" size="4">

</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">_______________________________________________</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">mapguide-users mailing list</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a moz-do-not-send="true"
 href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a moz-do-not-send="true"
 href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp; </span></font></pre>
  <pre wrap=""><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">

<hr align="center" size="4">

</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp;</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">_______________________________________________</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">mapguide-users mailing list</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a moz-do-not-send="true"
 href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a moz-do-not-send="true"
 href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp; </span></font></pre>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
  </pre>
</blockquote>
</body>
</html>