dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12006
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3546: WIP: gui for adding/removing indicators from datasets
------------------------------------------------------------
revno: 3546
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-09 12:42:32 +0200
message:
WIP: gui for adding/removing indicators from datasets
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorListFilteredByGroup.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseIndicatorGroup.vm
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.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/resources/org/hisp/dhis/dataset/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseDataElementGroup.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 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java 2011-05-09 10:42:32 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
@@ -73,7 +74,14 @@
{
this.dataElementComparator = dataElementComparator;
}
-
+
+ private Comparator<Indicator> indicatorComparator;
+
+ public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
+ {
+ this.indicatorComparator = indicatorComparator;
+ }
+
private SelectionTreeManager selectionTreeManager;
public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
@@ -111,20 +119,27 @@
return dataSetDataElements;
}
+ private List<Indicator> dataSetIndicators;
+
+ public List<Indicator> getDataSetIndicators()
+ {
+ return dataSetIndicators;
+ }
+
private DataEntryForm dataEntryForm;
-
+
public DataEntryForm getDataEntryForm()
{
return dataEntryForm;
}
-
+
private DataElementCategoryCombo categoryCombo;
public DataElementCategoryCombo getCategoryCombo()
{
- return categoryCombo;
+ return categoryCombo;
}
-
+
// -------------------------------------------------------------------------
// Action
// -------------------------------------------------------------------------
@@ -136,14 +151,18 @@
dataSetDataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
- Collections.sort( dataSetDataElements, dataElementComparator );
-
+ Collections.sort( dataSetDataElements, dataElementComparator );
+
+ dataSetIndicators = new ArrayList<Indicator>( dataSet.getIndicators() );
+
+ Collections.sort( dataSetIndicators, indicatorComparator );
+
displayPropertyHandler.handle( dataSetDataElements );
- dataEntryForm = dataSet.getDataEntryForm();
-
+ dataEntryForm = dataSet.getDataEntryForm();
+
selectionTreeManager.setSelectedOrganisationUnits( dataSet.getSources() );
-
+
return SUCCESS;
}
}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorGroupListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorGroupListAction.java 2011-05-09 10:42:32 +0000
@@ -0,0 +1,81 @@
+package org.hisp.dhis.dataset.action;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author mortenoh
+ */
+public class IndicatorGroupListAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<IndicatorGroup> indicatorGroups;
+
+ public List<IndicatorGroup> getIndicatorGroups()
+ {
+ return indicatorGroups;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ indicatorGroups = new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() );
+
+ Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorListFilteredByGroup.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorListFilteredByGroup.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/IndicatorListFilteredByGroup.java 2011-05-09 10:42:32 +0000
@@ -0,0 +1,169 @@
+package org.hisp.dhis.dataset.action;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author mortenoh
+ */
+public class IndicatorListFilteredByGroup
+ implements Action
+{
+ private String indicatorGroupId;
+
+ private String selectedIndicators[];
+
+ private List<Indicator> indicators;
+
+ private Integer dataSetId;
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private Comparator<Indicator> indicatorComparator;
+
+ public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
+ {
+ this.indicatorComparator = indicatorComparator;
+ }
+
+ private DisplayPropertyHandler displayPropertyHandler;
+
+ public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+ {
+ this.displayPropertyHandler = displayPropertyHandler;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+ public void setIndicatorGroupId( String indicatorGroupId )
+ {
+ this.indicatorGroupId = indicatorGroupId;
+ }
+
+ public void setSelectedIndicators( String[] selectedIndicators )
+ {
+ this.selectedIndicators = selectedIndicators;
+ }
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ public String getIndicatorGroupId()
+ {
+ return indicatorGroupId;
+ }
+
+ public List<Indicator> getIndicators()
+ {
+ return indicators;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( indicatorGroupId == null || indicatorGroupId.equals( "ALL" ) )
+ {
+ indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
+ }
+ else
+ {
+ IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( Integer.parseInt( indicatorGroupId ) );
+
+ indicators = new ArrayList<Indicator>( indicatorGroup.getMembers() );
+ }
+
+ if ( selectedIndicators != null && selectedIndicators.length > 0 )
+ {
+ Iterator<Indicator> iter = indicators.iterator();
+
+ while ( iter.hasNext() )
+ {
+ Indicator indicator = iter.next();
+
+ for ( int i = 0; i < selectedIndicators.length; i++ )
+ {
+ if ( indicator.getId() == Integer.parseInt( selectedIndicators[i] ) )
+ {
+ iter.remove();
+ }
+ }
+ }
+ }
+
+ if ( dataSetId != null )
+ {
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ indicators.removeAll( dataSet.getIndicators() );
+ }
+
+ Collections.sort( indicators, indicatorComparator );
+
+ displayPropertyHandler.handle( indicators );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2011-03-03 06:16:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2011-05-09 10:42:32 +0000
@@ -29,11 +29,14 @@
import java.util.Collection;
import java.util.HashSet;
+import java.util.Set;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
@@ -88,6 +91,13 @@
this.selectedList = selectedList;
}
+ private Collection<String> indicatorSelectedList = new HashSet<String>();
+
+ public void setIndicatorSelectedList( Collection<String> indicatorSelectedList )
+ {
+ this.indicatorSelectedList = indicatorSelectedList;
+ }
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -113,6 +123,13 @@
this.dataElementService = dataElementService;
}
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
// -------------------------------------------------------------------------
// Action
// -------------------------------------------------------------------------
@@ -141,6 +158,13 @@
dataElements.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
}
+ Set<Indicator> indicators = new HashSet<Indicator>();
+
+ for ( String id : indicatorSelectedList )
+ {
+ indicators.add( indicatorService.getIndicator( Integer.parseInt( id ) ) );
+ }
+
PeriodType periodType = periodService.getPeriodTypeByName( frequencySelect );
DataSet dataSet = dataSetService.getDataSet( dataSetId );
@@ -150,12 +174,13 @@
dataSet.setCode( code );
dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) );
dataSet.setDataElements( dataElements );
-
+ dataSet.setIndicators( indicators );
+
if ( dataSet.isMobile() )
{
dataSet.setVersion( dataSet.getVersion() + 1 ); // TODO we should check if anything is actually updated before bumping version and push this to service layer
}
-
+
dataSetService.updateDataSet( dataSet );
return SUCCESS;
=== 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 2011-05-08 08:20:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2011-05-09 10:42:32 +0000
@@ -218,7 +218,18 @@
<ref bean="org.hisp.dhis.dataset.DataSetService"/>
</property>
</bean>
-
+
+ <bean id="org.hisp.dhis.dataset.action.IndicatorListFilteredByGroup"
+ class="org.hisp.dhis.dataset.action.IndicatorListFilteredByGroup"
+ scope="prototype">
+ <property name="indicatorService">
+ <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
+ </property>
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+ </property>
+ </bean>
+
<bean id="org.hisp.dhis.dataset.action.DataElementGroupListAction"
class="org.hisp.dhis.dataset.action.DataElementGroupListAction"
scope="prototype">
@@ -226,6 +237,14 @@
<ref bean="org.hisp.dhis.dataelement.DataElementService"/>
</property>
</bean>
+
+ <bean id="org.hisp.dhis.dataset.action.IndicatorGroupListAction"
+ class="org.hisp.dhis.dataset.action.IndicatorGroupListAction"
+ scope="prototype">
+ <property name="indicatorService">
+ <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.dataset.action.SaveDataSetSortOrderAction"
class="org.hisp.dhis.dataset.action.SaveDataSetSortOrderAction"
@@ -266,6 +285,9 @@
<property name="dataElementService">
<ref bean="org.hisp.dhis.dataelement.DataElementService"/>
</property>
+ <property name="indicatorService">
+ <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
+ </property>
</bean>
<bean id="org.hisp.dhis.dataset.action.GetDataSetAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2011-04-28 19:47:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2011-05-09 10:42:32 +0000
@@ -22,6 +22,8 @@
frequency = Frequency
selected_data_elements = Selected data elements
available_data_elements = Available data elements
+selected_indicators = Selected indicators
+available_indicators = Available indicators
group_filter = Group filter
define_associations = Assign dataset to organisation units
id = Id
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-05-08 09:38:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-05-09 10:42:32 +0000
@@ -153,16 +153,28 @@
<action name="editDataSetForm"
class="org.hisp.dhis.dataset.action.DataElementListFilteredByGroup">
+ <result name="success" type="chain">indicatorListFilteredByGroup</result>
+ <param name="requiredAuthorities">F_DATASET_UPDATE</param>
+ </action>
+
+ <action name="indicatorListFilteredByGroup"
+ class="org.hisp.dhis.dataset.action.IndicatorListFilteredByGroup">
<result name="success" type="chain">dataElementGroupListEditChain</result>
<param name="requiredAuthorities">F_DATASET_UPDATE</param>
</action>
-
+
<action name="dataElementGroupListEditChain"
class="org.hisp.dhis.dataset.action.DataElementGroupListAction">
+ <result name="success" type="chain">indicatorGroupListEditChain</result>
+ <param name="requiredAuthorities">F_DATASET_UPDATE</param>
+ </action>
+
+ <action name="indicatorGroupListEditChain"
+ class="org.hisp.dhis.dataset.action.IndicatorGroupListAction">
<result name="success" type="chain">getDataSetEditChain</result>
<param name="requiredAuthorities">F_DATASET_UPDATE</param>
</action>
-
+
<action name="getDataSetEditChain"
class="org.hisp.dhis.dataset.action.GetDataSetAction">
<result name="success" type="chain">periodTypeListEditChain</result>
@@ -213,6 +225,12 @@
<result name="success" type="velocity-xml">/dhis-web-maintenance-dataset/responseDataElementGroup.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <action name="filterAvailableIndicatorsByIndicatorGroup"
+ class="org.hisp.dhis.dataset.action.IndicatorListFilteredByGroup">
+ <result name="success" type="velocity-xml">/dhis-web-maintenance-dataset/responseIndicatorGroup.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
<action name="filterDataElementsByDataElementGroupForSection"
class="org.hisp.dhis.dataset.action.section.DataElementListFilteredByGroupForSection">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2011-03-21 10:01:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2011-05-09 10:42:32 +0000
@@ -106,4 +106,69 @@
</tbody>
</table>
+
+ <table id="indicatorSelectionArea">
+ <col/> ## Available Indicators
+ <col/> ## Filter
+ <col/> ## Selected Indicators
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_indicators" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <select id="indicatorGroupSelect" name="indicatorGroupSelect" style="min-width:20em"
+ onchange="javascript:filterByIndicatorGroup( this.options[this.selectedIndex].value )">
+ <option value="ALL" selected="selected">$i18n.getString( "all" )</option>
+ #foreach ( $indicatorGroup in $indicatorGroups )
+ <option value="$indicatorGroup.id">$encoder.htmlEncode( $indicatorGroup.name )</option>
+ #end
+ </select>
+ </td>
+ <td>$i18n.getString( "group" )</td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><input type="text" id="availableIndicatorsFilter" onkeyup="filterList( this.value, 'indicatorAvailableList' )" style="min-width:20em"></td>
+ <td>$i18n.getString( "name" )</td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td>
+ <select size="15" id="indicatorAvailableList" name="indicatorAvailableList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'indicatorAvailableList', 'indicatorSelectedList');">
+ #foreach ( $availableIndicator in $indicators )
+ <option value="$availableIndicator.id">$encoder.htmlEncode( $availableIndicator.name )</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="moveSelectedById( 'indicatorAvailableList', 'indicatorSelectedList');"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="moveSelectedById( 'indicatorSelectedList', 'indicatorAvailableList');"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'indicatorAvailableList', 'indicatorSelectedList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'indicatorSelectedList', 'indicatorAvailableList' );"/>
+ </td>
+ <td>
+ <select id="indicatorSelectedList" name="indicatorSelectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'indicatorSelectedList', 'indicatorAvailableList' );">
+ #foreach ( $availableIndicator in $dataSetIndicators )
+ <option value="$availableIndicator.id">$encoder.htmlEncode( $availableIndicator.name )</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/><input type="button"
+ onclick="window.location.href='dataSet.action'" value="$i18n.getString( 'cancel' )" style="width:10em"/>
+ </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/dataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js 2010-11-20 08:23:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js 2011-05-09 10:42:32 +0000
@@ -87,4 +87,49 @@
availableList.add( new Option( name, id ), null );
}
-}
\ No newline at end of file
+}
+
+function filterByIndicatorGroup( selectedIndicatorGroup )
+{
+ var request = new Request();
+
+ var requestString = 'filterAvailableIndicatorsByIndicatorGroup.action';
+
+ var params = 'indicatorGroupId=' + selectedIndicatorGroup;
+
+ var selectedList = document.getElementById( 'indicatorSelectedList' );
+
+ for ( var i = 0; i < selectedList.options.length; ++i)
+ {
+ params += '&selectedIndicators=' + selectedList.options[i].value;
+ }
+
+ // Clear the list
+ var availableList = document.getElementById( 'indicatorAvailableList' );
+
+ availableList.options.length = 0;
+
+ request.setResponseTypeXML( 'indicatorGroup' );
+ request.setCallbackSuccess( filterByIndicatorGroupCompleted );
+ request.sendAsPost( params );
+ request.send( requestString );
+}
+
+function filterByIndicatorGroupCompleted( indicatorGroup )
+{
+ var indicators = indicatorGroup.getElementsByTagName( 'indicators' )[0];
+ var indicatorList = indicators.getElementsByTagName( 'indicator' );
+
+ alert(indicatorList.length);
+
+ var availableList = document.getElementById( 'indicatorAvailableList' );
+
+ for ( var i = 0; i < indicatorList.length; i++ )
+ {
+ var indicator = indicatorList[i];
+ var name = indicator.firstChild.nodeValue;
+ var id = indicator.getAttribute( 'id' );
+
+ availableList.add( new Option( name, id ), null );
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseDataElementGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseDataElementGroup.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseDataElementGroup.vm 2011-05-09 10:42:32 +0000
@@ -5,4 +5,4 @@
<dataElement id="$dataElement.id">$encoder.xmlEncode( $dataElement.name )</dataElement>
#end
</dataElements>
-</dataElementGroup>
\ No newline at end of file
+</dataElementGroup>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseIndicatorGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseIndicatorGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseIndicatorGroup.vm 2011-05-09 10:42:32 +0000
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<indicatorGroup>
+ <indicators>
+ #foreach( $indicator in $indicators )
+ <indicator id="$indicator.id">$encoder.xmlEncode( $indicator.name )</dataElement>
+ #end
+ </indicators>
+</indicatorGroup>