Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
titleAdding edit plugin to client
linenumberstrue

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

  <client:config id="edit">
    <!-- more config items here -->

    <view id="com.cohga.html.client.map.mapView">
      <label>Map</label>
      <location>center</location>

      <!-- Register the edit plugin with the map view -->
      <plugin id="weave.edit"/>

      <!-- map config items here -->
    </view>

    <!-- more config items here -->
  </client:config>

</config>

...

Code Block
xml
xml
titleAdding edit view to client
linenumberstrue

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

  <client:config id="edit">
    <!-- more config items here -->

    <!-- Add the Edit panel to the client -->
    <view id="com.cohga.client.panel.edit">
      <label>Edit</label>
      <location>west</location>
    </view>

    <view id="com.cohga.html.client.map.mapView">
      <label>Map</label>
      <location>center</location>

      <!-- Register the edit plugin with the map view -->
      <plugin id="weave.edit"/>

      <!-- more config items here -->
    </view>

    <!-- more config items here -->
  </client:config>

</config>

...

Code Block
xml
xml
titleSimple edit configuration example
linenumberstrue

<?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="simple.edit">
    <entity>graffiti</entity>
    <label>Graffiti</label>
    <description>Report graffiti for removal</description>
  </edit:config>

</config>

...

Code Block
xml
xml
titleBasic custom edit configuration example
linenumberstrue

<?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>
    <geometry>
      <point minimum="1" maximum="1"/>
    </geometry>
    <parameter id="description">
      <label>Description</label>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
  </edit:config>

</config>

...

Code Block
xml
xml
linenumberstrue

<geometry minimum="1"/>

or

Code Block
xml
xml
linenumberstrue

<geometry>
  <polygon minimum="1"/>
</geometry>

...

Code Block
xml
xml
linenumberstrue

<geometry maximum="1"/>

or

Code Block
xml
xml
linenumberstrue

<geometry>
  <polygon maximum="1"/>
</geometry>

...

Code Block
xml
xml
linenumberstrue

<geometry>
  <polygon/>
</geometry>

...

Code Block
xml
xml
linenumberstrue

<geometry minimum="2" maximum="2">
  <polygon minimum="1" maximum="1"/>
  <linestring/>
  <point/>
</geometry>

...

Code Block
xml
xml
linenumberstrue

<geometry minimum="2" maximum="2">
  <polygon minimum="1"/>
  <linestring/>
  <point/>
</geometry>

...

Code Block
xml
xml
linenumberstrue

<geometry maximum="2">
  <polygon minimum="1"/>
  <linestring/>
  <point/>
</geometry>

...

Code Block
xml
xml
linenumberstrue

<geometry>
  <point minimum="2" maximum="4"/>
</geometry>

...

Code Block
xml
xml
titleAuditing changes example
linenumberstrue
   <edit:config id="custom.edit">
    <entity>graffiti</entity>
    <label>Grafitti</label>
    <description>Report graffiti for removal</description>
    <geometry>
      <point minimum="1" maximum="1"/>
    </geometry>
    <parameter id="description">
      <label>Description</label>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
    <!-- Hidden parameters 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>

...

Code Block
xml
xml
titleId column example
linenumberstrue

  <edit:config id="custom.edit">
    <entity>graffiti</entity>
    <label>Grafitti</label>
    <description>Report graffiti for removal</description>
    <geometry>
      <point minimum="1" maximum="1"/>
    </geometry>
    <parameter id="id">
      <hidden>true</hidden>
      <column>ID</column>
      <value>nextval()</value>
    </parameter>
    <parameter id="description">
      <label>Description</label>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
  </edit:config>

...

Code Block
xml
xml
titleDrop down list example
linenumberstrue

  <edit:config id="custom.edit">
    <entity>graffiti</entity>
    <label>Grafitti</label>
    <description>Report graffiti for removal</description>
    <geometry>
      <point minimum="1" maximum="1"/>
    </geometry>
    <parameter id="id">
      <hidden>true</hidden>
      <column>ID</column>
      <value>nextval()</value>
    </parameter>
    <parameter id="description">
      <label>Description</label>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
    <parameter id="status">
      <label>Status</label>
      <controlType>list-box</controlType>
      <column>STATUS</column>
      <defaultValue>N</defaultValue>
      <list value="N" label="New"/>
      <list value="V" label="Verified"/>
      <list value="S" label="Scheduled"/>
      <list value="R" label="Removed"/>
    </parameter>
    <parameter id="reporter">
      <label>Reporter</label>
      <controlType>list-box</controlType>
      <dataSet>staff</dataSet>
      <allowNewValues>true</allowNewValues>
      <column>REPORTEDBY</column>
    </parameter>
  </edit:config>

...

Code Block
xml
xml
titleCheck box and radio button example
linenumberstrue

  <edit:config id="custom.edit">
    <entity>graffiti</entity>
    <label>Grafitti</label>
    <description>Report graffiti for removal</description>
    <geometry>
      <point minimum="1" maximum="1"/>
    </geometry>
    <parameter id="id">
      <hidden>true</hidden>
      <column>ID</column>
      <value>nextval()</value>
    </parameter>
    <parameter id="checkbox">
      <label>Check Box</label>
      <controlType>checkbox</controlType>
      <column>CHECKBOX</column>
      <trueValue>Y</trueValue>
      <falseValue xsi:nil="true"/>
    </parameter>
    <parameter id="radiobutton">
      <label>Radio Button</label>
      <controlType>radiobutton</controlType>
      <column>RADIOBUTTON</column>
      <defaultValue>value2</defaultValue>
      <list>
        <label>Label 1</label>
        <value>value1</value>
      </list>
      <list>
        <label>Label 2</label>
        <value>value2</value>
      </list>
      <list>
        <label>Label 3</label>
        <value>value3</value>
      </list>
    </parameter>
  </edit:config>

...

Info

Parameters in edit configurations can be setup with or without a column attribute. If there is a column specified then the value will be written to the corresponding column in the underlying spatial table, if there is no column specified then no value will be written during this phase. However, the value the user enters for the parameter, in both cases, is available to be written as part of an audit configuration.

 

 

Code Block
xml
xml
titleWriting audit information to a separate table
linenumberstrue

  <edit:config id="custom.edit">
    <entity>graffiti</entity>
    <label>Grafitti</label>
    <description>Report graffiti for removal</description>
    <geometry>
      <point minimum="1" maximum="1"/>
    </geometry>
    <parameter id="id" hidden="true" label="Id" column="ID" value="auto()"/>
    <parameter id="description" label="Description" controlType="text-area"/>
  </edit:config>

  <edit:audit id="custom.audit">
    <edit>custom.edit</edit>
    <datasource>datasource.main</datasource>
    <table>EDIT_AUDIT</table>
    <parameter column="ID" value="id()"/>
    <parameter column="DESC" parameter="description"/>
    <parameter column="USER" value="userid()"/>
    <parameter column="MODIFIED" value="datetime()"/>
  </edit:audit>

...

It's possible to localise the text used in the edit panels so they're displayed in the local language of the user, this localisation is performed using the standard localisation mechanism outlined at Internationalisation and localisationLocalisation.

The edit panel provides a set of resource id's that it understands and if they're set for the users locale they will be used instead of the defaults values.

...

Code Block
xml
xml
linenumbersfalse

<client:resources>
	<edit>
		<create>
			<text>Create</text>
			<tooltip>Create a new entity</tooltip>
			<notify>Entity successfully created</notify>
		</create>
		<update>
			<text>Update</text>
			<tooltip>Edit the selected entity</tooltip>
			<notify>Entity successfully edited</notify>
		</update>
		<delete>
			<text>Delete</text>
			<tooltip>Delete the selected entity</tooltip>
			<notify>Entity successfully deleted</notify>
		</delete>
		<submit>
			<text>Submit</text>
			<tooltip>Submit changes</tooltip>
		</submit>
		<cancel>
			<text>Cancel</text>
			<tooltip>Cancel changes</tooltip>
		</cancel>
		<polygon>
			<text>Polygon</text>
			<tooltip>Add a polygon</tooltip>
		</polygon>
		<line>
			<text>Line</text>
			<tooltip>Add a line</tooltip>
		</line>
		<point>
			<text>Point</text>
			<tooltip>Add a point</tooltip>
		</point>
		<modify>
			<text>Modify</text>
			<tooltip>Click on an item to modify it</tooltip>
		</modify>
		<remove>
			<text>Remove</text>
			<tooltip>Remove the currently selected item</tooltip>
		</remove>
		<reset>
			<text>Reset</text>
			<tooltip>Reset the form fields</tooltip>
		</reset>
		<import>
			<text>Import</text>
			<tooltip>Import geometry from another entity</tooltip>
			<error>
				<tooManyGeometries>There are too many geometries in the source</tooManyGeometries>
				<tooManyPoints>There are too many points in the source</tooManyPoints>
				<tooManyLinestrings>There are too many lines in the source</tooManyLinestrings>
				<tooManyPolygons>There are too many polygons in the source</tooManyPolygons>
			</error>
		</import>
	</edit>
</client:resources>
Info

It's possible, as of version 0.38 of the edit bundle to specify when, on create, update and/or delete, the audit record is written by specifying a 'mode' value in the audit config as a comma separated list of those three values. e.g <mode>create</mode> would just write an audit record when an new entity is created.

The default, if not specified, is <mode>create,update,delete</mode>.