← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2743: Removed date field for setting time of completeness. Making it too easy for users to cheat.

 

------------------------------------------------------------
revno: 2743
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-25 17:02:32 +0100
message:
  Removed date field for setting time of completeness. Making it too easy for users to cheat.
modified:
  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/resources/org/hisp/dhis/de/i18n_module.properties
  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/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/RegisterCompleteDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java	2011-01-25 16:02:32 +0000
@@ -34,8 +34,6 @@
 import org.hisp.dhis.dataset.CompleteDataSetRegistration;
 import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.de.state.SelectedStateManager;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
 
 import com.opensymphony.xwork2.Action;
 
@@ -66,70 +64,18 @@
         this.selectedStateManager = selectedStateManager;
     }
 
-    private I18nFormat format;
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private String date;
-
-    public void setDate( String date )
-    {
-        this.date = date;
-    }
-
-    private String message;
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    private I18n i18n;
-
-    public void setI18n( I18n i18n )
-    {
-        this.i18n = i18n;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        Date oDate;
-
-        if ( date == null || date.trim().length() == 0 )
-        {
-            message = i18n.getString( "specify_input_date" );
-
-            return INPUT;
-        }
-        else
-        {
-            oDate = format.parseDate( date.trim() );
-
-            if ( oDate == null )
-            {
-                message = i18n.getString( "specify_valid_input_date" );
-
-                return INPUT;
-            }
-        }
-
         CompleteDataSetRegistration registration = new CompleteDataSetRegistration();
 
         registration.setDataSet( selectedStateManager.getSelectedDataSet() );
         registration.setPeriod( selectedStateManager.getSelectedPeriod() );
         registration.setSource( selectedStateManager.getSelectedOrganisationUnit() );
-        registration.setDate( oDate );
+        registration.setDate( new Date() );
 
         registrationService.saveCompleteDataSetRegistration( registration );
 

=== 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	2011-01-25 14:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-01-25 16:02:32 +0000
@@ -81,7 +81,7 @@
 use_default_form 					= Use Default Form
 use_custom_form						= Use Custom Form
 complete							= Complete
-undo								= Undo
+incomplete							= Incomplete
 confirm_complete					= Are you sure this dataset is complete?
 confirm_undo						= Are you sure you will undo the registration?
 data_entry                          = Data Entry

=== modified 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-01-25 14:58:50 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/completeRegistration.vm	2011-01-25 16:02:32 +0000
@@ -1,13 +1,6 @@
 <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:100px"#if( $registration ) disabled="disabled"#end>
-<input type="button" id="undoButton" name="undoButton" value="$i18n.getString( 'undo' )" onclick="undoCompleteDataSet()"#if( !$registration ) disabled="disabled"#end>
-<input type="text" id="dateField" name="dateField" value="$!format.formatDate( $registrationDate )" style="width:160px"#if( $registration ) disabled="disabled"#end class="{validate:{required:true,dateISO:true}}">
-<span id="dateDiv" name="dateDiv" #if( $registration ) style="display:none"#else style="display:inline"#end>
-<input type="button" value="$i18n.getString( 'run_validation' )" onclick="javascript:validate()" style="width:100px"><br>
+<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>
-<script type="text/javascript">
-   jQuery(document).ready(function(){
-		datePicker( 'dateField' );
-   });
-</script>

=== 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-01-17 12:03:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-01-25 16:02:32 +0000
@@ -390,10 +390,8 @@
     var type = messageElement.getAttribute( 'type' );
     
     if ( type == "none" )
-    {
-        var date = document.getElementById( "dateField" ).value;
-    
-        var url = "registerCompleteDataSet.action?date=" + date;
+    {    
+        var url = "registerCompleteDataSet.action";
     
         var request = new Request();
 		request.setResponseTypeXML( 'message' );
@@ -418,8 +416,6 @@
 	
 	document.getElementById( "completeButton" ).disabled = true;
 	document.getElementById( "undoButton" ).disabled = false;
-    document.getElementById( "dateField" ).disabled = true;
-    document.getElementById( "dateDiv" ).style.display = "none";
 }
 
 function undoCompleteDataSet()
@@ -440,8 +436,6 @@
 {
     document.getElementById( "completeButton" ).disabled = false;
     document.getElementById( "undoButton" ).disabled = true;
-    document.getElementById( "dateField" ).disabled = false;
-    document.getElementById( "dateDiv" ).style.display = "inline";
 }
 
 // -----------------------------------------------------------------------------