dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15393
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5569: Disable data entry when data set completed is not working.
------------------------------------------------------------
revno: 5569
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-23 14:49:09 +0700
message:
Disable data entry when data set completed is not working.
modified:
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/select.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
--
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-12-02 08:51:28 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-12-23 07:49:09 +0000
@@ -495,6 +495,7 @@
if ( periodId && periodId != -1 && dataEntryFormIsLoaded )
{
+ disableFields( false );
showLoader();
loadDataValues();
}
@@ -627,6 +628,26 @@
displayEntryFormCompleted();
}
+function disableFields( disabled )
+{
+ if( disabled )
+ {
+ jQuery("#contentDiv :input").each(function()
+ {
+ jQuery(this).attr('disabled', 'disabled');
+ jQuery(this).css( 'background-color', COLOR_GREY );
+ });
+ }
+ else
+ {
+ jQuery("#contentDiv :input").each(function()
+ {
+ jQuery(this).removeAttr('disabled');
+ jQuery(this).css( 'background-color', COLOR_WHITE );
+ });
+ }
+}
+
function insertDataValues()
{
var dataValueMap = [];
@@ -646,7 +667,7 @@
$( '[name="min"]' ).html( '' );
$( '[name="max"]' ).html( '' );
- $( '[name="entryfield"]' ).filter( ':disabled' ).css( 'background-color', COLOR_GREY );
+ //$( '[name="entryfield"]' ).filter( ':disabled' ).css( 'background-color', COLOR_GREY );
$.ajax( {
url: 'getDataValues.action',
@@ -713,6 +734,14 @@
$( '#completedBy' ).html( json.storedBy );
$( '#completedDate' ).html( json.date );
}
+ if( getFieldValue('dataEntryFormCompleted') =='true' )
+ {
+ disableFields ( true )
+ }
+ else
+ {
+ disableFields( false );
+ }
}
else
{
@@ -858,9 +887,18 @@
{
storageManager.clearCompleteDataSet( params );
- if ( json.response == 'input' )
+ if( json.response == 'success' && getFieldValue('dataEntryFormCompleted') =='true' )
+ {
+ disableFields( true );
+ }
+ else if ( json.response == 'input' )
{
- validate();
+ if( getFieldValue('dataEntryFormCompleted') =='true' )
+ {
+ disableFields( true );
+ }
+
+ validate( false );
}
}
} );
@@ -882,10 +920,12 @@
success: function()
{
storageManager.clearCompleteDataSet( params );
+ disableFields( false );
},
error: function()
{
storageManager.clearCompleteDataSet( params );
+ disableFields( false );
}
} );
}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2011-11-02 17:11:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2011-12-23 07:49:09 +0000
@@ -34,6 +34,7 @@
</script>
<h3>$i18n.getString( "data_entry" ) #openHelp( "dataEntry" )</h3>
+<input type='hidden' id='dataEntryFormCompleted' name='dataEntryFormCompleted' value='$dataEntryFormCompleted'>
<div id="currentSelection">
<span style="float:left;cursor:pointer;margin-right:5px;"><img src="../images/hide.png" title="$i18n.getString( 'close' )" onclick="closeCurrentSelection()"></span>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2011-12-14 17:16:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2011-12-23 07:49:09 +0000
@@ -239,7 +239,6 @@
{
description = null;
}
-
if ( formName != null && formName.trim().length() == 0 )
{
formName = null;
@@ -299,7 +298,7 @@
dataElementService.updateDataElementGroup( newGroup );
}
}
-
+
if ( jsonAttributeValues != null )
{
AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues,
@@ -307,7 +306,7 @@
}
dataElementService.updateDataElement( dataElement );
-
+
return SUCCESS;
}
}