[Chameleon] Scalebar widget and PHP as a module

Eijnden, B. van den (Bart) b.vdeijnden at agi.rws.minvenw.nl
Tue May 30 04:48:48 EDT 2006

Hi list,

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.

Add the following javascript to the end of your HTML template:

<script type="text/javascript">
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {

function updateScalebar()
  document.images['ScaleBarImg'].src =


This will update the scalebar after the main page has loaded. 
Ofcourse make sure gszCoreWebPath and gszSessId are passed on to your
application as variables:

function CWCExecute($aszWidgetsDir=array())
  parent::setVar( 'gszSessId', $GLOBALS['gszSessId'] );
  parent::setVar( 'gszCoreWebPath', $_SESSION['gszCoreWebPath'] );

Best regards,

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060530/9fe5374b/attachment-0001.html

More information about the Chameleon mailing list