[Chameleon] RE: Window focus
Jason Fournier
jfournier at dmsolutions.ca
Fri Sep 10 10:07:04 EDT 2004
You could try the following:
In your index.phtml (after you initialize oApp) put:
if( isset( $_POST['childWin'] ) && strlen( $_POST['childWin'] ) > 0 )
$oApp->setVar( 'childWin', strtolower( $_POST['childWin'] ) );
----------------------------------------------------------------------
In your template form put:
<input type="hidden" name="childWin" value="[$szChildWin|NULL$]">
----------------------------------------------------------------------
In your javascript function include (forms[0] assumes you only have one
form in the template):
if( document.forms[0].childWin.value != "NULL" )
{
// the window has been opened prior to submit so get a handle on it
// reference it by name
}
else
{
//open the window
wh = window.open.......
// set the hidden var
document.forms[0].childWin.value = wh;
}
----------------------------------------------------------------------
You'll have to update your TemplateParser.php script from cvs for the
preprocessing to work properly.
This is untested code ;)
Jason
Tweedy, Scott wrote:
> Thanks to Paul and Jason for your answers they work. Now I have another
> question.
>
> It seems that the window I open is tied to the main window (that's where I
> had to declare the variable myWh to make this work). Once any operation is
> performed on the map (Zoom in, Apply points to map, etc) and the main page
> refreshes I lose the variable myWh and the application window starts again.
>
> Is there any way around this behaviour? Is there any way of passing the
> variable myWh (the child window) in a form to the newly refreshed page?
>
> Thanks again,
> st
>
>
>> -----Original Message-----
>>From: Tweedy, Scott
>>Sent: Thursday, September 09, 2004 10:56 AM
>>To: 'chameleon at lists.maptools.org'
>>Subject: Window focus
>>
>>I have an application written in Chameleon. When a button in the main
>>application is clicked it opens a child popup window which contains most
>>of the code for the application. If the user minimizes the child window
>>and clicks on the main button again the child window is reinitialized and
>>the user has to start from scratch.
>>
>>Is there a way to test to see if the child window is already open when the
>>user clicks on the main button and to simply shift focus to that window if
>>it is and to reinitialize it if the window isn't open?
>>
>>Thanks in advance,
>>st
>>
>>Scott Tweedy
>>Geoscience Database Analyst - Analyste de base des données
>>géoscientifiques
>>ESS Geoinformatics Division - Division SST Géoinformatique
>>Earth Sciences Sector - Secteur des sciences de la terre
>>Natural Resources Canada - Ressources naturelles Canada
>>580-615 Booth Street - 580-615 rue Booth
>>Ottawa, ON Canada K1A 0E9
>>tel. (613) 947-0665 - tél. (613) 947-0665
>>fax (613) 995-2520 - télc. (613) 995-2520
>>Email sctweedy at nrcan.gc.ca - Courriel sctweedy at nrcan.gc.ca
>>
>>
>
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
--
_____________________________
Jason Fournier
Applications Development
DM Solutions Group Inc.
jfournier at dmsolutions.ca
www.dmsolutions.ca
613.565.5056 x18
More information about the Chameleon
mailing list