← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13380: Data entry, simplification

 

------------------------------------------------------------
revno: 13380
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-12-22 00:57:23 +0100
message:
  Data entry, simplification
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js


--
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/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-12-21 23:00:20 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-12-21 23:57:23 +0000
@@ -55,8 +55,10 @@
 // Array with category objects, null if default category combo / no categories
 dhis2.de.currentCategories = null;
 
-// Current offset, next or previous corresponding to increasing or decreasing
-// value with one
+// Currently selected iso period
+dhis2.de.currentPeriodId = null;
+
+// Current offset, next or previous corresponding to increasing or decreasing value
 dhis2.de.currentPeriodOffset = 0;
 
 // Username of user who marked the current data set as complete if any
@@ -572,8 +574,11 @@
     $( '#infoDiv' ).hide();
 }
 
-function loadForm( dataSetId, multiOrg )
+function loadForm()
 {
+	var dataSetId = dhis2.de.currentDataSetId;
+	var multiOrg = !!$( '#selectedDataSetId :selected' ).data( 'multiorg' );
+	
 	dhis2.de.currentOrganisationUnitId = selection.getSelected()[0];
 
     if ( !multiOrg && dhis2.de.storageManager.formExists( dataSetId ) )
@@ -975,20 +980,19 @@
 
         var previousPeriodType = dhis2.de.currentDataSetId ? dhis2.de.dataSets[dhis2.de.currentDataSetId].periodType : null;
 
+        dhis2.de.currentDataSetId = dataSetId;
+        
         if ( periodId && periodId != -1 && previousPeriodType && previousPeriodType == periodType )
         {
             showLoader();
             $( '#selectedPeriodId' ).val( periodId );
 
-            var isMultiOrganisationUnitForm = !!$( '#selectedDataSetId :selected' ).data( 'multiorg' );
-            loadForm( dataSetId, isMultiOrganisationUnitForm );
+            loadForm();
         }
         else
         {
             clearEntryForm();
         }
-
-        dhis2.de.currentDataSetId = dataSetId;
     }
 }
 
@@ -1007,6 +1011,8 @@
 
     if ( periodId && periodId != -1 )
     {
+    	dhis2.de.currentPeriodId = periodId;
+    	
         showLoader();
 
         if ( dhis2.de.dataEntryFormIsLoaded )
@@ -1015,8 +1021,7 @@
         }
         else
         {
-            var isMultiOrganisationUnitForm = !!$( '#selectedDataSetId :selected' ).data( 'multiorg' );
-            loadForm( dataSetId, isMultiOrganisationUnitForm );
+            loadForm();
         }
     }
 }
@@ -1067,7 +1072,7 @@
 }
 
 //------------------------------------------------------------------------------
-// Attributes / Categories
+// Attributes / Categories Selection
 //------------------------------------------------------------------------------
 
 /**