← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7: Forgot to add two action classes.

 

------------------------------------------------------------
revno: 7
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Sun 2009-03-08 13:39:30 +0100
message:
  Forgot to add two action classes.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListSortOrderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java	2009-03-08 12:39:30 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.dd.action.dataelement;
+
+/*
+ * Copyright (c) 2004-2007, 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.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementSortOrderComparator;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+
+import com.opensymphony.xwork.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class GetDataElementListSortOrderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // DisplayPropertyHandler
+    // -------------------------------------------------------------------------
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<DataElement> dataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implemantation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
+        
+        Collections.sort( dataElements, new DataElementSortOrderComparator() );
+        
+        displayPropertyHandler.handle( dataElements );
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListSortOrderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListSortOrderAction.java	2009-03-08 12:39:30 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.dd.action.indicator;
+
+/*
+ * Copyright (c) 2004-2007, 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.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorSortOrderComparator;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+
+import com.opensymphony.xwork.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class GetIndicatorListSortOrderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+
+    // -------------------------------------------------------------------------
+    // DisplayPropertyHandler
+    // -------------------------------------------------------------------------
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<Indicator> indicators;
+
+    public List<Indicator> getIndicators()
+    {
+        return indicators;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implemantation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
+        
+        Collections.sort( indicators, new IndicatorSortOrderComparator() );
+        
+        displayPropertyHandler.handle( indicators );
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js	2009-03-08 12:39:30 +0000
@@ -0,0 +1,329 @@
+
+function initAllList()
+{
+    var list = document.getElementById( 'dataElementGroups' );
+    var id;
+
+    for ( id in dataElementGroups )
+    {
+        list.add( new Option( dataElementGroups[id], id ), null );
+    }
+
+    list = document.getElementById( 'availableDataElements' );
+
+    for ( id in availableDataElements )
+    {
+        list.add( new Option( availableDataElements[id], id ), null );
+    }
+    
+    if(list.selectedIndex==-1)
+    {
+        list.disabled = true;
+    }
+}
+
+function addSelectedDataElements()
+{
+    var list = document.getElementById( 'availableDataElements' );
+
+    while ( list.selectedIndex != -1 )
+    {
+        var id = list.options[list.selectedIndex].value;
+
+        list.options[list.selectedIndex].selected = false;
+
+        selectedDataElements[id] = availableDataElements[id];       
+    
+    }
+    filterSelectedDataElements();
+    filterAvailableDataElements();
+}
+
+function removeSelectedDataElements()
+{
+    var list = document.getElementById( 'selectedDataElements' );   
+
+    while ( list.selectedIndex != -1 )
+    {
+        var id = list.options[list.selectedIndex].value;
+
+        list.options[list.selectedIndex].selected = false;
+        
+        //availableDataElements[id] = selectedDataElements[id];
+        
+        delete selectedDataElements[id];        
+    }
+    
+    filterSelectedDataElements();
+    filterAvailableDataElements();
+}
+
+function filterDataElementGroups()
+{
+    var filter = document.getElementById( 'dataElementGroupsFilter' ).value;
+    var list = document.getElementById( 'dataElementGroups' );
+    
+    list.options.length = 0;
+    
+    for ( var id in dataElementGroups )
+    {
+        var value = dataElementGroups[id];
+        
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
+            list.add( new Option( value, id ), null );
+        }
+    }
+}
+
+function filterAvailableDataElements()
+{
+    var filter = document.getElementById( 'availableDataElementsFilter' ).value;
+    var list = document.getElementById( 'availableDataElements' );
+    
+    list.options.length = 0;
+    
+    for ( var id in availableDataElements )
+    {
+        var value = availableDataElements[id];
+        
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
+            list.add( new Option( value, id ), null );
+        }
+    }
+}
+
+function filterSelectedDataElements()
+{
+    var filter = document.getElementById( 'selecteDataElementsFilter' ).value;
+    var list = document.getElementById( 'selectedDataElements' );
+    
+    list.options.length = 0;
+    
+    for ( var id in selectedDataElements )
+    {
+        var value = selectedDataElements[id];
+        
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
+            list.add( new Option( value, id ), null );
+        }
+    }
+}
+
+function getDataElementGroup( dataElementGroupList )
+{           
+    selectedDataElements = new Object();
+    var id = dataElementGroupList.options[ dataElementGroupList.selectedIndex ].value;  
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( getDataElementGroupCompleted );
+    request.send( 'getDataElementGroupEditor.action?id=' + id );    
+}
+
+function getDataElementGroupCompleted( xmlObject )
+{   
+    var selectedList = document.getElementById( 'selectedDataElements' );   
+    selectedList.length = 0;
+    name = xmlObject.getElementsByTagName('name')[0].firstChild.nodeValue;
+    var dataElementList = xmlObject.getElementsByTagName('dataElement');
+    for ( var i = 0; i < dataElementList.length; i++ )
+    {
+        dataElement = dataElementList.item(i);  
+        var id = dataElement.getAttribute('id');
+        var value = dataElement.firstChild.nodeValue;       
+        selectedDataElements[id] = value;
+    }
+    filterSelectedDataElements();   
+    document.getElementById( 'groupNameView').innerHTML = i18n_member_of + " <b>" + name + "</b>";
+    document.getElementById('availableDataElements').disabled=false;
+    
+}
+
+function updateDataElementGroupMembers()
+{
+    var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+    var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
+    
+    var request = new Request();
+
+    var requestString = 'updateDataElementGroupEditor.action';
+
+    var params = "id=" + id;
+
+    var selectedDataElementMembers = document.getElementById( 'selectedDataElements' );
+
+    for ( var i = 0; i < selectedDataElementMembers.options.length; ++i)
+    {
+        params += '&selectedDataElements=' + selectedDataElementMembers.options[i].value;
+    }   
+    request.sendAsPost( params );
+    request.setResponseTypeXML( 'xmlObject' );  
+    request.setCallbackSuccess( updateDataElementGroupMembersReceived );
+    request.send( requestString );  
+}
+
+function updateDataElementGroupMembersReceived( xmlObject )
+{       
+    dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );   
+    document.getElementById('message').style.display='block';
+    document.getElementById('message').innerHTML = i18n_update_success + " : " + dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
+}
+
+function deleteDataElementGroup()
+{
+    var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+         
+    try
+    {
+        var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
+        var name =  dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
+        if( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+            var request = new Request();
+            request.setResponseTypeXML( 'xmlObject' );  
+            request.setCallbackSuccess( deleteDataElementGroupReceived );
+            request.send( 'deleteDataElemenGroupEditor.action?id=' + id );  
+        }           
+    }
+    catch(e)
+    {
+        alert( i18n_select_dataelement_group );
+    }
+}
+
+function deleteDataElementGroupReceived( xmlObject )
+{
+    var type = xmlObject.getAttribute( 'type' );
+    
+    if(type=='success')
+    {
+        var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );           
+        dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );
+        document.getElementById( 'groupNameView' ).innerHTML = "";
+        selectedDataElements = new Object();
+        filterSelectedDataElements();
+    }
+}
+
+function showRenameDataElementGroupForm()
+{       
+    var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+        
+    try
+    {
+        var name = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
+        document.getElementById( 'addRenameGroupButton' ).onclick=validateRenameDataElementGroup;
+        showDivCenter( 'addDataElementGroupForm' );
+        showDivEffect();
+        document.getElementById( 'groupName' ).value = name;
+    }
+    catch(e)
+    {
+        alert(i18n_select_dataelement_group);
+    }
+    
+}
+
+function validateRenameDataElementGroup()
+{
+    var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+    var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;    
+    var name = document.getElementById( 'groupName' ).value;    
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( validateRenameDataElementGroupReceived );
+    request.send( 'validateDataElementGroup.action?id=' + id + '&name=' + name );   
+}
+
+function validateRenameDataElementGroupReceived( xmlObject )
+{
+    var type = xmlObject.getAttribute( 'type' );
+    
+    if(type=='input')
+    {
+        alert(xmlObject.firstChild.nodeValue);
+    }
+    if(type=='success')
+    {
+        renameDataElementGroup();
+    }
+}
+
+function renameDataElementGroup()
+{
+    var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+    var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;    
+    var name = document.getElementById( 'groupName' ).value;        
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( renameDataElementGroupReceived );
+    request.send( 'renameDataElementGroupEditor.action?id=' + id + '&name=' + name );
+    
+}
+
+function renameDataElementGroupReceived( xmlObject )
+{   
+    var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
+    var list = document.getElementById( 'dataElementGroups' );
+    list.options[ list.selectedIndex ].text = name; 
+    document.getElementById( 'groupNameView' ).innerHTML = name;        
+    showHideDiv( 'addDataElementGroupForm' );
+    deleteDivEffect();      
+}
+
+function showAddDataElementGroupForm()
+{
+    document.getElementById( 'groupName' ).value='';    
+    document.getElementById( 'addRenameGroupButton' ).onclick=validateAddDataElementGroup;
+    showDivCenter( 'addDataElementGroupForm' );
+    showDivEffect();
+}
+
+function validateAddDataElementGroup()
+{
+    var name = document.getElementById( 'groupName' ).value;    
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( validateAddDataElementGroupReceived );
+    request.send( 'validateDataElementGroup.action?name=' + name ); 
+}
+
+function validateAddDataElementGroupReceived( xmlObject )
+{
+    var type = xmlObject.getAttribute( 'type' );
+    
+    if(type=='input')
+    {
+        alert(xmlObject.firstChild.nodeValue);
+    }
+    if(type=='success')
+    {
+        createNewGroup();
+    }
+}
+
+function createNewGroup()
+{
+    var name = document.getElementById( 'groupName' ).value;    
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( createNewGroupReceived );
+    request.send( 'addDataElementGroupEditor.action?name=' + name );    
+}
+
+function createNewGroupReceived( xmlObject )
+{       
+    var id = xmlObject.getElementsByTagName( "id" )[0].firstChild.nodeValue;
+    var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
+    var list = document.getElementById( 'dataElementGroups' );
+    var option = new Option( name, id );
+    option.selected = true;
+    list.add(option , null );   
+    document.getElementById( 'groupNameView' ).innerHTML = name;        
+    selectedDataElements = new Object();
+    filterSelectedDataElements();       
+    showHideDiv( 'addDataElementGroupForm' );
+    deleteDivEffect();  
+}



--

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.