=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2009-08-20 08:17:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2010-01-20 13:36:10 +0000 @@ -67,7 +67,7 @@ } // ------------------------------------------------------------------------- - // Action implemantation + // Action implementation // ------------------------------------------------------------------------- public String execute() === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java 2009-10-29 11:27:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java 2010-01-20 13:36:10 +0000 @@ -72,7 +72,7 @@ public String execute() { - this.dataElementGroupSets = new ArrayList( dataElementService.getAllDataElementGroupSets() ); + dataElementGroupSets = new ArrayList( dataElementService.getAllDataElementGroupSets() ); Collections.sort( dataElementGroupSets, new DataElementGroupSetNameComparator() ); === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/OpenAddDataElementGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/OpenAddDataElementGroupSetAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/OpenAddDataElementGroupSetAction.java 2010-01-20 13:36:10 +0000 @@ -0,0 +1,82 @@ +package org.hisp.dhis.dd.action.dataelementgroupset; + +/* + * Copyright (c) 2004-2007, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElementGroup; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; +import org.hisp.dhis.system.filter.DataElementGroupWithoutGroupSetFilter; +import org.hisp.dhis.system.util.FilterUtils; + +import com.opensymphony.xwork2.Action; + +/** + * @author Lars Helge Oeverland + */ +public class OpenAddDataElementGroupSetAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + // ------------------------------------------------------------------------- + // Input & Ouput + // ------------------------------------------------------------------------- + + private List availableGroups; + + public List getAvailableGroups() + { + return availableGroups; + } + + public String execute() + throws Exception + { + availableGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); + + FilterUtils.filter( availableGroups, new DataElementGroupWithoutGroupSetFilter() ); + + Collections.sort( availableGroups, new DataElementGroupNameComparator() ); + + return SUCCESS; + } +} + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/OpenUpdateDataElementGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/OpenUpdateDataElementGroupSetAction.java 2009-11-07 21:25:35 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/OpenUpdateDataElementGroupSetAction.java 2010-01-20 13:36:10 +0000 @@ -27,11 +27,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.hisp.dhis.dataelement.DataElementGroup; import org.hisp.dhis.dataelement.DataElementGroupSet; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; +import org.hisp.dhis.system.filter.DataElementGroupWithoutGroupSetFilter; +import org.hisp.dhis.system.util.FilterUtils; import com.opensymphony.xwork2.Action; @@ -71,16 +76,18 @@ return dataElementGroupSet; } - private List dataElementGroups; + private List availableGroups; - public List getDataElementGroups() + public List getAvailableGroups() { - return dataElementGroups; + return availableGroups; } + + private List selectedGroups; - public void setDataElementGroups( List dataElementGroups ) + public List getSelectedGroups() { - this.dataElementGroups = dataElementGroups; + return selectedGroups; } public String execute() @@ -88,9 +95,18 @@ { dataElementGroupSet = dataElementService.getDataElementGroupSet( id ); - dataElementGroups.removeAll( dataElementGroupSet.getMembers() ); - + availableGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); + + availableGroups.removeAll( dataElementGroupSet.getMembers() ); + + FilterUtils.filter( availableGroups, new DataElementGroupWithoutGroupSetFilter() ); + + Collections.sort( availableGroups, new DataElementGroupNameComparator() ); + + selectedGroups = dataElementGroupSet.getMembers(); + + Collections.sort( selectedGroups, new DataElementGroupNameComparator() ); + return SUCCESS; } - } === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/OpenAddIndicatorGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/OpenAddIndicatorGroupSetAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/OpenAddIndicatorGroupSetAction.java 2010-01-20 13:36:10 +0000 @@ -0,0 +1,84 @@ +package org.hisp.dhis.dd.action.indicatorgroupset; + +/* + * Copyright (c) 2004-2007, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.indicator.IndicatorGroup; +import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator; +import org.hisp.dhis.system.filter.IndicatorGroupWIthoutGroupSetFilter; +import org.hisp.dhis.system.util.FilterUtils; + +import com.opensymphony.xwork2.Action; + +/** + * @author Lars Helge Overland + */ +public class OpenAddIndicatorGroupSetAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private IndicatorService indicatorService; + + public void setIndicatorService( IndicatorService indicatorService ) + { + this.indicatorService = indicatorService; + } + + // ------------------------------------------------------------------------- + // Input & Ouput + // ------------------------------------------------------------------------- + + private List availableGroups; + + public List getAvailableGroups() + { + return availableGroups; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + availableGroups = new ArrayList( indicatorService.getAllIndicatorGroups() ); + + FilterUtils.filter( availableGroups, new IndicatorGroupWIthoutGroupSetFilter() ); + + Collections.sort( availableGroups, new IndicatorGroupNameComparator() ); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/OpenUpdateIndicatorGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/OpenUpdateIndicatorGroupSetAction.java 2009-10-29 11:27:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/OpenUpdateIndicatorGroupSetAction.java 2010-01-20 13:36:10 +0000 @@ -27,11 +27,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.hisp.dhis.indicator.IndicatorGroup; import org.hisp.dhis.indicator.IndicatorGroupSet; import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator; +import org.hisp.dhis.system.filter.IndicatorGroupWIthoutGroupSetFilter; +import org.hisp.dhis.system.util.FilterUtils; import com.opensymphony.xwork2.Action; @@ -39,7 +44,6 @@ * @author Tran Thanh Tri * @version $Id$ */ - public class OpenUpdateIndicatorGroupSetAction implements Action { @@ -72,16 +76,18 @@ return indicatorGroupSet; } - private List indicatorGroups; + private List availableGroups; - public List getIndicatorGroups() + public List getAvailableGroups() { - return indicatorGroups; + return availableGroups; } - public void setIndicatorGroups( List indicatorGroups ) + private List selectedGroups; + + public List getSelectedGroups() { - this.indicatorGroups = indicatorGroups; + return selectedGroups; } // ------------------------------------------------------------------------- @@ -92,8 +98,18 @@ { indicatorGroupSet = indicatorService.getIndicatorGroupSet( id ); - indicatorGroups.removeAll( indicatorGroupSet.getMembers() ); - + availableGroups = new ArrayList( indicatorService.getAllIndicatorGroups() ); + + availableGroups.removeAll( indicatorGroupSet.getMembers() ); + + FilterUtils.filter( availableGroups, new IndicatorGroupWIthoutGroupSetFilter() ); + + Collections.sort( availableGroups, new IndicatorGroupNameComparator() ); + + selectedGroups = indicatorGroupSet.getMembers(); + + Collections.sort( selectedGroups, new IndicatorGroupNameComparator() ); + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2009-12-04 14:09:09 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2010-01-20 13:36:10 +0000 @@ -210,6 +210,15 @@ + + + + + + + + + + + + + class="org.hisp.dhis.dd.action.dataelementgroupset.OpenAddDataElementGroupSetAction"> /main.vm /dhis-web-maintenance-datadictionary/addDataElementGroupSet.vm /dhis-web-maintenance-datadictionary/menu.vm @@ -254,14 +254,8 @@ dataElementGroupSet.action F_DATAELEMENTGROUP_ADD - + - openUpdateDataElementGroupSetChain - F_DATAELEMENTGROUP_UPDATE - - - /main.vm /dhis-web-maintenance-datadictionary/updateDataElementGroupSet.vm @@ -428,7 +422,7 @@ + class="org.hisp.dhis.dd.action.indicatorgroupset.OpenAddIndicatorGroupSetAction"> /main.vm /dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm /dhis-web-maintenance-datadictionary/menu.vm @@ -443,12 +437,6 @@ - openUpdateIndicatorGroupSetChain - F_INDICATORGROUP_UPDATE - - - /main.vm /dhis-web-maintenance-datadictionary/updateIndicatorGroupSet.vm === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupSet.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupSet.vm 2009-11-04 06:39:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupSet.vm 2010-01-20 13:36:10 +0000 @@ -58,7 +58,7 @@ var groupMembers = new Object(); var availableDataElementGroups = new Object(); -#foreach( $dataElementGroup in $dataElementGroups ) +#foreach( $dataElementGroup in $availableGroups ) availableDataElementGroups['$dataElementGroup.id'] = '$encoder.jsEscape( $dataElementGroup.name, "'" )'; #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm 2009-11-02 18:13:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm 2010-01-20 13:36:10 +0000 @@ -58,7 +58,7 @@ var groupMembers = new Object(); var availableIndicatorGroups = new Object(); -#foreach( $indicatorGroup in $indicatorGroups ) +#foreach( $indicatorGroup in $availableGroups ) availableIndicatorGroups['$indicatorGroup.id'] = '$encoder.jsEscape( $indicatorGroup.name, "'" )'; #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupSet.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupSet.vm 2009-11-02 18:13:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupSet.vm 2010-01-20 13:36:10 +0000 @@ -57,11 +57,11 @@