← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2125: Fixed bug with display mode selecion

 

------------------------------------------------------------
revno: 2125
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-11-21 16:05:05 +0100
message:
  Fixed bug with display mode selecion
modified:
  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/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/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-20 11:38:25 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java	2010-11-21 15:05:05 +0000
@@ -89,6 +89,24 @@
     }
 
     // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private String displayMode;
+
+    public void setDisplayMode( String displayMode )
+    {
+        this.displayMode = displayMode;
+    }
+
+    private Integer selectedPeriodIndex;
+
+    public void setSelectedPeriodIndex( Integer selectedPeriodIndex )
+    {
+        this.selectedPeriodIndex = selectedPeriodIndex;
+    }
+
+    // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
 
@@ -142,24 +160,6 @@
     }
 
     // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
-    private String displayMode;
-
-    public void setDisplayMode( String displayMode )
-    {
-        this.displayMode = displayMode;
-    }
-
-    private Integer selectedPeriodIndex;
-
-    public void setSelectedPeriodIndex( Integer selectedPeriodIndex )
-    {
-        this.selectedPeriodIndex = selectedPeriodIndex;
-    }
-
-    // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
@@ -223,8 +223,7 @@
 
         if ( selectedDataSet != null && period != null && organisationUnit != null )
         {
-            registration = registrationService.getCompleteDataSetRegistration( selectedDataSet, period,
-                organisationUnit );
+            registration = registrationService.getCompleteDataSetRegistration( selectedDataSet, period, organisationUnit );
 
             registrationDate = registration != null ? registration.getDate() : new Date();
         }

=== 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-20 11:38:25 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-21 15:05:05 +0000
@@ -185,55 +185,33 @@
 	displayEntryFormCompleted();
 	
 	$.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' );
-		}
-		
+		$( '#displayModeCustom' ).removeAttr( 'disabled' );
+		$( '#displayModeSection' ).removeAttr( 'disabled' );
 		$( '#displayModeDefault' ).removeAttr( 'disabled' );
 		
+		$( '#displayModeCustom' ).removeAttr( 'checked' );
+		$( '#displayModeSection' ).removeAttr( 'checked' );
+		$( '#displayModeDefault' ).removeAttr( 'checked' );
+		
 		if ( json.displayMode == 'customform' ) {
 			$( '#displayModeCustom' ).attr( 'checked', 'checked' );
-			$( '#displayModeSection' ).removeAttr( 'checked' );
-			$( '#displayModeDefault' ).removeAttr( 'checked' );
 		}
-		else if ( json.displayMode = 'sectionform' ) {
-			$( '#displayModeCustom' ).removeAttr( 'checked' );
+		else if ( json.displayMode == 'sectionform' ) {
 			$( '#displayModeSection' ).attr( 'checked', 'checked' );
-			$( '#displayModeDefault' ).removeAttr( 'checked' );
 		}
-		else if ( json.displayMode = 'defaultform' ) {
-			$( '#displayModeCustom' ).removeAttr( 'checked' );
-			$( '#displayModeSection' ).removeAttr( 'checked' );
+		else {
 			$( '#displayModeDefault' ).attr( 'checked', 'checked' );
 		}
+		
+		if ( !json.customForm ) {
+			$( '#displayModeCustom' ).attr( 'disabled', 'disabled' );
+		}		
+		if ( !json.sectionForm ) {
+			$( '#displayModeSection' ).attr( 'disabled', 'disabled' );
+		}		
 	} );
 }
 
-// -----------------------------------------------------------------------------
-// History
-// -----------------------------------------------------------------------------
-
-function viewHistory( dataElementId, optionComboId, showComment )
-{
-    window.open( 'viewHistory.action?dataElementId=' + dataElementId + '&optionComboId=' + optionComboId + '&showComment=' + showComment, '_blank', 'width=580,height=710,scrollbars=yes' );
-}
-
-/**
- * Display data element name in selection display when a value field recieves
- * focus.
- */
-var customDataEntryFormExists = "false";
-
 function valueFocus(e) 
 {
 	//Retrieve the data element id from the id of the field
@@ -393,7 +371,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// View history
+// Min max
 // -----------------------------------------------------------------------------
 
 /**
@@ -543,3 +521,12 @@
 {
     window.open( 'validate.action', '_blank', 'width=800, height=400, scrollbars=yes, resizable=yes' );
 }
+
+// -----------------------------------------------------------------------------
+// History
+// -----------------------------------------------------------------------------
+
+function viewHistory( dataElementId, optionComboId, showComment )
+{
+    window.open( 'viewHistory.action?dataElementId=' + dataElementId + '&optionComboId=' + optionComboId + '&showComment=' + showComment, '_blank', 'width=580,height=710,scrollbars=yes' );
+}