← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8447: Days before/after due date of template messages are not duplicate.

 

------------------------------------------------------------
revno: 8447
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-09 14:58:28 +0700
message:
  Days before/after due date of template messages are not duplicate.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.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-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2012-09-18 08:31:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2012-10-09 07:58:28 +0000
@@ -1,8 +1,24 @@
+var duplicate = false;
 jQuery( document ).ready( function()
 {
 	validation( 'addProgramStageForm', function( form ){ 
-		form.submit();
+		if( duplicate==true) 
+			return false;
+		else
+			form.submit();
 	}, function(){
+		duplicate = false;
+		var COLOR_RED = '#ff8a8a';
+		jQuery(".daysAllowedSendMessage").each( function( i, a ){ 
+			jQuery(".daysAllowedSendMessage").each( function(j, b){ 
+				if( i!=j && a.value==b.value){
+					jQuery( a ).css( 'background-color', COLOR_RED );
+					jQuery( b ).css( 'background-color', COLOR_RED );
+					duplicate = true;
+				}
+			});
+		});
+		
 		var selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
 		selectedDataElementsValidator.empty();
 		var compulsories = jQuery( "#compulsories" );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js	2012-09-18 08:31:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js	2012-10-09 07:58:28 +0000
@@ -1,8 +1,24 @@
+var duplicate = false;
 jQuery( document ).ready( function()
 {
 	validation( 'updateProgramStageForm', function( form ){ 
-		form.submit() ;
+		if( duplicate==true) 
+			return false;
+		else
+			form.submit();
 	}, function(){
+		duplicate = false;
+		var COLOR_RED = '#ff8a8a';
+		jQuery(".daysAllowedSendMessage").each( function( i, a ){ 
+			jQuery(".daysAllowedSendMessage").each( function(j, b){ 
+				if( i!=j && a.value==b.value){
+					jQuery( a ).css( 'background-color', COLOR_RED );
+					jQuery( b ).css( 'background-color', COLOR_RED );
+					duplicate = true;
+				}
+			});
+		});
+		
 		var selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
 		selectedDataElementsValidator.empty();
 		var compulsories = jQuery( "#compulsories" );