=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java' --- local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java 2011-01-14 11:48:48 +0000 +++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java 2011-01-17 07:45:29 +0000 @@ -38,6 +38,7 @@ * * @version DeTargetService.java Jan 12, 2011 12:46:10 PM */ + public interface DeTargetService { String ID = DeTargetService.class.getName(); @@ -144,7 +145,16 @@ * * @param DeTargetMember The DeTargetMember to delete. */ - int deleteDeTargetMember( DeTarget deTargetr,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo ); + //int deleteDeTargetMember( DeTarget deTargetr,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo ); + + /** + * Deletes a DeTarget. + * + * @param survey The Survey to delete. + */ + int deleteDeTargetMember( DeTargetMember deTargetMember ); + + void deleteDeTargetMembers( DeTarget deTarget ); /** * Returns Collection of DeTarget members. === modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java' --- local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java 2011-01-14 11:48:48 +0000 +++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java 2011-01-17 07:45:29 +0000 @@ -135,7 +135,14 @@ * * @param DeTargetMember The DeTargetMember to delete. */ - int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo ); + // int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo ); + + /** + * Deletes a DeTarget. + * + * @param survey The Survey to delete. + */ + int deleteDeTargetMember( DeTargetMember deTargetMember ); /** * Returns Collection of DeTarget members. === modified file 'local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java' --- local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java 2011-01-15 09:32:11 +0000 +++ local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java 2011-01-17 07:45:29 +0000 @@ -26,7 +26,9 @@ */ package org.hisp.dhis.detarget; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; @@ -121,10 +123,32 @@ { deTargetStore.updateDeTargetMember( deTargetMember ); } - + /* public int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo ) { return deTargetStore.deleteDeTargetMember( deTarget , dataelement, deoptioncombo ); } + */ + + public int deleteDeTargetMember( DeTargetMember deTargetMember ) + { + return deTargetStore.deleteDeTargetMember( deTargetMember ); + } + + public void deleteDeTargetMembers( DeTarget deTarget ) + { + List deTargetMemberList = new ArrayList( getDeTargetMembers( deTarget )); + + for( DeTargetMember dataElementTarget : deTargetMemberList ) + { + + deleteDeTargetMember( dataElementTarget ); + //deTargetService. + //selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() ); + } + + } + + } === modified file 'local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java' --- local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java 2011-01-15 09:32:11 +0000 +++ local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java 2011-01-17 07:45:29 +0000 @@ -186,7 +186,7 @@ session.update( deTargetMember ); } - +/* public int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo ) { Session session = sessionFactory.getCurrentSession(); @@ -204,6 +204,28 @@ return 0; } + */ + + public int deleteDeTargetMember( DeTargetMember deTargetMember ) + { + Session session = sessionFactory.getCurrentSession(); + + List deTargetDataValueList = new ArrayList( deTargetDataValueService.getDeTargetDataValues( deTargetMember.getDetarget() , deTargetMember.getDataelements() , deTargetMember.getDecategoryOptionCombo() ) ); + + if( deTargetDataValueList == null || deTargetDataValueList.isEmpty() ) + { + session.delete( deTargetMember ); + } + else + { + return -1; + } + + return 0; + } + + + @SuppressWarnings( "unchecked" ) public List getDeTargetMembers( DeTarget deTarget ) { === modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java 2011-01-14 12:08:54 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java 2011-01-17 07:45:29 +0000 @@ -140,7 +140,7 @@ DeTargetMember deTargetMember = new DeTargetMember( deTarget, dataElement, decoc); deTargetService.addDeTargetMember( deTargetMember ); - System.out.println( dataElement + ":" + decoc ); + // System.out.println( dataElement + ":" + decoc ); } === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +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 com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version DataElementGroupListAction.java Jan 15, 2011 1:40:28 PM + */ +public class DataElementGroupListAction implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + // ------------------------------------------------------------------------- + // Getters & Setters + // ------------------------------------------------------------------------- + + private List dataElementGroups; + + public List getDataElementGroups() + { + return dataElementGroups; + } + + + // ------------------------------------------------------------------------- + // Action + // ------------------------------------------------------------------------- + + public String execute() throws Exception + { + dataElementGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); + + Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); + + return SUCCESS; + } +} + === modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java 2011-01-14 12:08:54 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java 2011-01-17 07:45:29 +0000 @@ -36,6 +36,9 @@ import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementGroup; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetMember; +import org.hisp.dhis.detarget.DeTargetService; import com.opensymphony.xwork2.Action; @@ -57,14 +60,14 @@ { this.dataElementService = dataElementService; } -/* + private DeTargetService deTargetService; public void setDeTargetService( DeTargetService deTargetService ) { this.deTargetService = deTargetService; } -*/ + private DataElementCategoryService dataElementCategoryService; public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService ) @@ -77,7 +80,7 @@ // Getters & Setters // ------------------------------------------------------------------------- - + private String dataElementGroupId; public void setDataElementGroupId( String dataElementGroupId ) @@ -85,6 +88,8 @@ this.dataElementGroupId = dataElementGroupId; } + + /* private String selectedDataElements[]; @@ -92,7 +97,15 @@ { this.selectedDataElements = selectedDataElements; } + */ + /* + private List selectedList; + public void setSelectedList( List selectedList ) + { + this.selectedList = selectedList; + } + */ private List dataElements; public List getDataElements() @@ -115,35 +128,48 @@ return optionComboIds; } - - - + + private Integer deTargetId; + + public void setDeTargetId( Integer deTargetId ) + { + this.deTargetId = deTargetId; + } + + private List selectedDeTargetMember; + + public List getSelectedDeTargetMember() + { + return selectedDeTargetMember; + } // ------------------------------------------------------------------------- // Action // ------------------------------------------------------------------------- + public String execute() throws Exception { optionComboIds = new ArrayList(); optionComboNames = new ArrayList(); - - - + selectedDeTargetMember = new ArrayList(); + + //System.out.println(" deTarget Id is : " + deTargetId ); if ( dataElementGroupId == null || dataElementGroupId.equalsIgnoreCase( "ALL" ) ) { - System.out.println("\n\n +++ \n Inside dataElementGroupId null dataElementGroup Id is : " + dataElementGroupId ); + //System.out.println("\n\n +++ \n Inside dataElementGroupId null dataElementGroup Id is : " + dataElementGroupId ); dataElements = new ArrayList( dataElementService.getAllDataElements() ); } else { - DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroupId ) ); + //System.out.println("\n\n +++ \n Inside dataElementGroupId " + dataElementGroupId ); + DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroupId ) ); - dataElements = new ArrayList( dataElementGroup.getMembers() ); + dataElements = new ArrayList( dataElementGroup.getMembers() ); } - + /* if ( selectedDataElements != null && selectedDataElements.length > 0 ) { Iterator iter = dataElements.iterator(); @@ -163,6 +189,24 @@ } } } +*/ + + if ( deTargetId != null ) + { + DeTarget deTarget = deTargetService.getDeTarget( deTargetId ); + + List deTargetMemberList = new ArrayList(deTargetService.getDeTargetMembers( deTarget )); + for( DeTargetMember dataElementTarget : deTargetMemberList ) + { + selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() ); + } + //indicators.removeAll( survey.getIndicators() ); + } + + // Collections.sort( indicators, indicatorComparator ); + + // displayPropertyHandler.handle( indicators ); + Iterator deIterator = dataElements.iterator(); @@ -177,24 +221,21 @@ while ( optionComboIterator.hasNext() ) { DataElementCategoryOptionCombo decoc = optionComboIterator.next(); + + String deOptComboId = de.getId() + ":" + decoc.getId(); + + + + if( !selectedDeTargetMember.contains( deOptComboId ) ) + { optionComboIds.add( de.getId() + ":" + decoc.getId() ); optionComboNames.add( de.getName() + ":" + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() ); } + + } } -/* - if ( surveyId != null ) - { - Survey survey = surveyService.getSurvey( surveyId ); - - indicators.removeAll( survey.getIndicators() ); - } - - // Collections.sort( indicators, indicatorComparator ); - - // displayPropertyHandler.handle( indicators ); -*/ return SUCCESS; } } === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.source.Source; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version DefineDeTargetAssociationsAction.java Jan 15, 2011 11:21:06 AM + */ +public class DefineDeTargetAssociationsAction implements Action +{ + + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private SelectionTreeManager selectionTreeManager; + + public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) + { + this.selectionTreeManager = selectionTreeManager; + } + + private DeTargetService deTargetService; + + public void setDeTargetService( DeTargetService deTargetService ) + { + this.deTargetService = deTargetService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + + // ------------------------------------------------------------------------- + // Getters & Setters + // ------------------------------------------------------------------------- + + private int deTargetId; + + public void setDeTargetId( int deTargetId ) + { + this.deTargetId = deTargetId; + } + + // ------------------------------------------------------------------------- + // Action + // ------------------------------------------------------------------------- + + public String execute() throws Exception + { + + Collection rootUnits = selectionTreeManager.getRootOrganisationUnits(); + + Set unitsInTheTree = new HashSet(); + + organisationUnitService.getUnitsInTheTree( rootUnits, unitsInTheTree ); + + DeTarget deTarget = deTargetService.getDeTarget( deTargetId ); + + System.out.println( " DeTarget Id : " + deTarget.getId() + " DETarget Name " + deTarget.getName() ); + + Set assignedSources = deTarget.getSources(); + + assignedSources.removeAll( convert( unitsInTheTree ) ); + + Collection selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits(); + + assignedSources.addAll( organisationUnitService.convert( selectedOrganisationUnits ) ); + + deTarget.setSources( assignedSources ); + + System.out.println( " size of selected Organisation Units : " + selectedOrganisationUnits.size() + " Size of assigned Sources " + assignedSources.size() ); + + deTargetService.updateDeTarget( deTarget ); + + return SUCCESS; + } + + // ------------------------------------------------------------------------- + // Supportive methods + // ------------------------------------------------------------------------- + + private Set convert( Collection organisationUnits ) + { + Set sources = new HashSet(); + + sources.addAll( organisationUnits ); + + return sources; + } + /* + private void getUnitsInTheTree( Collection rootUnits, Set unitsInTheTree ) + { + for( OrganisationUnit root : rootUnits ) + { + unitsInTheTree.add( root ); + getUnitsInTheTree( root.getChildren(), unitsInTheTree ); + } + }*/ +} + === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetService; +import org.hisp.dhis.i18n.I18n; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version DelDeTargetAction.java Jan 15, 2011 5:07:57 PM + */ +public class DelDeTargetAction implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DeTargetService deTargetService; + + public void setDeTargetService( DeTargetService deTargetService ) + { + this.deTargetService = deTargetService; + } + + // ------------------------------------------------------------------------- + // Getters & setters + // ------------------------------------------------------------------------- + + + private I18n i18n; + + public void setI18n( I18n i18n ) + { + this.i18n = i18n; + } + + + private int deTargetId; + + public void setDeTargetId( int deTargetId ) + { + this.deTargetId = deTargetId; + } + + private String message; + + public String getMessage() + { + return message; + } + + private String status; + + public String getStatus() + { + return status; + } + /* + private List deTargetMemberList; + + public List getDeTargetMemberList() + { + return deTargetMemberList; + }*/ + // ------------------------------------------------------------------------- + // Action + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + + status = "success"; + + + + DeTarget deTarget = deTargetService.getDeTarget( deTargetId ); + + deTargetService.deleteDeTargetMembers( deTarget );//delete target Members(that is delete dataElements ) + + //deTargetMemberList = new ArrayList(deTargetService.getDeTargetMembers( deTarget )); + + /* + for( DeTargetMember dataElementTarget : deTargetMemberList ) + { + + deTargetService.deleteDeTargetMember( dataElementTarget ); + //deTargetService. + //selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() ); + } + + */ + + // DeTarget deTarget = deTargetService.getDeTarget( deTargetId ); + + + int flag = deTargetService.deleteDeTarget( deTarget ); // delete deTarget + + System.out.println( " Delete flag is flag is " + flag ); + if ( flag < 0 ) + { + status = "error"; + String delMseg = i18n.getString( "not_del_contain_data" ); + message = deTarget.getName() + " : "+ delMseg; + + return ERROR; + } + + return SUCCESS; + } +} === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementGroup; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetMember; +import org.hisp.dhis.detarget.DeTargetService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version GetDeTargetAction.java Jan 15, 2011 1:16:51 PM + */ +public class GetDeTargetAction implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DeTargetService deTargetService; + + public void setDeTargetService( DeTargetService deTargetService ) + { + this.deTargetService = deTargetService; + } + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + // ------------------------------------------------------------------------- + // Getters & Setters + // ------------------------------------------------------------------------- + + private List dataElementGroups; + + public List getDataElementGroups() + { + return dataElementGroups; + } + + private int deTargetId; + + public void setDeTargetId( int deTargetId ) + { + this.deTargetId = deTargetId; + } + + private DeTarget deTarget; + + public DeTarget getDeTarget() + { + return deTarget; + } + + private List deTargetDataElement; + + + public List getDeTargetDataElement() + { + return deTargetDataElement; + } + + private String description; + + public void setDescription( String description ) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + private List deTargetMemberList; + + public List getDeTargetMemberList() + { + return deTargetMemberList; + } + + // ------------------------------------------------------------------------- + // Action + // ------------------------------------------------------------------------- + + + + public String execute() + throws Exception + { + deTarget = deTargetService.getDeTarget( deTargetId ); + + deTargetMemberList = new ArrayList(deTargetService.getDeTargetMembers( deTarget )); + + dataElementGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); + + Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); + + + + + + //deTargetDataElement = new ArrayList( deTarget. ); + + //Collections.sort( surveyIndicators, dataElementComparator ); + + //displayPropertyHandler.handle( dataSetDataElements ); + + //dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet ); + + return SUCCESS; + } +} === modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java 2011-01-14 12:08:54 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java 2011-01-17 07:45:29 +0000 @@ -111,7 +111,7 @@ public String execute() throws Exception { - System.out.println( " DeTarget ID : " + deTargetId ); + //System.out.println( " DeTarget ID : " + deTargetId ); deTarget = deTargetService.getDeTarget( deTargetId ); // survey = surveyService.getSurvey( surveyId ); @@ -128,8 +128,8 @@ } - System.out.println( " DeTarget Id : " + deTarget.getId() + " DETarget Name " + deTarget.getName() + " DETarget Description " + deTarget.getDescription() ); - System.out.println( " DeTarget URL : " + deTarget.getUrl() + " dataElementSize " +dataElementSize ); + // System.out.println( " DeTarget Id : " + deTarget.getId() + " DETarget Name " + deTarget.getName() + " DETarget Description " + deTarget.getDescription() ); + // System.out.println( " DeTarget URL : " + deTarget.getUrl() + " dataElementSize " +dataElementSize ); //surveyIndicators = new ArrayList( survey.getIndicators() ); === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +import java.util.List; + +import org.hisp.dhis.organisationunit.OrganisationUnitLevel; +import org.hisp.dhis.organisationunit.OrganisationUnitService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version GetNumberOfLevelsAction.java Jan 15, 2011 10:59:21 AM + */ +public class GetNumberOfLevelsAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private List levels; + + public List getLevels() + { + return levels; + } + + // ------------------------------------------------------------------------- + // ActionSupport implementation + // ------------------------------------------------------------------------- + + public String execute() + { + levels = organisationUnitService.getOrganisationUnitLevels(); + + return SUCCESS; + } +} === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.source.Source; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version SetupAssociationsTreeAction.java Jan 15, 2011 11:08:15 AM + */ +public class SetupAssociationsTreeAction implements Action +{ + + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private SelectionTreeManager selectionTreeManager; + + public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) + { + this.selectionTreeManager = selectionTreeManager; + } + + private DeTargetService deTargetService; + + public void setDeTargetService( DeTargetService deTargetService ) + { + this.deTargetService = deTargetService; + } + + // ------------------------------------------------------------------------- + // Getters & Setters + // ------------------------------------------------------------------------- + + private int deTargetId; + + + + public int getDeTargetId() + { + return deTargetId; + } + + public void setDeTargetId( int deTargetId ) + { + this.deTargetId = deTargetId; + } + + private DeTarget deTarget; + + public DeTarget getDeTarget() + { + return deTarget; + } + + public void setDeTarget( DeTarget deTarget ) + { + this.deTarget = deTarget; + } + + + // ------------------------------------------------------------------------- + // Execute + // ------------------------------------------------------------------------- + + + + public String execute() throws Exception + { + deTarget = deTargetService.getDeTarget( deTargetId ); + + selectionTreeManager.setSelectedOrganisationUnits( convert( deTarget.getSources() ) ); + + return SUCCESS; + } + + // ------------------------------------------------------------------------- + // Supportive methods + // ------------------------------------------------------------------------- + + private Set convert( Collection sources ) + { + Set organisationUnits = new HashSet(); + + for ( Source source : sources ) + { + organisationUnits.add( (OrganisationUnit) source ); + } + + return organisationUnits; + } +} + === added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java 2011-01-17 07:45:29 +0000 @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2004-2010, 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. + */ +package org.hisp.dhis.detarget.action; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementCategoryService; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetMember; +import org.hisp.dhis.detarget.DeTargetService; + + + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + * + * @version UpdateDeTargetAction.java Jan 15, 2011 4:04:58 PM + */ +public class UpdateDeTargetAction implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DeTargetService deTargetService; + + public void setDeTargetService( DeTargetService deTargetService ) + { + this.deTargetService = deTargetService; + } + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + private DataElementCategoryService dataElementCategoryService; + + public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService ) + { + this.dataElementCategoryService = dataElementCategoryService; + } + // ------------------------------------------------------------------------- + // Getters & Setters + // ------------------------------------------------------------------------- + + private int deTargetId; + + + public void setDeTargetId( int deTargetId ) + { + this.deTargetId = deTargetId; + } + + private String name; + + public void setName( String name ) + { + this.name = name; + } + + private String shortName; + + public void setShortName( String shortName ) + { + this.shortName = shortName; + } + + private String url; + + public void setUrl( String url ) + { + this.url = url; + } + + private String description; + + public void setDescription( String description ) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + + private Collection selectedList = new HashSet(); + + public void setSelectedList( Collection selectedList ) + { + this.selectedList = selectedList; + } + + + private List deTargetMemberList; + + public List getDeTargetMemberList() + { + return deTargetMemberList; + } + + // ------------------------------------------------------------------------- + // Action + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + // --------------------------------------------------------------------- + // Prepare values + // --------------------------------------------------------------------- + + if ( shortName != null && shortName.trim().length() == 0 ) + { + shortName = null; + } + + System.out.println( " \n+++++++++ deTarget Id:" + deTargetId ); + + DeTarget deTarget = deTargetService.getDeTarget( deTargetId ); + //deTargetService.getDeTarget( deTargetId ); + deTarget.setName( name ); + deTarget.setShortName( shortName ); + deTarget.setUrl( url ); + deTarget.setDescription( description ); + + deTargetMemberList = new ArrayList(deTargetService.getDeTargetMembers( deTarget )); + + + //Collection updatedIndicatorList = new HashSet(); + + deTargetService.deleteDeTargetMembers( deTarget ); + + /* + for( DeTargetMember dataElementTarget : deTargetMemberList ) + { + + deTargetService.deleteDeTargetMember( dataElementTarget ); + //deTargetService. + //selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() ); + } + */ + + + for ( String selectedId : selectedList ) + { + String[] parts = selectedId.split( ":" ); + DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( parts[0] ) ); + DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( parts[1] )); + + DeTargetMember deTargetMember = new DeTargetMember( deTarget, dataElement, decoc); + + deTargetService.addDeTargetMember( deTargetMember ); + //System.out.println( dataElement + ":" + decoc ); + + + } + return SUCCESS; + } +} + === modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java' --- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java 2011-01-14 12:08:54 +0000 +++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java 2011-01-17 07:45:29 +0000 @@ -44,14 +44,14 @@ // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- -/* + private DeTargetService deTargetService; public void setDeTargetService( DeTargetService deTargetService ) { this.deTargetService = deTargetService; } - */ + // ------------------------------------------------------------------------- // I18n // ------------------------------------------------------------------------- @@ -63,14 +63,14 @@ { this.i18n = i18n; } -/* - private Integer surveyId; + + private Integer deTargetId; - public void setSurveyId( Integer surveyId ) + public void setDeTargetId( Integer deTargetId ) { - this.surveyId = surveyId; + this.deTargetId = deTargetId; } -*/ + private String name; public void setName( String name ) @@ -123,17 +123,17 @@ return INPUT; } -/* + DeTarget match = deTargetService.getDeTargetByName( name ); - if ( match != null && ( surveyId == null || match.getId() != surveyId ) ) + if ( match != null && ( deTargetId == null || match.getId() != deTargetId ) ) { message = i18n.getString( "duplicate_names" ); return INPUT; - }*/ + + } } - // --------------------------------------------------------------------- // Short name // --------------------------------------------------------------------- @@ -155,17 +155,17 @@ return INPUT; } - //DeTarget match = deTargetService.getDeTargetByName( shortName ); - /* - if ( match != null && ( surveyId == null || match.getId() != surveyId ) ) + DeTarget match = deTargetService.getDeTargetByShortName( shortName ); + + if ( match != null && ( deTargetId == null || match.getId() != deTargetId ) ) { message = i18n.getString( "duplicate_short_names" ); return INPUT; - }*/ + } } message = "validation success"; return SUCCESS; } -} + } === modified file 'local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml' --- local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml 2011-01-15 11:35:42 +0000 +++ local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml 2011-01-17 07:45:29 +0000 @@ -228,7 +228,7 @@ - + @@ -236,45 +236,45 @@ ref="org.hisp.dhis.survey.state.SelectedStateManager"/> - - - + - + - - - - - - + - + - - + ref="org.hisp.dhis.dataelement.DataElementCategoryService"/> - + @@ -282,10 +282,10 @@ ref="org.hisp.dhis.dataelement.DataElementService"/> - + - + @@ -294,18 +294,18 @@ - - - + - + @@ -314,10 +314,12 @@ + ref="org.hisp.dhis.dataelement.DataElementCategoryService"/> - + + + @@ -347,6 +349,13 @@ + + + + + - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + === modified file 'local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties' --- local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties 2011-01-15 11:35:42 +0000 +++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties 2011-01-17 07:45:29 +0000 @@ -3,8 +3,6 @@ survey_data_entry = Survey Data Entry survey = Survey de_target = DataElement Target - - add_new = Add New name = Name operations = Operations @@ -55,15 +53,19 @@ not_del_contain_data = Not Deleted Its Contains Data confirm_delete_survey = Are you sure you want to Remove Survey? number_of_dataelements = Number of DataElements -detarget_mamagement = DE Target Management +detarget_mamagement = DataElement Target Management de_target_mamagement = DataElement Target Management add_deTarget = Add DataElement Target deTarget_details = DataElement Target Details available_dataElements = Available DataElements selected_dataElements = Selected DataElements group = Group +define_detarget_associations = Define DataElement Target Associations select_deGroup_all = Select DataElementGroup / All -detarget_data_entry = DeTarget Data Entry +detarget_data_entry = DataElement Target Data Entry sl_no = Sl. No. dataelement = DataElement value = Value +edit_detarget = Edit DataElement Target +detarget_details DataElement Target Details +detarget_dataentry = DataElement Target Data Entry === modified file 'local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties' --- local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties 2011-01-15 11:35:42 +0000 +++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties 2011-01-17 07:45:29 +0000 @@ -55,9 +55,9 @@ not_del_contain_data = Not Deleted Its Contains Data confirm_delete_survey = Are you sure you want to Remove Survey? detarget_data_entry = DeTarget Data Entry - -detarget_mamagement = DE Target Management de_target_mamagement = DataElement Target Management +detarget_mamagement = DataElement Target Management +detarget_dataentry = DataElement Target Data Entry add_deTarget = Add DataElement Target deTarget_details = DataElement Target Details available_dataElements = Available DataElements === modified file 'local/in/dhis-web-survey/src/main/resources/struts.xml' --- local/in/dhis-web-survey/src/main/resources/struts.xml 2011-01-15 11:35:42 +0000 +++ local/in/dhis-web-survey/src/main/resources/struts.xml 2011-01-17 07:45:29 +0000 @@ -212,7 +212,7 @@ + class="org.hisp.dhis.target.action.GenerateTargetAction"> /main.vm /dhis-web-survey/targetFront.vm /dhis-web-survey/menu.vm @@ -221,83 +221,84 @@ + class="org.hisp.dhis.target.action.SaveMappingAction"> /dhis-web-survey/responseDe.vm plainTextError + class="org.hisp.dhis.target.action.DelMappingAction"> /dhis-web-survey/responseDe.vm plainTextError - - - - selectTarget.action - - - - - defaulttargetform - /main.vm - /dhis-web-survey/selectTarget.vm - /dhis-web-survey/menuWithTreeForDeTarget.vm - 350 - - ../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/form.js - - style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css - - - - - /main.vm - /dhis-web-survey/targetForm.vm - /dhis-web-survey/menuWithTreeForDeTarget.vm - 350 - ../dhis-web-commons/ouwt/ouwt.js, - javascript/general.js,javascript/form.js, - javascript/form.js,../dhis-web-commons/calendar/calendar.js, - ../dhis-web-commons/calendar/calendar-lang.js, - ../dhis-web-commons/calendar/calendar-setup.js - - style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css - - - - status.vm - plainTextError - - - - - ../dhis-web-commons/ajax/jsonPeriods.vm - - - + class="org.hisp.dhis.target.action.GetDataElementsAction"> /dhis-web-survey/responseDataElement.vm plainTextError + class="org.hisp.dhis.target.action.GetMesageAction"> /dhis-web-survey/responseDe.vm plainTextError + + + + + selectTarget.action + + + + + defaulttargetform + /main.vm + /dhis-web-survey/selectTarget.vm + /dhis-web-survey/menuWithTreeForDeTarget.vm + 350 + + ../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/form.js + + style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css + + + + + /main.vm + /dhis-web-survey/targetForm.vm + /dhis-web-survey/menuWithTreeForDeTarget.vm + 350 + ../dhis-web-commons/ouwt/ouwt.js, + javascript/general.js,javascript/form.js, + javascript/form.js,../dhis-web-commons/calendar/calendar.js, + ../dhis-web-commons/calendar/calendar-lang.js, + ../dhis-web-commons/calendar/calendar-setup.js + + style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css + + + + status.vm + plainTextError + + + + + ../dhis-web-commons/ajax/jsonPeriods.vm + + + /main.vm @@ -342,6 +343,69 @@ plainTextError + + + + defineDeTargetAssociationsFormChain + + + + + /main.vm + /dhis-web-survey/deTargetAssociations.vm + ../dhis-web-commons/oust/oust.js,javascript/associations.js + + + + + deTargetManagement.action + + + + + + + + + + /main.vm + /dhis-web-survey/editDeTarget.vm + javascript/deTarget.js,javascript/filterTable.js + + + + + deTargetManagement.action + javascript/deTarget.js,javascript/filterTable.js + + + + + + + /dhis-web-survey/responseSuccess.vm + /dhis-web-survey/responseError.vm + + === modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm' --- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm 2011-01-14 12:08:54 +0000 +++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm 2011-01-17 07:45:29 +0000 @@ -38,7 +38,7 @@ $i18n.getString( "available_dataElements" ) - $i18n.getString( "filter" ) + ##$i18n.getString( "filter" ) $i18n.getString( "selected_dataElements" ) @@ -55,14 +55,16 @@ #end - $i18n.getString( "group" ) + ##$i18n.getString( "group" ) - - $i18n.getString( "name" ) - + + + ##$i18n.getString( "name" ) + + === added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm' --- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm 2011-01-17 07:45:29 +0000 @@ -0,0 +1,23 @@ +

$i18n.getString( "define_detarget_associations" )

+ +

$encoder.htmlEncode( $deTarget.name )

+ +
+
+ +
+ + + + + + + +
+ #organisationUnitSelectionTree( false, true, false ) +
+ + +
+ +
\ No newline at end of file === modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm' --- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm 2011-01-14 12:08:54 +0000 +++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm 2011-01-17 07:45:29 +0000 @@ -1,5 +1,5 @@ -

$i18n.getString( "de_target_mamagement" )t

+

$i18n.getString( "de_target_mamagement" )

@@ -29,13 +29,13 @@ $encoder.htmlEncode( $deTarget.name ) - - + +
- $i18n.getString( - - $i18n.getString( - - $i18n.getString( + $i18n.getString( + + $i18n.getString( + + $i18n.getString( $i18n.getString( === added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm' --- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm 2011-01-17 07:45:29 +0000 @@ -0,0 +1,105 @@ + +

$i18n.getString( "edit_detarget" )

+ +
+
+ +
+ + + ## Labels + ## Input + + + + + + + + + + + + + + + + + + + + + + + + +
$i18n.getString( "detarget_details" )
  
+ + + ## Available Indicators + ## Filter + ## Selected Indicators + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
$i18n.getString( "available_dataElements" )##$i18n.getString( "filter" )$i18n.getString( "selected_dataElements" )
+ + ##$i18n.getString( "group" )
##$i18n.getString( "name" )
+ + + + +
+ +
+ + +
+ +
+
+ + + === modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js' --- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js 2011-01-15 11:35:42 +0000 +++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js 2011-01-17 07:45:29 +0000 @@ -3,29 +3,29 @@ // Delete Survey // ----------------------------------------------------------------------------- -var tmpSurveyId; - -var tmpSource; - -function removeSurvey( surveyId, surveyName ) +//var tmpSurveyId; + +//var tmpSource; + +function removeDeTarget( deTargetId, deTargetName ) { - var result = window.confirm( i18n_confirm_delete + '\n\n' + " Survey Id =" + surveyId + '\n\n' + " Survey Name =" + surveyName ); + var result = window.confirm( i18n_confirm_delete + '\n\n' + " DeTarget Id =" + deTargetId + '\n\n' + " DeTarget Name =" + deTargetName ); if ( result ) { - $.post("delSurvey.action", + $.post("delDeTarget.action", { - surveyId : surveyId + deTargetId : deTargetId }, function (data) { - removeSurveyCompleted(data); + removeDeTargetCompleted(data); },'xml'); } } -function removeSurveyCompleted( messageElement ) +function removeDeTargetCompleted( messageElement ) { messageElement = messageElement.getElementsByTagName( "message" )[0]; var type = messageElement.getAttribute( "type" ); @@ -40,7 +40,7 @@ } else { - window.location.href = 'index.action'; + window.location.href = 'deTargetManagement.action'; } } @@ -54,13 +54,13 @@ }, function (data) { - addSurveyValidationCompleted(data); + addDeTargetValidationCompleted(data); },'xml'); return false; } -function addSurveyValidationCompleted( messageElement ) +function addDeTargetValidationCompleted( messageElement ) { messageElement = messageElement.getElementsByTagName( "message" )[0]; var type = messageElement.getAttribute( "type" ); @@ -82,38 +82,39 @@ } -function validateEditSurvey() +function validateEditDeTarget() { - $.post("validateSurvey.action", + //alert("inside update"); + $.post("validateDeTarget.action", { name : byId( 'name' ).value, shortName : byId( 'shortName' ).value, url : byId( 'url' ).value, - surveyId : byId( 'surveyId' ).value + deTargetId : byId( 'deTargetId' ).value }, function (data) { - editSurveyValidationCompleted(data); + editDeTargetValidationCompleted(data); },'xml'); return false; } -function editSurveyValidationCompleted( messageElement ) +function editDeTargetValidationCompleted( messageElement ) { + //alert("inside update result"); messageElement = messageElement.getElementsByTagName( "message" )[0]; var type = messageElement.getAttribute( "type" ); var message = messageElement.firstChild.nodeValue; if ( type == 'success' ) { - // Both edit and add form has id='dataSetForm' var selectedList = document.getElementById( 'selectedList' ); for(var k=0;k
  • $i18n.getString( "detarget_mamagement" )
  • -
  • DeTarget Data Entry
  • +
  • $i18n.getString( "detarget_dataentry" )
  • === modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm' --- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm 2011-01-15 11:35:42 +0000 +++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm 2011-01-17 07:45:29 +0000 @@ -8,7 +8,8 @@ $i18n.getString( -#parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) +##parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) +#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )