← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9833: Sort program list by alphabet in program management.

 

------------------------------------------------------------
revno: 9833
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-19 15:22:26 +0700
message:
  Sort program list by alphabet in program management.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.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-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramListAction.java	2012-04-17 04:39:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramListAction.java	2013-02-19 08:22:26 +0000
@@ -29,11 +29,14 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.program.comparator.ProgramNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -90,14 +93,14 @@
         this.associations = associations;
     }
 
-    private Collection<Program> programs = new ArrayList<Program>();
+    private List<Program> programs = new ArrayList<Program>();
 
-    public Collection<Program> getPrograms()
+    public List<Program> getPrograms()
     {
         return programs;
     }
 
-    public void setPrograms( Collection<Program> programs )
+    public void setPrograms( List<Program> programs )
     {
         this.programs = programs;
     }
@@ -109,8 +112,9 @@
     public String execute()
         throws Exception
     {
-        programs = programService.getAllPrograms();
-
+        programs = new ArrayList<Program>( programService.getAllPrograms() );
+        Collections.sort( programs, new ProgramNameComparator() );
+        
         if ( id == null )
         {
             associations = programStageService.getAllProgramStages();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2013-02-19 06:54:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2013-02-19 08:22:26 +0000
@@ -72,8 +72,4 @@
     var i18n_single_event_with_registration = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")';
     var i18n_single_event_without_registration = '$encoder.jsEscape( $i18n.getString( "single_event_without_registration" ) , "'")';
 
-	jQuery(document).ready(function(){	
-		tableSorter( 'listTable' );
-	});
-	
 </script>