dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36602
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18728: Added programIndicators to Add/Update programStageSection form.
------------------------------------------------------------
revno: 18728
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-03-29 16:47:49 +0700
message:
Added programIndicators to Add/Update programStageSection form.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageSectionForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageSectionForm.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-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
@@ -29,13 +29,17 @@
*/
import com.opensymphony.xwork2.Action;
+
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.ProgramStageService;
+import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.HashSet;
@@ -74,6 +78,9 @@
this.programStageDataElementService = programStageDataElementService;
}
+ @Autowired
+ private ProgramIndicatorService programIndicatorService;
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -104,6 +111,13 @@
this.dataElementIds = dataElementIds;
}
+ private List<Integer> selectedIndicators = new ArrayList<>();
+
+ public void setSelectedIndicators( List<Integer> selectedIndicators )
+ {
+ this.selectedIndicators = selectedIndicators;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -141,6 +155,20 @@
}
sections.add( section );
+
+ // ---------------------------------------------------------------------
+ // Program indicators
+ // ---------------------------------------------------------------------
+
+ List<ProgramIndicator> programIndicators = new ArrayList<>();
+ for ( Integer id : selectedIndicators )
+ {
+ ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
+ programIndicators.add( indicator );
+ }
+
+ section.setProgramIndicators( programIndicators );
+
programStage.setProgramStageSections( sections );
programStageService.updateProgramStage( programStage );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
@@ -28,13 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.ProgramStageSectionService;
import org.hisp.dhis.program.ProgramStageService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -64,6 +69,9 @@
this.programStageSectionService = programStageSectionService;
}
+ @Autowired
+ private ProgramIndicatorService programIndicatorService;
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -103,6 +111,20 @@
return availableDataElements;
}
+ private List<ProgramIndicator> programIndicators;
+
+ public List<ProgramIndicator> getProgramIndicators()
+ {
+ return programIndicators;
+ }
+
+ private List<ProgramIndicator> availableProgramIndicators;
+
+ public List<ProgramIndicator> getAvailableProgramIndicators()
+ {
+ return availableProgramIndicators;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -118,13 +140,15 @@
programStage = programStageService.getProgramStage( programStageId );
availableDataElements = programStage.getProgramStageDataElements();
-
+ availableProgramIndicators = new ArrayList<>( programStage.getProgramIndicators() );
+ availableProgramIndicators.removeAll( section.getProgramIndicators() );
+
for ( ProgramStageSection section : programStage.getProgramStageSections() )
{
availableDataElements.removeAll( section.getProgramStageDataElements() );
}
}
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
@@ -28,12 +28,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.ProgramStageService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -55,6 +60,9 @@
{
this.programStageService = programStageService;
}
+
+ @Autowired
+ private ProgramIndicatorService programIndicatorService;
// -------------------------------------------------------------------------
// Input/Output
@@ -88,6 +96,13 @@
return availableDataElements;
}
+ private List<ProgramIndicator> availableProgramIndicators;
+
+ public List<ProgramIndicator> getAvailableProgramIndicators()
+ {
+ return availableProgramIndicators;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -99,12 +114,14 @@
programStage = programStageService.getProgramStage( programStageId );
availableDataElements = programStage.getProgramStageDataElements();
-
+ availableProgramIndicators = new ArrayList<>( programStage.getProgramIndicators() );
+
for ( ProgramStageSection section : programStage.getProgramStageSections() )
{
availableDataElements.removeAll( section.getProgramStageDataElements() );
}
-
+
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
@@ -33,12 +33,15 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.ProgramStageSectionService;
import org.hisp.dhis.program.ProgramStageService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -82,6 +85,9 @@
this.programStageDataElementService = programStageDataElementService;
}
+ @Autowired
+ private ProgramIndicatorService programIndicatorService;
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -119,6 +125,13 @@
this.dataElementIds = dataElementIds;
}
+ private List<Integer> selectedIndicators = new ArrayList<>();
+
+ public void setSelectedIndicators( List<Integer> selectedIndicators )
+ {
+ this.selectedIndicators = selectedIndicators;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -134,7 +147,8 @@
// ---------------------------------------------------------------------
ProgramStageSection section = programStageSectionService.getProgramStageSection( id );
-
+ section.setName( name );
+
List<ProgramStageDataElement> psDataElements = new ArrayList<>();
for ( Integer id : dataElementIds )
{
@@ -143,8 +157,21 @@
psDataElements.add( psDataElement );
}
- section.setName( name );
section.setProgramStageDataElements( psDataElements );
+
+ // ---------------------------------------------------------------------
+ // Program indicators
+ // ---------------------------------------------------------------------
+
+ List<ProgramIndicator> programIndicators = new ArrayList<>();
+ for ( Integer id : selectedIndicators )
+ {
+ ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
+ programIndicators.add( indicator );
+ }
+
+ section.setProgramIndicators( programIndicators );
+
programStageSectionService.updateProgramStageSection( section );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageSectionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageSectionForm.vm 2014-08-06 15:20:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageSectionForm.vm 2015-03-29 09:47:49 +0000
@@ -40,11 +40,11 @@
</table>
<table id="programStageMembersArea">
- <colgroup>
- <col style="width:400px;"/>
+ <colgroup>
+ <col style='width:500px'/>
<col/>
- <col style="width:400px;"/>
- </colgroup>
+ <col style='width:500px'/>
+ </colgroup>
<thead>
<tr>
<th>$i18n.getString( "available_data_elements" )</th>
@@ -84,6 +84,45 @@
</tr>
</tbody>
</table>
+
+
+<table>
+ <colgroup>
+ <col style='width:500px'/>
+ <col/>
+ <col style='width:500px'/>
+ </colgroup>
+ <tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_indicators" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select style="height: 200px; width: 100%;" multiple="multiple" id="availableIndicators" name="availableIndicators" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )" >
+ #foreach( $indicator in $availableProgramIndicators )
+ <option value="$indicator.id">$encoder.htmlEncode( $indicator.displayName )</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="dhisAjaxSelect_moveAllSelected( 'availableIndicators', 'selectedIndicators' )" class='filterButton'/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="dhisAjaxSelect_moveAllSelected( 'selectedIndicators', 'availableIndicators' )" class='filterButton'/><br/>
+ <input type="button" value=">>" onclick="moveAllById( 'availableIndicators', 'selectedIndicators' )" class='filterButton' /><br/>
+ <input type="button" value="<<" onclick="moveAllById( 'selectedIndicators', 'availableIndicators' )" class='filterButton' />
+ </td>
+ <td>
+ <select style="height: 200px; width: 100%; margin-top: 22px;" multiple="multiple" id="selectedIndicators" name="selectedIndicators" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )" > </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'selectedIndicators')" title="$i18n.getString( 'move_up' )"><img src="../images/move_up.png" alt="$i18n.getString( 'move_up' )"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedIndicators' )" title="$i18n.getString( 'move_down' )"><img src="../images/move_down.png" alt="$i18n.getString( 'move_up' )"/></a>
+ </td>
+ </tr>
+</table>
+
+
<p>
<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStageSectionList.action?id=$programStage.id'" style="width:10em"/>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageSectionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageSectionForm.vm 2014-11-03 13:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageSectionForm.vm 2015-03-29 09:47:49 +0000
@@ -42,10 +42,10 @@
<table id="programStageMembersArea">
<colgroup>
- <col style="width:400px;"/>
+ <col style='width:500px'/>
<col/>
- <col style="width:400px;"/>
- </colgroup>
+ <col style='width:500px'/>
+ </colgroup>
<thead>
<tr>
<th>$i18n.getString( "available_data_elements" )</th>
@@ -89,6 +89,48 @@
</tr>
</tbody>
</table>
+
+
+<table>
+ <colgroup>
+ <col style='width:500px'/>
+ <col/>
+ <col style='width:500px'/>
+ </colgroup>
+ <tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_indicators" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select style="height: 200px; width: 100%;" multiple="multiple" id="availableIndicators" name="availableIndicators" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )" >
+ #foreach( $indicator in $availableProgramIndicators )
+ <option value="$indicator.id">$encoder.htmlEncode( $indicator.displayName )</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="dhisAjaxSelect_moveAllSelected( 'availableIndicators', 'selectedIndicators' )" class='filterButton'/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="dhisAjaxSelect_moveAllSelected( 'selectedIndicators', 'availableIndicators' )" class='filterButton'/><br/>
+ <input type="button" value=">>" onclick="moveAllById( 'availableIndicators', 'selectedIndicators' )" class='filterButton' /><br/>
+ <input type="button" value="<<" onclick="moveAllById( 'selectedIndicators', 'availableIndicators' )" class='filterButton' />
+ </td>
+ <td>
+ <select style="height: 200px; width: 100%; margin-top: 22px;" multiple="multiple" id="selectedIndicators" name="selectedIndicators" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )" >
+ #foreach( $indicator in $section.programIndicators )
+ <option value="$indicator.id">$encoder.htmlEncode( $indicator.displayName )</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'selectedIndicators')" title="$i18n.getString( 'move_up' )"><img src="../images/move_up.png" alt="$i18n.getString( 'move_up' )"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedIndicators' )" title="$i18n.getString( 'move_down' )"><img src="../images/move_down.png" alt="$i18n.getString( 'move_up' )"/></a>
+ </td>
+ </tr>
+</table>
+
<p>
<input type="submit" value="$i18n.getString( 'update' )" style="width:10em"/>
<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStageSectionList.action?id=$programStage.id'" style="width:10em"/>