dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13454
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4323: Fixed minor bug with data value save
------------------------------------------------------------
revno: 4323
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-08-16 20:57:34 +0200
message:
Fixed minor bug with data value save
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
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/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2011-08-16 15:08:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2011-08-16 18:57:34 +0000
@@ -169,8 +169,8 @@
}
}
- var valueSaver = new ValueSaver( dataElementId, optionComboId, currentOrganisationUnitId, periodId, value,
- COLOR_GREEN );
+ var valueSaver = new ValueSaver( dataElementId, optionComboId,
+ currentOrganisationUnitId, periodId, value, COLOR_GREEN );
valueSaver.save();
updateIndicators(); // Update indicators in case of custom form
@@ -186,8 +186,8 @@
var periodId = $( '#selectedPeriodId' ).val();
- var valueSaver = new ValueSaver( dataElementId, optionComboId, currentOrganisationUnitId, periodId, value,
- COLOR_GREEN );
+ var valueSaver = new ValueSaver( dataElementId, optionComboId,
+ currentOrganisationUnitId, periodId, value, COLOR_GREEN );
valueSaver.save();
}
@@ -244,26 +244,24 @@
storageManager.saveDataValue( dataValue );
$.ajax( {
- url : "saveValue.action",
+ url : 'saveValue.action',
data : dataValue,
dataType : 'json',
- success : function( json ) {
- storageManager.clearDataValueJSON( dataValue );
- handleResponse( json );
- },
+ success : handleSuccess,
error : handleError
} );
};
- function handleResponse( json )
+ function handleSuccess( json )
{
var code = json.c;
- if ( code == 0 )
+ if ( code == 0 ) // Value successfully saved on server
{
+ storageManager.clearDataValueJSON( dataValue );
markValue( resultColor );
}
- else
+ else // Server error during save
{
markValue( COLOR_RED );
window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
@@ -272,9 +270,8 @@
function handleError( jqXHR, textStatus, errorThrown )
{
- setHeaderMessage( "Unable to contact server. Data will be stored locally." )
-// markValue( COLOR_RED );
-// window.alert( i18n_saving_value_failed_status_code + '\n\n' + textStatus );
+ setHeaderMessage( "You are offline. Data will be stored locally." );
+ markValue( resultColor );
}
function markValue( color )
=== 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-08-16 18:38:22 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-16 18:57:34 +0000
@@ -80,9 +80,9 @@
$(document).bind("dhis2.offline", function() {
if(isHeaderMessageVisible()) {
- updateHeaderMessage( "Unable to contact server. Data will be stored locally." )
+ updateHeaderMessage( "You are offline. Data will be stored locally." )
} else {
- setHeaderMessage( "Unable to contact server. Data will be stored locally." )
+ setHeaderMessage( "You are offline. Data will be stored locally." )
}
})