dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13423
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4297: fixed bug with trigger in ouwt. fixed bug with saveDataValue in form.js
------------------------------------------------------------
revno: 4297
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-08-15 12:35:59 +0200
message:
fixed bug with trigger in ouwt. fixed bug with saveDataValue in form.js
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
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-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-08-15 09:18:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-08-15 10:35:59 +0000
@@ -110,14 +110,16 @@
localStorage[getTagId( "Roots" )] = JSON.stringify( roots );
localStorage[getTagId( "Version" )] = data.version;
- } ).complete( sync_and_reload );
+ } ).complete( function() {
+ sync_and_reload();
+ $( "#orgUnitTree" ).trigger( "ouwtLoaded" );
+ } );
}
else
{
sync_and_reload();
+ $( "#orgUnitTree" ).trigger( "ouwtLoaded" );
}
-
- $( "#orgUnitTree" ).trigger( "ouwtLoaded" );
} );
};
=== 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-15 09:02:23 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2011-08-15 10:35:59 +0000
@@ -222,6 +222,8 @@
this.save = function()
{
+ storageManager.saveDataValueJSON( dataValue );
+
$.ajax( {
url : "saveValue.action",
data : dataValue,
=== 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-15 10:07:21 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-15 10:35:59 +0000
@@ -1005,6 +1005,16 @@
/**
* Saves a data value.
*
+ * @param dataValue The datavalue and identifiers in json format
+ */
+ this.saveDataValueJSON = function( dataValue )
+ {
+ this.saveDataValue( dataValue.dataElementId, dataValue.optionComboId, dataValue.periodId, dataValue.organisationUnitId, dataValue.value );
+ }
+
+ /**
+ * Saves a data value.
+ *
* @param dataElementId the data element identifier.
* @param categoryOptionComboId the category option combo identifier.
* @param periodId the period identifier.
@@ -1014,16 +1024,16 @@
this.saveDataValue = function( dataElementId, categoryOptionComboId, periodId, organisationUnitId, value )
{
var id = this.getDataValueIdentifier( dataElementId, categoryOptionComboId, periodId, organisationUnitId );
-
- var dataValues = [];
-
+
+ var dataValues = {};
+
if ( localStorage[KEY_DATAVALUES] != null )
{
dataValues = JSON.parse( localStorage[KEY_DATAVALUES] );
}
-
+
dataValues[id] = value;
-
+
try
{
localStorage[KEY_DATAVALUES] = JSON.stringify( dataValues );