<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.24">
<TITLE>Scalebar widget and PHP as a module</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi list,</FONT>
</P>

<P><FONT SIZE=2>since the Scalebar widget uses saveWebImage which isn't safe when running PHP as a module (you'll get the same filename used multiple times resulting in problems with images coming from the browser cache), I am using the following workaround for Chameleon apps not running in JSAPI mode.</FONT></P>

<P><FONT SIZE=2>Add the following javascript to the end of your HTML template:</FONT>
</P>

<P><FONT SIZE=2>&lt;script type=&quot;text/javascript&quot;&gt;</FONT>
<BR><FONT SIZE=2>function addLoadEvent(func) {</FONT>
<BR><FONT SIZE=2>&nbsp; var oldonload = window.onload;</FONT>
<BR><FONT SIZE=2>&nbsp; if (typeof window.onload != 'function') {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; window.onload = func;</FONT>
<BR><FONT SIZE=2>&nbsp; } else {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; window.onload = function() {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (oldonload) {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oldonload();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; func();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp; }</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>function updateScalebar()</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2>&nbsp; document.images['ScaleBarImg'].src = &quot;[$gszCoreWebPath$]common/wrapper/drawmap.php?map_session_mode=1&amp;run_query=0&amp;REQUEST=SCALEBAR&amp;sid=[$gszSessId$]&quot;;</FONT></P>

<P><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>addLoadEvent(updateScalebar);</FONT>
<BR><FONT SIZE=2>&lt;/script&gt;</FONT>
</P>

<P><FONT SIZE=2>This will update the scalebar after the main page has loaded. </FONT>
<BR><FONT SIZE=2>Ofcourse make sure gszCoreWebPath and gszSessId are passed on to your application as variables:</FONT>
</P>

<P><FONT SIZE=2>function CWCExecute($aszWidgetsDir=array())</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2>&nbsp; parent::setVar( 'gszSessId', $GLOBALS['gszSessId'] );</FONT>
<BR><FONT SIZE=2>&nbsp; parent::setVar( 'gszCoreWebPath', $_SESSION['gszCoreWebPath'] );</FONT>
<BR><FONT SIZE=2>&nbsp; parent::CWCExecute($aszWidgetsDir);</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>Best regards,</FONT>
<BR><FONT SIZE=2>Bart</FONT>
</P>

<BR>


Disclaimer
************************************************************************
Aan dit bericht kunnen geen rechten worden ontleend. Dit bericht is
uitsluitend bestemd voor de geadresseerde. Als u dit bericht per abuis
hebt ontvangen, wordt u verzocht het te vernietigen en de afzender te 
informeren. Wij adviseren u om bij twijfel over de juistheid of de 
volledigheid van de mail contact met afzender op te nemen.

This message shall not constitute any rights or obligations.
This message is intended solely for the addressee.
If you have received this message in error, please delete it and
notify the sender immediately. When in doubt whether this message
is correct or complete, please contact the sender.
************************************************************************

<BR>
</BODY>
</HTML>