← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2389: Add/update orgunit feature type validation improved + reverted code recommited.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2389 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-12-16 16:35:13 +0100
message:
  Add/update orgunit feature type validation improved + reverted code recommited.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  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/javascript/featureType.js


--
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-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm	2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm	2010-12-16 15:32:46 +0000
@@ -139,6 +139,8 @@
 		,custome_regex: validatorFormat("{1}")
 		,greaterDate: '$encoder.jsEscape($i18n.getString('closedDate_should_be_greater_than_openDate' ) , "'")'
 		,unicodechars: '$encoder.jsEscape($i18n.getString('please_unicode_chars_only' ) , "'")'
+		,unrecognizedcoordinatestring: '$encoder.jsEscape($i18n.getString('unrecognized_coordinate_string' ) , "'")'
+		
 };
 var i18n_process = '$encoder.jsEscape( $i18n.getString( "process" ) , "'" )';
 var i18n_delete_success = '$encoder.jsEscape( $i18n.getString( "delete_success" ) , "'" )';

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-12-14 03:56:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-12-16 15:32:46 +0000
@@ -350,6 +350,7 @@
 only_digits_are_not_allowed = Only digits are not allowed
 closedDate_should_be_greater_than_openDate = ClosedDate should be greater than OpenDate
 please_unicode_chars_only = Please unicode chars only.
+unrecognized_coordinate_string = Unrecognized coordinate string
 
 please_enter_name	        = Please enter name!
 please_select_period        = Please select period!

=== 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-16 13:29:08 +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-16 15:32:46 +0000
@@ -116,6 +116,13 @@
     {
         this.coordinates = coordinates;
     }
+    
+    private String featureType;
+
+    public void setFeatureType( String featureType )
+    {
+        this.featureType = featureType;
+    }
 
     private String url;
 
@@ -173,6 +180,7 @@
         code = nullIfEmpty( code );
         comment = nullIfEmpty( comment );
         coordinates = nullIfEmpty( coordinates );
+        featureType = nullIfEmpty( featureType );
         url = nullIfEmpty( url );
         
         contactPerson = nullIfEmpty( contactPerson );
@@ -205,6 +213,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-15 15:34:38 +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-16 15:32:46 +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 );
@@ -205,6 +213,7 @@
         organisationUnit.setComment( comment );
         organisationUnit.setCoordinates( coordinates );
         organisationUnit.setUrl( url );
+        organisationUnit.setFeatureType( featureType );
         organisationUnit.setContactPerson( contactPerson );
         organisationUnit.setAddress( address );
         organisationUnit.setEmail( email );

=== 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-15 15:34:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties	2010-12-16 15:32:46 +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/javascript/featureType.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/featureType.js	2010-12-16 13:23:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/featureType.js	2010-12-16 15:32:46 +0000
@@ -10,7 +10,7 @@
     
     if ( c.length >= 2 )
     {
-        if ( c.substring( 0, 1 ) == "[" && c.substring( 1, 2 ) != "[" && c.substring( c.length - 1, c.length ) == "]" )
+        if ( c.substring( 0, 1 ) == "[" && c.substring( 1, 2 ) != "[" && c.substring( c.length - 1, c.length ) == "]" && c.substring( c.length - 2, c.length - 1 ) != "]" )
         {
             field.value = "Point";
             return;
@@ -38,11 +38,11 @@
 
 function validateFeatureType( cField, fField )
 {
-    if ( cField.value && !fField.value )
+    if ( cField.value && ( !fField.value || fField.value == validationMessage.unrecognizedcoordinatestring ) )
     {
         fField.style.color = "#ff0000";
         fField.style.fontStyle = "italic";
-        fField.value = "Unrecognized coordinate string!";
+        fField.value = validationMessage.unrecognizedcoordinatestring;
         return false;
     }