<!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><script type="text/javascript"></FONT>
<BR><FONT SIZE=2>function addLoadEvent(func) {</FONT>
<BR><FONT SIZE=2> var oldonload = window.onload;</FONT>
<BR><FONT SIZE=2> if (typeof window.onload != 'function') {</FONT>
<BR><FONT SIZE=2> window.onload = func;</FONT>
<BR><FONT SIZE=2> } else {</FONT>
<BR><FONT SIZE=2> window.onload = function() {</FONT>
<BR><FONT SIZE=2> if (oldonload) {</FONT>
<BR><FONT SIZE=2> oldonload();</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> func();</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>function updateScalebar()</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2> document.images['ScaleBarImg'].src = "[$gszCoreWebPath$]common/wrapper/drawmap.php?map_session_mode=1&run_query=0&REQUEST=SCALEBAR&sid=[$gszSessId$]";</FONT></P>
<P><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>addLoadEvent(updateScalebar);</FONT>
<BR><FONT SIZE=2></script></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> parent::setVar( 'gszSessId', $GLOBALS['gszSessId'] );</FONT>
<BR><FONT SIZE=2> parent::setVar( 'gszCoreWebPath', $_SESSION['gszCoreWebPath'] );</FONT>
<BR><FONT SIZE=2> 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>