=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AssignGroupsForDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AssignGroupsForDataElementAction.java 2010-02-25 08:57:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AssignGroupsForDataElementAction.java 2010-03-22 10:21:47 +0000 @@ -1,7 +1,5 @@ package org.hisp.dhis.dd.action.dataelementgroup; - - /* * Copyright (c) 2004-2007, University of Oslo * All rights reserved. @@ -30,6 +28,8 @@ */ import java.util.Collection; +import java.util.HashSet; +import java.util.Set; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementGroup; @@ -39,7 +39,7 @@ /** * @author Tran Thanh Tri - * @version $Id: + * @version $Id: AssignGroupsForDataElementAction.java 2869 2010-03-27 14:26:09Z Chau Thu Tran $ */ public class AssignGroupsForDataElementAction @@ -79,20 +79,32 @@ public String execute() throws Exception { - DataElement dataElement = dataElementService.getDataElement( dataElementId ); + DataElement dataElement = dataElementService.getDataElement( dataElementId ); + + Set selectedGroups = new HashSet(); for ( Integer id : dataElementGroups ) { DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( id ); - + + selectedGroups.add( dataElementGroup ); + dataElementGroup.getMembers().add( dataElement ); - + dataElementService.updateDataElementGroup( dataElementGroup ); - } - + } + + SetremoveGroups = new HashSet( dataElementService + .getGroupsContainingDataElement( dataElement ) ); + removeGroups.removeAll( selectedGroups ); + + for ( DataElementGroup removeGroup : removeGroups ) + { + removeGroup.getMembers().remove( dataElement ); + dataElementService.updateDataElementGroup( removeGroup ); + } return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AssignGroupsForIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AssignGroupsForIndicatorAction.java 2010-02-26 06:40:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AssignGroupsForIndicatorAction.java 2010-03-22 10:21:47 +0000 @@ -28,6 +28,8 @@ */ import java.util.Collection; +import java.util.HashSet; +import java.util.Set; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorGroup; @@ -37,7 +39,8 @@ /** * @author Tran Thanh Tri - * @version $Id: $ + * @version $Id: AssignGroupsForIndicatorAction.java 2869 2010-03-27 15:01:079Z + * Chau Thu Tran $ */ public class AssignGroupsForIndicatorAction implements Action @@ -79,16 +82,30 @@ Indicator indicator = indicatorService.getIndicator( indicatorId ); + Set selectedGroups = new HashSet(); + for ( Integer id : indicatorGroups ) { IndicatorGroup group = indicatorService.getIndicatorGroup( id ); + selectedGroups.add( group ); + group.getMembers().add( indicator ); indicatorService.updateIndicatorGroup( group ); } + Set removeGroups = new HashSet( indicatorService + .getGroupsContainingIndicator( indicator ) ); + removeGroups.removeAll( selectedGroups ); + + for ( IndicatorGroup removeGroup : removeGroups ) + { + removeGroup.getMembers().remove( indicator ); + indicatorService.updateIndicatorGroup( removeGroup ); + } + return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm 2010-02-25 19:44:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm 2010-03-22 10:21:47 +0000 @@ -22,12 +22,12 @@ $i18n.getString( "data_element_group_management" ) #openHelp( "dataElementGroupEditor" ) - + - + @@ -52,9 +52,9 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js 2010-03-18 23:56:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js 2010-03-22 10:21:47 +0000 @@ -71,13 +71,34 @@ } filterAssignedGroups(); + visableAvailableDataElementGroups(); +} + +function visableAvailableDataElementGroups() +{ + var assignedGroups = byId( 'assignedGroups' ); + var availableGroups = byId( 'availableGroups' ); + var assignedOptions = assignedGroups.options; + var availableOptions = availableGroups.options; + for(var i=0;i
$i18n.getString( "available_dataelements" )$i18n.getString( "data_element_groups" ) $i18n.getString( "available_groups" )
- -