← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3207: Added hierarchy information in details in orgunit search

 

------------------------------------------------------------
revno: 3207
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-03-29 22:21:47 +0200
message:
  Added hierarchy information in details in orgunit search
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.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/organisationUnitDetails.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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2011-03-29 20:06:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2011-03-29 20:21:47 +0000
@@ -53,6 +53,8 @@
     private static final Pattern JSON_COORDINATE_PATTERN = Pattern.compile( "(\\[{3}.*?\\]{3})" );
     private static final Pattern COORDINATE_PATTERN = Pattern.compile("([\\-0-9.]+,[\\-0-9.]+)");
     
+    private static final String NAME_SEPARATOR = " - ";
+    
     private Set<OrganisationUnit> children = new HashSet<OrganisationUnit>();
 
     private OrganisationUnit parent;
@@ -302,6 +304,21 @@
         return group != null ? group.getName() : null;
     }
     
+    public String getAncestorNames()
+    {
+        StringBuilder builder = new StringBuilder( name );
+        
+        OrganisationUnit unit = parent;
+        
+        while ( unit != null )
+        {
+            builder.append( NAME_SEPARATOR ).append( unit.getName() );
+            unit = unit.getParent();
+        }
+        
+        return builder.toString();
+    }
+    
     // -------------------------------------------------------------------------
     // hashCode, equals and toString
     // -------------------------------------------------------------------------

=== 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	2011-03-17 22:55:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties	2011-03-29 20:21:47 +0000
@@ -116,4 +116,5 @@
 get_report_as_csv 									= Download as CSV
 get_report_as_pdf 									= Download as PDF
 please_wait_while_downloading						= Please wait while downloading report
-please_wait_while_searching							= Please wait while searching
\ No newline at end of file
+please_wait_while_searching							= Please wait while searching
+hierarchy											= Hierarchy
\ 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/organisationUnitDetails.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm	2010-12-14 07:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm	2011-03-29 20:21:47 +0000
@@ -51,6 +51,10 @@
 <td><b>$i18n.getString( "phone_number" ):</b></td>
 <td>$!encoder.htmlEncode( $organisationUnit.phoneNumber )</td>
 </tr>
+<tr>
+<td><b>$i18n.getString( "hierarchy" ):</b></td>
+<td>$!encoder.htmlEncode( $organisationUnit.ancestorNames )</td>
+</tr>
 
 #foreach( $groupSet in $groupSets )
 <tr>