[Chameleon] swapping .map files in index.html

kgrootendorst at baird.com kgrootendorst at baird.com
Thu Jul 28 11:16:47 EDT 2005


<p align=\"left\"><b><font face=\"Arial\" size=\"2\">GFI MailSecurity's HTML threat engine found HTML scripts in this email and has disabled them.</font></b></p>Hello,
I'm building an application where a user can 'switch' between .map files 
using a dropdown/combo box, and use the same 'template.html' file.

I've modified the index.html to accept user input via a combo box (user 
selects what project .map file they want to view), and have the .map load 
in the template.
I can view the first project without any problem.  However, when I select 
the second project, it loads fine, but it seems to maintain the coordinate 
system and extents of the first project.
Since they have 2 very different coordinate systems and extents, I'm 
unable to view the second project.

Any body have any suggestions?  I feel it has to do with the section 
around $oApp =  new SampleApp();, where the app is made.  Maybe these need 
to be reset somehow?
Below is my index.phtml file.
Thanks in advance.

<html>
<head>
<Xcript language="javascript"><!--
window.resizeTo(1028,768); 
--></Xcript>
</head>
<body>
<?php

//set up combo box and retain user selection
$values = array('Barbados','Pelee'); 
   echo ' 
   <form method="post" action="'.$_SERVER['PHP_SELF'].'"> 
       <select name="Project_Selection">'; 
   for($x = 0; $x < count($values); $x++) 
   { 
         // write "selected" if the value matches the one posted 
         if($values[$x] == $_POST['Project_Selection']) 
         { 
             $selected = ' selected'; 
          }else{ 
             $selected = ''; 
          } 
          // print the option 
          echo ' 
           <option 
value="'.$values[$x].'"'.$selected.'>'.$values[$x].'</option>'; 
   } 
   echo ' 
       </select> 
       <input type="submit" value="Go!">       ';
   //</form>'; 



/*
 * this is a sample of a minimal application script required to
 * get a chameleon application running with a template and a
 * local map file.  Most applications should actually just
 * copy this file and modify the template and mapfile
 * parts and should not need to do a lot more here.
 */

$project_choice = $_POST['Project_Selection'];

//echo "$project_choice";

$gszAppPath = dirname(__FILE__);

include( "../../htdocs/chameleon.php" );

$szTemplate = dirname(__FILE__)."/GIS_template.html";
//$szTemplate = dirname(__FILE__)."/$project_choice.html";
$szMapFile = dirname(__FILE__)."/../map/$project_choice.map";

class SampleApp extends Chameleon
{
  function SampleApp()
  {
    parent::Chameleon();
    $this->moMapSession = new MapSession_RW;
    $this->moMapSession->setTempDir( getSessionSavePath());
  }
}

// add some sort of reset?

$oApp =  new SampleApp();
$oApp->registerSkin( 'skins/sample' );
$oApp->CWCInitialize( $szTemplate, $szMapFile  );
$oApp->CWCExecute();

echo '</form>'; 
?>
</body>
</html>


Using Chameleon 2.2, MapServer 4.4, PHP 4.3.7

Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20050728/0404cf0b/attachment-0001.html


More information about the Chameleon mailing list