← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4291: Separated loading of completeness div from form. Removed use of OrganisationUnitSelectionManager ...

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 4291 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-08-13 20:09:11 +0200
message:
  Separated loading of completeness div from form. Removed use of OrganisationUnitSelectionManager / server state for orgunit selection.
removed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/completeRegistration.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.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/webapp/dhis-web-dataentry/customForm.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/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/responseDataValues.vm
  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


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java	2011-07-20 03:42:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java	2011-08-13 13:55:24 +0000
@@ -135,7 +135,7 @@
      * @param dataSet the data set associated with this form.
      * @return HTML code for the form.
      */
-    String prepareDataEntryFormForEntry( String htmlCode, String disabled, I18n i18n, DataSet dataSet );
+    String prepareDataEntryFormForEntry( String htmlCode, I18n i18n, DataSet dataSet );
     
     Collection<DataEntryForm> listDisctinctDataEntryFormByProgramStageIds( List<Integer> programStageIds );
     

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java	2011-08-02 09:12:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java	2011-08-13 13:55:24 +0000
@@ -28,7 +28,6 @@
 
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 
 import org.hisp.dhis.common.GenericStore;
 import org.hisp.dhis.patient.Patient;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-07-22 20:43:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-08-13 18:09:11 +0000
@@ -225,7 +225,7 @@
         return sb.toString();
     }
 
-    public String prepareDataEntryFormForEntry( String htmlCode, String disabled, I18n i18n, DataSet dataSet )
+    public String prepareDataEntryFormForEntry( String htmlCode, I18n i18n, DataSet dataSet )
     {
         // ---------------------------------------------------------------------
         // Inline javascript/html to add to HTML before output
@@ -233,8 +233,8 @@
         
         int i = 1;
         
-        final String jsCodeForInputFields = " name=\"entryfield\" $DISABLED ";
-        final String jsCodeForSelectLists = " name=\"entryfield\" $DISABLED ";
+        final String jsCodeForInputFields = " name=\"ef\" ";
+        final String jsCodeForSelectLists = " name=\"es\" ";
         
         StringBuffer sb = new StringBuffer();
 
@@ -306,7 +306,6 @@
 
                 inputHtml = inputHtml.replace( TAG_CLOSE, appendCode );
                 
-                inputHtml = inputHtml.replace( "$DISABLED", disabled );
                 inputHtml = inputHtml.replace( STYLE_TAG, backgroundColor );
 
                 inputMatcher.appendReplacement( sb, inputHtml );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java	2011-07-19 21:49:16 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java	2011-08-13 13:55:24 +0000
@@ -29,6 +29,10 @@
 
 import java.util.Collection;
 
+import org.hisp.dhis.datalock.DataSetLock;
+import org.hisp.dhis.datalock.DataSetLockService;
+import org.hisp.dhis.dataset.CompleteDataSetRegistration;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.datavalue.DataValue;
@@ -36,7 +40,7 @@
 import org.hisp.dhis.minmax.MinMaxDataElement;
 import org.hisp.dhis.minmax.MinMaxDataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 
@@ -73,11 +77,25 @@
         this.dataSetService = dataSetService;
     }
 
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
+    private CompleteDataSetRegistrationService registrationService;
+
+    public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
+    {
+        this.registrationService = registrationService;
+    }
+
+    private DataSetLockService dataSetLockService;
+
+    public void setDataSetLockService( DataSetLockService dataSetLockService )
+    {
+        this.dataSetLockService = dataSetLockService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
     }
 
     // -------------------------------------------------------------------------
@@ -98,6 +116,13 @@
         this.dataSetId = dataSetId;
     }
     
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -116,6 +141,20 @@
         return minMaxDataElements;
     }
 
+    private boolean locked;
+
+    public boolean isLocked()
+    {
+        return locked;
+    }
+
+    private boolean complete;
+
+    public boolean isComplete()
+    {
+        return complete;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -124,12 +163,45 @@
     {
         Period period = PeriodType.createPeriodExternalId( periodId );
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
-        OrganisationUnit unit = selectionManager.getSelectedOrganisationUnit();
-        
+        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+        // ---------------------------------------------------------------------
+        // Data values
+        // ---------------------------------------------------------------------
+
         dataValues = dataValueService.getDataValues( unit, period, dataSet.getDataElements() );
-        
+
+        // ---------------------------------------------------------------------
+        // Min-max data elements
+        // ---------------------------------------------------------------------
+
         minMaxDataElements = minMaxDataElementService.getMinMaxDataElements( unit, dataSet.getDataElements() );
-        
+
+        // ---------------------------------------------------------------------
+        // Data locking info
+        // ---------------------------------------------------------------------
+
+        if ( dataSet != null && period != null )
+        {
+            DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+
+            if ( dataSetLock != null && dataSetLock.getSources().contains( unit ) )
+            {
+                locked = true;
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Data set completeness info
+        // ---------------------------------------------------------------------
+
+        if ( dataSet != null && period != null && unit != null )
+        {
+            CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet, period, unit );
+
+            locked = registration != null;
+        }
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java	2011-07-28 07:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java	2011-08-13 17:51:36 +0000
@@ -34,7 +34,7 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 import org.jfree.chart.JFreeChart;
@@ -74,11 +74,11 @@
         this.categoryService = categoryService;
     }
 
-    private OrganisationUnitSelectionManager selectionManager;
+    private OrganisationUnitService organisationUnitService;
 
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
     {
-        this.selectionManager = selectionManager;
+        this.organisationUnitService = organisationUnitService;
     }
 
     private I18nFormat format;
@@ -112,6 +112,13 @@
     {
         this.periodId = periodId;
     }
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
 
     // -------------------------------------------------------------------------
     // Output
@@ -149,7 +156,7 @@
 
         Period period = PeriodType.createPeriodExternalId( periodId );
         
-        OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
         chart = chartService.getJFreeChartHistory( dataElement, categoryOptionCombo, period, organisationUnit, HISTORY_LENGTH, format );
         

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2011-07-28 07:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2011-08-13 17:51:36 +0000
@@ -41,7 +41,7 @@
 import org.hisp.dhis.de.history.DataElementHistory;
 import org.hisp.dhis.de.history.HistoryRetriever;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 
@@ -49,7 +49,6 @@
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: HistoryAction.java 4778 2008-03-20 13:21:56Z abyot $
  */
 public class HistoryAction
     implements Action
@@ -95,11 +94,11 @@
         this.dataValueAuditService = dataValueAuditService;
     }
 
-    private OrganisationUnitSelectionManager selectionManager;
+    private OrganisationUnitService organisationUnitService;
 
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
     {
-        this.selectionManager = selectionManager;
+        this.organisationUnitService = organisationUnitService;
     }
 
     // -------------------------------------------------------------------------
@@ -131,6 +130,13 @@
     {
         this.periodId = periodId;
     }
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
 
     // -------------------------------------------------------------------------
     // Output
@@ -194,7 +200,7 @@
 
         Period period = PeriodType.createPeriodExternalId( periodId );
 
-        OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
         dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, optionCombo );
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2011-07-21 11:52:46 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2011-08-13 13:55:24 +0000
@@ -31,13 +31,10 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -49,10 +46,6 @@
 import org.hisp.dhis.dataelement.comparator.DataElementSortOrderComparator;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
-import org.hisp.dhis.datalock.DataSetLock;
-import org.hisp.dhis.datalock.DataSetLockService;
-import org.hisp.dhis.dataset.CompleteDataSetRegistration;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.dataset.Section;
@@ -60,21 +53,15 @@
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodType;
 
 import com.opensymphony.xwork2.Action;
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: SelectAction.java 5930 2008-10-15 03:30:52Z tri $
  */
 public class LoadFormAction
     implements Action
 {
-    private static final Log log = LogFactory.getLog( LoadFormAction.class );
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -100,27 +87,6 @@
         this.dataSetService = dataSetService;
     }
 
-    private DataSetLockService dataSetLockService;
-
-    public void setDataSetLockService( DataSetLockService dataSetLockService )
-    {
-        this.dataSetLockService = dataSetLockService;
-    }
-
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    private CompleteDataSetRegistrationService registrationService;
-
-    public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
-    {
-        this.registrationService = registrationService;
-    }
-
     private DataElementCategoryService categoryService;
 
     public void setCategoryService( DataElementCategoryService categoryService )
@@ -158,7 +124,25 @@
     }
 
     // -------------------------------------------------------------------------
-    // Input & Output
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer dataSetId;
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    private boolean defaultForm;
+
+    public void setDefaultForm( boolean defaultForm )
+    {
+        this.defaultForm = defaultForm;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
     // -------------------------------------------------------------------------
 
     private Map<DataElementCategoryCombo, List<DataElement>> orderedDataElements = new HashMap<DataElementCategoryCombo, List<DataElement>>();
@@ -182,34 +166,6 @@
         return organisationUnit;
     }
 
-    private Period period;
-
-    public Period getPeriod()
-    {
-        return period;
-    }
-
-    private boolean locked;
-
-    public boolean isLocked()
-    {
-        return locked;
-    }
-
-    private CompleteDataSetRegistration registration;
-
-    public CompleteDataSetRegistration getRegistration()
-    {
-        return registration;
-    }
-
-    private Date registrationDate;
-
-    public Date getRegistrationDate()
-    {
-        return registrationDate;
-    }
-
     private List<Section> sections;
 
     public List<Section> getSections()
@@ -217,27 +173,6 @@
         return sections;
     }
 
-    private Integer dataSetId;
-
-    public void setDataSetId( Integer dataSetId )
-    {
-        this.dataSetId = dataSetId;
-    }
-
-    private String periodId;
-
-    public void setPeriodId( String periodId )
-    {
-        this.periodId = periodId;
-    }
-    
-    private boolean defaultForm;
-
-    public void setDefaultForm( boolean defaultForm )
-    {
-        this.defaultForm = defaultForm;
-    }
-
     private Map<Integer, Map<Integer, Collection<DataElementCategoryOption>>> orderedOptionsMap = new HashMap<Integer, Map<Integer, Collection<DataElementCategoryOption>>>();
 
     public Map<Integer, Map<Integer, Collection<DataElementCategoryOption>>> getOrderedOptionsMap()
@@ -315,40 +250,8 @@
     public String execute()
         throws Exception
     {
-        organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
 
-        Period period = PeriodType.createPeriodExternalId( periodId );
-
-        // ---------------------------------------------------------------------
-        // Get data locking info
-        // ---------------------------------------------------------------------
-
-        if ( dataSet != null && period != null )
-        {
-            DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
-
-            if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) )
-            {
-                locked = true;
-
-                log.info( "Dataset '" + dataSet.getName() + "' is locked " );
-            }
-        }
-
-        // ---------------------------------------------------------------------
-        // Get data set completeness info
-        // ---------------------------------------------------------------------
-
-        if ( dataSet != null && period != null && organisationUnit != null )
-        {
-            registration = registrationService.getCompleteDataSetRegistration( dataSet, period,
-                organisationUnit );
-
-            registrationDate = registration != null ? registration.getDate() : new Date();
-        }
-
         // ---------------------------------------------------------------------
         // Get display mode
         // ---------------------------------------------------------------------
@@ -440,7 +343,7 @@
         }
         else
         {
-            getOtherDataEntryForm( dataElements, dataSet, locked );
+            getOtherDataEntryForm( dataElements, dataSet );
         }
 
         return displayMode;
@@ -480,16 +383,14 @@
         }
     }
 
-    private void getOtherDataEntryForm( List<DataElement> dataElements, DataSet dataSet, boolean locked )
+    private void getOtherDataEntryForm( List<DataElement> dataElements, DataSet dataSet )
     {
-        String disabled = locked ? "disabled" : "";
-
         DataEntryForm dataEntryForm = dataSet.getDataEntryForm();
 
         if ( dataEntryForm != null )
         {
             customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEntry( 
-                dataEntryForm.getHtmlCode(), disabled, i18n, dataSet );
+                dataEntryForm.getHtmlCode(), i18n, dataSet );
         }
 
         List<DataElement> des = new ArrayList<DataElement>();

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java	2011-07-20 19:58:06 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java	2011-08-13 17:58:47 +0000
@@ -34,7 +34,7 @@
 import org.hisp.dhis.dataset.CompleteDataSetRegistration;
 import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.PeriodType;
 
 import com.opensymphony.xwork2.Action;
@@ -58,13 +58,6 @@
     {
         this.registrationService = registrationService;
     }
-
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
     
     private DataSetService dataSetService;
 
@@ -73,6 +66,13 @@
         this.dataSetService = dataSetService;
     }
 
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -91,6 +91,13 @@
         this.dataSetId = dataSetId;
     }
 
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -101,7 +108,7 @@
 
         registration.setDataSet( dataSetService.getDataSet( dataSetId ) );
         registration.setPeriod( PeriodType.createPeriodExternalId( periodId ) );
-        registration.setSource( selectionManager.getSelectedOrganisationUnit() );
+        registration.setSource( organisationUnitService.getOrganisationUnit( organisationUnitId ) );
         registration.setDate( new Date() );
 
         registrationService.saveCompleteDataSetRegistration( registration );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java	2011-07-20 19:58:06 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java	2011-08-13 17:58:47 +0000
@@ -34,7 +34,7 @@
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 
@@ -58,13 +58,6 @@
     {
         this.registrationService = registrationService;
     }
-
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
     
     private DataSetService dataSetService;
 
@@ -73,6 +66,13 @@
         this.dataSetService = dataSetService;
     }
 
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -91,6 +91,13 @@
         this.dataSetId = dataSetId;
     }
 
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -99,7 +106,7 @@
     {        
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
         Period period = PeriodType.createPeriodExternalId( periodId );
-        OrganisationUnit unit = selectionManager.getSelectedOrganisationUnit();
+        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
         CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet, period, unit );
         

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2011-07-20 19:58:06 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2011-08-13 18:03:46 +0000
@@ -47,7 +47,7 @@
 import org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService;
 import org.hisp.dhis.options.SystemSettingManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
@@ -61,8 +61,6 @@
 /**
  * @author Margrethe Store
  * @author Lars Helge Overland
- * @version $Id: ValidationAction.java 5426 2008-06-16 04:33:05Z larshelg $
- * @version $Id: ValidationAction.java 2010-04-20 01:52:07Z Chau Thu Tran $
  */
 public class ValidationAction
     implements Action
@@ -129,13 +127,6 @@
         this.minMaxDataElementService = minMaxDataElementService;
     }
 
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-    
     private DataSetService dataSetService;
 
     public void setDataSetService( DataSetService dataSetService )
@@ -143,6 +134,13 @@
         this.dataSetService = dataSetService;
     }
 
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -161,6 +159,13 @@
         this.dataSetId = dataSetId;
     }
 
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -201,7 +206,7 @@
     public String execute()
         throws Exception
     {
-        OrganisationUnit orgUnit = selectionManager.getSelectedOrganisationUnit();
+        OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
 
         Period selectedPeriod = PeriodType.createPeriodExternalId( periodId );
 

=== 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	2011-07-25 20:12:49 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-08-13 18:03:46 +0000
@@ -26,16 +26,15 @@
 	<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
 	<property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
     <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+    <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
+    <property name="dataSetLockService" ref="org.hisp.dhis.datalock.DataSetLockService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.de.action.LoadFormAction" class="org.hisp.dhis.de.action.LoadFormAction" scope="prototype">
     <property name="dataEntryFormService" ref="org.hisp.dhis.dataentryform.DataEntryFormService" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 	<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-    <property name="dataSetLockService" ref="org.hisp.dhis.datalock.DataSetLockService" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-    <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
   </bean>
 
@@ -74,24 +73,24 @@
   <bean id="org.hisp.dhis.de.action.HistoryAction" class="org.hisp.dhis.de.action.HistoryAction" scope="prototype">
     <property name="historyRetriever" ref="org.hisp.dhis.de.history.HistoryRetriever" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     <property name="dataValueAuditService" ref="org.hisp.dhis.datavalue.DataValueAuditService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.de.action.RegisterCompleteDataSetAction" class="org.hisp.dhis.de.action.RegisterCompleteDataSetAction"
     scope="prototype">
     <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 	<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.de.action.UndoCompleteDataSetAction" class="org.hisp.dhis.de.action.UndoCompleteDataSetAction"
     scope="prototype">
     <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 	<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.de.action.ValidationAction" class="org.hisp.dhis.de.action.ValidationAction" scope="prototype">
@@ -103,8 +102,8 @@
     <property name="minMaxValuesGenerationService" ref="org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService" />
     <property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
     <property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 	<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.de.action.MarkForFollowupAction" class="org.hisp.dhis.de.action.MarkForFollowupAction"
@@ -120,8 +119,8 @@
     scope="prototype">
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-    <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+    <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
 </beans>

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/completeRegistration.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/completeRegistration.vm	2011-07-13 17:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/completeRegistration.vm	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-
-<input type="hidden" id="curLocaleCode" value="$locale.getLanguage()_$locale.getCountry()"/>
-<hr style="clear:both">
-<input type="button" id="completeButton" name="completeButton" value="$i18n.getString( 'complete' )" onclick="validateCompleteDataSet()" style="width:120px"#if( $registration ) disabled="disabled"#end>
-<input type="button" id="undoButton" name="undoButton" value="$i18n.getString( 'incomplete' )" onclick="undoCompleteDataSet()" style="width:120px"#if( !$registration ) disabled="disabled"#end>
-<input type="button" value="$i18n.getString( 'run_validation' )" onclick="javascript:validate()" style="width:120px"><br>
-<span id="message"></span>

=== modified 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	2011-07-13 15:09:37 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/customForm.vm	2011-08-13 17:39:25 +0000
@@ -1,3 +1,1 @@
 $customDataEntryFormCode
-
-#parse( "/dhis-web-dataentry/completeRegistration.vm" )
\ No newline at end of file

=== modified file '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/defaultForm.vm	2011-08-05 14:45:27 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm	2011-08-13 17:39:25 +0000
@@ -36,18 +36,18 @@
   #end
   #set( $count = $count + 1 )
   <tr>
-  <td id="${dataElement.id}-cell" #if( $mark == 1 )class="altRow"#else class="regRow"#end><span>${encoder.htmlEncode( $dataElement.name )}</span></td>
+  <td id="${dataElement.id}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end>${encoder.htmlEncode( $dataElement.name )}</td>
   #foreach( $optionCombo in $optionCombos )
   #set( $dataEntryId = "${dataElement.id}-${optionCombo.id}-val" )	    
   <td>
   #if( $dataElement.type == "bool" )
-  <select name="entryselect" id="$dataEntryId" #if( !$hasAccess )disabled="disabled"#end tabindex="$tabIndex" #if( $locked )disabled="disabled"#end>
+  <select name="es" id="$dataEntryId"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex">
     <option value="">[$i18n.getString( "no_value" )]</option>
     <option value="true">$i18n.getString( "yes" )</option>
     <option value="false">$i18n.getString( "no" )</option>
   </select>
   #else
-  <input name="entryfield" id="$dataEntryId" type="text" #if( !$hasAccess )disabled="disabled"#end tabindex="$tabIndex" #if( $locked )disabled="disabled"#end>
+  <input name="ef" id="$dataEntryId" type="text"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex">
   #end
   </td>
   #set( $tabIndex = $tabIndex + 1 )
@@ -58,5 +58,3 @@
 <br>
 <br>
 #end
-
-#parse( "/dhis-web-dataentry/completeRegistration.vm" )
\ No newline at end of file

=== 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	2011-07-28 09:34:27 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2011-08-13 17:51:36 +0000
@@ -72,7 +72,7 @@
 			#if( !$isHistoryValid )			    
 			    <h4>$encoder.htmlEncode( $i18n.getString( "history_not_valid" ) )</h4>  
 			#end			
-			<img id="historyChart" src="getHistoryChart.action?dataElementId=${dataElementHistory.dataElement.id}&categoryOptionComboId=${dataElementHistory.optionCombo.id}&periodId=${periodId}"/>
+			<img id="historyChart" src="getHistoryChart.action?dataElementId=${dataElementHistory.dataElement.id}&categoryOptionComboId=${dataElementHistory.optionCombo.id}&organisationUnitId=${dataElementHistory.organisationUnit.id}&periodId=${periodId}"/>
         </td>
     </tr>
     #if( $dataValueAuditSize > 0 )

=== 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	2011-08-13 10:41:20 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-08-13 14:22:53 +0000
@@ -8,6 +8,8 @@
  * combo {dataelementid}-cell // table cell for data element name
  * {dataelementid}-{optioncomboid}-min // min value for data value
  * {dataelementid}-{optioncomboid}-max // max value for data value
+ * 
+ * Class "ef" means "entry field", class "es" means "entry select".
  */
 
 // -----------------------------------------------------------------------------
@@ -49,7 +51,7 @@
 {
     var entryFieldValues = new Array();
 
-    $( 'input[name="entryfield"]' ).each( function( index )
+    $( 'input[name="ef"]' ).each( function( index )
     {
         entryFieldValues[$( this ).attr( 'id' )] = $( this ).attr( 'value' );
     } );

=== 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	2011-08-13 11:51:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-13 17:58:47 +0000
@@ -57,7 +57,7 @@
 
 function addEventListeners()
 {
-    $( '[name="entryfield"]' ).each( function( i )
+    $( '[name="ef"]' ).each( function( i )
     {
         var id = $( this ).attr( 'id' );
         var dataElementId = id.split( '-' )[0];
@@ -99,7 +99,7 @@
         }
     } );
 
-    $( '[name="entryselect"]' ).each( function( i )
+    $( '[name="es"]' ).each( function( i )
     {
         var id = $( this ).attr( 'id' );
         var dataElementId = id.split( '-' )[0];
@@ -363,18 +363,19 @@
 
     // Clear existing values and colors
 
-    $( '[name="entryfield"]' ).val( '' );
-    $( '[name="entryselect"]' ).val( '' );
+    $( '[name="ef"]' ).val( '' );
+    $( '[name="es"]' ).val( '' );
 
-    $( '[name="entryfield"]' ).css( 'background-color', COLOR_WHITE );
-    $( '[name="entryselect"]' ).css( 'background-color', COLOR_WHITE );
+    $( '[name="ef"]' ).css( 'background-color', COLOR_WHITE );
+    $( '[name="es"]' ).css( 'background-color', COLOR_WHITE );
 
     $( '[name="min"]' ).html( '' );
     $( '[name="max"]' ).html( '' );
 
     $.getJSON( 'getDataValues.action', {
             periodId : periodId,
-        	dataSetId : dataSetId
+        	dataSetId : dataSetId,
+        	organisationUnitId: currentOrganisationUnitId
         },
         function( json )
         {
@@ -404,9 +405,9 @@
 
                 var dataValue = dataValueMap[value.id];
 
-                if ( dataValue
-                        && ( ( value.min && new Number( dataValue ) < new Number( value.min ) ) || ( value.max && new Number(
-                                dataValue ) > new Number( value.max ) ) ) )
+                if ( dataValue && 
+                	( ( value.min && new Number( dataValue ) < new Number( value.min ) ) 
+                	|| ( value.max && new Number( dataValue ) > new Number( value.max ) ) ) )
                 {
                     $( valFieldId ).css( 'background-color', COLOR_ORANGE );
                 }
@@ -418,6 +419,21 @@
             // Update indicator values in form
 
             updateIndicators();
+            
+            // Set completeness button
+            
+            if ( json.complete )
+            {
+            	$( '#completeButton' ).attr( 'disabled', 'disabled' );
+            	$( '#undoButton' ).removeAttr( 'disabled' );
+            }
+            else
+            {
+            	$( '#completeButton' ).removeAttr( 'disabled' );
+            	$( '#undoButton' ).attr( 'disabled', 'disabled' );
+            }
+            
+            // TODO locking
         } );
 }
 
@@ -430,6 +446,8 @@
 
     dataEntryFormIsLoaded = true;
     hideLoader();
+    
+    $( '#completenessDiv' ).css( 'display', 'block' );
 }
 
 function valueFocus( e )
@@ -473,13 +491,13 @@
 {
     var index = field.getAttribute( 'tabindex' );
 
-    field = $( 'input[name="entryfield"][tabindex="' + ( ++index ) + '"]' );
+    field = $( 'input[name="ef"][tabindex="' + ( ++index ) + '"]' );
 
     while ( field )
     {
         if ( field.is( ':disabled' ) || field.is( ':hidden' ) )
         {
-            field = $( 'input[name="entryfield"][tabindex="' + ( ++index ) + '"]' );
+            field = $( 'input[name="ef"][tabindex="' + ( ++index ) + '"]' );
         }
         else
         {
@@ -492,13 +510,13 @@
 {
     var index = field.getAttribute( 'tabindex' );
 
-    field = $( 'input[name="entryfield"][tabindex="' + ( --index ) + '"]' );
+    field = $( 'input[name="ef"][tabindex="' + ( --index ) + '"]' );
 
     while ( field )
     {
         if ( field.is( ':disabled' ) || field.is( ':hidden' ) )
         {
-            field = $( 'input[name="entryfield"][tabindex="' + ( --index ) + '"]' );
+            field = $( 'input[name="ef"][tabindex="' + ( --index ) + '"]' );
         }
         else
         {
@@ -525,7 +543,8 @@
 
         $.getJSON( 'getValidationViolations.action', {
             periodId : periodId,
-            dataSetId : dataSetId
+            dataSetId : dataSetId,
+            organisationUnitId: currentOrganisationUnitId
         }, registerCompleteDataSet ).error( function()
         {
             $( '#completeButton' ).removeAttr( 'disabled' );
@@ -545,7 +564,8 @@
     {
         $.getJSON( 'registerCompleteDataSet.action', {
             periodId : periodId,
-            dataSetId : dataSetId
+            dataSetId : dataSetId,
+            organisationUnitId: currentOrganisationUnitId
         }, function()
         {
         } ).error( function()
@@ -576,7 +596,8 @@
 
         $.getJSON( 'undoCompleteDataSet.action', {
             periodId : periodId,
-            dataSetId : dataSetId
+            dataSetId : dataSetId,
+            organisationUnitId: currentOrganisationUnitId
         }, function()
         {
         } ).error( function()
@@ -610,7 +631,8 @@
 
     $( '#validationDiv' ).load( 'validate.action', {
         periodId : periodId,
-        dataSetId : dataSetId
+        dataSetId : dataSetId,
+        organisationUnitId: currentOrganisationUnitId
     }, displayValidationDialog );
 }
 
@@ -637,9 +659,10 @@
     var operandName = dataElementName + ' ' + optionComboName;
 
     $( '#historyDiv' ).load( 'viewHistory.action', {
-        dataElementId : dataElementId,
-        optionComboId : optionComboId,
-        periodId : periodId
+        dataElementId: dataElementId,
+        optionComboId: optionComboId,
+        periodId: periodId,
+        organisationUnitId: currentOrganisationUnitId 
     }, function()
     {
         displayHistoryDialog( operandName );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataValues.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataValues.vm	2011-07-12 17:20:02 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataValues.vm	2011-08-13 14:05:28 +0000
@@ -14,5 +14,7 @@
     "min":"${element.min}",
     "max":"${element.max}"
   }#if( $velocityCount < $size2 ),#end
-  #end ]
+  #end ],
+  "locked":${locked},
+  "complete":${complete}
  }

=== 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	2011-08-05 14:45:27 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2011-08-13 17:39:25 +0000
@@ -53,19 +53,19 @@
     #end
     #set( $count = $count + 1 )
     <tr>
-    <td id="${dataElement.id}-cell" #if( $mark == 1 )class="altRow"#else class="regRow"#end><span>${encoder.htmlEncode( $dataElement.name )}</span></td>
+    <td id="${dataElement.id}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end>${encoder.htmlEncode( $dataElement.name )}</td>
     #foreach( $optionCombo in $optionCombos )
     #set( $dataEntryId = "${dataElement.id}-${optionCombo.id}-val" )
     #set( $greyedField = false )
     #set( $greyedField = $greyedFields.get( "$dataElement.id:$optionCombo.id" ) )        
     #if( $dataElement.type == "bool" )
-    <td><select name="entryselect" id="$dataEntryId" #if( !$hasAccess )disabled="disabled"#end tabindex="$tabIndex" #if( $locked || $greyedField )disabled="disabled"#end>
+    <td><select name="es" id="$dataEntryId"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex" #if( $greyedField )disabled="disabled"#end>
       <option value="">[$i18n.getString( "no_value" )]</option>
       <option value="true">$i18n.getString( "yes" )</option>
       <option value="false">$i18n.getString( "no" )</option>
     </select></td>
     #else
-    <td><input name="entryfield" id="$dataEntryId" type="text" #if( !$hasAccess )disabled="disabled"#end tabindex="$tabIndex" #if( $locked || $greyedField )class="grey" disabled="disabled"#end></td>
+    <td><input name="ef" id="$dataEntryId" type="text"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex" #if( $greyedField )class="grey" disabled="disabled"#end></td>
     #end
     </td>
     #set( $tabIndex = $tabIndex + 1 )
@@ -77,9 +77,5 @@
     </td>
   </tr>
 </table>
-
 <br>
-
 #end
-
-#parse( "/dhis-web-dataentry/completeRegistration.vm" )
\ No newline at end of file

=== 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	2011-08-13 11:51:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2011-08-13 17:39:25 +0000
@@ -113,3 +113,13 @@
 <div id="historyDiv" class="page"></div>
 
 <div id="validationDiv" class="page"></div>
+
+<div id="completenessDiv" class="page" style="display:none">
+
+<input type="hidden" id="curLocaleCode" value="$locale.getLanguage()_$locale.getCountry()"/>
+<hr style="clear:both">
+<input type="button" id="completeButton" name="completeButton" value="$i18n.getString( 'complete' )" onclick="validateCompleteDataSet()" style="width:120px">
+<input type="button" id="undoButton" name="undoButton" value="$i18n.getString( 'incomplete' )" onclick="undoCompleteDataSet()" style="width:120px">
+<input type="button" value="$i18n.getString( 'run_validation' )" onclick="javascript:validate()" style="width:120px">
+
+</div>

=== 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	2011-08-02 18:48:02 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2011-08-13 14:21:36 +0000
@@ -38,13 +38,13 @@
   background-color: #cccccc;
 }
 
-.altRow
+.alt
 {
   background-color: #e0e0e0;
   padding-right: 50px;
 }
 
-.regRow
+.reg
 {
   padding-right: 50px;
 }