=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.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/indicator/ShowAddIndicatorForm.java 2012-06-01 12:17:31 +0000 @@ -0,0 +1,78 @@ +package org.hisp.dhis.dd.action.indicator; + +/* + * Copyright (c) 2004-2012, 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 com.opensymphony.xwork2.Action; +import org.hisp.dhis.attribute.Attribute; +import org.hisp.dhis.attribute.AttributeService; +import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author Morten Olav Hansen + */ +public class ShowAddIndicatorForm + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private AttributeService attributeService; + + public void setAttributeService( AttributeService attributeService ) + { + this.attributeService = attributeService; + } + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private List attributes; + + public List getAttributes() + { + return attributes; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + attributes = new ArrayList( attributeService.getIndicatorAttributes() ); + Collections.sort( attributes, new AttributeSortOrderComparator() ); + + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowAddIndicatorGroupForm.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowAddIndicatorGroupForm.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/indicatorgroup/ShowAddIndicatorGroupForm.java 2012-06-01 12:17:31 +0000 @@ -0,0 +1,78 @@ +package org.hisp.dhis.dd.action.indicatorgroup; + +/* + * Copyright (c) 2004-2012, 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 com.opensymphony.xwork2.Action; +import org.hisp.dhis.attribute.Attribute; +import org.hisp.dhis.attribute.AttributeService; +import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author Morten Olav Hansen + */ +public class ShowAddIndicatorGroupForm + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private AttributeService attributeService; + + public void setAttributeService( AttributeService attributeService ) + { + this.attributeService = attributeService; + } + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private List attributes; + + public List getAttributes() + { + return attributes; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + attributes = new ArrayList( attributeService.getIndicatorAttributes() ); + Collections.sort( attributes, new AttributeSortOrderComparator() ); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java 2012-02-01 10:50:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java 2012-06-01 12:17:31 +0000 @@ -27,21 +27,21 @@ package org.hisp.dhis.dd.action.indicatorgroup; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - +import com.opensymphony.xwork2.Action; +import org.hisp.dhis.attribute.Attribute; +import org.hisp.dhis.attribute.AttributeService; +import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorGroup; import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.system.util.AttributeUtils; -import com.opensymphony.xwork2.Action; +import java.util.*; /** * @author Chau Thu Tran * @version $ ShowUpdateIndicatorGroupFormAction.java May 30, 2011 3:01:41 PM $ - * */ public class ShowUpdateIndicatorGroupFormAction implements Action @@ -57,6 +57,13 @@ this.indicatorService = indicatorService; } + private AttributeService attributeService; + + public void setAttributeService( AttributeService attributeService ) + { + this.attributeService = attributeService; + } + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- @@ -82,6 +89,20 @@ return groupMembers; } + private List attributes; + + public List getAttributes() + { + return attributes; + } + + public Map attributeValues = new HashMap(); + + public Map getAttributeValues() + { + return attributeValues; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -92,7 +113,12 @@ groupMembers = new ArrayList( indicatorGroup.getMembers() ); + attributes = new ArrayList( attributeService.getIndicatorGroupAttributes() ); + + attributeValues = AttributeUtils.getAttributeValueMap( indicatorGroup.getAttributeValues() ); + Collections.sort( groupMembers, new IdentifiableObjectNameComparator() ); + Collections.sort( attributes, new AttributeSortOrderComparator() ); 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 2012-06-01 11:35:55 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 12:17:31 +0000 @@ -263,6 +263,10 @@ + + + + @@ -304,6 +308,7 @@ + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-06-01 11:35:55 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-06-01 12:17:31 +0000 @@ -260,7 +260,7 @@ F_INDICATOR_DELETE - + /main.vm /dhis-web-maintenance-datadictionary/addIndicatorForm.vm javascript/shortName.js,javascript/indicator.js @@ -353,7 +353,7 @@ F_INDICATORGROUP_DELETE - + /main.vm /dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm javascript/indicatorGroup.js === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm 2011-10-06 07:57:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm 2012-06-01 12:17:31 +0000 @@ -28,7 +28,10 @@ - + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm 2011-10-06 07:29:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm 2012-06-01 12:17:31 +0000 @@ -1,6 +1,23 @@ -
$i18n.getString( "details" )