dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13465
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4332: minor changes to complete methods
------------------------------------------------------------
revno: 4332
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-08-17 15:38:07 +0200
message:
minor changes to complete methods
modified:
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/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-17 12:06:04 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-17 13:38:07 +0000
@@ -581,25 +581,37 @@
// Data completeness
// -----------------------------------------------------------------------------
+var KEY_COMPLETEDATASETS = "completedatasets";
+
+function getCompleteDataSetId(json)
+{
+ return json.periodId + "-" + json.dataSetId + "-" + json.organisationUnitId;
+}
+
+function getCurrentCompleteDataSetParams() {
+ var params = {
+ "periodId": $( '#selectedPeriodId' ).val(),
+ "dataSetId": $( '#selectedDataSetId' ).val(),
+ "organisationUnitId": currentOrganisationUnitId
+ };
+
+ return params;
+}
+
function validateCompleteDataSet()
{
var confirmed = confirm( i18n_confirm_complete );
if ( confirmed )
{
- var periodId = $( '#selectedPeriodId' ).val();
- var dataSetId = $( '#selectedDataSetId' ).val();
-
+ var params = getCurrentCompleteDataSetParams();
+
disableCompleteButton();
- $.getJSON( 'getValidationViolations.action', {
- periodId : periodId,
- dataSetId : dataSetId,
- organisationUnitId: currentOrganisationUnitId
- }, registerCompleteDataSet ).error( function()
- {
+ $.getJSON( 'getValidationViolations.action', params).success(function(data) {
+ registerCompleteDataSet(data);
+ }).error( function() {
disableUndoButton();
-
window.alert( i18n_no_response_from_server );
} );
}
@@ -607,21 +619,13 @@
function registerCompleteDataSet( json )
{
- var periodId = $( '#selectedPeriodId' ).val();
- var dataSetId = $( '#selectedDataSetId' ).val();
+ var params = getCurrentCompleteDataSetParams();
if ( json.response == 'success' )
{
- $.getJSON( 'registerCompleteDataSet.action', {
- periodId : periodId,
- dataSetId : dataSetId,
- organisationUnitId: currentOrganisationUnitId
- }, function()
- {
- } ).error( function()
- {
+ $.getJSON( 'registerCompleteDataSet.action', params).success(function() {
+ }).error( function() {
disableUndoButton();
-
window.alert( i18n_no_response_from_server );
} );
}
@@ -830,11 +834,11 @@
var MAX_SIZE = new Number( 2600000 );
var MAX_SIZE_FORMS = new Number( 1600000 );
var MAX_SIZE_DATA_VALUES = new Number( 500000 );
-
+
var KEY_FORM_PREFIX = "form-";
var KEY_FORM_VERSIONS = "formversions";
var KEY_DATAVALUES = "datavalues";
-
+
/**
* Returns the total number of characters currently in the local storage.
*