dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32894
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16730: Model change. Added list of Indicators to Section. Impl maintenance UI.
------------------------------------------------------------
revno: 16730
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-09-16 18:40:46 +0200
message:
Model change. Added list of Indicators to Section. Impl maintenance UI.
added:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionIndicatorsAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionDataElementsAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addSection.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editSection.js
--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2014-09-16 16:40:46 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.indicator.Indicator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
@@ -66,6 +67,9 @@
@Scanned
private List<DataElement> dataElements = new ArrayList<>();
+ @Scanned
+ private List<Indicator> indicators = new ArrayList<>();
+
private Set<DataElementOperand> greyedFields = new HashSet<>();
private int sortOrder;
@@ -215,6 +219,21 @@
this.dataElements = dataElements;
}
+ @JsonProperty
+ @JsonSerialize(contentAs = BaseIdentifiableObject.class)
+ @JsonView({ DetailedView.class, ExportView.class })
+ @JacksonXmlElementWrapper(localName = "indicators", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "indicator", namespace = DxfNamespaces.DXF_2_0)
+ public List<Indicator> getIndicators()
+ {
+ return indicators;
+ }
+
+ public void setIndicators( List<Indicator> indicators )
+ {
+ this.indicators = indicators;
+ }
+
public int getSortOrder()
{
return sortOrder;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml 2014-07-21 11:37:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml 2014-09-16 16:40:46 +0000
@@ -31,6 +31,14 @@
foreign-key="fk_section_dataelementid" />
</list>
+ <list name="indicators" table="sectionindicators">
+ <cache usage="read-write" />
+ <key column="sectionid" foreign-key="fk_sectionindicators_sectionid" />
+ <list-index column="sort_order" base="1" />
+ <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid"
+ foreign-key="fk_section_indicatorid" />
+ </list>
+
<set name="greyedFields" table="sectiongreyedfields">
<cache usage="read-write" />
<key column="sectionid" foreign-key="fk_sectiongreyedfields_sectionid" />
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm 2014-06-13 07:55:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm 2014-09-16 16:40:46 +0000
@@ -5,6 +5,7 @@
"name": "$!encoder.jsonEncode( ${section.displayName} )",
"dataSet": "$!encoder.jsonEncode( ${section.dataSet.name} )",
"categoryCombo": "$!encoder.jsonEncode( ${categoryCombo.name} )",
- "dataElementCount": "$!{sectionDataElements.size()}"
+ "dataElementCount": "$!{sectionDataElements.size()}",
+ "indicatorCount": "$!{sectionIndicators.size()}"
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionDataElementsAction.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionDataElementsAction.java 2014-09-16 16:40:46 +0000
@@ -30,10 +30,10 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -66,13 +66,6 @@
this.categoryService = categoryService;
}
- private Comparator<DataElement> dataElementComparator;
-
- public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
- {
- this.dataElementComparator = dataElementComparator;
- }
-
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -136,7 +129,7 @@
}
}
- Collections.sort( dataElements, dataElementComparator );
+ Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );
return SUCCESS;
}
=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionIndicatorsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionIndicatorsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetSectionIndicatorsAction.java 2014-09-16 16:40:46 +0000
@@ -0,0 +1,100 @@
+package org.hisp.dhis.commons.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.dataset.Section;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/*
+ * Copyright (c) 2004-2014, 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.
+ */
+
+public class GetSectionIndicatorsAction
+ extends ActionPagingSupport<Indicator>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer dataSetId;
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ private List<Indicator> indicators = new ArrayList<>();
+
+ public List<Indicator> getIndicators()
+ {
+ return indicators;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ if ( dataSetId == null )
+ {
+ return SUCCESS;
+ }
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ indicators = new ArrayList<>( dataSet.getIndicators() );
+
+ for ( Section section : dataSet.getSections() )
+ {
+ indicators.removeAll( section.getIndicators() );
+ }
+
+ Collections.sort( indicators, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2014-08-25 15:20:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2014-09-16 16:40:46 +0000
@@ -385,6 +385,11 @@
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
+
+ <bean id="org.hisp.dhis.commons.action.GetSectionIndicatorsAction" class="org.hisp.dhis.commons.action.GetSectionIndicatorsAction"
+ scope="prototype">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ </bean>
<bean id="org.hisp.dhis.commons.action.GetDataElementCategoriesAction" class="org.hisp.dhis.commons.action.GetDataElementCategoriesAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2014-08-26 07:05:04 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2014-09-16 16:40:46 +0000
@@ -629,6 +629,13 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
+ <action name="getSectionIndicators" class="org.hisp.dhis.commons.action.GetSectionIndicatorsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonIndicators.vm
+ </result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<action name="getDataElementCategories" class="org.hisp.dhis.commons.action.GetDataElementCategoriesAction">
<result name="success" type="velocity-json">
/dhis-web-commons/ajax/jsonDataElementCategories.vm
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2014-09-16 16:40:46 +0000
@@ -37,6 +37,8 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dataset.Section;
import org.hisp.dhis.dataset.SectionService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
import com.opensymphony.xwork2.Action;
@@ -61,6 +63,13 @@
this.dataElementService = dataElementService;
}
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
private SectionService sectionService;
public void setSectionService( SectionService sectionService )
@@ -93,17 +102,25 @@
this.description = description;
}
- private List<String> selectedList = new ArrayList<>();
-
- public void setSelectedList( List<String> selectedList )
- {
- this.selectedList = selectedList;
+ private List<String> selectedDataElementList = new ArrayList<>();
+
+ public void setSelectedDataElementList( List<String> selectedDataElementList )
+ {
+ this.selectedDataElementList = selectedDataElementList;
+ }
+
+ private List<String> selectedIndicatorList = new ArrayList<>();
+
+ public void setSelectedIndicatorList( List<String> selectedIndicatorList )
+ {
+ this.selectedIndicatorList = selectedIndicatorList;
}
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
+
public String execute()
throws Exception
{
@@ -118,12 +135,20 @@
List<DataElement> selectedDataElements = new ArrayList<>();
- for ( String id : selectedList )
+ for ( String id : selectedDataElementList )
{
selectedDataElements.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
}
+
+ List<Indicator> selectedIndicators = new ArrayList<>();
+
+ for ( String id : selectedIndicatorList )
+ {
+ selectedIndicators.add( indicatorService.getIndicator( Integer.parseInt( id ) ) );
+ }
section.setDataElements( selectedDataElements );
+ section.setIndicators( selectedIndicators );
dataSet.getSections().add( section );
sectionService.addSection( section );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java 2014-09-16 16:40:46 +0000
@@ -28,17 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.Section;
import org.hisp.dhis.dataset.SectionService;
@@ -59,13 +53,6 @@
this.sectionService = sectionService;
}
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -124,7 +111,7 @@
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
-
+
public String execute()
throws Exception
{
@@ -132,38 +119,8 @@
dataSet = section.getDataSet();
- dataElementOfDataSet = new ArrayList<>( dataSet.getDataElements() );
-
- Collection<Section> sections = dataSet.getSections();
-
- for ( Section s : sections )
- {
- dataElementOfDataSet.removeAll( s.getDataElements() );
- }
-
categoryCombo = section.getCategoryCombo();
- if ( categoryCombo != null )
- {
- Iterator<DataElement> dataElementIterator = dataElementOfDataSet.iterator();
-
- while ( dataElementIterator.hasNext() )
- {
- DataElement de = dataElementIterator.next();
-
- if ( !de.getCategoryCombo().equals( categoryCombo ) )
- {
- dataElementIterator.remove();
- }
- }
- }
-
- dataElementGroups = new ArrayList<>( dataElementService.getAllDataElementGroups() );
-
- Collections.sort( dataElementOfDataSet, new IdentifiableObjectNameComparator() );
-
- Collections.sort( dataElementGroups, IdentifiableObjectNameComparator.INSTANCE );
-
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionAction.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionAction.java 2014-09-16 16:40:46 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataset.Section;
import org.hisp.dhis.dataset.SectionService;
+import org.hisp.dhis.indicator.Indicator;
import com.opensymphony.xwork2.Action;
@@ -84,6 +85,13 @@
return sectionDataElements;
}
+ private List<Indicator> sectionIndicators;
+
+ public void setSectionIndicators( List<Indicator> sectionIndicators )
+ {
+ this.sectionIndicators = sectionIndicators;
+ }
+
private DataElementCategoryCombo categoryCombo;
public void setCategoryCombo( DataElementCategoryCombo categoryCombo )
@@ -107,9 +115,12 @@
sectionDataElements = new ArrayList<>( section.getDataElements() );
+ sectionIndicators = new ArrayList<>( section.getIndicators() );
+
categoryCombo = section.getDataElements().iterator().next().getCategoryCombo();
Collections.sort( sectionDataElements, new IdentifiableObjectNameComparator() );
+ Collections.sort( sectionIndicators, new IdentifiableObjectNameComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java 2014-09-16 16:40:46 +0000
@@ -37,6 +37,8 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dataset.Section;
import org.hisp.dhis.dataset.SectionService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
import com.opensymphony.xwork2.Action;
@@ -63,6 +65,13 @@
this.dataElementService = dataElementService;
}
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
private DataSetService dataSetService;
public void setDataSetService( DataSetService dataSetService )
@@ -95,11 +104,18 @@
this.description = description;
}
- private List<String> selectedList = new ArrayList<>();
-
- public void setSelectedList( List<String> selectedList )
- {
- this.selectedList = selectedList;
+ private List<String> selectedDataElementList = new ArrayList<>();
+
+ public void setSelectedDataElementList( List<String> selectedDataElementList )
+ {
+ this.selectedDataElementList = selectedDataElementList;
+ }
+
+ private List<String> selectedIndicatorList = new ArrayList<>();
+
+ public void setSelectedIndicatorList( List<String> selectedIndicatorList )
+ {
+ this.selectedIndicatorList = selectedIndicatorList;
}
// -------------------------------------------------------------------------
@@ -109,14 +125,20 @@
public String execute()
throws Exception
{
+ Section section = sectionService.getSection( sectionId.intValue() );
+
List<DataElement> dataElements = new ArrayList<>();
- Section section = sectionService.getSection( sectionId.intValue() );
-
- for ( String id : selectedList )
- {
- DataElement d = dataElementService.getDataElement( Integer.parseInt( id ) );
- dataElements.add( d );
+ for ( String id : selectedDataElementList )
+ {
+ dataElements.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
+ }
+
+ List<Indicator> indicators = new ArrayList<>();
+
+ for ( String id : selectedIndicatorList )
+ {
+ indicators.add( indicatorService.getIndicator( Integer.parseInt( id ) ) );
}
DataSet dataSet = section.getDataSet();
@@ -130,6 +152,7 @@
}
section.setDataElements( dataElements );
+ section.setIndicators( indicators );
section.setName( sectionName );
section.setDescription( description );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2014-07-16 15:41:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2014-09-16 16:40:46 +0000
@@ -14,6 +14,7 @@
<property name="sectionService" ref="org.hisp.dhis.dataset.SectionService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
</bean>
<bean id="org.hisp.dhis.dataset.action.section.GetSectionOptionsAction" class="org.hisp.dhis.dataset.action.section.GetSectionOptionsAction"
@@ -30,7 +31,6 @@
<bean id="org.hisp.dhis.dataset.action.section.EditSectionAction" class="org.hisp.dhis.dataset.action.section.EditSectionAction"
scope="prototype">
<property name="sectionService" ref="org.hisp.dhis.dataset.SectionService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
</bean>
<bean id="org.hisp.dhis.dataset.action.section.UpdateSectionAction" class="org.hisp.dhis.dataset.action.section.UpdateSectionAction"
@@ -38,6 +38,7 @@
<property name="sectionService" ref="org.hisp.dhis.dataset.SectionService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
</bean>
<bean id="org.hisp.dhis.dataset.action.section.RemoveSectionAction" class="org.hisp.dhis.dataset.action.section.RemoveSectionAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm 2014-07-21 11:37:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm 2014-09-16 16:40:46 +0000
@@ -1,15 +1,15 @@
<script type="text/javascript" src="javascript/addSection.js"></script>
<script type="text/javascript">
jQuery(document).ready( function(){
- jQuery("#availableList").dhisAjaxSelect({
- source: "../dhis-web-commons-ajax-json/getSectionDataElements.action",
+ jQuery('#availableDataElementList').dhisAjaxSelect({
+ source: '../dhis-web-commons-ajax-json/getSectionDataElements.action',
iterator: 'dataElements',
sortSelected: false,
- connectedTo: 'selectedList',
+ connectedTo: 'selectedDataElementList',
handler: function(item) {
- var option = jQuery("<option />");
+ var option = jQuery('<option />');
option.text( item.name );
- option.attr( "value", item.id );
+ option.attr( 'value', item.id );
return option;
},
@@ -18,6 +18,23 @@
'categoryComboId': $categoryCombo.id
}
});
+
+ jQuery("#availableIndicatorList").dhisAjaxSelect({
+ source: '../dhis-web-commons-ajax-json/getSectionIndicators.action',
+ iterator: 'indicators',
+ sortSelected: false,
+ connectedTo: 'selectedIndicatorList',
+ handler: function(item) {
+ var option = jQuery('<option />');
+ option.text( item.name );
+ option.attr( 'value', item.id );
+
+ return option;
+ },
+ params: {
+ 'dataSetId': $dataSet.id
+ }
+ });
});
</script>
@@ -55,12 +72,12 @@
</table>
<table id="dataElementSelectionArea">
- <colgroup>
- <col style="width: 500px;"/>
- <col/>
- <col style="width: 500px;"/>
- <col/>
- </colgroup>
+ <colgroup>
+ <col style="width: 500px;"/>
+ <col/>
+ <col style="width: 500px;"/>
+ <col/>
+ </colgroup>
<thead>
<tr>
@@ -73,23 +90,66 @@
<tbody>
<tr>
<td>
- <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%;"></select>
- </td>
-
- <td style="text-align:center">
- <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableList' );"/><br/>
- <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedList' );"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableList' );"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedList' );"/>
- </td>
-
- <td>
- <select id="selectedList" name="selectedList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
- </td>
-
- <td style="width:30px; text-align:center">
- <a href="javascript:moveUpSelectedOption( 'selectedList' )"><img src="../images/move_up.png"></a><br/><br/>
- <a href="javascript:moveDownSelectedOption( 'selectedList' )"><img src="../images/move_down.png"></a><br/><br/>
+ <select id="availableDataElementList" name="availableDataElementList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataElementList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataElementList' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataElementList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedDataElementList' );"/>
+ </td>
+
+ <td>
+ <select id="selectedDataElementList" name="selectedDataElementList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
+ </td>
+
+ <td style="width:30px; text-align:center">
+ <a href="javascript:moveUpSelectedOption( 'selectedDataElementList' )"><img src="../images/move_up.png"></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedDataElementList' )"><img src="../images/move_down.png"></a><br/><br/>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+ <table id="indicatorSelectionArea">
+ <colgroup>
+ <col style="width: 500px;"/>
+ <col/>
+ <col style="width: 500px;"/>
+ <col/>
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th></th>
+ <th>$i18n.getString( "selected_indicators" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>
+ <select id="availableIndicatorList" name="availableIndicatorList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableIndicatorList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedIndicatorList' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableIndicatorList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedIndicatorList' );"/>
+ </td>
+
+ <td>
+ <select id="selectedIndicatorList" name="selectedIndicatorList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
+ </td>
+
+ <td style="width:30px; text-align:center">
+ <a href="javascript:moveUpSelectedOption( 'selectedIndicatorList' )"><img src="../images/move_up.png"></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedIndicatorList' )"><img src="../images/move_down.png"></a><br/><br/>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm 2014-07-21 11:37:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm 2014-09-16 16:40:46 +0000
@@ -1,11 +1,11 @@
<script type="text/javascript" src="javascript/editSection.js"></script>
<script type="text/javascript">
jQuery(document).ready( function(){
- jQuery("#availableList").dhisAjaxSelect({
+ jQuery("#availableDataElementList").dhisAjaxSelect({
source: "../dhis-web-commons-ajax-json/getSectionDataElements.action",
iterator: 'dataElements',
sortSelected: false,
- connectedTo: 'selectedList',
+ connectedTo: 'selectedDataElementList',
handler: function(item) {
var option = jQuery("<option />");
option.text( item.name );
@@ -18,6 +18,23 @@
'categoryComboId': '$!{categoryCombo.id}'
}
});
+
+ jQuery("#availableIndicatorList").dhisAjaxSelect({
+ source: '../dhis-web-commons-ajax-json/getSectionIndicators.action',
+ iterator: 'indicators',
+ sortSelected: false,
+ connectedTo: 'selectedIndicatorList',
+ handler: function(item) {
+ var option = jQuery('<option />');
+ option.text( item.name );
+ option.attr( 'value', item.id );
+
+ return option;
+ },
+ params: {
+ 'dataSetId': '$!{dataSet.id}'
+ }
+ });
});
</script>
@@ -75,18 +92,18 @@
<tbody>
<tr>
<td>
- <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ <select id="availableDataElementList" name="availableDataElementList" multiple="multiple" style="height: 200px; width: 100%;"></select>
</td>
<td style="text-align:center">
- <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableList' );"/><br/>
- <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedList' );"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableList' );"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedList' );"/>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataElementList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataElementList' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataElementList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedDataElementList' );"/>
</td>
<td>
- <select id="selectedList" name="selectedList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
+ <select id="selectedDataElementList" name="selectedDataElementList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
#foreach ( $dataElement in $section.dataElements )
<option value="$dataElement.id">$dataElement.displayName</option>
#end
@@ -94,8 +111,55 @@
</td>
<td style="width:30px; text-align:center">
- <a href="javascript:moveUpSelectedOption( 'selectedList' )"><img src="../images/move_up.png"/></a><br/><br/>
- <a href="javascript:moveDownSelectedOption( 'selectedList' )"><img src="../images/move_down.png"/></a><br/><br/>
+ <a href="javascript:moveUpSelectedOption( 'selectedDataElementList' )"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedDataElementList' )"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
+
+ </tr>
+ </tbody>
+ </table>
+
+
+ <table id="indicatorSelectionArea">
+ <colgroup>
+ <col style="width: 500px;"/>
+ <col/>
+ <col style="width: 500px;"/>
+ <col/>
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th></th>
+ <th>$i18n.getString( "selected_indicators" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>
+ <select id="availableIndicatorList" name="availableIndicatorList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableIndicatorList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedIndicatorList' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableIndicatorList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedIndicatorList' );"/>
+ </td>
+
+ <td>
+ <select id="selectedIndicatorList" name="selectedIndicatorList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
+ #foreach ( $indicator in $section.indicators )
+ <option value="$indicator.id">$indicator.displayName</option>
+ #end
+ </select>
+ </td>
+
+ <td style="width:30px; text-align:center">
+ <a href="javascript:moveUpSelectedOption( 'selectedIndicatorList' )"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedIndicatorList' )"><img src="../images/move_down.png"/></a><br/><br/>
</td>
</tr>
@@ -107,5 +171,4 @@
</td>
</tr>
</tbody>
- </table>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addSection.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addSection.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addSection.js 2014-09-16 16:40:46 +0000
@@ -3,7 +3,8 @@
form.submit();
}, {
'beforeValidateHandler' : function() {
- selectAllById('selectedList');
+ selectAllById('selectedDataElementList');
+ selectAllById('selectedIndicatorList');
},
'rules' : getValidationRules("section")
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editSection.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editSection.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editSection.js 2014-09-16 16:40:46 +0000
@@ -3,7 +3,8 @@
form.submit();
}, {
'beforeValidateHandler' : function() {
- selectAllById('selectedList');
+ selectAllById('selectedDataElementList');
+ selectAllById('selectedIndicatorList');
},
'rules' : getValidationRules("section")
});