← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2016: Fix bug: Cannnot sort and update program-stage-order.

 

------------------------------------------------------------
revno: 2016
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2010-11-09 14:12:10 +0700
message:
  Fix bug: Cannnot sort and update program-stage-order.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/sortProgramStageForm.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/programstage/SaveProgramStageSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.java	2010-10-22 09:23:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.java	2010-11-09 07:12:10 +0000
@@ -52,19 +52,19 @@
     public void setProgramStageService( ProgramStageService programStageService )
     {
         this.programStageService = programStageService;
-    }   
-    
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
 
     private List<Integer> programStageList;
 
-    public void setprogramStageList( List<Integer> programStageList )
+    public void setProgramStageList( List<Integer> programStageList )
     {
         this.programStageList = programStageList;
     }
-    
+
     private Integer id;
 
     public Integer getId()
@@ -82,22 +82,21 @@
     // -------------------------------------------------------------------------
     public String execute()
     {
-
         int stageInProgram = 1;
-        
-        List<ProgramStage> programStages = new ArrayList<ProgramStage>( programStageList.size() );        
+
+        List<ProgramStage> programStages = new ArrayList<ProgramStage>( programStageList.size() );
 
         for ( Integer programStageId : programStageList )
         {
             ProgramStage programStage = programStageService.getProgramStage( programStageId );
-            
+
             programStages.add( programStage );
 
             programStage.setStageInProgram( stageInProgram++ );
 
             programStageService.updateProgramStage( programStage );
-        }        
-                
+        }
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2010-11-09 07:12:10 +0000
@@ -799,7 +799,7 @@
 
 		<action name="saveProgramStageSortOder"
 			class="org.hisp.dhis.patient.action.programstage.SaveProgramStageSortOrderAction">
-			<result name="success" type="redirect">programStage.action
+			<result name="success" type="redirect">programStage.action?id=${id}
 			</result>
 		</action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm	2010-10-20 12:59:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm	2010-11-09 07:12:10 +0000
@@ -33,11 +33,10 @@
 		  </tr>
 
 		  <tbody id="list">
-			#set( $mark = false )
 			#foreach( $association in $associations )
 			  <tr id="tr${association.id}">			  
-				<td#alternate( $mark )>$encoder.htmlEncode( $association.name )</td>                
-				<td#alternate( $mark )>$encoder.htmlEncode( $association.description )</td>
+				<td>$encoder.htmlEncode( $association.name )</td>                
+				<td>$encoder.htmlEncode( $association.description )</td>
 				
 				<td style="text-align:center"#alternate( $mark )>
 				  <a href="showUpdateProgramStageForm.action?id=$association.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
@@ -56,11 +55,6 @@
 				</td>
 				
 			  </tr>
-			  #if( $mark )
-				#set( $mark = false )
-			  #else
-				#set( $mark = true )
-			  #end
 			#end
 
 		  </tbody>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/sortProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/sortProgramStageForm.vm	2010-10-22 09:23:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/sortProgramStageForm.vm	2010-11-09 07:12:10 +0000
@@ -1,6 +1,6 @@
 <h3>$i18n.getString( "program_stage_sort_order" )</h3>
 																		
-<form id="sortProgramStageForm" name "sortProgramStageForm" action="saveProgramStageSortOder.action" method="post">
+<form id="sortProgramStageForm" name "sortProgramStageForm" action="saveProgramStageSortOder.action" method="get" onsubmit="selectAllById('programStageList');">
 
 <div style="display:inline">
   <input type="hidden" id="id" name="id" value="$program.id">
@@ -13,7 +13,7 @@
     </tr>        
     <tr>
         <td>
-            <select size="15" id="sortedList" name="sortedList" multiple="multiple" style="min-width:20em;height:20em">
+            <select size="15" id="programStageList" name="programStageList" multiple="multiple" style="min-width:20em;height:20em">
                 #foreach ( $programStage in $programStages )
                     <option value="$programStage.id">$encoder.htmlEncode( $programStage.name )</option>
                 #end