← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1869: made dataentry displaymode to use a fallback sequence of customform, sectionform or defaultform ...

 

------------------------------------------------------------
revno: 1869
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-07-21 12:31:21 +0200
message:
  made dataentry displaymode  to use a fallback sequence of customform, sectionform or defaultform - this is by default. Users can make their own choice using radio button selection.
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/SectionFormAction.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/action/multidimensional/FormAction.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/resources/org/hisp/dhis/de/i18n_module.properties
  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/multidimensional/form.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.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-07-07 10:22:14 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java	2010-07-21 10:31:21 +0000
@@ -292,6 +292,18 @@
     {
         return optionComboId;
     }
+    
+    private String displayMode;
+
+    public String getDisplayMode()
+    {
+        return displayMode;
+    }
+
+    public void setDisplayMode( String displayMode )
+    {
+        this.displayMode = displayMode;
+    }
 
     // -------------------------------------------------------------------------
     // Action implementation

=== 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-06-27 15:47:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java	2010-07-21 10:31:21 +0000
@@ -311,6 +311,18 @@
         return zeroValueSaveMode;
     }
 
+    private String displayMode;
+
+    public String getDisplayMode()
+    {
+        return displayMode;
+    }
+
+    public void setDisplayMode( String displayMode )
+    {
+        this.displayMode = displayMode;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -367,6 +379,7 @@
 
         for ( Section section : sections )
         {
+
             if ( section.getDataElements().size() > 0 )
             {
                 orderedCategoryCombos.add( section.getDataElements().iterator().next().getCategoryCombo() );

=== 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-06-27 15:47:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java	2010-07-21 10:31:21 +0000
@@ -61,8 +61,12 @@
 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 Log log = LogFactory.getLog( SelectAction.class );
 
     // -------------------------------------------------------------------------
@@ -161,18 +165,6 @@
         return haveSection;
     }
 
-    private String useSectionForm;
-
-    public String getUseSectionForm()
-    {
-        return useSectionForm;
-    }
-
-    public void setUseSectionForm( String useSectionForm )
-    {
-        this.useSectionForm = useSectionForm;
-    }
-
     private Boolean customDataEntryFormExists;
 
     public Boolean getCustomDataEntryFormExists()
@@ -180,16 +172,16 @@
         return this.customDataEntryFormExists;
     }
 
-    private String useDefaultForm;
+    private String displayMode;
 
-    public String getUseDefaultForm()
+    public String getDisplayMode()
     {
-        return useDefaultForm;
+        return displayMode;
     }
 
-    public void setUseDefaultForm( String useDefaultForm )
+    public void setDisplayMode( String displayMode )
     {
-        this.useDefaultForm = useDefaultForm;
+        this.displayMode = displayMode;
     }
 
     private Integer selectedDataSetId;
@@ -216,18 +208,6 @@
         return selectedPeriodIndex;
     }
 
-    private String useShortName;
-
-    public void setUseShortName( String useShortName )
-    {
-        this.useShortName = useShortName;
-    }
-
-    public String getUseShortName()
-    {
-        return useShortName;
-    }
-
     private Collection<Integer> calculatedDataElementIds;
 
     public Collection<Integer> getCalculatedDataElementIds()
@@ -347,7 +327,7 @@
                 period = selectedStateManager.getSelectedPeriod();
 
                 DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( selectedDataSet, period );
-                
+
                 if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) )
                 {
                     locked = true;
@@ -366,12 +346,6 @@
         period = selectedStateManager.getSelectedPeriod();
 
         // ---------------------------------------------------------------------
-        // Get Section Information
-        // ---------------------------------------------------------------------
-
-        haveSection = dataEntryScreenManager.hasSection( selectedDataSet );
-
-        // ---------------------------------------------------------------------
         // Get CalculatedDataElementInformation
         // ---------------------------------------------------------------------
 
@@ -379,6 +353,12 @@
         calculatedDataElementMap = dataEntryScreenManager.getNonSavedCalculatedDataElements( selectedDataSet );
 
         // ---------------------------------------------------------------------
+        // Get Section Information
+        // ---------------------------------------------------------------------
+
+        haveSection = dataEntryScreenManager.hasSection( selectedDataSet );
+
+        // ---------------------------------------------------------------------
         // Get the custom data entry form if any
         // ---------------------------------------------------------------------
 
@@ -392,12 +372,30 @@
 
         if ( selectedDataSetId != null && selectedPeriodIndex != null && organisationUnit != null )
         {
-            registration = registrationService.getCompleteDataSetRegistration( selectedDataSet, period, organisationUnit );
+            registration = registrationService.getCompleteDataSetRegistration( selectedDataSet, period,
+                organisationUnit );
 
             registrationDate = registration != null ? registration.getDate() : new Date();
-        }        
-
-        if ( useSectionForm != null )
+        }
+
+        if ( displayMode == null )
+        {
+            if ( customDataEntryFormExists )
+            {
+                displayMode = CUSTOM_FORM;
+            }
+            else if ( haveSection )
+            {
+                displayMode = SECTION_FORM;
+            }            
+        }
+        
+        if( !customDataEntryFormExists && !haveSection )
+        {
+            displayMode = DEFAULT_FORM;
+        }
+
+        if ( displayMode.equals( SECTION_FORM ) && haveSection )
         {
             return SECTION_FORM;
         }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/multidimensional/FormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/multidimensional/FormAction.java	2010-07-07 10:22:14 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/multidimensional/FormAction.java	2010-07-21 10:31:21 +0000
@@ -74,7 +74,7 @@
  */
 public class FormAction
     implements Action
-{   
+{
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -361,6 +361,18 @@
 
     private String disabled = " ";
 
+    private String displayMode;
+
+    public String getDisplayMode()
+    {
+        return displayMode;
+    }
+
+    public void setDisplayMode( String displayMode )
+    {
+        this.displayMode = displayMode;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------

=== 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-07-10 12:15:44 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java	2010-07-21 10:31:21 +0000
@@ -73,7 +73,7 @@
     
     private static final String DEFAULT_FORM = "defaultform";
 
-    private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform";
+    private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform";    
 
     private static final String EMPTY = "";
 

=== 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-07-12 15:24:04 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2010-07-21 10:31:21 +0000
@@ -95,6 +95,7 @@
 no_period_selected					= No Period Selected
 no_dataelement_selected				= No Data Element Selected
 use_default_form 					= Use Default Form
+use_custom_form						= Use Custom Form
 complete							= Complete
 undo								= Undo
 confirm_complete					= Are you sure this dataset is complete?

=== modified 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/form.vm	2009-12-21 05:32:40 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm	2010-07-21 10:31:21 +0000
@@ -9,7 +9,7 @@
 
 <div id="entryform">
 
-#if ( $customDataEntryFormExists && !$useDefaultForm )
+#if ( $customDataEntryFormExists && $displayMode=="customform" )
 			
 		#foreach( $optionCombo in $orderdCategoryOptionCombos )
 			

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multidimensional/form.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multidimensional/form.vm	2010-02-05 09:05:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multidimensional/form.vm	2010-07-21 10:31:21 +0000
@@ -24,7 +24,7 @@
 
 #else
     
-    #if ( $customDataEntryFormExists && !$useDefaultForm )
+    #if ( $customDataEntryFormExists && $displayMode=="customform" )
     
         #foreach( $optionCombo in $allOptionCombos )
             

=== 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-07-12 15:24:04 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2010-07-21 10:31:21 +0000
@@ -18,21 +18,33 @@
     <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>
 
-	<input type="checkbox" id="useDefaultForm" name="useDefaultForm"
-		#if( $useDefaultForm || !$customDataEntryFormExists ) 
-			checked="checked" 
-		#end 
-		#if( !$customDataEntryFormExists || $disableDefaultForm ) 
-			disabled="disabled" 
-		#end 
-		onchange="document.getElementById( 'selectForm' ).submit();">	
-	<label>$i18n.getString( "use_default_form" )</label><br>
+    <br>
+	<input type="radio" id="displayMode" name="displayMode" value="customform"
+       #if( $displayMode == "customform" ) 
+           checked="checked" 
+       #end
+       #if( !$customDataEntryFormExists ) 
+           disabled="disabled" 
+       #end         
+       onclick="document.getElementById( 'selectForm' ).submit();">    
+    <label>$i18n.getString( "use_custom_form" )</label><br>
 
-	<input type="checkbox" id="useSectionForm" name="useSectionForm" #if( $useSectionForm ) checked="checked" #end  #if( !$haveSection ) disabled="disabled" #end onchange="document.getElementById( 'selectForm' ).submit();">
+	<input type="radio" id="displayMode" name="displayMode" value="sectionform"
+	   #if( $displayMode == "sectionform" ) 
+	       checked="checked" 
+	   #end  
+	   #if( !$haveSection ) 
+	       disabled="disabled" 
+	   #end 
+	   onclick="document.getElementById( 'selectForm' ).submit();">
 	<label>$i18n.getString( "use_section_form" )</label><br>
 
-	<input type="checkbox" id="useShortName" name="useShortName" #if( $useShortName ) checked="checked" #end  #if( $customDataEntryFormExists && !$useDefaultForm ) disabled="disabled" #end onchange="document.getElementById( 'selectForm' ).submit();">
-	<label>$i18n.getString( "use_short_names" )</label><br><br>
+	<input type="radio" id="displayMode" name="displayMode" value="defaultform"
+       #if( $displayMode == "defaultform" ) 
+           checked="checked" 
+       #end       
+       onclick="document.getElementById( 'selectForm' ).submit();">    
+    <label>$i18n.getString( "use_default_form" )</label><br>
 
 </div>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm	2010-07-10 12:45:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addSection.vm	2010-07-21 10:31:21 +0000
@@ -101,8 +101,8 @@
 
       <tr>
         <td colspan="3">
-          <input type="submit" value="$i18n.getString( "save" )"><input type="button" 
-            onclick="window.location.href='section.action'" value="$i18n.getString( "cancel" )">
+          <input type="submit" value="$i18n.getString( "save" )">
+          <input type="button" onclick="window.location.href='section.action'" value="$i18n.getString( "cancel" )">
         </td>
       </tr>
     </tbody>