← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5051: Organisation unit search - Sorted order for group sets and the searched result by alphabetic.

 

------------------------------------------------------------
revno: 5051
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-10-27 12:55:02 +0700
message:
  Organisation unit search - Sorted order for group sets and the searched result by alphabetic.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.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/search/SearchOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java	2011-03-19 22:30:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java	2011-10-27 05:55:02 +0000
@@ -44,6 +44,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupSetNameComparator;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.system.grid.ListGrid;
 
@@ -131,9 +132,9 @@
         return groupSets;
     }
     
-    private Collection<OrganisationUnit> organisationUnits;
+    private List<OrganisationUnit> organisationUnits;
 
-    public Collection<OrganisationUnit> getOrganisationUnits()
+    public List<OrganisationUnit> getOrganisationUnits()
     {
         return organisationUnits;
     }
@@ -214,10 +215,12 @@
             
             boolean limit = type == null; // Only limit for HTML view since browser is memory constrained
             
-            organisationUnits = organisationUnitService.getOrganisationUnitsByNameAndGroups( name, groups, selectedOrganisationUnit, limit );
+            organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsByNameAndGroups( name, groups, selectedOrganisationUnit, limit ) );
             
             limited = organisationUnits != null && organisationUnits.size() == OrganisationUnitService.MAX_LIMIT;
             
+            Collections.sort( organisationUnits, new OrganisationUnitNameComparator() );
+            
             if ( type != null && !type.equalsIgnoreCase( DEFAULT_TYPE ) )
             {
                 grid = generateGrid();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm	2011-09-11 09:37:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm	2011-10-27 05:55:02 +0000
@@ -38,7 +38,7 @@
 <td>
   <select name="groupId" style="width:360px">
   <option value="0">[ $i18n.getString( "all" ) $encoder.htmlEncode( $groupSet.name ) ]</option>
-    #foreach( $group in $groupSet.organisationUnitGroups )
+    #foreach( $group in $groupSet.getSortedGroups() )
     <option value="$group.id"
     #if( $groupId && $groupId.contains( $group.id ) )selected="selected"#end
     >$encoder.htmlEncode( $group.name )</option>