[Chameleon] cant Access hidden values from MAP File

Julien-Samuel Lacroix jlacroix at mapgears.com
Wed Jun 13 10:22:27 EDT 2007


Hi,

Hmmm... MapScript ignore the mapfile pre-processor. From the 
documentation, you should update the mapfile yourself.

In your index.phtml file, you can update the mapfile like this:

$oApp->CWCInitialize( $szTemplate, $szMapFile  );

$oLayer = $oApp->moMapSession->oMap->getLayerByName('Village');
$oLayer->set("filter", "distcode=".$_REQUEST['DistCode']);

$oApp->CWCExecute();

Julien

Dee Lee wrote:
> 
> LAYER
>      GROUP "Polygon"
>      NAME "Village"
>      TYPE POLYGON
>      STATUS ON
> 
>      CONNECTIONTYPE postgis
>      CONNECTION "user=postgres dbname=gistest host=localhost port=5432 
> password=postgres"
>      DATA "the_geom  from gis_region using unique oid using SRID=-1"
>      FILTER "dist_code='%DistCode%'"
>      TRANSPARENCY ALPHA
> 
>      METADATA
>        "queryable" "true"
>      END
>   END # layer
> 
> 
> 
> 
> 
> 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title></title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> 
> <cwc2 type="SharedResource" name="projection">
>    <projection name="NAD 83 / Geographic" srs="epsg:4269"/>
>    <projection name="WGS 84 / Geographic" srs="epsg:4326" default="true"/>
>    <projection name="WGS 84 / Auto UTM" srs="AUTO:42001"/>
>    <projection name="WGS 84 / Auto Tr. Mercator" srs="AUTO:42002"/>
>    <projection name="WGS 84 / Auto Orthographic" srs="AUTO:42003"/>
>    <projection name="WGS 84 / Auto Equirectangular" srs="AUTO:42004"/>
>    <projection name="WGS 84 / LCC Canada" srs="epsg:42101"/>
>    <projection name="NAD 83 / NRCan LCC Canada" srs="epsg:42304"/>
> </cwc2>
> 
> <!-- Button Resource for Pan Arrows -->
> <cwc2 type="SharedResource" name="PanArrows">
>    <imagewidth value="50"/>
>    <imageheight value="50"/>
>    <labelfont value="fonts/Vera.ttf"/>
>    <usetextbuttoncache value="false"/>
>    <state value="normal">
>        <textbuttoncolor value="f0f0f0"/>
>    </state>
>    <state value="hover">
>        <textbuttoncolor value="cccccc"/>
>    </state>
>    <state value="selected">
>        <textbuttoncolor value="cccccc"/>
>    </state>
> </cwc2>
> 
> <!-- Button Resource for Tabs -->
> <cwc2 type="SharedResource" name="Tabs">
>    <imagewidth value="60"/>
>    <imageheight value="10"/>
>    <textbuttonpadding value="0"/>
>    <textbuttonnudge value="0"/>
>    <labelfont value="fonts/Vera.ttf"/>
>    <usetextbuttoncache value="false"/>
>    <state value="normal">
>        <textbuttoncolor value="f0f0f0"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_1.png"/>
>        <textbuttonborder_top_image value="borders/border_t_1.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_1.png"/>
>        <textbuttonborder_right_image value="borders/border_r_1.png"/>
>        <textbuttonborder_left_image value="borders/border_l_1.png"/>
>    </state>
>    <state value="hover">
>        <textbuttoncolor value="cccccc"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_2.png"/>
>        <textbuttonborder_top_image value="borders/border_t_2.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_2.png"/>
>        <textbuttonborder_right_image value="borders/border_r_2.png"/>
>        <textbuttonborder_left_image value="borders/border_l_2.png"/>
>    </state>
>    <state value="selected">
>        <textbuttoncolor value="cccccc"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_3.png"/>
>        <textbuttonborder_top_image value="borders/border_t_3.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_3.png"/>
>        <textbuttonborder_right_image value="borders/border_r_3.png"/>
>        <textbuttonborder_left_image value="borders/border_l_3.png"/>
>    </state>
> </cwc2>
> 
> <!-- defaults for NavButton -->
> <cwc2 type="SharedResource" name="NavButtons">
>    <textbuttonbackgroundimage value=""/>
>    <imagewidth value="24"/>
>    <imageheight value="24"/>
>    <textbuttonpadding value="0"/>
>    <textbuttonnudge value="0"/>
>    <labelcolor value="111111"/>
>    <labelfont value="fonts/Vera.ttf"/>
>    <labelalign value="left"/>
>    <labelfontsize value="8"/>
>    <labelantialias value="true"/>
>    <usetextbuttoncache value="false"/>
>    <state value="normal">
>        <textbuttoncolor value="f0f0f0"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_1.png"/>
>        <textbuttonborder_top_image value="borders/border_t_1.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_1.png"/>
>        <textbuttonborder_right_image value="borders/border_r_1.png"/>
>        <textbuttonborder_left_image value="borders/border_l_1.png"/>
>        <textbuttonborder_bottomright_image 
> value="borders/border_br_1.png"/>
>        <textbuttonborder_bottom_image value="borders/border_b_1.png"/>
>        <textbuttonborder_bottomleft_image value="borders/border_bl_1.png"/>
>    </state>
>    <state value="hover">
>        <textbuttoncolor value="cccccc"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_2.png"/>
>        <textbuttonborder_top_image value="borders/border_t_2.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_2.png"/>
>        <textbuttonborder_right_image value="borders/border_r_2.png"/>
>        <textbuttonborder_left_image value="borders/border_l_2.png"/>
>        <textbuttonborder_bottomright_image 
> value="borders/border_br_2.png"/>
>        <textbuttonborder_bottom_image value="borders/border_b_2.png"/>
>        <textbuttonborder_bottomleft_image value="borders/border_bl_2.png"/>
>    </state>
>    <state value="selected">
>        <textbuttoncolor value="cccccc"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_3.png"/>
>        <textbuttonborder_top_image value="borders/border_t_3.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_3.png"/>
>        <textbuttonborder_right_image value="borders/border_r_3.png"/>
>        <textbuttonborder_left_image value="borders/border_l_3.png"/>
>        <textbuttonborder_bottomright_image 
> value="borders/border_br_3.png"/>
>        <textbuttonborder_bottom_image value="borders/border_b_3.png"/>
>        <textbuttonborder_bottomleft_image value="borders/border_bl_3.png"/>
>    </state>
> </cwc2>
> 
> <!-- defaults for Text Buttons -->
> <cwc2 type="SharedResource" name="TextButtons">
>    <textbuttonbackgroundimage value=""/>
>    <imagewidth value="120"/>
>    <imageheight value="24"/>
>    <textbuttonpadding value="0"/>
>    <textbuttonnudge value="0"/>
>    <labelcolor value="111111"/>
>    <labelfont value="fonts/Vera.ttf"/>
>    <labelalign value="left"/>
>    <labelfontsize value="8"/>
>    <labelantialias value="true"/>
>    <usetextbuttoncache value="false"/>
>    <state value="normal">
>        <textbuttoncolor value="f0f0f0"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_1.png"/>
>        <textbuttonborder_top_image value="borders/border_t_1.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_1.png"/>
>        <textbuttonborder_right_image value="borders/border_r_1.png"/>
>        <textbuttonborder_left_image value="borders/border_l_1.png"/>
>        <textbuttonborder_bottomright_image 
> value="borders/border_br_1.png"/>
>        <textbuttonborder_bottom_image value="borders/border_b_1.png"/>
>        <textbuttonborder_bottomleft_image value="borders/border_bl_1.png"/>
>    </state>
>    <state value="hover">
>        <textbuttoncolor value="cccccc"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_2.png"/>
>        <textbuttonborder_top_image value="borders/border_t_2.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_2.png"/>
>        <textbuttonborder_right_image value="borders/border_r_2.png"/>
>        <textbuttonborder_left_image value="borders/border_l_2.png"/>
>        <textbuttonborder_bottomright_image 
> value="borders/border_br_2.png"/>
>        <textbuttonborder_bottom_image value="borders/border_b_2.png"/>
>        <textbuttonborder_bottomleft_image value="borders/border_bl_2.png"/>
>    </state>
>    <state value="selected">
>        <textbuttoncolor value="cccccc"/>
>        <textbuttonborder_topleft_image value="borders/border_tl_3.png"/>
>        <textbuttonborder_top_image value="borders/border_t_3.png"/>
>        <textbuttonborder_topright_image value="borders/border_tr_3.png"/>
>        <textbuttonborder_right_image value="borders/border_r_3.png"/>
>        <textbuttonborder_left_image value="borders/border_l_3.png"/>
>        <textbuttonborder_bottomright_image 
> value="borders/border_br_3.png"/>
>        <textbuttonborder_bottom_image value="borders/border_b_3.png"/>
>        <textbuttonborder_bottomleft_image value="borders/border_bl_3.png"/>
>    </state>
> </cwc2>
> 
> <cwc2 type="SharedResource" name="MiniButton">
>  <imagewidth value="9"/>
>  <imageheight value="9"/>
>  <state value="normal">
>    <textbuttoncolor value="FFFEFF"/>
>  </state>
>  <state value="hover">
>    <textbuttoncolor value="CCCCCC"/>
>  </state>
>  <state value="selected">
>    <textbuttoncolor value="DDDDDD"/>
>  </state>
> </cwc2>
> 
> <cwc2 type="cwcjsapi" debug="false"/>
> <cwc2 type="SharedResource" name="CWCJSAPI"/>
> 
> <cwc2 type="SharedResource" name="WaitImage">
>    <waitimage language="en-CA" waitimage="images/spinner.gif" 
> waitimagewidth="216" waitimageheight="50"/>
>    <waitimage language="fr-CA" waitimage="images/spinner_f.gif" 
> waitimagewidth="216" waitimageheight="50"/>
> </cwc2>
> <cwc2 type="SelectLayers" />
> 
> <link href="sample.css" rel="stylesheet" type="text/css">
> </head>
> 
> <body >
> <form method="post">
> 
> <input type="hidden" name="TopTabsLayerActive" 
> value="[$TopTabsLayerActive$]">
> <input type="hidden" name="DistCode" value="[$DistCode$]">
> <input type="hidden" name="SideTabsLayerActive" 
> value="[$SideTabsLayerActive$]">
> <div id="TopTabsLayer" name="TopTabsLayer">
>  <table border="0" cellspacing="0" cellpadding="1">
>    <tr>
>      <td><cwc2 type="Link" linktype="javascript" 
> jsfunction="ShowNavToolsLayer" styleresource="Tabs" 
> Image="icons/icon_tab_nav.png" ImageTip="Navigation Tools" 
> toolset="TopTabs" default="true">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <td><cwc2 type="Link" linktype="javascript" 
> jsfunction="ShowROIToolsLayer" styleresource="Tabs" 
> Image="icons/icon_tab_roi.png" ImageTip="Region of Interest Tools" 
> toolset="TopTabs">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
> <td>
> 
> 
>    </tr>
>  </table>
> </div>
> 
> <div id="NavToolsLayer" name="NavToolsLayer">
>  <table border="0" cellspacing="4" cellpadding="0">
>    <tr>
>      [#nav_basic.html#]
>      [#nav_enhanced.html#]
> 
>    </tr>
>  </table>
> </div>
> 
> <div id="ROIToolsLayer" name="ROIToolsLayer">
>  <table border="0" cellspacing="4" cellpadding="0">
>    <tr>
>      [#nav_roi.html#]
>    </tr>
>  </table>
> </div>
> 
> <div id="SideTabsLayer" name="SideTabsLayer">
>  <table border="0" cellspacing="0" cellpadding="1">
>    <tr>
>      <td><cwc2 type="Link" linktype="javascript" 
> jsfunction="ShowLegendLayer" styleresource="Tabs" 
> Image="icons/icon_tab_legend.png" ImageTip="Legend" toolset="SideTabs" 
> default="true">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <td><cwc2 type="Link" linktype="javascript" 
> jsfunction="ShowOtherToolsLayer" styleresource="Tabs" 
> Image="icons/icon_tab_tools.png" ImageTip="Other Tools" toolset="SideTabs">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>    </tr>
>  </table>
> </div>
> 
> <div id="LegendLayer" name="LegendLayer">
> <cwc2 type="LegendTemplate" visible="true" embedded="true" 
> template="legend_template.html" popupstyleresource="TextButtons" 
> popupwidth="500" popupheight="400" status="false" menubar="false"/>
> <cwc2 type="UpdateMap" styleresource="TextButtons" visible="true" 
> image="icons/icon_update.png" imagetip="update map" label="Update">
>    <image state="normal"/>
>    <image state="selected"/>
>    <image state="hover"/>
> </cwc2>
> </div>
> 
> <div id="OtherToolsLayer" name="OtherToolsLayer">
>  <table width="100%" border="0" cellspacing="4" cellpadding="0">
>   [#tools_basic.html#]
>   [#tools_enhanced.html#]
>  </table>
> </div>
> 
> <div id="PanArrowsLayer" name="PanArrowsLayer">
>  <table width="100%" height="100%" border="0" cellpadding="0" 
> cellspacing="0" bgcolor="f0f0f0" class="grey_border">
>    <tr valign="top">
>      <!-- COMPASSPOINT - NORTHWEST -->
>      <td align="left"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="northwest" 
> image="icons/icon_pan_nw.png" PanPercent="80" imagetip="Pan NorthWest">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <!-- COMPASSPOINT - NORTH -->
>      <td align="center"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="north" image="icons/icon_pan_n.png" 
> PanPercent="80" imagetip="Pan North">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <!-- COMPASSPOINT - NORTHEAST -->
>      <td align="right"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="northeast" 
> image="icons/icon_pan_ne.png" PanPercent="80" imagetip="Pan NorthEast">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>        </cwc2></td>
>    </tr>
>    <tr valign="middle">
>      <!-- COMPASSPOINT - WEST -->
>      <td align="left"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="west" image="icons/icon_pan_w.png" 
> PanPercent="80" imagetip="Pan West">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <td align="center">&nbsp;</td>
>      <!-- COMPASSPOINT - EAST -->
>      <td align="right"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="east" image="icons/icon_pan_e.png" 
> PanPercent="80" imagetip="Pan East">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>    </tr>
>    <tr valign="bottom">
>      <!-- COMPASSPOINT - SOUTHWEST -->
>      <td align="left"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="southwest" 
> image="icons/icon_pan_sw.png" PanPercent="80" imagetip="Pan SouthWest">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <!-- COMPASSPOINT - SOUTH -->
>      <td align="center"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="south" image="icons/icon_pan_s.png" 
> PanPercent="80" imagetip="Pan South">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>      <!-- COMPASSPOINT - SOUTHEAST -->
>      <td align="right"><cwc2 type="CompassPoint" Visible="true" 
> styleresource="PanArrows" Direction="southeast" 
> image="icons/icon_pan_se.png" PanPercent="80" imagetip="Pan SouthEast">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
>          </cwc2></td>
>    </tr>
>  </table>
> </div>
> 
> <div id="MainMapLayer" name="MainMapLayer">
> <!-- MapDHTML -->
> <cwc2 type="MapDHTML" visible="true" width="800" height="800" 
> allowresize="true" marqueecolor="FF3333" marqueewidth="2" minscale="1"/>
> </div>
> 
> <div id="ReferenceLayer" name="ReferenceLayer">
> <table width="100%" border="0" cellspacing="4" cellpadding="0">
>  <tr>
>    <!-- SCALEBAR -->
>    <td colspan="3" align="center"><cwc2 type="TrueNorth" 
> TrueNorthImage="images/north_6_a.png"/> &nbsp; <cwc2 type="Scalebar" 
> units="KILOMETERS" visible="true" width="250" height="3"></cwc2></td>
>  </tr>
>  <tr>
>    <!-- KEYMAP -->
> 
>    <!-- PROJECTIONLABEL -->
>    <td colspan="2"><cwc2 type="ProjectionLabel" label="Projection:" 
> labelclass="label" widgetclass="inputBox"/></td>
>  </tr>
>  <tr>
>    <!-- MINX EXTENT-->
>    <td><cwc2 type="Extent" label="Left: " visible="true" extent="minx" 
> labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"/></td>
>    <!-- MAPUNITS -->
>    <td><cwc2 type="MapUnits" label="Map Units: "labelposition="8" 
> labelvalign="middle" labelclass="label" widgetclass="inputBox"/></td>
>  </tr>
>  <tr>
>    <!-- MAXX EXTENT -->
>    <td><cwc2 type="Extent" label="Right: " visible="true" extent="maxx" 
> labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"/></td>
>    <td><p class="label"><cwc2 type="RulerResult" visible="true" 
> label="Dist:" labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"/></p></td>
>  </tr>
>  <tr>
>    <!-- MINY EXTENT -->
>    <td><cwc2 type="Extent" label="Bottom: " visible="true" extent="miny" 
> labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"/></td>
>    <!-- CURSOR X POSITION -->
>    <td><cwc2 type="Cursorpos" axis="X" label="Mouse X: " 
> labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"></cwc2></td>
>  </tr>
>  <tr>
>    <!-- MAXY EXTENT -->
>    <td><cwc2 type="Extent" label="Top: " visible="true" extent="maxy" 
> labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"/></td>
>    <!-- CURSOR Y POSITION -->
>    <td><cwc2 type="Cursorpos" axis="Y" label="Mouse Y: " 
> labelposition="8" labelvalign="middle" labelclass="label" 
> widgetclass="inputBox"></cwc2></td>
>  </tr>
> </table>
> </div>
> 
> <div id="ScaleZoomLayer" name="ScaleZoomLayer">
> <table border="0" cellpadding="2" cellspacing="0">
> <tr><td><span class="label">Scale<br>Zoom:</span></td>
> <td colspan="2"><cwc2 type="ScaleZoom" 
> IncreaseImage="images/zoom_h_in.gif" 
> DecreaseImage="images/zoom_h_out.gif" PutTableTags="true">
> <ZOOMVALUE SCALE="42000000" IMAGE="images/zoom_h_1.gif" IMAGEWIDTH="14" 
> IMAGEHEIGHT="22"/>;
> <ZOOMVALUE SCALE="21000000" IMAGE="images/zoom_h_2.gif" IMAGEWIDTH="14" 
> IMAGEHEIGHT="22"/>;
> <ZOOMVALUE SCALE="10500000" IMAGE="images/zoom_h_3.gif" IMAGEWIDTH="14" 
> IMAGEHEIGHT="22"/>;
> <ZOOMVALUE SCALE="5250000" IMAGE="images/zoom_h_4.gif" IMAGEWIDTH="14" 
> IMAGEHEIGHT="22"/>;
> <ZOOMVALUE SCALE="2125000" IMAGE="images/zoom_h_5.gif" IMAGEWIDTH="14" 
> IMAGEHEIGHT="22"/>;
> <ZOOMVALUE SCALE="1000000" IMAGE="images/zoom_h_6.gif" IMAGEWIDTH="14" 
> IMAGEHEIGHT="22"/>;
> </cwc2>
> </td>
> </tr>
> 
> </table></div>
> 
> <!-- include the javascript code that manages the DHTML layers -->
> <script language="JavaScript" src="sample.js" 
> type="text/javascript"></script>
> 
> </form>
> </body>
> </html>
> 
> 
> 
> 
> 
> 
>> From: Julien-Samuel Lacroix <jlacroix at mapgears.com>
>> To: Dee Lee <bose_biswadip at hotmail.com>
>> CC: chameleon at lists.maptools.org
>> Subject: Re: [Chameleon] cant Access hidden values from MAP File
>> Date: Mon, 11 Jun 2007 11:58:11 -0400
>>
>> Hi,
>> Can you post the template and mapfile segment that are being used?
>>
>> Julien
>>
>> Dee Lee wrote:
>>
>>> Hello
>>>
>>> I have faced a problem during substitution of FILTER 
>>> "dist_code='%DistCide%'" in map file
>>>
>>> and I set [$DistCode$] in my template file and by viewing source i 
>>> see the actual value but in the map file the   %DistCide% is not 
>>> replaced .. please help me .. how acan I access the value from map 
>>> file using hidden fields. i am using chameleon 4.10
>>>
>>>
>>> Regards
>>> Biswadip Bose
>>>
>>> _________________________________________________________________
>>> Career Aptitude Test. Based on the most scientific MBT Test. 
>>> http://ss1.richmedia.in/recurl.asp?pid=64
>>>
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>
>>
>> -- 
>> Julien-Samuel Lacroix
>> Mapgears
>> http://www.mapgears.com/
> 
> 
> _________________________________________________________________
> Voice your questions and our experts will answer them 
> http://content.msn.co.in/Lifestyle/AskExpert/Default01.htm
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list