dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09577
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2567: Work in Progress in DataElementTarget Module
------------------------------------------------------------
revno: 2567
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-01-14 17:38:54 +0530
message:
Work in Progress in DataElementTarget Module
added:
local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/
local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/
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/DataElementListFilterByGroupAction.java
local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetAddFormAction.java
local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetListAction.java
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/ValidateDeTargetAction.java
local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/
local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties
local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm
local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm
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/responseDataElementGroupMember.vm
local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDeTargetObject.vm
modified:
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetDataElementsForTabularAnalysisAction.java
local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties
local/in/dhis-web-survey/src/main/resources/struts.xml
local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetDataElementsForTabularAnalysisAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetDataElementsForTabularAnalysisAction.java 2011-01-13 09:39:35 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetDataElementsForTabularAnalysisAction.java 2011-01-14 12:08:54 +0000
@@ -153,8 +153,7 @@
DataElement de = deIterator.next();
DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
- List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
- dataElementCategoryCombo.getOptionCombos() );
+ List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
while ( optionComboIterator.hasNext() )
=== added directory 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget'
=== added directory 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action'
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java 2011-01-14 12:08:54 +0000
@@ -0,0 +1,155 @@
+/*
+ * 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 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 AddDeTargetAction.java Jan 14, 2011 3:48:26 PM
+ */
+public class AddDeTargetAction 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;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & output
+ // -------------------------------------------------------------------------
+
+ 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;
+ }
+
+ private Collection<String> selectedList = new HashSet<String>();
+
+ public void setSelectedList( Collection<String> selectedList )
+ {
+ this.selectedList = selectedList;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ // ---------------------------------------------------------------------
+ // Prepare values
+ // ---------------------------------------------------------------------
+
+ if ( shortName != null && shortName.trim().length() == 0 )
+ {
+ shortName = null;
+ }
+
+ DeTarget deTarget = new DeTarget( name, shortName, url, description );
+ int deTargetId = deTargetService.addDeTarget( deTarget );
+
+ deTarget = deTargetService.getDeTarget( deTargetId );
+
+ 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 );
+
+
+ }
+
+ //DeTargetMember deTargetMember = new DeTargetMember( );
+
+
+
+ return SUCCESS;
+ }
+}
+
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java 2011-01-14 12:08:54 +0000
@@ -0,0 +1,201 @@
+/*
+ * 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.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DataElementListFilterByGroupAction.java Jan 13, 2011 7:09:15 PM
+ */
+public class DataElementListFilterByGroupAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+/*
+ private DeTargetService deTargetService;
+
+ public void setDeTargetService( DeTargetService deTargetService )
+ {
+ this.deTargetService = deTargetService;
+ }
+*/
+ private DataElementCategoryService dataElementCategoryService;
+
+ public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+ {
+ this.dataElementCategoryService = dataElementCategoryService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+
+ private String dataElementGroupId;
+
+ public void setDataElementGroupId( String dataElementGroupId )
+ {
+ this.dataElementGroupId = dataElementGroupId;
+ }
+
+ private String selectedDataElements[];
+
+
+ public void setSelectedDataElements( String[] selectedDataElements )
+ {
+ this.selectedDataElements = selectedDataElements;
+ }
+
+ private List<DataElement> dataElements;
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+
+ private List<String> optionComboNames;
+
+ public List<String> getOptionComboNames()
+ {
+ return optionComboNames;
+ }
+
+ private List<String> optionComboIds;
+
+ public List<String> getOptionComboIds()
+ {
+ return optionComboIds;
+ }
+
+
+
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+
+ optionComboIds = new ArrayList<String>();
+ optionComboNames = new ArrayList<String>();
+
+
+
+
+ if ( dataElementGroupId == null || dataElementGroupId.equalsIgnoreCase( "ALL" ) )
+ {
+ System.out.println("\n\n +++ \n Inside dataElementGroupId null dataElementGroup Id is : " + dataElementGroupId );
+ dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
+ }
+ else
+ {
+ DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroupId ) );
+
+ dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
+ }
+
+
+ if ( selectedDataElements != null && selectedDataElements.length > 0 )
+ {
+ Iterator<DataElement> iter = dataElements.iterator();
+
+ while ( iter.hasNext() )
+ {
+ DataElement dataElement = iter.next();
+ //System.out.println("\n\n +++ \n Indicator Id is : " + indicator.getId() + " , Indicator name is :" + indicator.getName() );
+
+ for ( int i = 0; i < selectedDataElements.length; i++ )
+ {
+ //System.out.println("\n\n +++ \n Indicator Id is : " + indicator.getId() + " , Indicator name is :" + indicator.getName() );
+ if ( dataElement.getId() == Integer.parseInt( selectedDataElements[i] ) )
+ {
+ iter.remove();
+ }
+ }
+ }
+ }
+
+
+ Iterator<DataElement> deIterator = dataElements.iterator();
+ while ( deIterator.hasNext() )
+ {
+ DataElement de = deIterator.next();
+
+ DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
+ List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
+
+ Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+ while ( optionComboIterator.hasNext() )
+ {
+ DataElementCategoryOptionCombo decoc = optionComboIterator.next();
+ 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/DeTargetAddFormAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetAddFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetAddFormAction.java 2011-01-14 12:08:54 +0000
@@ -0,0 +1,105 @@
+/*
+ * 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.dataelement.comparator.DataElementNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DeTargetAddFormAction.java Jan 13, 2011 3:19:19 PM
+ */
+public class DeTargetAddFormAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+ private List<DataElement> dataElements;
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+
+ private List<DataElementGroup> dataElementGroups;
+
+ public List<DataElementGroup> getDataElementGroups()
+ {
+ return dataElementGroups;
+ }
+
+ // -------------------------------------------------------------------------
+ // Execute
+ // -------------------------------------------------------------------------
+
+ public String execute()throws Exception
+ {
+
+
+ /* DataElements and Groups */
+ dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
+ dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+ Collections.sort( dataElements, new DataElementNameComparator() );
+ Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
+
+ // indicatorgroups = new ArrayList<IndicatorGroup>(indicatorService.getAllIndicatorGroups() );
+
+ // indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
+
+ // Collections.sort( indicators, indicatorComparator );
+
+ //displayPropertyHandler.handle( indicators );
+
+ return SUCCESS;
+ }
+}
+
=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetListAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetListAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DeTargetListAction.java 2011-01-14 12:08:54 +0000
@@ -0,0 +1,80 @@
+/*
+ * 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.List;
+
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DeTargetListAction.java Jan 13, 2011 2:53:19 PM
+ */
+public class DeTargetListAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DeTargetService deTargetService;
+
+ public void setDeTargetService( DeTargetService deTargetService )
+ {
+ this.deTargetService = deTargetService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+ private List<DeTarget> deTargets;
+
+ public List<DeTarget> getDeTargets()
+ {
+ return deTargets;
+ }
+
+ // -------------------------------------------------------------------------
+ // Execute
+ // -------------------------------------------------------------------------
+
+
+ public String execute() throws Exception
+ {
+ deTargets = new ArrayList<DeTarget>( deTargetService.getAllDeTargets() );
+
+ return SUCCESS;
+ }
+}
+
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java 2011-01-14 12:08:54 +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.ArrayList;
+import java.util.List;
+
+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 GetDeTargetDetailsAction.java Jan 13, 2011 4:25:23 PM
+ */
+public class GetDeTargetDetailsAction implements Action
+{
+
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DeTargetService deTargetService;
+
+ public void setDeTargetService( DeTargetService deTargetService )
+ {
+ this.deTargetService = deTargetService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+
+ private int 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;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ private Integer dataElementSize;
+
+ public Integer getDataElementSize()
+ {
+ return dataElementSize;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+
+
+ public String execute()
+ throws Exception
+ {
+ System.out.println( " DeTarget ID : " + deTargetId );
+
+ deTarget = deTargetService.getDeTarget( deTargetId );
+ // survey = surveyService.getSurvey( surveyId );
+
+ List<DeTargetMember> targetDataElements = new ArrayList<DeTargetMember>( deTargetService.getDeTargetMembers( deTarget ) );
+
+ if ( targetDataElements == null || targetDataElements.size() == 0 )
+ {
+ dataElementSize = 0;
+ }
+ else
+ {
+ dataElementSize = targetDataElements.size();
+
+ }
+
+ 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<Indicator>( survey.getIndicators() );
+
+ //Collections.sort( surveyIndicators, dataElementComparator );
+
+ //displayPropertyHandler.handle( dataSetDataElements );
+
+ //dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet );
+
+ return SUCCESS;
+ }
+}
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java 2011-01-14 12:08:54 +0000
@@ -0,0 +1,171 @@
+/*
+ * 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 ValidateDeTargetAction.java Jan 14, 2011 11:10:57 AM
+ */
+public class ValidateDeTargetAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+/*
+ private DeTargetService deTargetService;
+
+ public void setDeTargetService( DeTargetService deTargetService )
+ {
+ this.deTargetService = deTargetService;
+ }
+ */
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+/*
+ private Integer surveyId;
+
+ public void setSurveyId( Integer surveyId )
+ {
+ this.surveyId = surveyId;
+ }
+*/
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String shortName;
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Execution
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ // ---------------------------------------------------------------------
+ // Name
+ // ---------------------------------------------------------------------
+
+ if ( name == null )
+ {
+ message = i18n.getString( "specify_name" );
+
+ return INPUT;
+ }
+ else
+ {
+ name = name.trim();
+
+ if ( name.length() == 0 )
+ {
+ message = i18n.getString( "specify_name" );
+
+ return INPUT;
+ }
+/*
+ DeTarget match = deTargetService.getDeTargetByName( name );
+
+ if ( match != null && ( surveyId == null || match.getId() != surveyId ) )
+ {
+ message = i18n.getString( "duplicate_names" );
+
+ return INPUT;
+ }*/
+ }
+
+ // ---------------------------------------------------------------------
+ // Short name
+ // ---------------------------------------------------------------------
+
+ if ( shortName == null )
+ {
+ message = i18n.getString( "specify_short_name" );
+
+ return INPUT;
+ }
+ else
+ {
+ shortName = shortName.trim();
+
+ if ( shortName.length() == 0 )
+ {
+ message = i18n.getString( "specify_short_name" );
+
+ return INPUT;
+ }
+
+ //DeTarget match = deTargetService.getDeTargetByName( shortName );
+ /*
+ if ( match != null && ( surveyId == null || match.getId() != surveyId ) )
+ {
+ 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 2010-09-10 11:35:58 +0000
+++ local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml 2011-01-14 12:08:54 +0000
@@ -264,6 +264,61 @@
ref="org.hisp.dhis.target.DeTargetMappingService"/>
<property name="dataElementCategoryService"
ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
- </bean>
+ </bean>
+
+ <!-- DataElement Targets -->
+ <bean id="org.hisp.dhis.detarget.action.DeTargetListAction"
+ class="org.hisp.dhis.detarget.action.DeTargetListAction"
+ scope="prototype">
+ <property name="deTargetService"
+ ref="org.hisp.dhis.detarget.DeTargetService"/>
+ </bean>
+
+ <!-- Add DataElement Target form -->
+ <bean id="org.hisp.dhis.detarget.action.DeTargetAddFormAction"
+ class="org.hisp.dhis.detarget.action.DeTargetAddFormAction"
+ scope="prototype">
+ <property name="dataElementService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
+ </property>
+ </bean>
+
+ <!-- Add DataElement Target Result -->
+ <bean id="org.hisp.dhis.detarget.action.AddDeTargetAction"
+ class="org.hisp.dhis.detarget.action.AddDeTargetAction"
+ scope="prototype">
+ <property name="deTargetService" ref="org.hisp.dhis.detarget.DeTargetService">
+ </property>
+ <property name="dataElementService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
+ </property>
+ <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService">
+ </property>
+ </bean>
+
+
+ <!-- Show Details DataElement Target -->
+ <bean id="org.hisp.dhis.detarget.action.GetDeTargetDetailsAction"
+ class="org.hisp.dhis.detarget.action.GetDeTargetDetailsAction"
+ scope="prototype">
+ <property name="deTargetService">
+ <ref bean="org.hisp.dhis.detarget.DeTargetService"/>
+ </property>
+ </bean>
+
+ <!-- DataElement Group Member in DataElement Target -->
+ <bean id="org.hisp.dhis.detarget.action.DataElementListFilterByGroupAction"
+ class="org.hisp.dhis.detarget.action.DataElementListFilterByGroupAction"
+ scope="prototype">
+ <property name="dataElementService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
+ </property>
+ <property name="dataElementCategoryService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+ </property>
+ </bean>
+
+
+
</beans>
=== added directory 'local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget'
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties 2011-01-14 12:08:54 +0000
@@ -0,0 +1,66 @@
+filter_by_name = Filter By Name
+survey_mamagement = Survey Management
+survey_data_entry = Survey Data Entry
+survey = Survey
+de_target = DataElement Target
+
+
+add_new = Add New
+name = Name
+operations = Operations
+define_associations = Define Associations
+edit = Edit
+remove = Remove
+show_details = Show Details
+hide_details = Hide Details
+id = ID
+number_of_indicators= Number Of Indicators
+no_survey_selected = No Survey Selected
+no_indecator_selected = No Indicator Selected
+url = URL
+confirm_delete = Confirm Delete
+required = Required
+short_name = Short Name
+description = Description
+filter = Filter
+save = Save
+cancel = Cancel
+all = ALL
+move_selected = Move Selected
+remove_selected = Remove Selected
+define_survey_associations = Define Survey Association
+remove_all = Remove All
+select_all_at_level = Select All At Level
+unselect_all_at_level= UnSelect All At Level
+level_must_be_int = Level Must Be Integer
+loading = Loading
+edit_survey = Edit Survey
+survey_details = Survey Details
+available_indicators= Available Indicators
+selected_indicators = Selected Indicators
+specify_short_name = Specify Short Name
+duplicate_names= Duplicate Name
+duplicate_short_names= Duplicate Short Name
+duplicate_codes = Duplicate Names
+selected_indicators = Selected Indicators
+no_organisationunit_selected = No Organisation Unit Selected.
+no_survey_selected = No Survey Selected.
+organisation_unit = Organisation Unit
+select = Select
+survey = Survey
+specify_name = Specify Name
+define_survey_associations = Define Survey Associations
+value_must_integer = Value must be integer
+none = NONE
+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
+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
+select_deGroup_all = Select DataElementGroup / All
+
=== 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 2010-12-29 07:53:18 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties 2011-01-14 12:08:54 +0000
@@ -1,4 +1,10 @@
filter_by_name = Filter By Name
+survey_mamagement = Survey Management
+survey_data_entry = Survey Data Entry
+survey = Survey
+de_target = DataElement Target
+
+
add_new = Add New
name = Name
operations = Operations
@@ -49,3 +55,12 @@
not_del_contain_data = Not Deleted Its Contains Data
confirm_delete_survey = Are you sure you want to Remove Survey?
+detarget_mamagement = DE 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
+
+
=== modified file 'local/in/dhis-web-survey/src/main/resources/struts.xml'
--- local/in/dhis-web-survey/src/main/resources/struts.xml 2010-12-29 07:53:18 +0000
+++ local/in/dhis-web-survey/src/main/resources/struts.xml 2011-01-14 12:08:54 +0000
@@ -249,5 +249,51 @@
/dhis-web-survey/responseDe.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <!-- DataElement Targets -->
+ <action name="deTargetManagement" class="org.hisp.dhis.detarget.action.DeTargetListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-survey/deTargetList.vm</param>
+ <param name="menu">/dhis-web-survey/menu.vm</param>
+ <param name="javascripts">javascript/deTarget.js,javascript/filterTable.js</param>
+ </action>
+
+ <!-- Add DataElement Target form -->
+
+ <action name="addDeTargetForm"
+ class="org.hisp.dhis.detarget.action.DeTargetAddFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-survey/addDeTarget.vm</param>
+ <param name="menu">/dhis-web-survey/menu.vm</param>
+ <param name="javascripts">javascript/deTarget.js,javascript/filterTable.js</param>
+ </action>
+
+ <action name="addDeTarget"
+ class="org.hisp.dhis.detarget.action.AddDeTargetAction">
+ <result name="success" type="redirect">deTargetManagement.action</result>
+ <param name="javascripts">javascript/deTarget.js</param>
+ </action>
+ <!-- Show Details DataElement Target -->
+ <action name="getDeTargetDetails"
+ class="org.hisp.dhis.detarget.action.GetDeTargetDetailsAction">
+ <result name="success" type="velocity-xml">/dhis-web-survey/responseDeTargetObject.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+ <!-- Filter By DataElement Group DataElement Target -->
+ <action name="filterAvailableDataElementsByDataElementGroup"
+ class="org.hisp.dhis.detarget.action.DataElementListFilterByGroupAction">
+ <result name="success" type="velocity-xml">/dhis-web-survey/responseDataElementGroupMember.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <param name="javascripts">javascript/deTarget.js</param>
+ </action>
+ <!-- Validation for Adding DataElement Target -->
+ <action name="validateDeTarget"
+ class="org.hisp.dhis.detarget.action.ValidateDeTargetAction">
+ <result name="success" type="velocity-xml">/dhis-web-survey/responseSuccess.vm</result>
+ <result name="input" type="velocity-xml">/dhis-web-survey/responseInput.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+
</package>
</struts>
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm 2011-01-14 12:08:54 +0000
@@ -0,0 +1,96 @@
+
+<h3>$i18n.getString( "add_deTarget" )</h3>
+
+<form id="addDeTargetForm" name="addDeTargetForm" action="addDeTarget.action" method="post" onsubmit="return validateAddDeTarget()">
+ <table id="detailsList">
+ <col> ## Labels
+ <col> ## Input
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "deTarget_details" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" )<em title=$i18n.getString( "required" ) class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" style="width:20em"></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "short_name" )<em title=$i18n.getString( "required" ) class="required">*</em></label></td>
+ <td><input type="text" id="shortName" name="shortName" maxlength="20" style="width:20em"></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "url" )</label></td>
+ <td><input type="text" id="url" name="url" style="width:20em"></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "description" )</label></td>
+ <td><textarea id="description" name="description" cols=41 rows=4></textarea></td>
+ </tr>
+ <tr><td> </td><td> </td></tr>
+ </tbody>
+ </table>
+
+ <table id="DataElementsSelectionArea">
+ <col> ## Available DataElements
+ <col> ## Filter
+ <col> ## Selected DataElements
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_dataElements" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_dataElements" )</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>
+ <select id="dataElementGroupSelect" name="dataElementGroupSelect" style="min-width:25em"
+ onchange="javascript:filterByDataElementGroup( this.options[this.selectedIndex].value )">
+ <!-- <option value="ALL" selected="selected">$i18n.getString( "all" ) </option>-->
+ <option value="ALL">$i18n.getString( "select_deGroup_all" )</option>
+ #foreach ( $dataElementGroup in $dataElementGroups )
+ <option value="$dataElementGroup.id">$encoder.htmlEncode( $dataElementGroup.name )</option>
+ #end
+ </select>
+ </td>
+ <td>$i18n.getString( "group" )</td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><input type="text" id="availableDataElementFilter" onkeyup="filterValues( this.value )" style="min-width:25em"></td>
+ <td>$i18n.getString( "name" )</td>
+ <td><input type="text" id="deTargetMembersFilter" onkeyup="filterValues( this.value )" style="min-width:25em"></td>
+ </tr>
+
+ <tr>
+ <td>
+ <!-- List of all available DataElements -->
+ <select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:25em;height:20em" ondblclick="moveSelectedById( 'availableList', 'selectedList' )">
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title=$i18n.getString( 'move_selected' ) onClick="moveSelectedById( 'availableList', 'selectedList' )">
+ <br>
+ <input type="button" value="<" title=$i18n.getString( 'remove_selected' ) onClick="moveSelectedById( 'selectedList', 'availableList' )">
+ </td>
+ <td>
+ <!-- List of all selected DataElemnts -->
+ <select id="selectedList" name="selectedList" multiple="multiple" style="min-width:25em;height:20em" ondblclick="moveSelectedById( 'selectedList', 'availableList' )">
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <input type="submit" value=$i18n.getString( "save" ) style="width:13em"><input type="button"
+ onclick="window.location.href='deTargetManagement.action'" value=$i18n.getString( "cancel" ) style="width:12em">
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</form>
+
+<span id="message"></span>
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm 2011-01-14 12:08:54 +0000
@@ -0,0 +1,85 @@
+
+<h3>$i18n.getString( "de_target_mamagement" )t</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table class="listTable">
+ <col>
+ <col width="20">
+ <col width="20">
+ <col width="20">
+ <col width="20">
+
+ <tr>
+ <td>$i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"></div></form></td>
+ <td colspan="4" style="text-align:right">
+ <input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='addDeTargetForm.action'"style="width:80px">
+ </td>
+ </tr>
+
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th colspan="4">$i18n.getString( "operations" )</th>
+ </tr>
+
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $deTarget in $deTargets )
+ <tr>
+ <td#alternate( $mark )>$encoder.htmlEncode( $deTarget.name )</td>
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="defineSurveyAssociationsForm.action?deTargetId=$deTarget.id" title="$i18n.getString( "define_associations" )"><img src="../images/assign.png" alt="$i18n.getString( "define_associations" )"></a>
+ </td>
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="editSurveyForm.action?deTargetId=$deTarget.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
+ </td>
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="javascript:removeSurvey( '$deTarget.id', '$encoder.jsEncode( $deTarget.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+ </td>
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="javascript:showDeTargetDetails( $deTarget.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
+ </td>
+ </tr>
+ #if( $mark )
+ #set( $mark = false )
+ #else
+ #set( $mark = true )
+ #end
+ #end
+ </tbody>
+ </table>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
+ </div>
+ <p><label>$i18n.getString( "id" ):</label><br><span id="idField"></span></p>
+ <p><label>$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "number_of_dataelements" ):</label><br><span id="dataElementSizeField"></span></p>
+ <p><label>$i18n.getString( "url" ):</label><br><span id="urlField"></span></p>
+ <p><label>$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ </div>
+
+ <div id="warningArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( "hide_warning" )"><img src="../images/close.png" alt="$i18n.getString( "hide_warning" )"></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
+
+<span id="message"></span>
+
+<script type="text/javascript">
+function showsection(SurveyId)
+{
+ window.location.href="section.action?surveyId=" + surveyId;
+}
+var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_survey" ) , "'" )';
+var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'" )';
+</script>
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js 2011-01-14 12:08:54 +0000
@@ -0,0 +1,325 @@
+
+// -----------------------------------------------------------------------------
+// Delete Survey
+// -----------------------------------------------------------------------------
+
+var tmpSurveyId;
+
+var tmpSource;
+
+function removeSurvey( surveyId, surveyName )
+{
+ var result = window.confirm( i18n_confirm_delete + '\n\n' + " Survey Id =" + surveyId + '\n\n' + " Survey Name =" + surveyName );
+
+ if ( result )
+ {
+ $.post("delSurvey.action",
+ {
+ surveyId : surveyId
+ },
+ function (data)
+ {
+ removeSurveyCompleted(data);
+ },'xml');
+
+ }
+}
+
+function removeSurveyCompleted( messageElement )
+{
+ messageElement = messageElement.getElementsByTagName( "message" )[0];
+ var type = messageElement.getAttribute( "type" );
+
+ if ( type == 'error' )
+ {
+ var message = messageElement.firstChild.nodeValue;
+ //alert( message );
+ //setFieldValue( 'warningField', message );
+ setInnerHTML( 'warningField', message );
+ showWarning();
+ }
+ else
+ {
+ window.location.href = 'index.action';
+ }
+}
+
+//validation for adding New DeTarget
+function validateAddDeTarget()
+{
+ $.post("validateDeTarget.action",
+ {
+ name : byId( 'name' ).value,
+ shortName : byId( 'shortName' ).value
+ },
+ function (data)
+ {
+ addSurveyValidationCompleted(data);
+ },'xml');
+
+ return false;
+}
+
+function addSurveyValidationCompleted( messageElement )
+{
+ messageElement = messageElement.getElementsByTagName( "message" )[0];
+ var type = messageElement.getAttribute( "type" );
+ var message = messageElement.firstChild.nodeValue;
+
+ if ( type == 'success' )
+ {
+ var selectedList = document.getElementById( 'selectedList' );
+ for(var k=0;k<selectedList.length;k++)
+ {
+ selectedList.options[k].selected = "true";
+ }
+ document.forms['addDeTargetForm'].submit();
+ }
+ else if ( type == 'input' )
+ {
+ setMessage( message );
+ }
+}
+
+
+function validateEditSurvey()
+{
+ $.post("validateSurvey.action",
+ {
+ name : byId( 'name' ).value,
+ shortName : byId( 'shortName' ).value,
+ url : byId( 'url' ).value,
+ surveyId : byId( 'surveyId' ).value
+ },
+ function (data)
+ {
+ editSurveyValidationCompleted(data);
+ },'xml');
+
+ return false;
+}
+function editSurveyValidationCompleted( messageElement )
+{
+ 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<selectedList.length;k++)
+ {
+ selectedList.options[k].selected = "true";
+ }
+
+ document.forms['editSurveyForm'].submit();
+ }
+ else if ( type == 'input' )
+ {
+ setMessage(message);
+ }
+}
+
+// ----------------------------------------------------------------------
+// List
+// ----------------------------------------------------------------------
+/*
+function initLists()
+{
+ var id;
+
+ var list = document.getElementById( 'selectedList' );
+
+ for ( id in deTargetMembers )
+ {
+ list.add( new Option( deTargetMembers[id], id ), null );
+ }
+
+ list = document.getElementById( 'availableList' );
+
+ for ( id in availableDataElements )
+ {
+ list.add( new Option( availableDataElements[id], id ), null );
+ }
+}
+*/
+// complette
+function filterDeTargetMembers()
+{
+ var filter = document.getElementById( 'deTargetMembersFilter' ).value;
+ var list = document.getElementById( 'selectedList' );
+
+ list.options.length = 0;
+
+ for ( var id in deTargetMembers )
+ {
+ var value = deTargetMembers[id];
+
+ if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+ {
+ list.add( new Option( value, id ), null );
+ }
+ }
+}
+
+//complette
+function filterAvailableDataElements()
+{
+ var filter = document.getElementById( 'availableDataElementFilter' ).value;
+ var list = document.getElementById( 'availableList' );
+
+ list.options.length = 0;
+
+ for ( var id in availableDataElements )
+ {
+ var value = availableDataElements[id];
+
+ if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+ {
+ list.add( new Option( value, id ), null );
+ }
+ }
+}
+
+function addDeTargetMembers()
+{
+ var list = document.getElementById( 'availableList' );
+
+ while ( list.selectedIndex != -1 )
+ {
+ var id = list.options[list.selectedIndex].value;
+
+ list.options[list.selectedIndex].selected = false;
+
+ deTargetMembers[id] = availableDataElements[id];
+
+ delete availableDataElements[id];
+ }
+
+ filterDeTargetMembers();
+ filterAvailableDataElements();
+}
+
+function removeDeTargetMembers()
+{
+ var list = document.getElementById( 'selectedList' );
+
+ while ( list.selectedIndex != -1 )
+ {
+ var id = list.options[list.selectedIndex].value;
+
+ list.options[list.selectedIndex].selected = false;
+
+ availableIndicators[id] = surveyMembers[id];
+
+ delete surveyMembers[id];
+ }
+
+ filterSurveyMembers();
+ filterAvailableIndicators();
+}
+
+function filterByDataElementGroup( selectedDataElementGroup )
+{
+ var selectedList = document.getElementById( 'selectedList' );
+
+ // var list = new Array();
+
+ var params = 'dataElementGroupId=' + selectedDataElementGroup;
+
+ for ( var i = 0; i < selectedList.options.length; ++i)
+ {
+ //params += '&selectedIndicators=' + selectedList.options[i].value;
+ params += '&selectedDataElements=' + selectedList.options[i].value;
+ //list[i] = selectedList.options[i].value;
+ }
+ // Clear the list
+ var availableList = document.getElementById( 'availableList' );
+
+ availableList.options.length = 0;
+
+ // alert(list);
+ //alert(list.length);
+
+ var request = new Request();
+ request.setResponseTypeXML( 'indicatorgroup' );
+ request.setCallbackSuccess( filterByDataElementGroupCompleted );
+ //request.send( url );
+
+ var requestString = "filterAvailableDataElementsByDataElementGroup.action";
+ // var params = "indicatorGroupId=" + selectedIndicatorGroup + "&selectedIndicators=" + list;
+ request.sendAsPost( params );
+ request.send( requestString );
+
+ /*
+
+ $.post("filterAvailableIndicatorsByIndicatorGroup.action",
+ {
+ indicatorGroupId : selectedIndicatorGroup,
+ selectedIndicators : list
+ },
+ function (data)
+ {
+ filterByIndicatorGroupCompleted(data);
+ },'xml');
+ */
+}
+
+function filterByDataElementGroupCompleted( xmlObject )
+{
+ //var indicators = indicatorGroup.getElementsByTagName( 'indicators' )[0];
+ // var indicatorList = indicators.getElementsByTagName( 'indicator' );
+
+ var availableList = document.getElementById( 'availableList' );
+
+
+ // var availableDataElements = document.getElementById("availableDataElements");
+ //var selectedDataElements = document.getElementById("selectedServices");
+
+ //clearList(availableList);
+
+ var dataElements = xmlObject.getElementsByTagName("dataElement");
+ alert( "DataElement Group Received lent of Group member " + dataElements.length );
+ for ( var i = 0; i < dataElements.length; i++ )
+ {
+ var id = dataElements[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var dataElementName = dataElements[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
+
+ var option = document.createElement("option");
+ option.value = id;
+ option.text = dataElementName;
+ option.title = dataElementName;
+ availableList.add( option, null );
+
+ }
+}
+
+function showDeTargetDetails( deTargetId )
+{
+ $.get("getDeTargetDetails.action",
+ {
+ deTargetId : deTargetId
+ },
+ function (data)
+ {
+ deTargetRecieved(data);
+ },'xml');
+}
+
+function deTargetRecieved( deTargetElement )
+{
+
+ setInnerHTML( 'idField', getElementValue( deTargetElement, 'id' ) );
+ setInnerHTML( 'nameField', getElementValue( deTargetElement, 'name' ) );
+ setInnerHTML( 'dataElementSizeField', getElementValue( deTargetElement, 'dataElementSize' ) );
+
+ var desCription = getElementValue( deTargetElement, 'description' );
+ setInnerHTML( 'descriptionField', desCription ? desCription : '[' + i18n_none + ']' );
+
+ var url = getElementValue( deTargetElement, 'url' );
+ setInnerHTML( 'urlField', url ? '<a href="' + url + '">' + url + '</a>' : '[' + i18n_none + ']' );
+
+ showDetails();
+}
+
=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm 2011-01-14 12:08:54 +0000
@@ -1,12 +1,13 @@
-<h2>Survey</h2>
+<h2>$i18n.getString( "survey" )</h2>
<ul>
- <li><a href="index.action">Survey Management</a></li>
- <li><a href="surveydataentry.action">Survey Data Entry</a></li>
+ <li><a href="index.action">$i18n.getString( "survey_mamagement" )</a></li>
+ <li><a href="surveydataentry.action">$i18n.getString( "survey_data_entry" )</a></li>
</ul>
-<h2>Target</h2>
+<h2>$i18n.getString( "de_target" )</h2>
<ul>
- <li><a href="generateTarget.action">Target Mapping</a></li>
+ <!-- <li><a href="generateTarget.action">$i18n.getString( "detarget_mamagement" )</a></li> -->
+ <li><a href="deTargetManagement.action">$i18n.getString( "detarget_mamagement" )</a></li>
</ul>
\ No newline at end of file
=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDataElementGroupMember.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDataElementGroupMember.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDataElementGroupMember.vm 2011-01-14 12:08:54 +0000
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+#set($count1 = 0)
+<dataElements>
+#foreach( $optionComboName in $optionComboNames )
+ <dataElement>
+ <id>$optionComboIds.get($count1)</id>
+ <name>$encoder.xmlEncode( $optionComboName )</name>
+ </dataElement>
+ #set($count1 = $count1 + 1)
+#end
+</dataElements>
\ No newline at end of file
=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDeTargetObject.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDeTargetObject.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseDeTargetObject.vm 2011-01-14 12:08:54 +0000
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deTarget>
+ <id>$deTarget.id</id>
+ <name>$encoder.xmlEncode( $deTarget.name )</name>
+ <dataElementSize>$dataElementSize</dataElementSize>
+ <url>$encoder.xmlEncode( $!deTarget.url )</url>
+ <description>$encoder.xmlEncode( $!deTarget.description )</description>
+</deTarget>
\ No newline at end of file