MapTools.org

[Chameleon] legend and context questions

Paul Spencer spencer@dmsolutions.ca
Thu, 11 Mar 2004 10:21:19 -0500
Debbie

Debbie Pagurek wrote:

> Hi,
> thanks for getting back to me on this.  First - the context thing works 
> fine, that was something silly on my part ;-).

I guess you're not going to tell us what it was? ;)

>  
> the legend popup remains an issue however.
> When I run the sample script that you provided, I am first getting an 
> error message:
> Mapscript: Unable to register functions, unable to load.

you are loading mapscript through your php.ini then.  the first line of 
this script loads the mapscript library, to avoid this error message 
remove the line or add a test if (!extension_loaded('MapScript')) dl 
('...');

> When I click ok, however, then I do see a listing of the layers with a 
> checkbox next to it.  Is that what I should be seeing?

yes

> When I try my chameleon application again and click on the legend 
> button, I still get an empty pop up box as described below - not a 404 
> error, but a message "The legend displays the layers in your map"

I don't know if popup mode is working ... just a sec, I'll check ... um 
yes it works for me with embedded=false and embedded=true.  The only 
thing I can think of is that the template parameter to the widget is not 
valid or pointing to the wrong place.  The template is considered 
relative to the application (index.phtml) so the simplest set up is to 
have it in the same directory and set the template="<filename>"

what are the contents of your template?  Here is what is in mine:

[leg_layer_html order=ascending opt_flag=15]
[if name=CWC_TMP_LAYER oper=isnull]
   <tr bgcolor="#CCCCCC">
     <td align="center" width=20><input type="radio" name="my_legend" 
onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected 
value=1] CHECKED[/if] ></td>
     <td align="center" width=20><input type="checkbox" 
name="legendlayername[]"
value="[leg_layer_name]"
     [if name=layer_status oper=eq  value=1]CHECKED[/if]
     [if name=layer_status oper=eq value=2]CHECKED[/if]></td>
     [if name=wms_name oper=isnull]
     <td><a href="#" 
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><font 
face="Arial, Helvetica, sans-serif" 
size="2">[leg_layer_name]</font></a></td>
   </tr>
     [/if]
     [if name=wms_name oper=isset]
     <td><a href="#" 
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><font 
face="Arial, Helvetica, sans-serif" size="2">[metadata 
name=WMS_TITLE]</font></a></td>
   </tr>
     [/if]
[/if]
[/leg_layer_html]

> If I click Apply or OK at this point, the map refreshes and I get an 
> error that says:
> the legend template has no inputs named legendlayername[].  Which makes 
> sense I guess, because nothing is showing in the pop up.
>  
> How should the layer status be set in the mapfile - Default? On?

on or default should be fine

>  
> Other issues in trying to get my chameleon app working:
> When I do a view source, I am seeing a couple errors right at the top:
> <!-- ROIManagerMode ParseURL Failed ! -->
>  
> <!-- ROIRectangleTool ParseURL Failed ! -->
>  
> <!-- PanMap ParseURL Failed ! -->

you can ignore these, this will be cleaned up for the release.

Cheers,

Paul
>  
> I appreciate everyone's help in getting my first app up and running.
>  
> Debbie
> 
>  >>> pagameba@magma.ca 03/10/04 07:34PM >>>
> Debbie ...
> 
> you can test your template using a test script outside of chameleon to
> make sure it actually works:
> 
> <?php
> dl( 'php_mapscript_41.dll' );
> 
> $oMap = ms_newMapObj( "/ms4w/apps/gmap/htdocs/gmap75.map" );
> $oMap->legend->set( "template",
> "/ms4w/apps/chameleon/htdocs/legend_template_widget.html" );
> 
> echo "<table>";
> echo $oMap->processLegendTemplate( array() );
> echo "</table>";
> ?>
> 
> obviously you'll have to add your own paths.
> 
> Debbie Pagurek wrote:
> 
>  > OK - now I have the most recent chameleon and mapserver versions
>  > installed properly and the correct documentation to go with it - Thank
>  > you Paul.
>  > I have a lot working but am having trouble seeing a legend.  I have
>  > tried the following tags for either an embedded legend:
>  > <cwc2 type="LegendTemplate" visible="true" embedded="true"
>  > template="legend_template.html" popupwidth="500" popupheight="400"
>  > status="false" menubar="false"/>
>  > 
>  > nothing shows.
>  > 
>  > or a popup:
>  > <cwc2 type="LegendTemplate" styleresource="TextButton" embedded="false"
>  > template="legend_template_widget.html" PopupWidth="350"
>  > PopupHeight="300" Toolbar="false" Status="false" Menubar="false"
>  > Location="false" Visible="true" Image="images/icon_legend.png"
>  > ImageTip="Display Legend" LABEL="Legend">
>  >    <image state="normal"/>
>  >    <image state="selected"/>
>  >    <image state="hover"/>
>  > </cwc2>
>  > 
>  > the popup simply says " The legend displays the layers in your map. "
>  > but I see no legend.
>  > 
>  > Also, I tried to save a context map.  My mapfile is set up to serve wms
>  > layers, and I know the wms getmap request works.
>  > However, when I click on my "save" button, I get a message that says:
>  > There are no WMS Layers to export.
>  > 
>  > I don't think anything is wrong with my mapfile...
>  > anyone have any suggestions?
>  > 
>  > Thanks,
>  > Debbie
> 
> -- 
>   -----------------------------------------------------------------
> |Paul Spencer                           spencer@dmsolutions.ca    |
> |-----------------------------------------------------------------|
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
>   -----------------------------------------------------------------
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           spencer@dmsolutions.ca    |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



This archive was generated by Pipermail.