I'd suggest the following:
create the 2 custom functions function runPeriodically() { PMap.reloadTime = 60; window.setTimeout('runPeriodically()', 60000 ); reloadMap(false); } function displayTime4Refresh() { $('#displayrefreshtime').html('Time until map reload: ' + PMap.reloadTime + ' s'); PMap.reloadTime -= 1; window.setTimeout('displayTime4Refresh()', 1000 ); } put them into a JavaScript file, like the custom.js under /javascript/ or a JS file under your '/config/.../' directory (all JS files there are loaded automatically). Add the 2 function calls under pminit.js->function pm_init() like runPeriodically(); displayTime4Refresh(); For the display of the splash GIF add the line showloading(); inside the function mapserver.js->reloadMap(remove) { Then it should do what you want. armin Gaston Izaguirre wrote: > Hi everybody, > > I need some help on refreshing the map area every 60 seconds automatically, > without pressing the refresh button. > I was using p.mapper 3.0 for a while, but recently I updated it to p.mapper > 3.1 (release) with MS4W 2.2.4 (mapserver 4.10.2, PHP 5.2.3, mapscript > 4.10.2, Apache 2.2.4) > > In the previous version of p.mapper I made a small modification, with the > aid of Armin [1], to automatically refresh the map once every minute. > In the map.phtml I changed: > <body class="BGCLG" > > to: > <body class="BGCLG" onload="runPeriodically();"> > > where runPeriodically() is a tiny javascript: > > function runPeriodically() { > window.setTimeout('runPeriodically()', 60000 ); > reloadMap(false); > } > > and is defined in pminit.js > > The previous code worked perfectly in version 3, but now, in version 3.1 it > behaves different (the "auto refresh" is working, but I don't know when it > comes). > The first thing I have noticed is that the loading splash (animated GIF) is > never displayed at the "auto refresh" event. It does not appear the GIF > either when the refresh button is pressed (I do not know if this this > related), but with the previous version of p.mapper it did. > The thing is that now I don't know when the refreshing is coming up, as I > knew before due to the "loading GIF". Perhaps i'm missing something, I'm not > a javascript expert... > I saw that reloadMap() function uses updateMap(), which has been modified > slightly since version 3.0. > > So, the question is: Why at some events (reload/refresh, runPeriodically(), > etc.) the "loading splash" is not displayed, but in other events (e.g.: zoom > in or out, pan, etc.) the GIF is displayed? > > Other problem I have is that I need to show the count down between every > auto refresh. I have tried with a little function displayCountDown() that > shows the counter in the status bar (with window.status="Next update in " + > seconds + " s.") but I don't know where I must put the function in order to > obtain the wished behavior. > I have tested this function: > > function displayCountDown() { > if (seconds>=0) { > seconds-=1; > } > if (seconds<=-1) { > seconds+=1; > } > else { > window.status="Next update in " + seconds + " s."; > setTimeout("displayCountDown()",1000); > } > } > > in a separate HTML file and it worked fine. But my attempts to integrate it > to p.mapper have failed. My greatest progress was to show the count down > until the first auto refresh and then it stops to work. > > > Any idea or advice on this will be very helpful. > Thanks in advance for your comments. > > Regards, > Gaston. > > [1] > http://www.mail-archive.com/pmapper-users@lists.sourceforge.net/msg01080.html > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > pmapper-users mailing list > pmapper-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pmapper-users > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pmapper-users mailing list pmapper-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pmapper-users