=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2011-04-24 10:11:07 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2011-05-08 19:22:16 +0000
@@ -59,13 +59,13 @@
- status.vm
+ /dhis-web-dataentry/status.vm
plainTextError
F_DATAVALUE_ADD,F_DATAVALUE_UPDATE,F_DATAVALUE_DELETE
=== 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-05-07 14:07:03 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2011-05-08 19:22:16 +0000
@@ -7,6 +7,9 @@
var COLOR_YELLOW = '#fffe8c';
var COLOR_RED = '#ff8a8a';
+/**
+/* Used by default and section forms.
+*/
function saveVal( dataElementId, optionComboId )
{
var dataElementName = document.getElementById( 'value[' + dataElementId + '].name' ).innerHTML;
@@ -14,6 +17,9 @@
saveValue( dataElementId, optionComboId, dataElementName, null );
}
+/**
+/* Used by custom forms.
+*/
function saveValue( dataElementId, optionComboId, dataElementName )
{
var field = document.getElementById( 'value[' + dataElementId + '].value' + ':' + 'value[' + optionComboId + '].value');
@@ -154,18 +160,15 @@
this.save = function()
{
- var request = new Request();
- request.setCallbackSuccess( handleResponse );
- request.setCallbackError( handleHttpError );
- request.setResponseTypeXML( 'status' );
- request.send( 'saveValue.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
- dataElementId + '&optionComboId=' + optionComboId + '&value=' + value );
+ var url = 'saveValue.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
+ dataElementId + '&optionComboId=' + optionComboId + '&value=' + value;
+
+ $.ajax( { url: url, dataType: 'json', success: handleResponse, error: handleError } );
};
- function handleResponse( rootElement )
+ function handleResponse( json )
{
- var codeElement = rootElement.getElementsByTagName( 'code' )[0];
- var code = parseInt( codeElement.firstChild.nodeValue );
+ var code = json.code;
if ( code == 0 )
{
@@ -178,10 +181,10 @@
}
}
- function handleHttpError( errorCode )
+ function handleError( jqXHR, textStatus, errorThrown )
{
markValue( COLOR_RED );
- window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
+ window.alert( i18n_saving_value_failed_error_code + '\n\n' + textStatus );
}
function markValue( color )
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js 2011-04-12 19:30:34 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js 2011-05-08 19:22:16 +0000
@@ -68,19 +68,16 @@
this.save = function()
{
- var request = new Request();
- request.setCallbackSuccess( handleResponse );
- request.setCallbackError( handleHttpError );
- request.setResponseTypeXML( 'status' );
- request.send( 'saveComment.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
- dataElementId + '&optionComboId=' + optionComboId + '&comment=' + value );
+ var url = 'saveComment.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
+ dataElementId + '&optionComboId=' + optionComboId + '&comment=' + value;
+
+ $.ajax( { url: url, dataType: 'json', success: handleResponse, error: handleError } );
};
- function handleResponse( rootElement )
+ function handleResponse( json )
{
- var codeElement = rootElement.getElementsByTagName( 'code' )[0];
- var code = parseInt( codeElement.firstChild.nodeValue );
-
+ var code = json.code;
+
if ( code == 0 )
{
markComment( SUCCESS );
@@ -92,10 +89,10 @@
}
}
- function handleHttpError( errorCode )
+ function handleError( jqXHR, textStatus, errorThrown )
{
markComment( ERROR );
- window.alert( i18n_saving_comment_failed_error_code + '\n\n' + errorCode );
+ window.alert( i18n_saving_comment_failed_error_code + '\n\n' + textStatus );
}
function markComment( color )
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/status.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/status.vm 2011-01-25 16:14:19 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/status.vm 2011-05-08 19:22:16 +0000
@@ -1,3 +1,1 @@
-
- $statusCode
-
+{ "code": "${statusCode}" }
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2011-05-07 22:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2011-05-08 18:59:01 +0000
@@ -67,7 +67,8 @@
html = "";
- } else {
+ }
+ else {
id = dataEntryId;
html = "" + i18n_dataelement_is_inserted + "");
return;
- } else {
+ }
+ else {
jQuery("#message_").html("");
}