...
Weave supports the ability to configure multiple clients from the one instance. Each Client needs to have a unique ID which is used in the url when opening the client.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... <client:config id="main"> ... </client:config> <client:config id="police"> ... </client:config> ... |
...
For example to restrict the police
configuration to only those users who are in the police access control list you would change the configuration to:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... <client:config id="police"> <acl id="acl.police"> ... </client:config> ... |
this assumes that elsewhere in your configuration you have the ACL for acl.police
, something like:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<acl:acl id="acl.police"> <entry type="allow">ROLE_POLICE</entry> <entry type="deny">*</deny> </acl:acl> |
...
For example, to provide a generic client that has a single button that should only be available to users in a certain group you could either create two separate client configurations, one with the button for the selected users and the other without the button for everyone else, or you could create one configuration with the button but attach an ACL to the button.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... <client:config id="main"> ... <toolbar> ... <item action="au.gov.police.ShowSpeedCameras"> <acl id="acl.police"/> </item> ... </toolbar> ... </client:config> ... |
...
The absolute minimum requirements for a client configuration is shown below (where CONFIGID, TITLE and LABEL are configured by you)
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> </perspective> </client:config> |
...
So the next this we could do would be to add content to the default center region that was created. We do this by adding Views to the perspective. A View is responsible for presenting its content the the user in whatever way is appropriate, it could be a map image, a text input form or just a fixed image. What's shown in the region is different depending upon the id of the view that's added to the perspective, so for now we won't bother looking at the actual content of the view tags.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> <view id="VIEWID"> VIEWCONTENT </view> </perspective> </client:config> |
...
From there we can add additional views to show different content to the user.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> <view id="VIEWID1"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> </client:config> |
...
Say we wanted to move one of our views to be to the left of the other one, rather than having them both within the same region. To do this we'd add a layout to the perspective and then configure each of the views to be placed in a specific region within the layout. Remember at the moment there's a default layout created for us that has a single center region defined.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> </client:config> |
...
From there we can fill out the client configuration with some other components. We can add a toolbar and statusbar (as mentioned earlier).
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <toolbar> TOOLBARCONTENT </toolbar> <statusbar> STATUSBARCONTENT </statusbar> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> </client:config> |
...
We can also include a set of default values at the same level as perspectives to provide defaults values for various components that are included on the client, for example indicating the initial map extent to use if a map view doesn't specify it explicitly, or determining of a report should be opened in a new browser window.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <toolbar> TOOLBARCONTENT </toolbar> <statusbar> STATUSBARCONTENT </statusbar> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> <defaults> DEFAULTCONTENT </defaults> </client:config> |
...
Aside from that there are a couple of other minor items that could be added, one is a description, that's shown to the user if they get the option to choose between multiple client configurations. Another is a debug flag that indicates that the client should be loaded in debug mode which helps when modifying the client configuration. And finally it's possible to specify a theme to be used for the configuration.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> <title>TITLE</title> <description>DESCRIPTION</description> <debug>true</debug> <theme>THEMENAME</theme> <toolbar> TOOLBARCONTENT </toolbar> <statusbar> STATUSBARCONTENT </statusbar> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> <defaults> DEFAULTCONTENT </defaults> </client:config> |
...
You can set various default options in the defaults
section in the client configuration. For example the default report format to generate, which entity to have active initially or which data to display when the user open a data grid.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<client:config id="CONFIGID"> ... <perspective> .. </perspective> <defaults> <entity id="property" isDefault="true"> <data>data.property.detail</data> <search>search.property.byaddress</search> </entity> <entity id="roads"> <data>data.road.detail</data> <search>search.road.byname</search> </entity> <report> <format>html</format> <openExternal>true</openExternal> <openWithScript>true</openWithScript> <timeout>240</timeout> </report> </defaults> </client:config> |
...