...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?> <config xmlns="urn:com.cohga.server.config#1.0" xmlns:edit="urn:com.cohga.spatial.edit#1.0"> <edit:config id="custom.edit"> <entity>graffiti</entity> <label>Grafitti</label> <description>Report graffiti for removal</description> <supportedGeometry>point</supportedGeometry> <requiredGeometry>point</requiredGeometry> <parameter id="description"> <promptText>Description<<label>Description</promptText>label> <controlType>text-area</controlType> <column>DESCRIPTION</column> </parameter> </edit:config> </config> |
...
If the default attribute editing setup isn't suitable you can directly specify the attributes that the user can edit and how they appear to the user, by doing this you'll completely replace the attributes that the Weave automatically generated from the underlying spatial tables..
Info |
---|
When any parameters are specified they will completely replace any parameters that may have been created by Weave |
This is done by adding one or more parameter
items to the edit configuration, where each parameter
specified one input parameter. The format of the parameter
items in an edit config are an extension of those available for search parameters.
Name | Type | Required | Default | Description |
id | string | yes |
| A unique identifier for the parameter |
label | string | yes |
| The prompt text displayed when user input the parameter value |
column | string | no |
| The name of the column within the table that this parameter references |
helptext | string | no |
| Additional text to display for the parameter to explain how to use the parameter |
hidden | boolean | no | false | Hides the parameter from the parameter UI |
alignment | 'left', 'center', 'right', 'auto' | no | 'auto' | How the items should appear in the UI |
controltype | 'listbox', 'checkbox', 'radiobutton', 'textbox' or 'textarea' | no | 'textbox' | The suggested type of UI control to use when displaying the parameter |
datatype | 'any', 'date', 'time', 'datetime', 'integer', 'string' | no | 'string' | The data type for the parameter |
allownull | boolean | no | false | Whether a null value is allowed for this parameter |
allowblank | boolean | no | true | Give the user the choice of an empty value in the listbox (as opposed to a null value) |
allownewvalues | boolean | no | false | Allow the user to enter values not in the listbox already |
defaultvalue | any | no |
| The default value of the parameter |
dataset | no |
| Where to get the values for a listbox | |
labelcolumn | string | no |
| Column in the datadefinition that supplies the label of the value to show the user |
valuecolumn | string | no |
| Column in the datadefinition that supplies the value of the value to use in the SQL |
uppercase | boolean | no | false | Should the value be converted to upper case in the generated SQL |
readonly | boolean | no | false | Can the user change the value |
readonlyoninsert | boolean | no | false | Can the user change the value when a new entity is being created |
readonlyonupdate | boolean | no | false | Can the user change the value when an entity is being edited |
updatable | boolean | no | true | Can the underlying value ever be changed once set (implied readonlyonupdate if set to true) |
value | any | formula or any |
| A value to insert into the database, provides a means of creating values beyond what the user enters (implied readonly if set |
A few things to not about the properties that can be applied to parameters:
column
is optional, if not provided then the field will still appear, but an attempt to write the entered value into the underlying spatial table will not be made. The user entered value can still be used by other means that will be covered later.- The
controltype
now supports 'textarea' which isn't available for search fields, it provides a multi-line text input field. readonly
,readonlyoninsert
andreadonlyonupdate
aren't available for search field either, they're special marker that allow you to alter the ability of the user to change the value in a field. These are client side flags, and if set alter the display of the field so that the user cannot change the value, the field is still displayed, just not editable.updatable
specifies that one a value is set it can't be changed, this is similar toreadonlyonupdate
, and in factreadonlyonupdate
will be set totrue
ifupdatable
is set to false, but it also provides additional checks on the server to ensure that the value is not updated.value
can be used to set a value explicitly by directly supplying the value, or there are a number of formulas that are available.entity()
The id of the entity being edited.userid()
The current username.datetime()
The current date/time.operation()
The type of operation being perform, 'create', 'update' or 'delete'.maxvalue()
The value used for the column will be the previous largest value from the column plus one, the underlying column must be numeric.geometry()
A WKT (Well Know Text) representation of the geometry if available, otherwisenull
.id()
The value for the key field for the spatial table will be used if available, otherwisenull
.
Custom parameter examples
...
Auditing changes
...
To record who created and who modifies an entity
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<edit:config id="custom.edit">
<entity>graffiti</entity>
<label>Grafitti</label>
<description>Report graffiti for removal</description>
<supportedGeometry>point</supportedGeometry>
<requiredGeometry>point</requiredGeometry>
<parameter id="description">
<label>Description</label>
<controlType>text-area</controlType>
<column>DESCRIPTION</column>
</parameter>
<!-- Hidden parameter to record audit information -->
<parameter id="createdby">
<hidden>true</hidden>
<column>CREATEDBY</column
<value>userid()</value>
<updatable>false</updatable>
</parameter>
<parameter id="createdon">
<hidden>true</hidden>
<column>CREATEDON</column>
<value>datetime()</value>
<updatable>false</updatable>
</parameter>
<parameter id="modifiedby">
<hidden>true</hidden>
<column>MODIFIEDBY</column
<value>userid()</value>
</parameter>
<parameter id="modifiedon">
<hidden>true</hidden>
<column>MODIFIEDON</column>
<value>datetime()</value>
</parameter>
</edit:config>
|
In this example the audit information is stored in the spatial table itself, so the table must already contain the CREATEDBY
, CREATEDON
, MODIFIEDBY
and MODIFIEDON
fields and they need to by character fields for the 'by' fields and timestamps for the 'on' fields.