dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10160
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2789: Removed the DataElement-DataElementGroupSet association, not in use
------------------------------------------------------------
revno: 2789
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-02-01 09:11:57 +0100
message:
Removed the DataElement-DataElementGroupSet association, not in use
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/multiDimensionalDataElement.js
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.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-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-02-01 08:11:57 +0000
@@ -154,11 +154,6 @@
private Set<DataSet> dataSets = new HashSet<DataSet>();
/**
- * A Set of DataElementGroupSets.
- */
- private List<DataElementGroupSet> groupSets = new ArrayList<DataElementGroupSet>();
-
- /**
* The lower organisation unit levels for aggregation.
*/
private List<Integer> aggregationLevels = new ArrayList<Integer>();
@@ -325,21 +320,6 @@
return domainType != null ? domainType : DOMAIN_TYPE_AGGREGATE;
}
- public Set<DataElement> getDataElements()
- {
- Set<DataElement> dataElements = new HashSet<DataElement>();
-
- for ( DataElementGroupSet groupSet : groupSets )
- {
- for ( DataElementGroup group : groupSet.getMembers() )
- {
- dataElements.addAll( group.getMembers() );
- }
- }
-
- return dataElements;
- }
-
public String toJSON()
{
StringBuffer result = new StringBuffer();
@@ -477,16 +457,6 @@
this.dataSets = dataSets;
}
- public List<DataElementGroupSet> getGroupSets()
- {
- return groupSets;
- }
-
- public void setGroupSets( List<DataElementGroupSet> groupSets )
- {
- this.groupSets = groupSets;
- }
-
public List<Integer> getAggregationLevels()
{
return aggregationLevels;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2011-01-13 10:50:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2011-02-01 08:11:57 +0000
@@ -30,7 +30,6 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
@@ -258,16 +257,6 @@
Collection<DataElement> getDataElementsWithGroupSets();
/**
- * Returns all DataElements which are associated with the given set of
- * DataElementGroupSets.
- *
- * @param groupSets the set of DataElementGroupSets.
- * @return all DataElements which are associated with the given set of
- * DataElementGroupSets.
- */
- Collection<DataElement> getDataElementsByGroupSets( Set<DataElementGroupSet> groupSets );
-
- /**
* Returns all DataElements which are not member of any DataElementGroups.
*
* @return all DataElements which are not member of any DataElementGroups.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2011-02-01 08:11:57 +0000
@@ -320,22 +320,6 @@
return i18n( i18nService, dataElementStore.getDataElementsWithGroupSets() );
}
- public Collection<DataElement> getDataElementsByGroupSets( Set<DataElementGroupSet> groupSets )
- {
- Collection<DataElement> dataElements = new HashSet<DataElement>();
-
- for ( DataElement dataElement : getDataElementsWithGroupSets() )
- {
- if ( dataElement.getGroupSets() != null
- && new HashSet<DataElementGroupSet>( dataElement.getGroupSets() ).equals( groupSets ) )
- {
- dataElements.add( dataElement );
- }
- }
-
- return i18n( i18nService, dataElements );
- }
-
public Collection<DataElement> getDataElementsWithoutGroups()
{
return i18n( i18nService, dataElementStore.getDataElementsWithoutGroups() );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2011-02-01 08:11:57 +0000
@@ -62,14 +62,7 @@
<key column="dataelementid"/>
<many-to-many class="org.hisp.dhis.dataset.DataSet" column="datasetid"/>
</set>
-
- <list name="groupSets" table="dataelement_dataelementgroupsetmembers">
- <key column="dataelementid"/>
- <list-index column="sort_order" base="0"/>
- <many-to-many class="org.hisp.dhis.dataelement.DataElementGroupSet"
- column="dataelementgroupsetid" foreign-key="fk_dataelement_dataelementgroupsetid"/>
- </list>
-
+
<list name="aggregationLevels" table="dataelementaggregationlevels">
<key column="dataelementid"/>
<list-index column="sort_order" base="0"/>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java 2011-02-01 08:11:57 +0000
@@ -429,41 +429,6 @@
assertEquals( 3, dataElementService.getDataElementsByType( DataElement.VALUE_TYPE_BOOL ).size() );
}
- @Test
- public void testGetDataElementsByGroupSets()
- {
- DataElementGroupSet groupSetA = createDataElementGroupSet( 'A' );
- DataElementGroupSet groupSetB = createDataElementGroupSet( 'B' );
-
- dataElementService.addDataElementGroupSet( groupSetA );
- dataElementService.addDataElementGroupSet( groupSetB );
-
- DataElement dataElementA = createDataElement( 'A' );
- DataElement dataElementB = createDataElement( 'B' );
- DataElement dataElementC = createDataElement( 'C' );
- DataElement dataElementD = createDataElement( 'D' );
-
- dataElementB.getGroupSets().add( groupSetA );
- dataElementB.getGroupSets().add( groupSetB );
- dataElementD.getGroupSets().add( groupSetA );
- dataElementD.getGroupSets().add( groupSetB );
-
- dataElementService.addDataElement( dataElementA );
- dataElementService.addDataElement( dataElementB );
- dataElementService.addDataElement( dataElementC );
- dataElementService.addDataElement( dataElementD );
-
- Set<DataElementGroupSet> groupSets = new HashSet<DataElementGroupSet>();
- groupSets.add( groupSetA );
- groupSets.add( groupSetB );
-
- Collection<DataElement> dataElements = dataElementService.getDataElementsByGroupSets( groupSets );
-
- assertEquals( 2, dataElements.size() );
- assertTrue( dataElements.contains( dataElementB ) );
- assertTrue( dataElements.contains( dataElementD ) );
- }
-
// -------------------------------------------------------------------------
// CalculatedDataElements
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java 2010-08-30 10:56:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java 2011-02-01 08:11:57 +0000
@@ -463,34 +463,7 @@
assertEquals( 2, dataElementStore.getDataElement( idA ).getAggregationLevels().size() );
assertEquals( aggregationLevels, dataElementStore.getDataElement( idA ).getAggregationLevels() );
}
-
- @Test
- public void testGetDataElementsWithGroupSets()
- {
- DataElementGroupSet groupSetA = createDataElementGroupSet( 'A' );
-
- dataElementService.addDataElementGroupSet( groupSetA );
-
- DataElement dataElementA = createDataElement( 'A' );
- DataElement dataElementB = createDataElement( 'B' );
- DataElement dataElementC = createDataElement( 'C' );
- DataElement dataElementD = createDataElement( 'D' );
-
- dataElementB.getGroupSets().add( groupSetA );
- dataElementD.getGroupSets().add( groupSetA );
-
- dataElementStore.addDataElement( dataElementA );
- dataElementStore.addDataElement( dataElementB );
- dataElementStore.addDataElement( dataElementC );
- dataElementStore.addDataElement( dataElementD );
-
- Collection<DataElement> dataElements = dataElementStore.getDataElementsWithGroupSets();
-
- assertEquals( 2, dataElements.size() );
- assertTrue( dataElements.contains( dataElementB ) );
- assertTrue( dataElements.contains( dataElementD ) );
- }
-
+
@Test
public void testGetDataElementsZeroIsSignificant()
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2011-02-01 08:11:57 +0000
@@ -154,13 +154,6 @@
this.url = url;
}
- private Collection<String> dataElementGroupSets = new ArrayList<String>();
-
- public void setDataElementGroupSets( Collection<String> dataElementGroupSets )
- {
- this.dataElementGroupSets = dataElementGroupSets;
- }
-
private Collection<String> aggregationLevels;
public void setAggregationLevels( Collection<String> aggregationLevels )
@@ -282,11 +275,6 @@
dataElement = new DataElement();
}
- for ( String id : dataElementGroupSets )
- {
- dataElement.getGroupSets().add( dataElementService.getDataElementGroupSet( Integer.parseInt( id ) ) );
- }
-
dataElement.setName( name );
dataElement.setAlternativeName( alternativeName );
dataElement.setShortName( shortName );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2010-11-05 09:24:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2011-02-01 08:11:57 +0000
@@ -31,18 +31,15 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.CalculatedDataElement;
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.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -142,13 +139,6 @@
return dataElementCategoryCombos;
}
- private List<DataElementGroupSet> dataElementGroupSets;
-
- public List<DataElementGroupSet> getDataElementGroupSets()
- {
- return dataElementGroupSets;
- }
-
private List<OrganisationUnitLevel> organisationUnitLevels;
public List<OrganisationUnitLevel> getOrganisationUnitLevels()
@@ -223,12 +213,6 @@
}
}
- dataElementGroupSets = new ArrayList<DataElementGroupSet>( dataElementService.getAllDataElementGroupSets() );
-
- dataElementGroupSets.removeAll( dataElement.getGroupSets() );
-
- Collections.sort( dataElementGroupSets, new IdentifiableObjectNameComparator() );
-
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2010-12-22 04:05:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2011-02-01 08:11:57 +0000
@@ -167,13 +167,6 @@
this.url = url;
}
- private Collection<String> dataElementGroupSets = new ArrayList<String>();
-
- public void setDataElementGroupSets( Collection<String> dataElementGroupSets )
- {
- this.dataElementGroupSets = dataElementGroupSets;
- }
-
private Collection<String> aggregationLevels;
public void setAggregationLevels( Collection<String> aggregationLevels )
@@ -305,13 +298,6 @@
calculatedDataElement.setSaved( saved != null );
}
- dataElement.getGroupSets().clear();
-
- for ( String id : dataElementGroupSets )
- {
- dataElement.getGroupSets().add( dataElementService.getDataElementGroupSet( Integer.parseInt( id ) ) );
- }
-
Set<DataSet> dataSets = dataElement.getDataSets();
for ( DataSet dataSet : dataSets )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2011-01-20 15:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2011-02-01 08:11:57 +0000
@@ -1,5 +1,4 @@
<script>
-
jQuery(document).ready( function(){
validation( 'addDataElementForm', function( form ){
form.submit();
@@ -16,8 +15,6 @@
toggleCDEForm();
}
);
-
-
</script>
<h3>$i18n.getString( "create_new_data_element" )</h3>
@@ -175,50 +172,6 @@
</div>
<table>
- <tr>
- <td style="height:10px" colspan="2"></td>
- </tr>
- <tr>
- <td style="width:200px">$i18n.getString( "data_element_group_sets" )</td>
- <td><input type="checkbox" onclick="toggleById( 'dataElementGroupSetContainer' )"/></td>
- </tr>
-</table>
-
-<div id="dataElementGroupSetContainer" style="border:1px solid #808080; padding:10px; width:465px; display:none;">
-
-<table>
- <tr>
- <th style="width:450px">$i18n.getString( "available_data_element_group_sets" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="4" id="availableDataElementGroupSets" style="width:450px" ondblclick="moveSelectedById( 'availableDataElementGroupSets', 'dataElementGroupSets' )">
- #foreach( $groupSet in $dataElementGroupSets )
- <option value="$groupSet.id">$encoder.htmlEncode( $groupSet.name )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add' )" style="width:120px" onclick="moveSelectedById( 'availableDataElementGroupSets', 'dataElementGroupSets' )"/><input
- type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove' )" style="width:120px" onclick="moveSelectedById( 'dataElementGroupSets', 'availableDataElementGroupSets' )"/>
- </td>
- </tr>
- <tr>
- <th style="width:450px">$i18n.getString( "selected_data_element_group_sets" )</th>
- </tr>
- </tr>
- <td>
- <select multiple size="4" id="dataElementGroupSets" name="dataElementGroupSets" style="width:450px" ondblclick="moveSelectedById( 'dataElementGroupSets', 'availableDataElementGroupSets' )">
- </select>
- </td>
- </tr>
-</table>
-
-</div>
-
-<table>
<tr>
<td style="height:10px" colspan="2"></td>
</tr>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/multiDimensionalDataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/multiDimensionalDataElement.js 2010-09-01 16:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/multiDimensionalDataElement.js 1970-01-01 00:00:00 +0000
@@ -1,410 +0,0 @@
-
-// -----------------------------------------------------------------------------
-// View details
-// -----------------------------------------------------------------------------
-
-function showDataElementDetails( dataElementId )
-{
- var request = new Request();
- request.setResponseTypeXML( 'dataElement' );
- request.setCallbackSuccess( dataElementReceived );
- request.send( 'getMultiDimensionalDataElement.action?id=' + dataElementId );
-}
-
-function dataElementReceived( dataElementElement )
-{
- setInnerHTML( 'nameField', getElementValue( dataElementElement, 'name' ) );
-
- setInnerHTML( 'shortNameField', getElementValue( dataElementElement, 'shortName' ) );
-
- var alternativeName = getElementValue( dataElementElement, 'alternativeName' );
- setInnerHTML( 'alternativeNameField', alternativeName ? alternativeName : '[' + i18n_none + ']' );
-
- var code = getElementValue( dataElementElement, 'code' );
- setInnerHTML( 'codeField', code ? code : '[' + i18n_none + ']' );
-
- var description = getElementValue( dataElementElement, 'description' );
- setInnerHTML( 'descriptionField', description ? description : '[' + i18n_none + ']' );
-
- var active = getElementValue( dataElementElement, 'active' );
- setInnerHTML( 'activeField', active == 'true' ? i18n_yes : i18n_no );
-
- var typeMap = { 'int':i18n_number, 'bool':i18n_yes_no, 'string':i18n_text };
- var type = getElementValue( dataElementElement, 'type' );
- setInnerHTML( 'typeField', typeMap[type] );
-
- var aggregationOperator = getElementValue( dataElementElement, 'aggregationOperator' );
- var aggregationOperatorText = i18n_none;
- if ( aggregationOperator == 'sum' )
- {
- aggregationOperatorText = i18n_sum;
- }
- else if ( aggregationOperator == 'average' )
- {
- aggregationOperatorText = i18n_average;
- }
- setInnerHTML( 'aggregationOperatorField', aggregationOperatorText );
-
- var selectedCategoryComboId = getElementValue( dataElementElement, 'selectedCategoryComboId' );
- setInnerHTML( 'selectedCategoryComboIdField', selectedCategoryComboId );
-
- showDetails();
-}
-
-function getDataElements( dataElementGroupId, type )
-{
- var url = "getMultiDimensionalDataElements.action?";
-
- if ( dataElementGroupId == '[select]' )
- {
- return;
- }
-
- if ( dataElementGroupId != null )
- {
- url += "dataElementGroupId=" + dataElementGroupId;
- }
-
- if ( type != null )
- {
- url += "&type=" + type
- }
-
- alert(url);
-
- var request = new Request();
- request.setResponseTypeXML( 'dataElement' );
- request.setCallbackSuccess( getDataElementsReceived );
- request.send( url );
-}
-
-function getDataElementsReceived( xmlObject )
-{
- var availableDataElements = document.getElementById( "availableDataElements" );
- //var selectedDataElements = document.getElementById( "selectedDataElements" );
-
- clearList( availableDataElements );
-
- var dataElements = xmlObject.getElementsByTagName( "dataElement" );
-
- 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;
-
- //if ( listContains( selectedDataElements, id ) == false )
- //{
- var option = document.createElement( "option" );
- option.value = id;
- option.text = dataElementName;
- option.title = dataElementName;
- availableDataElements.add( option, null );
- //}
- }
-
- // If the list of available dataelements is empty, an empty placeholder will be added
- addOptionPlaceHolder( availableDataElements );
-}
-
-// -----------------------------------------------------------------------------
-// Remove data element
-// -----------------------------------------------------------------------------
-
-function removeDataElement( dataElementId, dataElementName )
-{
- var result = window.confirm( i18n_confirm_delete + '\n\n' + dataElementName );
-
- if ( result )
- {
- window.location.href = 'removeMultiDimensionalDataElement.action?id=' + dataElementId;
- }
-}
-
-// -----------------------------------------------------------------------------
-// Add data element
-// -----------------------------------------------------------------------------
-
-function validateAddDataElement()
-{
- var request = new Request();
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( addValidationCompleted );
-
- request.send( 'validateMultiDimensionalDataElement.action?name=' + getFieldValue( 'name' ) +
- '&shortName=' + getFieldValue( 'shortName' ) +
- '&alternativeName=' + getFieldValue( 'alternativeName' ) +
- '&code=' + getFieldValue( 'code' ) +
- '&type=' + getSelectValue( 'type' ) +
- '&calculated=' + getCheckboxValue( 'calculated' ) +
- '&selectedCategoryComboId=' + getSelectValue( 'selectedCategoryComboId' ) +
- makeValueString('dataElementIds', getInputValuesByParentId('selectedDataElements', 'dataElementIds'))
- );
-
- return false;
-}
-
-/**
- * Make a CGI parameter string for the given field name and set of values
- *
- * @param fieldName name of the field to make a string for
- * @param values array of values to add to the string
- * @returns String on the form '&fieldName=value1...$fieldName=valueN'
- */
-function makeValueString( fieldName, values )
-{
- var valueStr = "";
- for ( var i = 0, value; value = values[i]; i++ )
- {
- valueStr += "&" + fieldName + "=" + value;
- }
-
- return valueStr;
-}
-
-function addValidationCompleted( messageElement )
-{
- var type = messageElement.getAttribute( 'type' );
- var message = messageElement.firstChild.nodeValue;
-
- if ( type == 'success' )
- {
- var form = document.getElementById( 'addMultiDimensionalDataElementForm' );
- form.submit();
- }
- else if ( type == 'error' )
- {
- window.alert( i18n_adding_data_element_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- document.getElementById( 'message' ).innerHTML = message;
- document.getElementById( 'message' ).style.display = 'block';
- }
-}
-
-/**
- * Returns the first value of the specified select box
- *
- * @param selectId
- * @return The first (or only) String value of the given select box,
- * or null if no options are selected
- */
-function getSelectValue( selectId )
-{
- var select = document.getElementById( selectId );
- var option = select.options[select.selectedIndex];
-
- if ( option )
- {
- return option.value;
- }
- else
- {
- return null;
- }
-}
-
-/**
- * Returns the values for the specified select box
- *
- * @param id id of the select box to get values for
- * @return Array of String values from the given select box,
- * or an empty array if no options are selected
- */
-function getSelectValues( selectId )
-{
- var select = document.getElementById( selectId );
- var values = [];
- for ( var i = 0, option; option = select.options[i]; i++ )
- {
- if ( option.selected )
- {
- values.push(option.value);
- }
- }
-
- return values;
-}
-
-/**
- * Returns the value for the specified checkbox
- *
- * @param checkboxId id of the checkbox to get a value for
- * @return String value for the specified checkbox,
- * or null if the checkbox is not checked
- */
-function getCheckboxValue( checkboxId )
-{
- var checkbox = document.getElementById( checkboxId );
-
- return ( checkbox.checked ? checkbox.value : null );
-}
-
-/**
- * Returns the values for a set of inputs with the same name,
- * under a specified parent node.
- *
- * @param parentId id of the parent node to limit the search to
- * @param fieldName form name of the inputs to get values for
- * @return Array with the String values for the specified inputs,
- * or an empty Array if no inputs with that name exist under the specified parent node
- */
-function getInputValuesByParentId( parentId, fieldName )
-{
- var node = document.getElementById(parentId);
-
- if ( ! node )
- {
- return [];
- }
-
- var inputs = node.getElementsByTagName("input");
- values = [];
-
- for ( var i = 0, input; input = inputs[i]; i++ )
- {
- if ( input.name == fieldName )
- {
- values.push(input.value);
- }
- }
-
- return values;
-}
-
-// -----------------------------------------------------------------------------
-// Update data element
-// -----------------------------------------------------------------------------
-
-function validateUpdateDataElement()
-{
- var request = new Request();
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( updateValidationCompleted );
- request.send( 'validateMultiDimensionalDataElement.action?id=' + getFieldValue( 'id' ) +
- '&name=' + getFieldValue( 'name' ) +
- '&shortName=' + getFieldValue( 'shortName' ) +
- '&alternativeName=' + getFieldValue( 'alternativeName' ) +
- '&selectedCategoryComboId=' + getSelectValue( 'selectedCategoryComboId' ) +
- '&code=' + getFieldValue( 'code' ) );
-
- return false;
-}
-
-function updateValidationCompleted( messageElement )
-{
- var type = messageElement.getAttribute( 'type' );
- var message = messageElement.firstChild.nodeValue;
-
- if ( type == 'success' )
- {
- var form = document.getElementById( 'updateMultiDimensionalDataElementForm' );
- form.submit();
- }
- else if ( type == 'error' )
- {
- window.alert( i18n_saving_data_element_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- document.getElementById( 'message' ).innerHTML = message;
- document.getElementById( 'message' ).style.display = 'block';
- }
-}
-
-/**
- * Adds a set of data elements to the CDE table.
- * Either add the selected ones, or add all.
- * @param requireSelect Whether to only add the selected data elements
- */
-function addCDEDataElements( requireSelected )
-{
- var available = byId('availableDataElements');
- var option;
-
- removeTablePlaceholder();
-
- for ( var i = available.options.length - 1; i >= 0; i-- )
- {
- option = available.options[i];
-
- if ( requireSelected && ! option.selected )
- {
- continue;
- }
-
- available.remove(i);
- addCDEDataElement( option.value, option.firstChild.nodeValue );
- }
-}
-
-/**
- * Add a single data element to the CDE table.
- */
-function addCDEDataElement( dataElementId, dataElementName )
-{
- //Add data to the table of selected data elements
- var tr = document.createElement('tr');
-
- var nameTd = tr.appendChild(document.createElement('td'));
- nameTd.appendChild(document.createTextNode(dataElementName));
- var idInput = nameTd.appendChild(document.createElement('input'));
- idInput.type = 'hidden';
- idInput.name = 'dataElementIds';
- idInput.value = dataElementId;
-
- var factorTd = tr.appendChild(document.createElement('td'));
- var factorInput = factorTd.appendChild(document.createElement('input'));
- factorInput.type = 'text';
- factorInput.name = 'factors';
- factorInput.value = 1;
-
- var opTd = tr.appendChild(document.createElement('td'));
- var button = opTd.appendChild(document.createElement('button'));
- // i18n?
- button.setAttribute('title', 'Remove from list');
- button.onclick = removeCDEDataElement;
- var delIcon = button.appendChild(document.createElement('img'));
- delIcon.setAttribute( 'src', '../images/delete.png' );
- delIcon.setAttribute( 'alt', 'Delete icon' );
-
- var selectedTable = byId('selectedDataElements');
- selectedTable.appendChild(tr);
-}
-
-/**
- * Remove one data element row from the CDE form.
- */
-function removeCDEDataElement( e )
-{
- var tr = this.parentNode.parentNode;
-
- //Add data back to the list of available data elements
- var nameTd = tr.getElementsByTagName('td')[0];
- var dataElementName = nameTd.firstChild.nodeValue;
- var dataElementId = nameTd.getElementsByTagName('input')[0].value;
- var option = document.createElement('option');
- option.value = dataElementId;
- option.appendChild(document.createTextNode(dataElementName));
- byId('availableDataElements').add(option, null);
-
- //Remove data from the table of data elements
- tr.parentNode.removeChild(tr);
-}
-
-/**
- * Remove placeholder from the selected data elements table
- */
-function removeTablePlaceholder()
-{
- var table = byId('selectedDataElements').getElementsByTagName('tbody')[0];
- var trs = table.getElementsByTagName('tr');
-
- for ( var i = 0, tr; tr = trs[i]; i++ )
- {
- if ( tr.getAttribute('class') == 'placeholder' )
- {
- table.removeChild(tr);
- }
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2011-01-20 15:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2011-02-01 08:11:57 +0000
@@ -203,53 +203,6 @@
<td style="height:10px" colspan="2"></td>
</tr>
<tr>
- <td style="width:200px">$i18n.getString( "data_element_group_sets" )</td>
- <td><input type="checkbox" onclick="toggleById( 'dataElementGroupSetContainer' )"/></td>
- </tr>
-</table>
-
-<div id="dataElementGroupSetContainer" style="border:1px solid #808080; padding:10px; width:465px; display:none;">
-
-<table>
- <tr>
- <th style="width:450px">$i18n.getString( "available_data_element_group_sets" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="4" id="availableDataElementGroupSets" style="width:450px" ondblclick="moveSelectedById( 'availableDataElementGroupSets', 'dataElementGroupSets' )">
- #foreach( $groupSet in $dataElementGroupSets )
- <option value="$groupSet.id">$encoder.htmlEncode( $groupSet.name )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add' )" style="width:120px" onclick="moveSelectedById( 'availableDataElementGroupSets', 'dataElementGroupSets' )"/><input
- type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove' )" style="width:120px" onclick="moveSelectedById( 'dataElementGroupSets', 'availableDataElementGroupSets' )"/>
- </td>
- </tr>
- <tr>
- <th style="width:450px">$i18n.getString( "selected_data_element_group_sets" )</th>
- </tr>
- </tr>
- <td>
- <select multiple size="4" id="dataElementGroupSets" name="dataElementGroupSets" style="width:450px" ondblclick="moveSelectedById( 'dataElementGroupSets', 'availableDataElementGroupSets' )">
- #foreach( $groupSet in $dataElement.groupSets )
- <option value="$groupSet.id">$encoder.htmlEncode( $groupSet.name )</option>
- #end
- </select>
- </td>
- </tr>
-</table>
-
-</div>
-
-<table>
- <tr>
- <td style="height:10px" colspan="2"></td>
- </tr>
- <tr>
<td style="width:200px">$i18n.getString( "aggregation_levels" )</td>
<td><input type="checkbox" #if ( $dataElement.hasAggregationLevels() )checked="checked"#end onclick="toggleById( 'aggregationLevelsContainer' )"/></td>
</tr>