← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2093: Ajax-ified data entry module part 1

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 2093 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-11-17 19:26:47 +0100
message:
  Ajax-ified data entry module part 1
removed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/NextPeriodsAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PreviousPeriodsAction.java
added:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDisplayModesAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadPeriodsAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/customForm.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDisplayModes.vm
renamed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm => dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/SelectedStateManager.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.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-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java	2010-11-11 21:55:05 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java	2010-11-17 18:26:47 +0000
@@ -316,16 +316,10 @@
         return zeroValueSaveMode;
     }
 
-    private Boolean disableDefaultForm;
-
-    public Boolean getDisableDefaultForm()
-    {
-        return disableDefaultForm;
-    }
-
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
+    
     private Integer selectedDataSetId;
 
     public void setSelectedDataSetId( Integer selectedDataSetId )
@@ -370,8 +364,6 @@
     public String execute()
         throws Exception
     {
-        disableDefaultForm = false;
-
         zeroValueSaveMode = (Boolean) systemSettingManager.getSystemSetting( KEY_ZERO_VALUE_SAVE_MODE, false );
 
         OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();

=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	2010-11-17 18:26:47 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.de.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
+import org.hisp.dhis.de.state.SelectedStateManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadDataSetsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<DataSet> dataSets = new ArrayList<DataSet>();
+
+    public Collection<DataSet> getDataSets()
+    {
+        return dataSets;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        dataSets = selectedStateManager.loadDataSetsForSelectedOrgUnit();
+
+        Collections.sort( dataSets, new DataSetNameComparator() );
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDisplayModesAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDisplayModesAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDisplayModesAction.java	2010-11-17 18:26:47 +0000
@@ -0,0 +1,64 @@
+package org.hisp.dhis.de.action;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.de.state.SelectedStateManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadDisplayModesAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private boolean customForm;
+    
+    public boolean isCustomForm()
+    {
+        return customForm;
+    }
+
+    private boolean sectionForm;
+
+    public boolean isSectionForm()
+    {
+        return sectionForm;
+    }
+    
+    private String displayMode;
+
+    public String getDisplayMode()
+    {
+        return displayMode;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        DataSet dataSet = selectedStateManager.getSelectedDataSet();
+        
+        customForm = dataSet.getSections() != null && dataSet.getSections().size() > 0;
+
+        sectionForm = dataSet.getDataEntryForm() != null;
+        
+        displayMode = selectedStateManager.getSelectedDisplayMode();
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadOrganisationUnitAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadOrganisationUnitAction.java	2010-11-17 18:26:47 +0000
@@ -0,0 +1,46 @@
+package org.hisp.dhis.de.action;
+
+import org.hisp.dhis.de.state.SelectedStateManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadOrganisationUnitAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnit organisationUnit;
+
+    public OrganisationUnit getOrganisationUnit()
+    {
+        return organisationUnit;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
+
+        selectedStateManager.clearSelectedDataSet();
+        selectedStateManager.clearSelectedPeriod();
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadPeriodsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadPeriodsAction.java	2010-11-17 18:26:47 +0000
@@ -0,0 +1,110 @@
+package org.hisp.dhis.de.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.de.state.SelectedStateManager;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.Period;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadPeriodsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+    
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer dataSetId;
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+    
+    private boolean next;
+
+    public void setNext( boolean next )
+    {
+        this.next = next;
+    }
+
+    private boolean previous;
+
+    public void setPrevious( boolean previous )
+    {
+        this.previous = previous;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<Period> periods = new ArrayList<Period>();
+
+    public Collection<Period> getPeriods()
+    {
+        return periods;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        DataSet dataSet = dataSetService.getDataSet( dataSetId );
+        
+        if ( dataSet != null )
+        {
+            selectedStateManager.setSelectedDataSet( dataSet );
+            
+            if ( next )
+            {
+                selectedStateManager.nextPeriodSpan();
+            }
+            else if ( previous )
+            {
+                selectedStateManager.previousPeriodSpan();
+            }
+            
+            periods = selectedStateManager.getPeriodList();
+            
+            for ( Period period : periods )
+            {
+                period.setName( format.formatPeriod( period ) );
+            }
+        }
+        
+        return SUCCESS;
+    }
+}

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/NextPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/NextPeriodsAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/NextPeriodsAction.java	1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-package org.hisp.dhis.de.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 org.hisp.dhis.de.state.SelectedStateManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: NextPeriodsAction.java 2966 2007-03-03 14:38:20Z torgeilo $
- */
-public class NextPeriodsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private SelectedStateManager selectedStateManager;
-
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        selectedStateManager.nextPeriodSpan();
-
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PreviousPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PreviousPeriodsAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PreviousPeriodsAction.java	1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-package org.hisp.dhis.de.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 org.hisp.dhis.de.state.SelectedStateManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: PreviousPeriodsAction.java 2966 2007-03-03 14:38:20Z torgeilo $
- */
-public class PreviousPeriodsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private SelectedStateManager selectedStateManager;
-
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        selectedStateManager.previousPeriodSpan();
-
-        return SUCCESS;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java	2010-11-15 17:08:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java	2010-11-17 18:26:47 +0000
@@ -52,6 +52,8 @@
 
 import com.opensymphony.xwork2.ActionSupport;
 
+import static org.hisp.dhis.de.state.SelectedStateManager.*;
+
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: SelectAction.java 5930 2008-10-15 03:30:52Z tri $
@@ -59,11 +61,6 @@
 public class SelectAction
     extends ActionSupport
 {
-    private static final String CUSTOM_FORM = "customform";
-    private static final String SECTION_FORM = "sectionform";
-    private static final String DEFAULT_FORM = "defaultform";    
-    private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform";   
-
     private static final Log log = LogFactory.getLog( SelectAction.class );
 
     // -------------------------------------------------------------------------
@@ -144,10 +141,6 @@
         return locked;
     }
 
-    // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
     private Boolean hasSection;
 
     public Boolean getHasSection()
@@ -162,42 +155,6 @@
         return this.customDataEntryFormExists;
     }
 
-    private String displayMode;
-
-    public String getDisplayMode()
-    {
-        return displayMode;
-    }
-
-    public void setDisplayMode( String displayMode )
-    {
-        this.displayMode = displayMode;
-    }
-
-    private Integer selectedDataSetId;
-
-    public void setSelectedDataSetId( Integer selectedDataSetId )
-    {
-        this.selectedDataSetId = selectedDataSetId;
-    }
-
-    public Integer getSelectedDataSetId()
-    {
-        return selectedDataSetId;
-    }
-
-    private Integer selectedPeriodIndex;
-
-    public void setSelectedPeriodIndex( Integer selectedPeriodIndex )
-    {
-        this.selectedPeriodIndex = selectedPeriodIndex;
-    }
-
-    public Integer getSelectedPeriodIndex()
-    {
-        return selectedPeriodIndex;
-    }
-
     private Collection<Integer> calculatedDataElementIds;
 
     public Collection<Integer> getCalculatedDataElementIds()
@@ -227,6 +184,46 @@
     }
 
     // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private String displayMode;
+
+    public String getDisplayMode()
+    {
+        return displayMode;
+    }
+
+    public void setDisplayMode( String displayMode )
+    {
+        this.displayMode = displayMode;
+    }
+
+    private Integer selectedDataSetId;
+
+    public Integer getSelectedDataSetId()
+    {
+        return selectedDataSetId;
+    }
+
+    public void setSelectedDataSetId( Integer selectedDataSetId )
+    {
+        this.selectedDataSetId = selectedDataSetId;
+    }
+
+    private Integer selectedPeriodIndex;
+
+    public Integer getSelectedPeriodIndex()
+    {
+        return selectedPeriodIndex;
+    }
+
+    public void setSelectedPeriodIndex( Integer selectedPeriodIndex )
+    {
+        this.selectedPeriodIndex = selectedPeriodIndex;
+    }
+
+    // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
@@ -329,21 +326,17 @@
         period = selectedStateManager.getSelectedPeriod();
 
         // ---------------------------------------------------------------------
-        // Get CalculatedDataElementInformation
+        // Get CalculatedDataElement info
         // ---------------------------------------------------------------------
 
         calculatedDataElementIds = dataEntryScreenManager.getAllCalculatedDataElements( selectedDataSet );
         calculatedDataElementMap = dataEntryScreenManager.getNonSavedCalculatedDataElements( selectedDataSet );
 
         // ---------------------------------------------------------------------
-        // Get Section Information
-        // ---------------------------------------------------------------------
-
-        hasSection = dataEntryScreenManager.hasSection( selectedDataSet );
-
-        // ---------------------------------------------------------------------
-        // Get the custom data entry form if any
-        // ---------------------------------------------------------------------
+        // Get display info
+        // ---------------------------------------------------------------------
+
+        hasSection = selectedDataSet.getSections() != null && selectedDataSet.getSections().size() > 0;
 
         customDataEntryFormExists = selectedDataSet.getDataEntryForm() != null;
 
@@ -359,7 +352,7 @@
             registrationDate = registration != null ? registration.getDate() : new Date();
         }
 
-        if ( displayMode == null )
+        if ( displayMode == null || !ALLOWED_FORM_TYPES.contains( displayMode ) )
         {
             if ( customDataEntryFormExists )
             {
@@ -375,11 +368,8 @@
             }
         }
         
-        if ( displayMode.equals( SECTION_FORM ) && hasSection )
-        {
-            return SECTION_FORM;
-        }
-
-        return MULTI_DIMENSIONAL_FORM;
+        selectedStateManager.setSelectedDisplayMode( displayMode );
+        
+        return displayMode;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java	2010-11-11 18:03:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java	2010-11-17 18:26:47 +0000
@@ -48,8 +48,6 @@
 {
     boolean hasMultiDimensionalDataElement( Section section );
     
-    boolean hasSection( DataSet dataSet );
-    
     Collection<Integer> getAllCalculatedDataElements( DataSet dataSet );
     
     Map<CalculatedDataElement, Map<DataElement, Integer>> getNonSavedCalculatedDataElements( DataSet dataSet );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java	2010-11-11 21:43:28 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java	2010-11-17 18:26:47 +0000
@@ -161,13 +161,6 @@
         return calculatedDataElementMap;
     }
 
-    public boolean hasSection( DataSet dataSet )
-    {
-        Collection<Section> sections = new ArrayList<Section> ( dataSet.getSections() );
-
-        return sections.size() != 0;
-    }
-
     public Map<CalculatedDataElement, Integer> populateValuesForCalculatedDataElements(
         OrganisationUnit organisationUnit, DataSet dataSet, Period period )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java	2010-11-15 18:43:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java	2010-11-17 18:26:47 +0000
@@ -67,6 +67,8 @@
     public static final String SESSION_KEY_SELECTED_PERIOD_INDEX = "data_entry_selected_period_index";
 
     public static final String SESSION_KEY_BASE_PERIOD = "data_entry_base_period";
+    
+    public static final String SESSION_KEY_SELECTED_DISPLAY_MODE = "data_entry_selected_display_mode";
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -274,6 +276,20 @@
 
         return periodService.reloadPeriod( period );
     }
+
+    // -------------------------------------------------------------------------
+    // DisplayMode
+    // -------------------------------------------------------------------------
+    
+    public void setSelectedDisplayMode( String displayMode )
+    {
+        getSession().put( SESSION_KEY_SELECTED_DISPLAY_MODE, displayMode );
+    }
+    
+    public String getSelectedDisplayMode()
+    {
+        return (String) getSession().get( SESSION_KEY_SELECTED_DISPLAY_MODE );
+    }
     
     // -------------------------------------------------------------------------
     // Support methods

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/SelectedStateManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/SelectedStateManager.java	2010-11-15 18:43:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/SelectedStateManager.java	2010-11-17 18:26:47 +0000
@@ -27,6 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Arrays;
 import java.util.List;
 
 import org.hisp.dhis.dataset.DataSet;
@@ -39,6 +40,12 @@
  */
 public interface SelectedStateManager
 {
+    final String CUSTOM_FORM = "customform";
+    final String SECTION_FORM = "sectionform";
+    final String DEFAULT_FORM = "defaultform";
+    
+    final List<String> ALLOWED_FORM_TYPES = Arrays.asList( CUSTOM_FORM, SECTION_FORM, DEFAULT_FORM );
+
     // -------------------------------------------------------------------------
     // OrganisationUnit
     // -------------------------------------------------------------------------
@@ -76,4 +83,12 @@
     void previousPeriodSpan();
     
     Period reloadPeriod();
+
+    // -------------------------------------------------------------------------
+    // DisplayMode
+    // -------------------------------------------------------------------------
+    
+    void setSelectedDisplayMode( String displayMode );
+    
+    String getSelectedDisplayMode();
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2010-11-16 17:14:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2010-11-17 18:26:47 +0000
@@ -41,6 +41,23 @@
 
 	<!-- Actions -->
 
+	<bean id="org.hisp.dhis.de.action.LoadOrganisationUnitAction" class="org.hisp.dhis.de.action.LoadOrganisationUnitAction" scope="prototype">
+		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
+	</bean>
+
+	<bean id="org.hisp.dhis.de.action.LoadDataSetsAction" class="org.hisp.dhis.de.action.LoadDataSetsAction" scope="prototype">
+		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
+	</bean>
+
+	<bean id="org.hisp.dhis.de.action.LoadPeriodsAction" class="org.hisp.dhis.de.action.LoadPeriodsAction" scope="prototype">
+		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+	</bean>
+	
+	<bean id="org.hisp.dhis.de.action.LoadDisplayModesAction" class="org.hisp.dhis.de.action.LoadDisplayModesAction" scope="prototype">
+		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
+	</bean>
+
 	<bean id="org.hisp.dhis.de.action.SelectAction" class="org.hisp.dhis.de.action.SelectAction" scope="prototype">
 		<property name="dataSetLockService" ref="org.hisp.dhis.datalock.DataSetLockService" />
 		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
@@ -49,14 +66,6 @@
 		<property name="dataEntryScreenManager"	ref="org.hisp.dhis.de.screen.DataEntryScreenManager" />
 	</bean>
 
-	<bean id="org.hisp.dhis.de.action.NextPeriodsAction" class="org.hisp.dhis.de.action.NextPeriodsAction" scope="prototype">
-		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
-	</bean>
-
-	<bean id="org.hisp.dhis.de.action.PreviousPeriodsAction" class="org.hisp.dhis.de.action.PreviousPeriodsAction" scope="prototype">
-		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
-	</bean>
-
 	<bean id="org.hisp.dhis.de.action.FormAction" class="org.hisp.dhis.de.action.FormAction" scope="prototype">
 		<property name="dataSetLockService" ref="org.hisp.dhis.datalock.DataSetLockService" />
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2010-10-29 15:44:34 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2010-11-17 18:26:47 +0000
@@ -112,13 +112,13 @@
 no_outlier_values_found				= No outlier values found.
 specify_input_date					= Please specify an input date
 specify_valid_input_date			= Please enter a valid input date
-save_calculated_data_element_success = Save calculated data elements successfully.
-register_complete_dataset_success = Register complete dataset successfully.
-register_complete_dataset_failed = Register complete dataset failed.
+save_calculated_data_element_success = Saved calculated data elements
+register_complete_dataset_success = Registered complete dataset
+register_complete_dataset_failed = Register complete dataset failed
 undo_register_complete_dataset_success = Undo register complete dataset success
-datavalue_history =	Data value history
-data_element_order = Data Element Order
-generate_min_max_success 			= Generate Min/Max successfully.
+datavalue_history 					=	Data value history
+data_element_order 					= Data Element Order
+generate_min_max_success 			= Generated min/max values
 enter_digits                        = Enter digit only.
 value_must_number					= Value must be an number
 value_must_positive_number			= Value must be an positive number

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2010-11-16 16:50:56 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2010-11-17 18:26:47 +0000
@@ -10,47 +10,52 @@
 		namespace="/dhis-web-dataentry">
 
 		<action name="index" class="org.hisp.dhis.de.action.EmptyAction">
-			<result name="success" type="redirect">select.action</result>
-		</action>
-
+			<result name="success" type="redirect">displayForm.action</result>
+		</action>
+
+		<action name="displayForm" class="org.hisp.dhis.de.action.LoadOrganisationUnitAction">
+			<interceptor-ref name="organisationUnitTreeStack" />
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-dataentry/select.vm</param>
+			<param name="menu">/dhis-web-dataentry/menu.vm</param>
+			<param name="menuTreeHeight">420</param>
+			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/form.js,javascript/entry.js</param>
+			<param name="stylesheets">style/dhis-web-dataentry.css</param>
+		</action>
+
+		<action name="loadDataSets" class="org.hisp.dhis.de.action.LoadDataSetsAction">
+			<result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonDataSets.vm</result>
+		</action>
+		
+		<action name="loadPeriods" class="org.hisp.dhis.de.action.LoadPeriodsAction">
+			<result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonPeriods.vm</result>
+		</action>
+		
+		<action name="loadDisplayModes" class="org.hisp.dhis.de.action.LoadDisplayModesAction">
+			<result name="success" type="velocity-json">/dhis-web-dataentry/responseDisplayModes.vm</result>
+		</action>
+		
 		<action name="select" class="org.hisp.dhis.de.action.SelectAction">
 			<interceptor-ref name="organisationUnitTreeStack" />
+			<result name="customform" type="chain">customform</result>
 			<result name="sectionform" type="chain">sectionform</result>
-			<result name="multidimensionalform" type="chain">multidimensionalform</result>
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-dataentry/select.vm</param>
-			<param name="menu">/dhis-web-dataentry/menu.vm</param>
-			<param name="menuTreeHeight">420</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/form.js,javascript/entry.js</param>
-			<param name="stylesheets">style/dhis-web-dataentry.css</param>
-		</action>
-
-		<action name="nextPeriods" class="org.hisp.dhis.de.action.NextPeriodsAction">
-			<result name="success" type="redirect">select.action</result>
-		</action>
-
-		<action name="previousPeriods" class="org.hisp.dhis.de.action.PreviousPeriodsAction">
-			<result name="success" type="redirect">select.action</result>
+			<result name="defaultform" type="chain">defaultform</result>
+			<result name="success" type="velocity">/dhis-web-dataentry/responseVoid.vm</result>
+		</action>
+
+		<action name="customform" class="org.hisp.dhis.de.action.FormAction">
+			<interceptor-ref name="organisationUnitTreeStack" />
+			<result name="success" type="velocity">/dhis-web-dataentry/customForm.vm</result>
 		</action>
 
 		<action name="sectionform" class="org.hisp.dhis.de.action.SectionFormAction">
 			<interceptor-ref name="organisationUnitTreeStack" />
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-dataentry/sectionForm.vm</param>
-			<param name="menu">/dhis-web-dataentry/menu.vm</param>
-			<param name="menuTreeHeight">420</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/form.js,javascript/entry.js</param>
-			<param name="stylesheets">style/dhis-web-dataentry.css</param>
+			<result name="success" type="velocity">/dhis-web-dataentry/sectionForm.vm</result>
 		</action>
 
-		<action name="multidimensionalform"	class="org.hisp.dhis.de.action.FormAction">
+		<action name="defaultform"	class="org.hisp.dhis.de.action.FormAction">
 			<interceptor-ref name="organisationUnitTreeStack" />
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-dataentry/form.vm</param>
-			<param name="menu">/dhis-web-dataentry/menu.vm</param>
-			<param name="menuTreeHeight">420</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/form.js,javascript/entry.js</param>
-			<param name="stylesheets">style/dhis-web-dataentry.css</param>
+			<result name="success" type="velocity">/dhis-web-dataentry/defaultForm.vm</result>
 		</action>
 
 		<action name="saveMultiDimensionalValue" class="org.hisp.dhis.de.action.SaveValueAction">
@@ -128,6 +133,6 @@
 		<action name="getHistoryChart" class="org.hisp.dhis.de.action.GetHistoryChartAction">
 			<result name="success" type="chart"></result>
 		</action>
-
+		
 	</package>
 </struts>

=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/customForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/customForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/customForm.vm	2010-11-17 18:26:47 +0000
@@ -0,0 +1,7 @@
+
+<input type="hidden" value="$organisationUnit.id" id="organisationUnitId"/>
+
+#foreach( $optionCombo in $allOptionCombos )
+<td><span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span></td>       
+#end
+$customDataEntryFormCode

=== renamed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm' => 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm	2010-11-16 15:09:55 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm	2010-11-17 18:26:47 +0000
@@ -1,158 +1,131 @@
-<script>
-    customDataEntryFormExists = "false";
-    #if ( $customDataEntryFormExists )
-        customDataEntryFormExists = "true";
+
+<input type="hidden" value="$organisationUnit.id" id="organisationUnitId"/>
+
+#set( $tabIndex = 1 )
+#foreach( $categoryCombo in $orderedCategoryCombos )
+<div style="border:1px solid #808080;width:98%">            
+  <table class="mainPageTable" cellpadding="0">
+  #set( $colCount = $numberOfTotalColumns.get( $categoryCombo.id )  ) 
+  #set( $categories = $orderedCategories.get( $categoryCombo.id )  )
+  #set( $optionsMap = $orderedOptionsMap.get( $categoryCombo.id )  )
+  #set( $colRepeat = $catColRepeat.get( $categoryCombo.id )  )
+    
+  #foreach( $category in $categories )
+  #set( $categoryOptions = $optionsMap.get( $category.id ) )
+  #set( $colCount = $colCount / $categoryOptions.size() )
+  <tr colspan="$colCount">
+    <td></td>
+    #set( $cols = $colRepeat.get( $category.id ) )
+    #foreach( $col in $cols )
+      #foreach( $categoryOption in $categoryOptions )
+      #set( $optionName = $categoryOption.name )
+      <th colspan="$colCount"><div align="center"> #if( $optionName != "default" ) $optionName #end </div></th>
+      #end
     #end
-</script>
-
-#parse( "/dhis-web-dataentry/select.vm" )
-
-#if ( $disableDefaultForm )    
-  #if ( $customDataEntryFormExists )  
-  #foreach( $optionCombo in $allOptionCombos )            
-  <td>
-    <span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span>                          
-  </td>       
-  #end              
-  $customDataEntryFormCode
-  #end
-  
-#else
-    
-  #if ( $customDataEntryFormExists && $displayMode=="customform" )
-  #foreach( $optionCombo in $allOptionCombos )
-  <td><span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span></td>       
-  #end
-  $customDataEntryFormCode    
-  
+  </tr>
+  #end
+
+  #set( $count = 0 )               
+  #set( $dataElements = $orderedDataElements.get( $categoryCombo )  )
+  #set( $optionCombos = $orderdCategoryOptionCombos.get( $categoryCombo.id )  )
+  #set( $mark = 0 )
+  #foreach( $dataElement in $dataElements )
+  #if( $mark == 1 )
+  #set( $mark = 0 )
   #else
-  #set( $tabIndex = 1 )
-  #foreach( $categoryCombo in $orderedCategoryCombos )
-  <div style="border:1px solid #808080;width:98%">            
-    <table class="mainPageTable" cellpadding="0">
-    #set( $colCount = $numberOfTotalColumns.get( $categoryCombo.id )  ) 
-    #set( $categories = $orderedCategories.get( $categoryCombo.id )  )
-    #set( $optionsMap = $orderedOptionsMap.get( $categoryCombo.id )  )
-    #set( $colRepeat = $catColRepeat.get( $categoryCombo.id )  )
-    
-    #foreach( $category in $categories )
-    #set( $categoryOptions = $optionsMap.get( $category.id ) )
-    #set( $colCount = $colCount / $categoryOptions.size() )
-    <tr colspan="$colCount">
-      <td></td>
-      #set( $cols = $colRepeat.get( $category.id ) )
-      #foreach( $col in $cols )
-        #foreach( $categoryOption in $categoryOptions )
-        #set( $optionName = $categoryOption.name )
-        <th colspan="$colCount"><div align="center"> #if( $optionName != "default" ) $optionName #end </div></th>
-        #end
-      #end
-    </tr>
-    #end
-
-    #set( $count = 0 )               
-    #set( $dataElements = $orderedDataElements.get( $categoryCombo )  )
-    #set( $optionCombos = $orderdCategoryOptionCombos.get( $categoryCombo.id )  )
-    #set( $mark = 0 )
-    #foreach( $dataElement in $dataElements )
-    #if( $mark == 1 )
-    #set( $mark = 0 )
-    #else
-    #set( $mark = 1 )
-    #end
+  #set( $mark = 1 )
+  #end
         				 
-    #set( $count = $count + 1 )
-    #set( $calculatedValue = false )
-    #set( $calculatedValue = $calculatedValueMap.get( $dataElement ) )                        
-    #set( $calculated = false )
-    #set( $calculated = ($calculatedDataElementIds.contains($dataElement.id)) )
-    <tr>            
-      ## Data element name
-      <td #if( $mark == 1 ) style="background-color:#dddddd" #end>
-        <span id="value[$dataElement.id].name" title="$!encoder.htmlEncode( $dataElement.description )">
-        #if( $useShortName )
-        $encoder.htmlEncode( $dataElement.shortName )
-        #else
-        $encoder.htmlEncode( $dataElement.name )
-        #end           
-        </span>
-      </td>    
-                    
-      ## Type      
-      <td style="display:none">
-        $dataElementTypeMap.get( $dataElement.type )
-        <span id="value[$dataElement.id].type" style="display:none">$dataElement.getDetailedNumberType()</span>
-      </td>                                  
-                                            
-      #foreach( $optionCombo in $optionCombos )                       
-      #set( $minMax = false )
-      #set( $minMax = $minMaxMap.get( "$dataElement.id:$optionCombo.id" ) )
-      #set( $dataValue = false )
-      #set( $dataValue = $dataValueMap.get( "$dataElement.id:$optionCombo.id" ) )
-      #set( $dataEntryId = "value[$dataElement.id].value:value[$optionCombo.id].value" )
-      
-      ## Data entry
-      <td>
-        #if( $dataElement.type == "bool" )
-        <span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span>
-        <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue" )) onchange="saveBoolean($dataElement.id,$optionCombo.id, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
-          <option value="">[$i18n.getString( "no_value" )]</option>
-          <option value="true" #if( $dataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
-          <option value="false" #if( $dataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
-        </select>
-        
-        #else                                
-        #if( $dataElement.type == "string" )
-        #set( $coun = 0 )
-        #foreach($customValue in $customValues)
-          #if($dataElement.id == $customValue.dataElement.id && $optionCombo.id == $customValue.optionCombo.id)                                    
-          #set( $coun = $coun +1 )
-          #end
-        #end
-        #if( $coun > 0 )
-        <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue" )) onchange="saveBoolean($dataElement.id,$optionCombo.id, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
-        #foreach($customValue in $customValues)
-          #if($dataElement.id == $customValue.dataElement.id && $optionCombo.id == $customValue.optionCombo.id)
-          <option value="$customValue.customValue" #if( $dataValue.value == $customValue.customValue ) selected="selected" #end>$customValue.customValue</option>
-          #end
-        #end
-        </select>
-        
-        #else
-        <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>                                
-        #end
-        #end
-        #end
-                                
-        #set( $minMaxError = false )
-        #if( $dataElement.type == "int" && $dataValue && $minMax )
-          #if( $integer.parseInt( $dataValue.value ) < $minMax.min || $integer.parseInt( $dataValue.value ) > $minMax.max )
-          #set( $minMaxError = true )
-          #end
-        #end
-
-        <span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span>
-        <span id="value[$dataElement.id].name" style="display:none">$encoder.htmlEncode( $dataElement.shortName )</span>
-        <div id="value[$dataElement.id:$optionCombo.id].min" style="display:none">$!minMax.min</div>
-        <div id="value[$dataElement.id:$optionCombo.id].max" style="display:none">$!minMax.max</div>
-                    
-        #if( $dataElement.aggregationOperator == "sum" && $dataElement.type != "string")
-        <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
-        #elseif( $dataElement.type != "string")
-        <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
-        #end
-      </td>
-
-      #set( $tabIndex = $tabIndex + 1 )
-      #end
-    </tr>
+  #set( $count = $count + 1 )
+  #set( $calculatedValue = false )
+  #set( $calculatedValue = $calculatedValueMap.get( $dataElement ) )                        
+  #set( $calculated = false )
+  #set( $calculated = ($calculatedDataElementIds.contains($dataElement.id)) )
+  <tr>            
+    ## Data element name
+    <td #if( $mark == 1 ) style="background-color:#dddddd" #end>
+      <span id="value[$dataElement.id].name" title="$!encoder.htmlEncode( $dataElement.description )">
+      #if( $useShortName )
+      $encoder.htmlEncode( $dataElement.shortName )
+      #else
+      $encoder.htmlEncode( $dataElement.name )
+      #end           
+      </span>
+    </td>    
+                    
+    ## Type      
+    <td style="display:none">
+      $dataElementTypeMap.get( $dataElement.type )
+      <span id="value[$dataElement.id].type" style="display:none">$dataElement.getDetailedNumberType()</span>
+    </td>                                  
+
+    #foreach( $optionCombo in $optionCombos )                       
+    #set( $minMax = false )
+    #set( $minMax = $minMaxMap.get( "$dataElement.id:$optionCombo.id" ) )
+    #set( $dataValue = false )
+    #set( $dataValue = $dataValueMap.get( "$dataElement.id:$optionCombo.id" ) )
+    #set( $dataEntryId = "value[$dataElement.id].value:value[$optionCombo.id].value" )
+    
+    ## Data entry
+    <td>
+      #if( $dataElement.type == "bool" )
+      <span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span>
+      <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue" )) onchange="saveBoolean($dataElement.id,$optionCombo.id, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
+        <option value="">[$i18n.getString( "no_value" )]</option>
+        <option value="true" #if( $dataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+        <option value="false" #if( $dataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+      </select>
+      
+      #else
+      #if( $dataElement.type == "string" )
+      #set( $coun = 0 )
+      #foreach($customValue in $customValues)
+        #if($dataElement.id == $customValue.dataElement.id && $optionCombo.id == $customValue.optionCombo.id)                                    
+        #set( $coun = $coun +1 )
+        #end
+      #end
+      #if( $coun > 0 )
+      <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue" )) onchange="saveBoolean($dataElement.id,$optionCombo.id, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
+      #foreach($customValue in $customValues)
+        #if($dataElement.id == $customValue.dataElement.id && $optionCombo.id == $customValue.optionCombo.id)
+        <option value="$customValue.customValue" #if( $dataValue.value == $customValue.customValue ) selected="selected" #end>$customValue.customValue</option>
+        #end
+      #end
+      </select>
+
+      #else
+      <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>                                
+      #end
+      #end
+      #end
+      
+      #set( $minMaxError = false )
+      #if( $dataElement.type == "int" && $dataValue && $minMax )
+        #if( $integer.parseInt( $dataValue.value ) < $minMax.min || $integer.parseInt( $dataValue.value ) > $minMax.max )
+        #set( $minMaxError = true )
+        #end
+      #end
+
+      <span id="value[option$optionCombo.id].name" style="display:none">$optionCombo.name</span>
+      <span id="value[$dataElement.id].name" style="display:none">$encoder.htmlEncode( $dataElement.shortName )</span>
+      <div id="value[$dataElement.id:$optionCombo.id].min" style="display:none">$!minMax.min</div>
+      <div id="value[$dataElement.id:$optionCombo.id].max" style="display:none">$!minMax.max</div>
+                    
+      #if( $dataElement.aggregationOperator == "sum" && $dataElement.type != "string")
+      <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
+      #elseif( $dataElement.type != "string")
+      <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
+      #end
+    </td>
+
+    #set( $tabIndex = $tabIndex + 1 )
     #end
-    </table>
-  </div>
-  <br>
-  <br>
-  #end        
-#end
+  </tr>
+  #end
+  </table>
+</div>
+<br>
+<br>
 #end
 
 #parse( "/dhis-web-dataentry/completeRegistration.vm" )

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2010-10-12 10:00:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2010-11-17 18:26:47 +0000
@@ -115,7 +115,7 @@
 
 </table>
 
-<p><input type="button" value="$encoder.htmlEncode( $i18n.getString( 'close' ) )" onclick="window.opener.location.reload();window.close()"/></p>
+<p><input type="button" value="$encoder.htmlEncode( $i18n.getString( 'close' ) )"/></p>
 
 <script type="text/javascript">
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2010-11-16 13:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2010-11-17 18:26:47 +0000
@@ -1,16 +1,5 @@
 
 // -----------------------------------------------------------------------------
-// Selection
-// -----------------------------------------------------------------------------
-
-function organisationUnitSelected( orgUnits )
-{
-    window.location.href = 'select.action';
-}
-
-selection.setListenerFunction( organisationUnitSelected );
-
-// -----------------------------------------------------------------------------
 // Save
 // -----------------------------------------------------------------------------
 
@@ -315,5 +304,5 @@
 	
 	unLockScreen();
 	
-	setMessage(i18n_save_calculated_data_element_success);
+	setHeaderDelayMessage(i18n_save_calculated_data_element_success);
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-16 16:07:55 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-17 18:26:47 +0000
@@ -16,6 +16,129 @@
 	}
 }
 
+// -----------------------------------------------------------------------------
+// Selection
+// -----------------------------------------------------------------------------
+
+function organisationUnitSelected( orgUnits )
+{
+    var url = 'loadDataSets.action';
+    
+    var list = document.getElementById( 'selectedDataSetId' );
+    
+    clearList( list );
+    addOptionToList( list, '-1', '[ Select ]' );
+    
+    $.getJSON( '../dhis-web-commons-ajax-json/getOrganisationUnit.action?id=' + orgUnits[0], function( json ) {
+    	$('#selectedOrganisationUnit').val( json.organisationUnit.name );
+    	$('#currentOrganisationUnit').html( json.organisationUnit.name );
+    } );
+    
+    $.getJSON( url, function( json ) {
+    	for ( i in json.dataSets ) {
+    		addOptionToList( list, json.dataSets[i].id, json.dataSets[i].name );
+    	}
+    } );
+}
+
+selection.setListenerFunction( organisationUnitSelected );
+
+function nextPeriodsSelected()
+{
+	displayPeriodsInternal( true, false );
+}
+
+function previousPeriodsSelected()
+{
+	displayPeriodsInternal( false, true );
+}
+
+function dataSetSelected()
+{
+	displayPeriodsInternal( false, false );
+}
+
+function displayPeriodsInternal( next, previous )
+{
+	var dataSetId = $( '#selectedDataSetId' ).val();
+	
+	if ( dataSetId && dataSetId != -1 )
+	{
+		var url = 'loadPeriods.action?dataSetId=' + dataSetId + '&next=' + next + '&previous=' + previous;
+
+		var list = document.getElementById( 'selectedPeriodIndex' );
+		
+	    clearList( list );
+	    addOptionToList( list, '-1', '[ Select ]' );
+		
+	    $.getJSON( url, function( json ) {
+	    	for ( i in json.periods ) {
+	    		addOptionToList( list, i, json.periods[i].name );
+	    	}
+	    } );
+	}
+}
+
+function displayEntryForm()
+{
+	displayEntryFormInternal( null );
+}
+
+function periodSelected()
+{
+	displayEntryFormInternal( setDisplayModes );
+}
+
+function displayEntryFormInternal( callback )
+{
+	var dataSetId = $('#selectedDataSetId').val();
+	var periodIndex = $('#selectedPeriodIndex').val();
+	
+	if ( dataSetId && dataSetId != -1 && periodIndex && periodIndex != -1 )
+	{
+		var url = 'select.action?selectedDataSetId=' + dataSetId +
+			'&selectedPeriodIndex=' + periodIndex +
+			'&displayMode=' + $("input[name='displayMode']:checked").val();
+		
+		$('#entryForm').load( url, callback );
+	}
+}
+
+function setDisplayModes()
+{
+	$.getJSON( 'loadDisplayModes.action', function( json ) {
+		if ( json.customForm ) {
+			$( '#displayModeCustom' ).removeAttr( 'disabled' );
+		}
+		else {
+			$( '#displayModeCustom' ).attr( 'disabled', 'disabled' );
+		}
+		
+		if ( json.sectionForm ) {
+			$( '#displayModeSection' ).removeAttr( 'disabled' );
+		}
+		else {
+			$( '#displayModeSection' ).attr( 'disabled', 'disabled' );
+		}
+		
+		if ( json.displayMode == 'customform' ) {
+			$( '#displayModeCustom' ).attr( 'checked', 'checked' );
+			$( '#displayModeSection' ).removeAttr( 'checked' );
+			$( '#displayModeDefault' ).removeAttr( 'checked' );
+		}
+		else if ( json.displayMode = 'sectionform' ) {
+			$( '#displayModeCustom' ).removeAttr( 'checked' );
+			$( '#displayModeSection' ).attr( 'checked', 'checked' );
+			$( '#displayModeDefault' ).removeAttr( 'checked' );
+		}
+		else if ( json.displayMode = 'defaultform' ) {
+			$( '#displayModeCustom' ).removeAttr( 'checked' );
+			$( '#displayModeSection' ).removeAttr( 'checked' );
+			$( '#displayModeDefault' ).attr( 'checked', 'checked' );
+		}
+	} );
+}
+
 function viewHistory( dataElementId, optionComboId, showComment )
 {
     window.open( 'viewHistory.action?dataElementId=' + dataElementId + '&optionComboId=' + optionComboId + '&showComment=' + showComment, '_blank', 'width=580,height=710,scrollbars=yes' );
@@ -24,11 +147,9 @@
 /**
  * Display data element name in selection display when a value field recieves
  * focus.
- * XXX May want to move this to a separate function, called by valueFocus.
- * @param e focus event
- * @author Hans S. Tommerholt
  */
 var customDataEntryFormExists = "false";
+
 function valueFocus(e) 
 {
 	//Retrieve the data element id from the id of the field
@@ -54,7 +175,6 @@
 	deId = match1[1];
 	ocId = match2[1];		
 	
-	//Get the data element name
 	var nameContainer = document.getElementById('value[' + deId + '].name');
 	var opCbContainer = document.getElementById('value[option' + ocId + '].name');
 	var minContainer = document.getElementById('value[' + deId + ':' + ocId +'].min');	
@@ -250,7 +370,7 @@
     setGeneratedMinMaxValues.save();
 	
 	unLockScreen();
-	setMessage(i18n_generate_min_max_success);
+	setHeaderDelayMessage(i18n_generate_min_max_success);
 }
 
 // -----------------------------------------------------------------------------

=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDisplayModes.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDisplayModes.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDisplayModes.vm	2010-11-17 18:26:47 +0000
@@ -0,0 +1,5 @@
+{
+  "sectionForm": ${sectionForm},
+  "customForm": ${customForm},
+  "displayMode": "${displayMode}"
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2010-11-16 15:09:55 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2010-11-17 18:26:47 +0000
@@ -1,5 +1,5 @@
 
-#parse( "/dhis-web-dataentry/select.vm" )
+<input type="hidden" value="$organisationUnit.id" id="organisationUnitId"/>
 
 #set( $marker = 0 )
 #set( $tabIndex = 1 )

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2010-11-12 08:09:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2010-11-17 18:26:47 +0000
@@ -1,100 +1,56 @@
-<span id='message' style="position:fixed;top:80px;right:5px;z-index: 1001" onclick="hideMessage();"></span>
 
 <h3>$i18n.getString( "data_entry" ) #openHelp( "dataEntry" )</h3>
 
 <div id="currentSelection">
-	#if ( $organisationUnit ) $encoder.htmlEncode( $organisationUnit.name )#else $i18n.getString( "no_organisationunit_selected" ) #end - 
-	#if ( $period ) $format.formatPeriod( $period ) #else $i18n.getString( "no_period_selected" ) #end <br/>				
+	<span id="currentOrganisationUnit">$i18n.getString( "no_organisationunit_selected" )</span> -
+	<span id="currentPeriod">$i18n.getString( "no_period_selected" )</span/><br>
 	<span id="currentDataElement">$i18n.getString( "no_dataelement_selected" )</span> -
 	<span id="currentOptionCombo">$i18n.getString( "no_option_selected" )</span>	
 </div>
 
-<form id="selectForm" name="selectForm" method="post" action="select.action">
-<input type="hidden" value="$organisationUnit.id" id="organisationUnitId"/>
-<div id="actions" style="width:200px text-align:right">
-	
-    <input type="button" value="$i18n.getString( 'generate_min_max' )" onclick="javascript:generateMinMaxValues();" style="width:150px" #if( !$selectedPeriodIndex || !$auth.hasAccess( "dhis-web-dataentry", "minMaxGeneration" )) disabled="disabled" #end/><br/>
-    <input type="button" value="$i18n.getString( 'run_validation' )" onclick="javascript:validate();" style="width:150px" #if( !$selectedPeriodIndex ) disabled="disabled" #end/><br/>
-    <input type="button" id="calculateCDEs" value="$i18n.getString( 'save_calculated' )" name="calculateCDEs" onclick="calculateAndSaveCDEs();" style="width:150px" #if( !$selectedPeriodIndex ) disabled="disabled" #end/><br/>
+<div id="actions" style="width:200px text-align:right">	
+    <input type="button" value="$i18n.getString( 'generate_min_max' )" onclick="javascript:generateMinMaxValues()" style="width:150px" #if( !$auth.hasAccess( "dhis-web-dataentry", "minMaxGeneration" ) ) disabled="disabled" #end/><br/>
+    <input type="button" value="$i18n.getString( 'run_validation' )" onclick="javascript:validate()" style="width:150px"/><br/>
+    <input type="button" id="calculateCDEs" value="$i18n.getString( 'save_calculated' )" name="calculateCDEs" onclick="calculateAndSaveCDEs()" style="width:150px"/><br/><br/>
 
-    <br/>
-	<input type="radio" id="displayModeCustom" name="displayMode" value="customform"
-       #if( $displayMode == "customform" ) 
-           checked="checked" 
-       #end
-       #if( !$customDataEntryFormExists ) 
-           disabled="disabled" 
-       #end         
-       onclick="document.getElementById( 'selectForm' ).submit();"/>    
+	<input type="radio" id="displayModeCustom" name="displayMode" value="customform" disabled="disabled" onclick="displayEntryForm()">
     <label for="displayModeCustom">$i18n.getString( "use_custom_form" )</label><br/>
-
-	<input type="radio" id="displayModeSection" name="displayMode" value="sectionform"
-	   #if( $displayMode == "sectionform" ) 
-	       checked="checked" 
-	   #end  
-	   #if( !$hasSection ) 
-	       disabled="disabled" 
-	   #end 
-	   onclick="document.getElementById( 'selectForm' ).submit();"/>
+	<input type="radio" id="displayModeSection" name="displayMode" value="sectionform" disabled="disabled" onclick="displayEntryForm()">
 	<label for="displayModeSection">$i18n.getString( "use_section_form" )</label><br/>
-
-	<input type="radio" id="displayModeDefault" name="displayMode" value="defaultform"
-       #if( $displayMode == "defaultform" ) 
-           checked="checked"           
-       #end       
-       onclick="document.getElementById( 'selectForm' ).submit();"/>    
+	<input type="radio" id="displayModeDefault" name="displayMode" value="defaultform" onclick="displayEntryForm()">
     <label for="displayModeDefault">$i18n.getString( "use_default_form" )</label><br/><br/>
-
 </div>
 
-<table>
-	
+<table>	
 	<tr>
 		<td><label>$i18n.getString( "organisation_unit" )</label></td>
-		<td><input type="text" readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'select' )]" #end style="min-width:350px"/></td>
-	</tr>
-	
+		<td><input type="text" id="selectedOrganisationUnit" readonly="readonly" value="[ $i18n.getString( 'select' ) ]" style="min-width:350px"/></td>
+	</tr>	
 	<tr>
 		<td><label for="selectedDataSetId">$i18n.getString( "data_set" )</label></td>
-		<td>
-		    <select id="selectedDataSetId" name="selectedDataSetId" style="min-width:350px" onchange="document.getElementById( 'selectForm' ).submit();" #if( $dataSets.size() == 0 ) disabled="disabled" #end>
-				<option value="null">[$i18n.getString( "select" )]</option>
-			    #foreach( $dataSet in $dataSets )
-				<option value="$dataSet.id" #if( $selectedDataSetId && $dataSet.id == $selectedDataSetId ) selected="selected" #end>$encoder.htmlEncode( $dataSet.name )</option>
-			    #end
-			</select>
-		</td>
-	</tr>
-	
+		<td><select id="selectedDataSetId" name="selectedDataSetId" style="min-width:350px" onchange="dataSetSelected()"></select></td>
+	</tr>	
 	<tr>
 		<td><label for="selectedPeriodIndex">$i18n.getString( "period" )</label></td>
 		<td>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('earlier_periods')" onclick="window.location.href='previousPeriods.action'" #if( $periods.size() == 0 ) disabled="disabled" #end/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('later_periods')" onclick="window.location.href='nextPeriods.action'" #if( $periods.size() == 0 ) disabled="disabled" #end/><br/>
-			<select id="selectedPeriodIndex" name="selectedPeriodIndex" style="min-width:350px" onchange="document.getElementById( 'selectForm' ).submit();" #if( $periods.size() == 0 ) disabled="disabled" #end>
-				<option value="null">[$i18n.getString( "select" )]</option>
-			    #foreach( $period in $periods )
-				#set( $index = $velocityCount - 1 )
-				<option value="$index" #if( $index && $selectedPeriodIndex && $index == $selectedPeriodIndex ) selected="selected" #end>$format.formatPeriod( $period )</option>
-			    #end
-			</select>
+			<input type="button" value="&lt;&lt;" title="$i18n.getString('earlier_periods')" onclick="previousPeriodsSelected()"/>
+			<input type="button" value="&gt;&gt;" title="$i18n.getString('later_periods')" onclick="nextPeriodsSelected()"/><br/>
+			<select id="selectedPeriodIndex" name="selectedPeriodIndex" style="min-width:350px" onchange="periodSelected()"></select>
 		</td>
-	</tr>
-	
+	</tr>	
 </table>
 
-</form>
-
 <hr style="clear:both"/>
 <br/>
 
+<div id="entryForm"></div>
+
 <script type="text/javascript">
 	var i18n_save_calculated_data_element_success = '$encoder.jsEscape( $i18n.getString( "save_calculated_data_element_success" ) , "'")';
 	var i18n_register_complete_dataset_success = '$encoder.jsEscape( $i18n.getString( "register_complete_dataset_success" ) , "'")';
 	var i18n_register_complete_dataset_failed = '$encoder.jsEscape( $i18n.getString( "register_complete_dataset_failed" ) , "'")';
 	var i18n_undo_register_complete_dataset_success = '$encoder.jsEscape( $i18n.getString( "undo_register_complete_dataset_success" ) , "'")';
-	var i18n_generate_min_max_success = '$encoder.jsEscape( $i18n.getString( "generate_min_max_success" ) , "'")';
-	
+	var i18n_generate_min_max_success = '$encoder.jsEscape( $i18n.getString( "generate_min_max_success" ) , "'")';	
 	var i18n_saving_zero_values_unnecessary = '$encoder.jsEscape( $i18n.getString( "saving_zero_values_unnecessary" ) , "'")';
     var i18n_value_of_data_element_less = '$encoder.jsEscape( $i18n.getString( "value_of_data_element_less" ) , "'")';
     var i18n_value_of_data_element_greater = '$encoder.jsEscape( $i18n.getString( "value_of_data_element_greater" ) , "'")';
@@ -105,5 +61,4 @@
 	var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
     var i18n_saving_comment_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_comment_failed_status_code" ) , "'")';
     var i18n_saving_minmax_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_minmax_failed_error_code" ) , "'")';
-	
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2010-11-16 16:50:56 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2010-11-17 18:26:47 +0000
@@ -8,7 +8,7 @@
   font-size: 14px;
   text-align: right;
   position: fixed;
-  top: 85px;
+  top: 80px;
   right: 10px;
   filter: alpha(opacity=90);
   opacity: 0.90;
@@ -16,7 +16,7 @@
 
 #selectForm 
 {
-  padding-top: 15px;
+  padding-top: 10px;
 }
 
 #actions