GeoPrisma logo

WMSLayerAdder

Widget that permits a user to add layers that are setted manually, removed from the workspace or from a external server.

Note

This widget can’t be drawn with the drawWidget template. Instead, it must be added to one of the toolbar widgets :

  • Toolbar
  • GeoExtToolbar

XML Sample

Configuration using the cookie mode

<wmslayeradder>
  <name>WLA_Sample</name>
  <options>
    <mode>cookie</mode>
    <layers>
      <layer>
        <name>Metacarta</name>
        <text>Metacarta</text>
        <url>http://labs.metacarta.com/wms/vmap0</url>
        <layer>basic</layer>
        <opacity>0.5</opacity>
      </layer>
    </layers>
  </options>
</wmslayeradder>

Configuration using curl mode

<wmslayeradder>
  <name>WLA_Sample</name>
  <options>
    <mode>curl</mode>
    <urlmode>relative</urlmode>
    <url>userwmslist.php</url>
    <post>
      <username>$_SESSION[login_username]</username>
    </post>
    <layers>
      <layer>
        <name>Metacarta</name>
        <text>Metacarta</text>
        <url>http://labs.metacarta.com/wms/vmap0</url>
        <layer>basic</layer>
        <opacity>0.5</opacity>
      </layer>
    </layers>
  </options>
</wmslayeradder>

Configuration using db mode

<wmslayeradder>
  <name>WLA_Sample</name>
  <options>
    <mode>db</mode>
    <dsn>mysql:localhost;port=xxxx;dbname=mydbname</dsn>
    <user>myuser</user>
    <password>mypassword</password>

    <select_query>SELECT id,user, pass, url,description FROM user_wmslist AS w INNER JOIN user AS u ON w.idUser=u.idUser WHERE u.username = :0</select_query>
    <select_list>$_SESSION[login_username]</select_list>

    <insert_query>INSERT INTO user_wmslist (id, idUser,user,pass,url,description) VALUES(NULL,(SELECT idUser FROM user WHERE username = :0 LIMIT 1),:1,:2,:3,:4)</insert_query>
    <insert_list>$_SESSION[login_username],$_REQUEST[user],$_REQUEST[pwd],$_REQUEST[url],$_REQUEST[desc]</insert_list><!-- value sent by querystring/Post or available in php $_SESSION -->

    <delete_query>DELETE FROM user_wmslist WHERE idUser = (SELECT idUser FROM user WHERE username = :0 LIMIT 1) AND id = :1 LIMIT 1</delete_query>
    <delete_list>$_SESSION[login_username],$_REQUEST[id_wms]</delete_list>

    <layers>
      <layer>
        <name>Metacarta</name>
        <text>Metacarta</text>
        <url>http://labs.metacarta.com/wms/vmap0</url>
        <layer>basic</layer>
        <opacity>0.5</opacity>
      </layer>
    </layers>
  </options>
</wmslayeradder>

XML Sample - widget to be added to a toolbar

This widget must be added to a GeoExtToolbar widget

<geoexttoolbar>
  <name>W_GeoExtToolbar</name>
  <options>
    <widgets>
      <widget>WLA_Sample</widget>
    </widgets>
  </options>
</geoexttoolbar>

XML Sample - widget needs a widget type service

In services :

<widget>
  <name>WidgetService</name>
</widget>

In datastore :

<datastore>
  <name>DataStoreWidget</name>
  <service>WidgetService</service>
  <params>
    <widgettype>wmslayeradder</widgettype>
    <method>methodManager</method>
  </params>
</datastore>

In resource :

<resource>
  <name>res_wmslist</name>
  <datastores>
    <datastore>DataStoreWidget</datastore>
  </datastores>
  <widgets>
    <widget>WLA_Sample</widget>
  </widgets>
</resource>

Mandatory Options

N/A

Optional Options

layers:Contains <layer> tags.
layers/layer:Must be in the <layers> tag. List of manually defined layers that are not te be securised by geoprisma.
layers/layer/name:
 Must be in a <layer> tag. Unique name for the layer, only use alphanumeric characters or the underscore.
layers/layer/text:
 Must be in a <layer> tag. Name to be shown in the list.
layers/layer/url:
 Must be in a <layer> tag. Url of the server containing the desired layer.
layers/layer/layer:
 Must be in a <layer> tag. List of the layers to get from the server.
layers/layer/opacity:
 Must be in a <layer> tag. Opacity of the layer. Number from 0 to 1.
mode:Specify the location where the favorites are stored. Can be cookie, curl or db. Default to cookie (not safe for user/pass)

== If mode is db (all mandatory) ==

dsn:Database access informations.
user:The user for the wanted database
password:The password for the wanted database
select_query:The query required to obtain the list from the database
select_list:The variable list to obtain them in php. Seperated by commas.
insert_query:The query required to insert a new server in the database
insert_list:The variable list to obtain them in php. Seperated by commas.
delete_query:The query required to delete a server from the database
delete_list:The variable list to obtain them in php. Seperated by commas.

== If mode is curl (all mandatory) ==

urlmode:The type of path that will be used. Can be relative or absolute.
url:The url of the page that will insert, delete or list the saved servers.
post:Contains a list of tags that will be posted to the specified url.

Service Type

wms

Widget Action

read