<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = 
"urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word"><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19154">
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt
}
LI.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt
}
DIV.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        FONT-FAMILY: Arial; COLOR: windowtext; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
</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]--></HEAD>
<BODY lang=EN-US link=blue vLink=purple>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011>MapServer 6 comes with "Built-in OpenLayers map 
viewer", template with use of OpenLayers javascript library.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011>see <A 
href="http://mapserver.org/development/rfc/ms-rfc-63.html">http://mapserver.org/development/rfc/ms-rfc-63.html</A></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011>an example, how I use javascript in 
templates:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>&lt;!-- Mapserver 
Template&nbsp;<SPAN class=125574515-31102011>(Body Template) 
</SPAN>--&gt;</FONT></DIV>
<DIV><SPAN class=125574515-31102011><FONT color=#0000ff size=2 
face=Arial>&lt;!-- styles are defined in Header Template 
--&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>&lt;script&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>var idx = 
parseInt("[lrn]")%2;<BR>var myClass = "tdBody" + idx;</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>if("[version]".search(/version 5.6.1/)!=-1)<BR>&nbsp;&nbsp;&nbsp; var 
imgLeg = "...<SPAN class=125574515-31102011>?</SPAN><SPAN 
class=125574515-31102011>map=mapfile_561.map</SPAN><SPAN 
class=125574515-31102011>&amp;</SPAN>SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=getlegendgraphic&amp;LAYER=[cl]&amp;FORMAT=image/png&amp;STYLES=";<BR>else 
if("[version]".search(/version 6./)!=-1)<BR>&nbsp;&nbsp;&nbsp; var imgLeg = 
"...?<SPAN 
class=125574515-31102011>map=mapfile_6.map&amp;</SPAN>SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=getlegendgraphic&amp;LAYER=[cl]&amp;FORMAT=image/png&amp;STYLES=";<BR>else<BR>&nbsp;&nbsp;&nbsp; 
var imgLeg = "...?<SPAN 
class=125574515-31102011>map=mapfile_49.map&amp;</SPAN>SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=getlegendgraphic&amp;LAYER=[cl]&amp;FORMAT=image/png&amp;STYLES=";</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>document.write("&lt;tr 
class='tblBody'&gt;");<BR>document.write("&nbsp;&nbsp;&nbsp; &lt;td class='" + 
myClass + "'&gt;&lt;img src='" + imgLeg + "'&gt;&lt;/td&gt;");</FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>document.write("&nbsp;&nbsp;&nbsp; &lt;td class='" + myClass + 
"'&gt;[NAME_LOCAL]&lt;/td&gt;");<BR>document.write("&nbsp;&nbsp;&nbsp; &lt;td 
class='" + myClass + 
"'&gt;[NAME_FAO]&lt;/td&gt;");<BR>document.write("&nbsp;&nbsp;&nbsp; &lt;td 
class='" + myClass + 
"'&gt;[UNREGION2]&lt;/td&gt;");<BR>document.write("&lt;/tr&gt;");</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>&lt;/script&gt;<BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=125574515-31102011><FONT color=#0000ff 
size=2 face=Arial>Arnd</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> mapserver-users-bounces@lists.osgeo.org 
[mailto:mapserver-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Bistrais, 
Bob<BR><B>Gesendet:</B> Montag, 31. Oktober 2011 16:11<BR><B>An:</B> 
mapserver-users@lists.osgeo.org<BR><B>Betreff:</B> [mapserver-users] Possible to 
use JavaScript code in a MapServertemplate?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT size=2 face=Arial><SPAN 
style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">Is it possible to write and execute 
JavaScript within a MapServer template? &nbsp;What I&#8217;d like to do, when a 
ProcessTemplate is called for a certain layer, I would like to check item 
values.&nbsp; If item values equal a certain value, write something to the 
output.&nbsp; It would seem possible since a template is an HTML file, but I&#8217;m 
just not sure how to do it, or if it&#8217;s possible. 
<o:p></o:p></SPAN></FONT></P></DIV></BODY></HTML>