<!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> </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> </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> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=125574515-31102011></SPAN></FONT> </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> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><!-- Mapserver 
Template <SPAN class=125574515-31102011>(Body Template) 
</SPAN>--></FONT></DIV>
<DIV><SPAN class=125574515-31102011><FONT color=#0000ff size=2 
face=Arial><!-- styles are defined in Header Template 
--></FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial><script></FONT></DIV>
<DIV> </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> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>if("[version]".search(/version 5.6.1/)!=-1)<BR>    var 
imgLeg = "...<SPAN class=125574515-31102011>?</SPAN><SPAN 
class=125574515-31102011>map=mapfile_561.map</SPAN><SPAN 
class=125574515-31102011>&</SPAN>SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgraphic&LAYER=[cl]&FORMAT=image/png&STYLES=";<BR>else 
if("[version]".search(/version 6./)!=-1)<BR>    var imgLeg = 
"...?<SPAN 
class=125574515-31102011>map=mapfile_6.map&</SPAN>SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgraphic&LAYER=[cl]&FORMAT=image/png&STYLES=";<BR>else<BR>    
var imgLeg = "...?<SPAN 
class=125574515-31102011>map=mapfile_49.map&</SPAN>SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgraphic&LAYER=[cl]&FORMAT=image/png&STYLES=";</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>document.write("<tr 
class='tblBody'>");<BR>document.write("    <td class='" + 
myClass + "'><img src='" + imgLeg + "'></td>");</FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>document.write("    <td class='" + myClass + 
"'>[NAME_LOCAL]</td>");<BR>document.write("    <td 
class='" + myClass + 
"'>[NAME_FAO]</td>");<BR>document.write("    <td 
class='" + myClass + 
"'>[UNREGION2]</td>");<BR>document.write("</tr>");</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial></script><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?  What I’d like to do, when a 
ProcessTemplate is called for a certain layer, I would like to check item 
values.  If item values equal a certain value, write something to the 
output.  It would seem possible since a template is an HTML file, but I’m 
just not sure how to do it, or if it’s possible. 
<o:p></o:p></SPAN></FONT></P></DIV></BODY></HTML>