← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2106: Added progress indicator

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 2106 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-11-18 14:53:54 +0100
message:
  Added progress indicator
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/loader/loader.vm
  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/SectionFormAction.java
  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/select.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-commons-resources/src/main/webapp/dhis-web-commons/loader/loader.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/loader/loader.vm	2010-01-26 15:20:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/loader/loader.vm	2010-11-18 13:53:54 +0000
@@ -9,11 +9,12 @@
   width: 500px;
   height: 230px;
   text-align: center;
+  display: none;
 }
 
 </style>
 
-<div id="loaderDiv" style="display:none">
+<div id="loaderDiv">
     
     <br><br><br>
     

=== 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-17 18:26:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java	2010-11-18 13:17:32 +0000
@@ -163,6 +163,7 @@
     // -------------------------------------------------------------------------
     // Comparator
     // -------------------------------------------------------------------------
+    
     private Comparator<DataElement> dataElementComparator;
 
     public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
@@ -173,6 +174,7 @@
     // -------------------------------------------------------------------------
     // DisplayPropertyHandler
     // -------------------------------------------------------------------------
+    
     private DisplayPropertyHandler displayPropertyHandler;
 
     public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
@@ -274,7 +276,7 @@
         return orderdCategoryOptionCombos;
     }
 
-    Collection<DataElementCategoryOptionCombo> allOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+    private Collection<DataElementCategoryOptionCombo> allOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
 
     public Collection<DataElementCategoryOptionCombo> getAllOptionCombos()
     {
@@ -361,6 +363,7 @@
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
+    
     public String execute()
         throws Exception
     {
@@ -402,13 +405,12 @@
 
             orderdCategoryOptionCombos.put( categoryCombo.getId(), optionCombos );
 
-            // ---------------------------------------------------------------------
+            // -----------------------------------------------------------------
             // Perform ordering of categories and their options so that they
-            // could
-            // be displayed as in the paper form. Note that the total number of
-            // entry cells to be generated are the multiple of options from each
-            // category.
-            // ---------------------------------------------------------------------
+            // could be displayed as in the paper form. Note that the total 
+            // number of entry cells to be generated are the multiple of options 
+            // from each category.
+            // -----------------------------------------------------------------
 
             numberOfTotalColumns.put( categoryCombo.getId(), optionCombos.size() );
 
@@ -423,9 +425,9 @@
 
             orderedOptionsMap.put( categoryCombo.getId(), optionsMap );
 
-            // ---------------------------------------------------------------------
+            // -----------------------------------------------------------------
             // Calculating the number of times each category should be repeated
-            // ---------------------------------------------------------------------
+            // -----------------------------------------------------------------
 
             int catColSpan = optionCombos.size();
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java	2010-11-18 13:17:32 +0000
@@ -337,7 +337,6 @@
     public String execute()
         throws Exception
     {
-
         zeroValueSaveMode = (Boolean) systemSettingManager.getSystemSetting( KEY_ZERO_VALUE_SAVE_MODE, false );
 
         OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
@@ -417,13 +416,12 @@
 
             orderdCategoryOptionCombos.put( categoryCombo.getId(), optionCombos );
 
-            // ---------------------------------------------------------------------
+            // -----------------------------------------------------------------
             // Perform ordering of categories and their options so that they
-            // could
-            // be displayed as in the paper form. Note that the total number of
-            // entry cells to be generated are the multiple of options from each
-            // category.
-            // ---------------------------------------------------------------------
+            // could be displayed as in the paper form. Note that the total 
+            // number of entry cells to be generated are the multiple of options 
+            // from each category.
+            // -----------------------------------------------------------------
 
             numberOfTotalColumns.put( categoryCombo.getId(), optionCombos.size() );
 
@@ -438,9 +436,9 @@
 
             orderedOptionsMap.put( categoryCombo.getId(), optionsMap );
 
-            // ---------------------------------------------------------------------
+            // -----------------------------------------------------------------
             // Calculating the number of times each category should be repeated
-            // ---------------------------------------------------------------------
+            // -----------------------------------------------------------------
 
             int catColSpan = optionCombos.size();
 
@@ -560,6 +558,5 @@
         dataElementValueTypeMap.put( DataElement.VALUE_TYPE_DATE, i18n.getString( "date" ) );
 
         return 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-18 13:11:49 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-18 13:53:54 +0000
@@ -24,7 +24,7 @@
 
 function clearEntryForm()
 {
-	$('#entryForm').html( '' );
+	$('#contentDiv').html( '' );
 }
 
 // -----------------------------------------------------------------------------
@@ -55,7 +55,7 @@
     		$( '#selectedDataSetId' ).val( dataSetId );
     		
     		if ( json.periodValid ) {
-    			displayEntryFormInternal( null );
+    			displayEntryFormInternal( false );
     		}
     	}
     	else {
@@ -123,7 +123,7 @@
 	    	
 	    	if ( json.periodValid && periodIndex != null ) {
 	    		$( '#selectedPeriodIndex' ).val( periodIndex );	    		
-	    		displayEntryFormInternal( setDisplayModes );
+	    		displayEntryFormInternal( true );
 	    	}
 	    	else {
 	    		clearEntryForm();
@@ -138,7 +138,7 @@
 
 function displayModeSelected()
 {
-	displayEntryFormInternal( null );
+	displayEntryFormInternal( false );
 }
 
 // -----------------------------------------------------------------------------
@@ -147,11 +147,13 @@
 
 function periodSelected()
 {
-	displayEntryFormInternal( setDisplayModes );
+	displayEntryFormInternal( true );
 }
 
-function displayEntryFormInternal( callback )
+function displayEntryFormInternal( updateDisplayModes )
 {
+	showLoader();
+	
 	var periodIndex = $( '#selectedPeriodIndex' ).val();
 	
 	if ( periodIndex && periodIndex != -1 )
@@ -159,12 +161,16 @@
 		var url = 'select.action?selectedPeriodIndex=' + periodIndex +
 			'&displayMode=' + $("input[name='displayMode']:checked").val();
 		
-		$( '#entryForm' ).load( url, callback );
+		var callback = updateDisplayModes ? setDisplayModes : hideLoader;
+		
+		$( '#contentDiv' ).load( url, callback );
 	}
 }
 
 function setDisplayModes()
 {
+	hideLoader();
+	
 	$.getJSON( 'loadDisplayModes.action', function( json ) {
 		if ( json.customForm ) {
 			$( '#displayModeCustom' ).removeAttr( 'disabled' );

=== 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-18 12:28:04 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2010-11-18 13:53:54 +0000
@@ -43,7 +43,9 @@
 <hr style="clear:both"/>
 <br/>
 
-<div id="entryForm"></div>
+#parse( "dhis-web-commons/loader/loader.vm" )
+
+<div id="contentDiv"></div>
 
 <script type="text/javascript">
 	var i18n_save_calculated_data_element_success = '$encoder.jsEscape( $i18n.getString( "save_calculated_data_element_success" ) , "'")';