← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4087: Add description for program validation in Patient module.

 

------------------------------------------------------------
revno: 4087
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-07-07 15:03:22 +0700
message:
  Add description for program validation in Patient module.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramValidationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgramValidation.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramValidationForm.vm


--
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-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2011-07-07 03:34:52 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2011-07-07 08:03:22 +0000
@@ -259,6 +259,12 @@
             int categoryOptionId = Integer.parseInt( ids[2] );
             DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( categoryOptionId );
 
+            if( programStage == null || dataElement == null || optionCombo == null )
+            {
+                return "Invalid condition";
+            
+            }
+            
             matcher.appendReplacement( decription, "[" + programStage.getName() + SEPARATOR_ID + dataElement.getName()
                  + optionCombo.getName() + "]" );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationAction.java	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationAction.java	2011-07-07 08:03:22 +0000
@@ -27,6 +27,7 @@
 
 package org.hisp.dhis.patient.action.validation;
 
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
 import org.hisp.dhis.program.ProgramValidation;
 import org.hisp.dhis.program.ProgramValidationService;
 
@@ -45,6 +46,8 @@
 
     private ProgramValidationService programValidationService;
 
+    private CaseAggregationConditionService aggregationConditionService;
+
     // -------------------------------------------------------------------------
     // Input && Output
     // -------------------------------------------------------------------------
@@ -53,6 +56,20 @@
 
     private ProgramValidation validation;
 
+    private String leftDescription;
+
+    public String getLeftDescription()
+    {
+        return leftDescription;
+    }
+
+    private String rightDescription;
+
+    public String getRightDescription()
+    {
+        return rightDescription;
+    }
+
     // -------------------------------------------------------------------------
     // Getter && Setter
     // -------------------------------------------------------------------------
@@ -62,6 +79,11 @@
         this.programValidationService = programValidationService;
     }
 
+    public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
+    {
+        this.aggregationConditionService = aggregationConditionService;
+    }
+
     public void setValidationId( Integer validationId )
     {
         this.validationId = validationId;
@@ -82,6 +104,9 @@
     {
         validation = programValidationService.getProgramValidation( validationId );
 
+        leftDescription = aggregationConditionService.getConditionDescription( validation.getLeftSide() );
+        rightDescription = aggregationConditionService.getConditionDescription( validation.getRightSide() );
+
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-07-07 05:00:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-07-07 08:03:22 +0000
@@ -1221,6 +1221,9 @@
 		<property name="programValidationService">
 			<ref bean="org.hisp.dhis.program.ProgramValidationService" />
 		</property>
+		<property name="aggregationConditionService">
+			<ref bean="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+		</property>
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-07-05 05:23:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-07-07 08:03:22 +0000
@@ -156,7 +156,6 @@
 add_new_program_stage = Add New Program Stage
 enrolled_in_program = Enrolled in Programs
 order = Order in Program
-min_days_from_start = Min no of days to wait from start of Program
 max_days_from_start = Max no of days to wait from start of Program
 program_details = Program Details
 update_program = Update Program

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramValidationForm.vm	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramValidationForm.vm	2011-07-07 08:03:22 +0000
@@ -1,3 +1,4 @@
+<script type="text/javascript" src="javascript/addProgramValidationForm.js"></script>
 <h3>$i18n.getString( "add_program_validation" )</h3>
 
 <form id='programValidationForm' name='programValidationForm' method='post' action='addProgramValidation.action'>
@@ -25,50 +26,61 @@
 	<tr>
 		<td width="20em">
 			<label>$i18n.getString('left_side')</label>
-			
-			<br>
+		</td>
+		<td>
+			<label id='rightLabel'>$i18n.getString('right_side')</label>
+		</td>
+	</tr>
+	<tr>
+		<td>
 			<select style="width:30.2em" id='leftStage' name='leftStage' onchange="getLeftPrgramStageDataElements();">
 				<option value=''>[$i18n.getString( "please_select" )]</option>
 				#foreach($stage in $program.programStages)
 				<option value='$stage.id'>$stage.name</option>
 				#end
 			</select>
-			<br>
-			<select style="width:30.2em" id='leftSideDE' name='leftSideDE' size='7' ondblclick="insertDataElement(this, 'leftSide');" >
-			</select>
-			<br>
-			<textarea rows='5' style="width:30em" id='leftSide' name='leftSide' class="{validate:{required:true,minlength:4}}"></textarea>
-			
 		</td>
-		<td width="20em">
-			<div id='rightSideDiv'>
-			
-				<label>$i18n.getString('right_side')</label>
-				
-				<br>
-				<select style="width:30.2em" id='rightStage' name='rightStage' onchange="getRightPrgramStageDataElements();">
-					<option value=''>[$i18n.getString( "please_select" )]</option>
-					#foreach($stage in $program.programStages)
-					<option value='$stage.id'>$stage.name</option>
+		<td>
+			<select style="width:30.2em" id='rightStage' name='rightStage' onchange="getRightPrgramStageDataElements();">
+				<option value=''>[$i18n.getString( "please_select" )]</option>
+				#foreach($stage in $program.programStages)
+				<option value='$stage.id'>$stage.name</option>
 					#end
-				</select>
-				<br>
-				<select style="width:30.2em" id='rightSideDE' name='rightSideDE' size='7' ondblclick="insertDataElement(this, 'rightSide');">
-				</select>
-				<br>
-				<textarea rows='5' style="width:30em" id='rightSide' name='rightSide' class="{validate:{required:true,minlength:4}}"></textarea>
-		
-			</div>
-			
+			</select>
 		</td>
 	</tr>
 	<tr>
 		<td>
-			</td>
-		<td>			
-			</td>
-	</tr>
-	
+			<select style="width:30.2em" id='leftSideDE' name='leftSideDE' size='7' ondblclick="insertDataElement(this, 'leftSide', 'leftStageDescription');" >
+			</select>
+		</td>
+		<td>
+			<select style="width:30.2em" id='rightSideDE' name='rightSideDE' size='7' ondblclick="insertDataElement(this, 'rightSide', 'rightStageDescription' );">
+			</select>
+		</td>
+	</tr>
+	<tr>	
+		<td>
+			<textarea rows='5' style="width:30em" id='leftSide' name='leftSide' class="{validate:{required:true,minlength:4}}" onkeyup="getValidationDescription('leftStageDescription', 'leftSide')"></textarea>
+		</td>
+		<td>
+			<textarea rows='5' style="width:30em" id='rightSide' name='rightSide' class="{validate:{required:true,minlength:4}}" onkeyup="getValidationDescription('rightStageDescription', 'rightSide')"></textarea>
+		</td>
+	</tr>
+	<tr>	
+		<td>
+			<fieldset style="border: 1px solid #3f5d8e; ">
+				<legend>$i18n.getString( "description" )</legend>
+				<div id='leftStageDescription' style="width:29em"></div>
+			</fieldset>
+		</td>
+		<td>
+			<fieldset style="border: 1px solid #3f5d8e; " id='rightStageDescriptionFieldset'>
+				<legend>$i18n.getString( "description" )</legend>
+				<div id='rightStageDescription' style="width:29em;"></div>
+			</fieldset>
+		</td>
+	</tr>
 	<tr>
 		<td>
 			<input type='submit' value="$i18n.getString( "add" )" style="width:10em">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2011-07-07 08:03:22 +0000
@@ -8,7 +8,11 @@
 	
 	if( isSingle || getFieldValue('rightSide') == '1==1')
 	{
-		hideById('rightSideDiv');
+		hideById('rightLabel');
+		hideById('rightStage');
+		hideById('rightSideDE');
+		hideById('rightSide');
+		hideById('rightStageDescriptionFieldset');
 		setFieldValue('rightSide','1==1');
 	}
 });
@@ -49,11 +53,24 @@
 // Insert items data-element
 //-----------------------------------------------------------------
 
-function insertDataElement( element, target )
+function insertDataElement( element, target, decriptionDiv )
 {
 	byId(target).value += " " + element.options[element.selectedIndex].value + " ";
+	
+	getValidationDescription( decriptionDiv, target );
 }
 
+function getValidationDescription( decriptionDiv, sideDiv )
+{
+	$.post("getCaseAggregationDescription.action",
+		{
+			condition: getFieldValue( sideDiv )
+		},
+		function (data)
+		{
+			byId( decriptionDiv ).innerHTML = data;
+		},'html');
+}
 
 //------------------------------------------------------------------------------
 // Get DataElements of Program-Stage into left-side

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm	2011-07-07 08:03:22 +0000
@@ -8,7 +8,7 @@
 			  <col width="60"> 
 			  <tr>
 				<td></td>
-				<td colspan="2">
+				<td>
 					<input type="button" value="$i18n.getString( "add_new_single_validation" )" onclick="window.location.href='showAddProgramValidationForm.action?id=$programId&single=true'" style="width:200px">
 					<input type="button" value="$i18n.getString( "add_new_multi_validation" )" onclick="window.location.href='showAddProgramValidationForm.action?id=$programId&single=false'" style="width:200px">
 					<input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='program.action'" style="width:200px">
@@ -24,7 +24,7 @@
 				  <tr id="tr${validation.id}">
 					
 					<td>$validation.description</td>
-					<td colspan='2'>
+					<td>
 					  <a href="showUpdateProgramValidationForm.action?validationId=$validation.id&id=$programId" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
 					  <a href="javascript:removeProgramValidation( '$validation.id', '$encoder.jsEncode( $validation.description )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
 					  <a href="javascript:showProgramValidationDetails( $validation.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
@@ -45,8 +45,8 @@
 				</div>				
 				<p><label>$i18n.getString( "id" ):</label><br><span id="idField"></span></p>
 				<p><label>$i18n.getString( "name" ):</label><br><span id="descriptionField"></span></p>
-				<p><label>$i18n.getString( "description" ):</label><br><span id="leftSideField"></span></p>
-				<p><label>$i18n.getString( "value_type" ):</label><br><span id="rightSideField"></span></p>
+				<p><label>$i18n.getString( "left_side" ):</label><br><span id="leftSideField"></span></p>
+				<p><label>$i18n.getString( "right_side" ):</label><br><span id="rightSideField"></span></p>
 			</div>
 
 		</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgramValidation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgramValidation.vm	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgramValidation.vm	2011-07-07 08:03:22 +0000
@@ -4,5 +4,5 @@
 	<description>$encoder.htmlEncode($validation.description)</description>
 	<leftSide>$encoder.htmlEncode($validation.leftSide)</leftSide>
 	<rightSide>$encoder.htmlEncode($validation.rightSide)</rightSide>
-	<program>$encoder.htmlEncode($validation.rightSide.name)</program>
+	<program>$encoder.htmlEncode($validation.program.name)</program>
 </validation>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramValidationForm.vm	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramValidationForm.vm	2011-07-07 08:03:22 +0000
@@ -24,43 +24,62 @@
 	</tr>
 	<tr>
 		<td width="20em">
-			
 			<label>$i18n.getString('left_side')</label>
-			<br>
+		</td>
+		<td>
+			<label id='rightLabel'>$i18n.getString('right_side')</label>	
+		</td>
+	</tr>
+	<tr>
+		<td>
 			<select style="width:30.2em" id='leftStage' name='leftStage' onchange="getLeftPrgramStageDataElements();">
 				<option value=''>[$i18n.getString( "please_select" )]</option>
 				#foreach($stage in $validation.program.programStages)
 				<option value='$stage.id'>$stage.name</option>
 				#end
 			</select>
-			<br>
+		</td>
+		<td>
+			<select style="width:30.2em" id='rightStage' name='rightStage' onchange="getRightPrgramStageDataElements();">
+				<option value=''>[$i18n.getString( "please_select" )]</option>
+				#foreach($stage in $validation.program.programStages)
+				<option value='$stage.id'>$stage.name</option>
+				#end
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td>
 			<select style="width:30.2em" id='leftSideDE' name='leftSideDE' size='7' ondblclick="insertDataElement(this, 'leftSide');">
 			</select>
-			<br>
-			<textarea rows='5' style="width:30em" id='leftSide' name='leftSide'>$validation.leftSide</textarea>
-	
-		</td>
-		<td width="20em">
-			<div id='rightSideDiv'>
-				
-				<label>$i18n.getString('right_side')</label>
-				<br>
-				<select style="width:30.2em" id='rightStage' name='rightStage' onchange="getRightPrgramStageDataElements();">
-					<option value=''>[$i18n.getString( "please_select" )]</option>
-					#foreach($stage in $validation.program.programStages)
-					<option value='$stage.id'>$stage.name</option>
-					#end
-				</select>
-				<br>
-				<select style="width:30.2em" id='rightSideDE' name='rightSideDE' size='7' ondblclick="insertDataElement(this, 'rightSide');">
-				</select>
-				<br>
-				<textarea rows='5' style="width:30em" id='rightSide' name='rightSide'>$validation.rightSide</textarea>
-			
-			</div>
-		</td>
-	</tr>
-	
+		</td>
+		<td>
+			<select style="width:30.2em" id='rightSideDE' name='rightSideDE' size='7' ondblclick="insertDataElement(this, 'rightSide');">
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<textarea rows='5' style="width:30em" id='leftSide' name='leftSide' onkeyup="getValidationDescription('leftStageDescription', 'leftSide')">$validation.leftSide</textarea>
+		</td>
+		<td>
+			<textarea rows='5' style="width:30em" id='rightSide' name='rightSide' onkeyup="getValidationDescription('rightStageDescription', 'rightSide')">$validation.rightSide</textarea>
+		</td>
+	</tr>
+	<tr>	
+		<td>
+			<fieldset style="border: 1px solid #3f5d8e; ">
+				<legend>$i18n.getString( "description" )</legend>
+				<div id='leftStageDescription' style="width:29em">$!leftDescription</div>
+			</fieldset>
+		</td>
+		<td>
+			<fieldset style="border: 1px solid #3f5d8e; " id='rightStageDescriptionFieldset'>
+				<legend>$i18n.getString( "description" )</legend>
+				<div id='rightStageDescription' style="width:29em;">$!rightDescription</div>
+			</fieldset>
+		</td>
+	</tr>
 	<tr>
 		<td>
 			<input type='submit' value="$i18n.getString( "update" )" style="width:10em">