dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09203
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2381: Feature type field added to 'new orgunit' and 'update orgunit' forms + Bug fixed: Updating an org...
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2381 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-12-15 15:26:24 +0100
message:
Feature type field added to 'new orgunit' and 'update orgunit' forms + Bug fixed: Updating an orgunit removed its existing coordinates.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2010-12-14 03:56:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2010-12-15 14:19:17 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.jfree.util.Log;
import com.opensymphony.xwork2.ActionSupport;
@@ -116,6 +117,13 @@
{
this.coordinates = coordinates;
}
+
+ private String featureType;
+
+ public void setFeatureType( String featureType )
+ {
+ this.featureType = featureType;
+ }
private String url;
@@ -173,6 +181,7 @@
code = nullIfEmpty( code );
comment = nullIfEmpty( comment );
coordinates = nullIfEmpty( coordinates );
+ featureType = nullIfEmpty( featureType );
url = nullIfEmpty( url );
contactPerson = nullIfEmpty( contactPerson );
@@ -205,6 +214,7 @@
OrganisationUnit organisationUnit = new OrganisationUnit( name, shortName, code, date, null, true, comment );
organisationUnit.setCoordinates( coordinates );
+ organisationUnit.setFeatureType( featureType );
organisationUnit.setUrl( url );
organisationUnit.setParent( parent );
organisationUnit.setContactPerson( contactPerson );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2010-12-14 03:56:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2010-12-15 14:19:17 +0000
@@ -124,9 +124,16 @@
private String coordinates;
- public void setPolygonCoordinates( String polygonCoordinates )
- {
- this.coordinates = polygonCoordinates;
+ public void setCoordinates( String coordinates )
+ {
+ this.coordinates = coordinates;
+ }
+
+ private String featureType;
+
+ public void setFeatureType( String featureType )
+ {
+ this.featureType = featureType;
}
private String url;
@@ -174,6 +181,7 @@
code = nullIfEmpty( code );
comment = nullIfEmpty( comment );
coordinates = nullIfEmpty( coordinates );
+ featureType = nullIfEmpty( featureType );
url = nullIfEmpty( url );
contactPerson = nullIfEmpty( contactPerson );
@@ -204,6 +212,7 @@
organisationUnit.setClosedDate( cDate );
organisationUnit.setComment( comment );
organisationUnit.setCoordinates( coordinates );
+ organisationUnit.setFeatureType( featureType );
organisationUnit.setUrl( url );
organisationUnit.setContactPerson( contactPerson );
organisationUnit.setAddress( address );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2010-12-13 17:03:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2010-12-15 14:19:17 +0000
@@ -107,4 +107,5 @@
organisation_units = organisation units
found = Found
all = All
-please_select_from_tree = Please select from tree (optional)
\ No newline at end of file
+please_select_from_tree = Please select from tree (optional)
+feature_type = Feature type
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2010-12-14 07:35:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2010-12-15 14:19:17 +0000
@@ -1,17 +1,17 @@
<script>
jQuery(document).ready( function(){
- validation( 'addOrganisationUnitForm' );
+ validation( 'addOrganisationUnitForm' );
checkValueIsExist( "name", "validateOrganisationUnit.action");
checkValueIsExist( "code", "validateOrganisationUnit.action");
- datePickerValid( 'openingDate', false );
+ datePickerValid( 'openingDate', false );
});
</script>
<h3>$i18n.getString( "create_new_org_unit" ) #openHelp( "ou_edit" )</h3>
-<form id="addOrganisationUnitForm" action="addOrganisationUnit.action" method="post">
+<form id="addOrganisationUnitForm" name="addOrganisationUnitForm" action="addOrganisationUnit.action" method="post">
<table>
<tr>
@@ -40,7 +40,11 @@
</tr>
<tr>
<td><label for="coordinates">$i18n.getString( "coordinates" )</label></td>
- <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em"></textarea></td>
+ <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em" onkeyup="setFeatureType(this.value)"></textarea></td>
+ </tr>
+ <tr>
+ <td><label for="featureType">$i18n.getString( "feature_type" )</label></td>
+ <td><input type="text" id="featureType" name="featureType" style="width:20em" readonly="readonly"/></td>
</tr>
<tr>
<td><label for="url">$i18n.getString( "url" )</label></td>
@@ -80,4 +84,25 @@
nameField.select();
nameField.focus();
var adding_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "adding_the_org_unit_failed" ) , "'" )';
-</script>
\ No newline at end of file
+
+ function setFeatureType(c) {
+ document.addOrganisationUnitForm.featureType.value = getFeatureType(c);
+ }
+
+ function getFeatureType(c) {
+ if (c.length >= 2) {
+ if (c.substring(0,1) == "[" && c.substring(1,2) != "[" && c.substring(c.length-1,c.length) == "]") {
+ return "Point";
+ }
+
+ if (c.length >= 8) {
+ if (c.substring(0,4) == "[[[[" && c.substring(c.length-4,c.length) == "]]]]") {
+ return "MultiPolygon";
+ }
+ }
+ }
+
+ return "";
+ }
+
+</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2010-12-14 07:35:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2010-12-15 14:19:17 +0000
@@ -21,7 +21,7 @@
<h3>$i18n.getString( "edit_org_unit" ) #openHelp( "ou_edit" )</h3>
-<form id="updateOrganisationUnitForm" action="updateOrganisationUnit.action" method="post">
+<form id="updateOrganisationUnitForm" name="updateOrganisationUnitForm" action="updateOrganisationUnit.action" method="post">
<div>
<input type="hidden" id="id" name="id" value="$organisationUnit.id"/>
@@ -33,11 +33,11 @@
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" maxlength="160" value="$encoder.htmlEncode( $organisationUnit.name )" onchange="nameChanged()" style="width:20em" class="{validate:{required:true,minlength:2}}"/></td>
+ <td><input type="text" id="name" name="name" maxlength="160" value="$!encoder.htmlEncode( $organisationUnit.name )" onchange="nameChanged()" style="width:20em" class="{validate:{required:true,minlength:2}}"/></td>
</tr>
<tr>
<td><label for="shortName">$i18n.getString( "short_name" )</label></td>
- <td><input type="text" id="shortName" name="shortName" maxlength="25" value="$encoder.htmlEncode( $organisationUnit.shortName )" style="width:20em" class="{validate:{required:true,minlength:2}}"/></td>
+ <td><input type="text" id="shortName" name="shortName" maxlength="25" value="$!encoder.htmlEncode( $organisationUnit.shortName )" style="width:20em" class="{validate:{required:true,minlength:2}}"/></td>
</tr>
<tr>
<td><label for="code">$i18n.getString( "code" )</label></td>
@@ -69,7 +69,11 @@
</tr>
<tr>
<td><label for="coordinates">$i18n.getString( "coordinates" )</label></td>
- <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em">$!encoder.htmlEncode( $organisationUnit.coordinates )</textarea></td>
+ <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em" onkeyup="setFeatureType(this.value)">$!encoder.htmlEncode( $organisationUnit.coordinates )</textarea></td>
+ </tr>
+ <tr>
+ <td><label for="featureType">$i18n.getString( "feature_type" )</label></td>
+ <td><input type="text" id="featureType" name="featureType" value="$!encoder.htmlEncode( $organisationUnit.featureType )" style="width:20em" readonly="readonly"/></td>
</tr>
<tr>
<td><label for="url">$i18n.getString( "url" )</label></td>
@@ -102,4 +106,24 @@
<script type="text/javascript">
var previousName = '$encoder.jsEscape( $organisationUnit.name, "'" )';
var saving_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "saving_the_org_unit_failed" ) , "'" )';
+
+ function setFeatureType(c) {
+ document.updateOrganisationUnitForm.featureType.value = getFeatureType(c);
+ }
+
+ function getFeatureType(c) {
+ if (c.length >= 2) {
+ if (c.substring(0,1) == "[" && c.substring(1,2) != "[" && c.substring(c.length-1,c.length) == "]") {
+ return "Point";
+ }
+
+ if (c.length >= 8) {
+ if (c.substring(0,4) == "[[[[" && c.substring(c.length-4,c.length) == "]]]]") {
+ return "MultiPolygon";
+ }
+ }
+ }
+
+ return "";
+ }
</script>
Follow ups