← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4590: Data entry history screen, added info on who stored the value and when.

 

------------------------------------------------------------
revno: 4590
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-15 15:30:54 +0200
message:
  Data entry history screen, added info on who stored the value and when.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
  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_en_GB.properties
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.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-api/src/main/java/org/hisp/dhis/user/UserCredentials.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java	2011-07-22 20:43:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java	2011-09-15 13:30:54 +0000
@@ -168,6 +168,18 @@
         return true;
     }
     
+    /**
+     * Return the name of this user credentials. More specifically, if this
+     * credentials has a user it will return the first name and surname of that
+     * user, if not it returns the username of this credentials.
+     * 
+     * @return the name.
+     */
+    public String getName()
+    {
+        return user != null ? user.getName() : username;
+    }
+    
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2011-08-13 17:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2011-09-15 13:30:54 +0000
@@ -44,6 +44,8 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -100,6 +102,13 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
+    
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
 
     // -------------------------------------------------------------------------
     // Input
@@ -149,13 +158,13 @@
         return dataElementHistory;
     }
     
-    private Boolean isHistoryValid = true;
+    private boolean historyInvalid;
     
-    public Boolean getIsHistoryValid()
+    public boolean isHistoryInvalid()
     {
-    	return isHistoryValid;
+        return historyInvalid;
     }
-    
+
     private DataValue dataValue;
 
     public DataValue getDataValue()
@@ -176,7 +185,14 @@
     {
         return dataValueAudits;
     }
-   
+    
+    private String storedBy;
+
+    public String getStoredBy()
+    {
+        return storedBy;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -204,13 +220,16 @@
         
         dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, optionCombo );
 
+        if ( dataValue != null )
+        {
+            UserCredentials credentials = userService.getUserCredentialsByUsername( dataValue.getStoredBy() );
+            storedBy = credentials != null ? credentials.getName() : dataValue.getStoredBy();
+        }
+        
         dataElementHistory = historyRetriever.getHistory( dataElement, optionCombo, organisationUnit, period, HISTORY_LENGTH );
         
-        if ( dataElementHistory == null )
-        {
-            isHistoryValid = false;
-        }
-
+        historyInvalid = dataElementHistory == null;
+        
         // ---------------------------------------------------------------------
         // Data Value Audit
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-08-20 12:10:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-09-15 13:30:54 +0000
@@ -78,6 +78,7 @@
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     <property name="dataValueAuditService" ref="org.hisp.dhis.datavalue.DataValueAuditService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	<property name="userService" ref="org.hisp.dhis.user.UserService" />
   </bean>
 
   <bean id="org.hisp.dhis.de.action.RegisterCompleteDataSetAction" class="org.hisp.dhis.de.action.RegisterCompleteDataSetAction"

=== 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-08-23 13:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-09-15 13:30:54 +0000
@@ -19,7 +19,8 @@
 entry								= Entry
 max									= Max
 timestamp							= Timestamp
-stored_by							= Stored By
+stored_by							= Stored by
+stored_date							= Stored date
 edit_min_max						= Edit Min/Max
 no_value							= No value
 no_comment							= No comment
@@ -136,4 +137,6 @@
 sync_success						= Upload to server was successful
 sync_failed							= Upload to server failed, please try again later
 uploading_data_notification			= Uploading locally stored data to the server
-ajax_login_failed					= Login failed, check your username and password and try again
\ No newline at end of file
+ajax_login_failed					= Login failed, check your username and password and try again
+mark_value_for_followup				= Mark value for follow-up
+unmark_value_for_followup			= Un-mark value for follow-up
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_en_GB.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_en_GB.properties	2011-01-25 14:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_en_GB.properties	2011-09-15 13:30:54 +0000
@@ -1,124 +0,0 @@
-#Resource generated by I18n Resource Editor
-#Tue Sep 14 15:24:01 CEST 2010
-import_from_excel=Import from Excel (Exported Template)
-saving_comment_failed_status_code=Saving comment failed with status code 
-description=Description
-use_short_names=Use Short Names
-saving_value_failed_error_code=Saving value failed with error code
-entry=Entry
-data_set=Data Set
-dataelement_comment=Comment
-confirm_undo=Are you sure you will undo the registration?
-successful_validation=The data entry screen successfully passed validation
-data_entry=Data Entry
-stored_by=Stored By
-order_by_entry=Order by registration (default)
-saving_value_failed_status_code=Saving value failed with status code 
-max_limit=Max limit
-dv_deleted=Deleted
-delete_min_max_values=Delete min/max values
-saving_comment_failed_error_code=Saving comment failed with error code 
-organisation_unit=Organisation Unit
-value_of_data_element_greater=The value of the following data element is greater than the maximum accepted value
-yes=Yes
-max=Max
-generate_min_max=Generate min/max
-date=Date
-audit_operation=Operation Type
-less_than_or_equal_to=<\=
-validation_result=Validation Result
-dv_updated=Updated
-use_custom_form=Use Custom Form
-value_of_data_element_less=The value of the following data element is less than the minimum accepted value
-save=Save
-saving_minmax_failed_error_code=Saving min/max values failed with error code
-min_max_limits=Min-max limits
-left_description=Left Description
-comment=Comment
-dataelement_history=Data element history
-minimum_must_less_than_maximum=The minimum value must be less than the maximum value
-unsuccessful_validation=The data entry screen has validation errors, please correct these before proceeding
-specify_minimum_value=Please specify a minimum value
-open_entry_form=Open Entry Form
-equal_to=\=\=
-code=Code
-use_section_form=Use Section Form
-change_order=Change Order
-specify_valid_input_date=Please enter a valid input date
-not_equal_to=\!\=
-hide_entry_form=Hide Entry Form
-audit_stored_by=Operated By
-value=Value
-specify_maximum_value=Please specify a maximum value
-operator=Operator
-no_dataelement_selected=No Data Element Selected
-data_element=Data Element
-please_design_a_custom_form=Please design a custom FORM for this dataSet \!\!
-minimum_value_must_integer=The minimum value must be an integer
-yes_no=Yes/no
-import_export=Import/Export
-close=Close
-history_not_valid=History is not applied for this dataelement
-value_date=Value Date
-type=Type
-interpolation=Interpolation
-no_organisationunit_selected=No Organisation Unit Selected
-nr=Nr
-audit_value=Audit Value
-use_default_form=Use Default Form
-no=No
-edit_min_max_for=Edit min/max for
-min_limit=Min limit
-later_periods=Later periods
-custom_comment=Custom comment
-period=Period
-no_outlier_values_found=No outlier values found.
-complete=Complete
-order_by_code=Order by code
-name=Name
-timestamp=Timestamp
-less_than=<
-dv_added=Added
-data_entry_is_not_possible=DataEntry is not Possible\! Probably Empty DataSet.
-move=Move
-no_option_selected=No Option Selected
-right_description=Right Description
-move_up=Move up
-reset_order_inherit=Reset order/inherit from parent
-no_value=No value
-expression=Expression
-not_set=Not set
-specify_input_date=Please specify an input date
-average=Average
-earlier_periods=Earlier periods
-validation_rule=Validation rule
-text=Text
-edit_min_max=Edit Min/Max
-audit_from=From
-confirm_complete=Are you sure this dataset is complete?
-maximum_value_must_integer=The maximum value must be an integer
-undo=Undo
-audit_time=Audit Time
-no_comment=No comment
-maximum=Maximum
-value_type=Value Type
-followup=Follow-up
-audit_to=To
-the_following_values_are_outliers=The following values are considered as outliers (min-max or std dev).
-value_must_integer=Value must be an integer
-order_by_name=Order by name
-available_sections=Available Sections
-select=Select
-greater_than_or_equal_to=>\=
-number=Number
-move_down=Move down
-export_entry_template=Export Entry screen as Excel
-greater_than=>
-min=Min
-minimum=Minimum
-the_following_values_violates_rules=The following values violates validation rules
-cancel=Cancel
-no_period_selected=No Period Selected
-audit=\u12A0\u1265\u12EE\u1275
-multidimensional_data_entry=Multi-Dimensional Data Entry
-run_validation=Run validation

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2011-08-20 12:10:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2011-09-15 13:30:54 +0000
@@ -30,7 +30,7 @@
             <h4>$encoder.htmlEncode( $i18n.getString( "min_max_limits" ) )</h4>
             <table>
                 <tr>
-                    <td style="background-color:#d54a4a; height:26px">&nbsp;</td>
+                    <td style="background-color:#d54a4a; height:26px;">&nbsp;</td>
                     <td>$encoder.htmlEncode( $i18n.getString( "min_limit" ) ) </td>
                     <td><input type="text" id="minLimit" style="width:10em" value="$!{dataElementHistory.minLimit}" class="{validate:{digits:true}}" 
                         #if( !$auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) ) disabled="disabled"#end />
@@ -38,7 +38,7 @@
 					</td>
                 </tr>
                 <tr>
-                    <td style="background-color:#2e4e83; height:26px">&nbsp;</td>
+                    <td style="background-color:#2e4e83; height:26px;">&nbsp;</td>
                     <td>$encoder.htmlEncode( $i18n.getString( "max_limit" ) ) </td>
                     <td><input type="text" id="maxLimit" style="width:10em" value="$!{dataElementHistory.maxLimit}" class="{validate:{digits:true}}" 
                     	#if( !$auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) ) disabled="disabled"#end />
@@ -46,30 +46,37 @@
 					</td>
                 </tr>
                 <tr>
-                    <td style="background-color:#f4f256; height:26px">&nbsp;</td>
+                    <td style="background-color:#f4f256; height:26px;">&nbsp;</td>
                     <td>$encoder.htmlEncode( $i18n.getString( "average" ) ) </td>
-                    <td>${average}</td>
-                </tr>
-                <tr>
-                    <td style="background-color:#75e077; height:26px">&nbsp;</td>
-                    <td>$encoder.htmlEncode( $i18n.getString( "interpolation" ) ) </td>
-                    <td></td>
+                    <td>$!{average}</td>
                 </tr>
                 <tr>
                 	<td colspan="3"><input type="button" value="$i18n.getString( 'save' )" onclick="saveMinMaxLimit()" style="width:100px">
                 		<input type="button" value="$i18n.getString( 'remove' )" onclick="removeMinMaxLimit()" style="width:100px"></td>
                 </tr>
+                <tr>
+                	<td colspan="3" style="height:15px"></td>
+                </tr>
+                <tr>
+                	<td colspan="2" style="background-color: #e0e0e0; height:26px;">$i18n.getString( "stored_by" )</td>
+                	<td>$!encoder.htmlEncode( $storedBy )</td>
+                </tr>
+                <tr>
+                	<td colspan="2" style="background-color: #e0e0e0; height:26px;">$i18n.getString( "stored_date" )</td>
+                	<td>$!format.formatDate( $dataValue.timestamp )</td>
+                </tr>
             </table>
         </td>
 	</tr>
 	<tr>
 		<!-- History chart -->
 		<td colspan="2">
+			#if( $historyInvalid )
+			<h4>$encoder.htmlEncode( $i18n.getString( "history_not_valid" ) )</h4>	
+			#else
 			<h4>$encoder.htmlEncode( $i18n.getString( "dataelement_history" ) )</h4>
-			#if( !$isHistoryValid )			    
-			    <h4>$encoder.htmlEncode( $i18n.getString( "history_not_valid" ) )</h4>  
-			#end			
 			<img id="historyChart" src="getHistoryChart.action?dataElementId=${dataElementHistory.dataElement.id}&categoryOptionComboId=${dataElementHistory.optionCombo.id}&organisationUnitId=${dataElementHistory.organisationUnit.id}&periodId=${periodId}"/>
+			#end
         </td>
     </tr>
     #if( $dataValueAuditSize > 0 )