Map Manager Plugins - geosolutions-it/MapStore GitHub Wiki

Current Map Manager application has been designed to compose the application with pluggable components based on the old widgets you can see in [this page](Map Manager).

It means that you can customize and extend it as you want.

The plugins functionalities are based on gxp.Tool with the functions:

  • addActions: Called on plugins initializing. It usually add a button to actionTarget panels.
  • addOutput: Usually called when generated buttons are pressed. It show the plugin widgets to outputTarget panels

The actionTarget and outputTarget properties are specific configurations for be used to put each plugin in different panels and don't link it to current layout Other available options common for all manager tools are :

  • autoOpen run addOutput() method during addActions() method (so on tool load): note: if the method has not actions, the output will be added automatically, this option should run 2 times.

You can find a list of the available plugins at this page :

Panels layout

The first thing you must know in this application is the default layout.

Map Manager basic layout

The north container basically contains the buttons added by each plugin and the mainTabPanel is the default target for the addOutput functions.

managerConfig.js

This file contains current configuration for the Map Manager.

The lastest changes allow you to customize the plugins in different levels:

By user role

It distinguish the users in roles:

  • GUEST: No user logged
  • USET: User logged
  • ADMIN: An administrator has been logged

and you can configure specific plugins for each user.

Guest tools

Default plugins shown in the application for GUEST users:

{
   ...
   "tools":[{
        "ptype": "mxp_mapmanager",
        "loginManager": "loginTool",
        "actionTarget":null
    },{
        "ptype": "mxp_login",
        "pluginId": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 3
        }
    },{
        "ptype": "mxp_languageselector",
        "actionTarget":{
          "target": "north.tbar",
          "index": 7
        }
    }],

By default it contains:

Admin tools

Default plugins shown in the application for the administrators:

   "adminTools":[{
        "ptype": "mxp_mapmanager",
        "loginManager": "loginTool",
        "actionTarget": null
    },{
        "ptype": "mxp_templatemanager",
        "loginManager": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 0
        }
    },{
        "ptype": "mxp_myaccount",
        "loginManager": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 1
        }
    },{
        "ptype": "mxp_usermanager",
        "loginManager": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 2
        }
    },{
        "ptype": "mxp_login",
        "pluginId": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 10
        }
    },{
        "ptype": "mxp_languageselector",
        "actionTarget":{
          "target": "north.tbar",
          "index": 20
        }
    }],

By default it contains:

User tools

Default plugins shown in the application for the users:

    "loggedTools":[{
        "ptype": "mxp_mapmanager",
        "loginManager": "loginTool",
        "actionTarget": null
    },{
        "ptype": "mxp_myaccount",
        "loginManager": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 1 
        }
    },{
        "ptype": "mxp_login",
        "pluginId": "loginTool",
        "actionTarget":{
          "target": "north.tbar",
          "index": 4
        }
    },{
        "ptype": "mxp_languageselector",
        "actionTarget":{
          "target": "north.tbar",
          "index": 8
        }
    }],

By default it contains:

Pluggable by user / usergroup

This option is already available, but there aren't any plugin to manage it.

It assumes that you can add specific plugins configuration for:

  • User group
  • User

in geostore as resources in the category ADMINCONFIG and add it to the default one when the user is logged.

You can enable this option putting pluggableByUserGroupConfig: true in the managerConfig.js file.

You must create each custom tools for the users (or groups) on GeoStore. There are some examples created with curl:

  • User user configuration: curl -u user:user -XPOST -H 'Content-type: text/xml' -d '<Resource><Attributes><attribute><name>owner</name><type>STRING</type><value>user</value></attribute></Attributes><description>test</description><metadata></metadata><name>userConfig</name><category><name>ADMINCONFIG</name></category><store><data><![CDATA[[{"ptype":"mxp_mapmanager","loginManager":"loginTool","actionTarget":null},{"ptype":"mxp_login","pluginId":"loginTool","actionTarget":{"target":"north.tbar","index":3}},{"ptype":"mxp_languageselector","actionTarget":{"target":"north.tbar","index":7}}]]]></data></store></Resource>' http://localhost:9191/geostore/rest/resources
  • User admim configuration: curl -u admin:admin -XPOST -H 'Content-type: text/xml' -d '<Resource><Attributes><attribute><name>owner</name><type>STRING</type><value>admin</value></attribute></Attributes><description>test</description><metadata></metadata><name>test2</name><category><name>ADMINCONFIG</name></category><store><data><![CDATA[[{"ptype":"mxp_mapmanager","loginManager":"loginTool","actionTarget":null},{"ptype":"mxp_templatemanager","loginManager":"loginTool","actionTarget":{"target":"north.tbar","index":0}},{"ptype":"mxp_usermanager","loginManager":"loginTool","actionTarget":{"target":"north.tbar","index":1}},{"ptype":"mxp_login","pluginId":"loginTool","actionTarget":{"target":"north.tbar","index":4}},{"ptype":"mxp_languageselector","actionTarget":{"target":"north.tbar","index":8}}]]]></data></store></Resource>' http://localhost:9191/geostore/rest/resources

You can change it as you need to customize the map mananager by user/user groups

#GeoStore Resource Editor

MapStore Manager has a plugin to edit GeoStore resources as plain text.
To enable the edit of a specific category (eg. "MAP"), use the following configuration:

{ 
    "ptype": "mxp_geostore_resource_editor",
    "category": "MAP",
    "loginManager": "loginTool",
    "buttonText": "Map JSON",
    "actionTarget":{
        "target": "north.tbar",
        "index": 7
    },
    "attributeFields":[{
        "xtype":"textfield",
        "id":"attribute.owner",
        "anchor":"95%",
        "fieldLabel": "Owner",
        "name":"attribute.owner"
    }]
}

Other Configurations

Following a list of root elements of managerConfig.js elements to use:

  • "loginDataStorage" : "sessionStorage" : keep login on refresh
  • "locales" : a array of the allowed locales for the application. Every element is an array composed by the code and the extended name of the language. E.g. "locales":[["en,"English"],["de","Detush"]]
⚠️ **GitHub.com Fallback** ⚠️