← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14058: Add validation for Add/Update program field; add the trackedEntityId in Add/Update tracked-entity...

 

------------------------------------------------------------
revno: 14058
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-02-17 23:09:10 +0700
message:
  Add validation for Add/Update program field; add the trackedEntityId in Add/Update tracked-entity-instance with a program selected.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultTrackedEntityForm.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.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-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java	2014-02-17 15:00:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java	2014-02-17 16:09:10 +0000
@@ -50,7 +50,7 @@
     public TrackedEntity()
     {
     }
-
+    
     public TrackedEntity( String name, String description )
     {
         this.name = name;

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultTrackedEntityForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultTrackedEntityForm.vm	2014-02-17 15:00:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultTrackedEntityForm.vm	1970-01-01 00:00:00 +0000
@@ -1,83 +0,0 @@
-<tr>
-	<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
-</tr>
-
-#if($program)
-	<input type='hidden' id='trackedEntityId' name='trackedEntityId' value='$program.trackedEntity.id'>
-#else
-	<tr>
-		<td class='text-column'><label>$i18n.getString('tracked_entity')<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-		<td class="input-column">
-			<select type='hidden' id='trackedEntityId' name='trackedEntityId' value='$program.trackedEntity.id'>
-				<option value=''>[$i18n.getString('please_select')]</option>
-				#foreach($trackedEntity in $trackedEntities)
-				<option value='$trackedEntity.id' #if($entityInstance.trackedEntity>$trackedEntity.displayName</option>
-				#end
-			</select>
-		</td>	
-	</tr>
-#end
-
-<!-- ATTRIBUTES IN GROUPS -->
-
-#foreach($attribute in $$trackedEntityForm.dynamicAttributes )
-	#if( $attribute )
-		#set($value = "")
-		#set($value = $attributeValueMap.get($attribute.id))
-		<tr>
-			<td class='text-column'><label>$encoder.htmlEncode($attribute.displayName) #if($attribute.mandatory) <em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-			<td class="input-column">
-				#if( $attribute.valueType == "bool" )
-					<select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit"> 
-						<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-						<option value="true" #if($value=='true') selected #end>$i18n.getString( "yes" )</option>
-						<option value="false" #if($value=='false') selected #end>$i18n.getString( "no" )</option>
-					</select>                
-				#elseif( $attribute.valueType == "trueOnly" )
-					<input type='checkbox' value="true" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" #if($value=='true') checked #end> 
-				#elseif( $attribute.valueType == "date" )
-					<input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class=' #validate( "default"  $attribute.mandatory )'/>
-					<script type="text/javascript">
-						datePickerValid( 'attr$attribute.id', false, false );
-					</script>                    
-				#elseif( $attribute.valueType == "combo" )  
-					<select  id="attr$attribute.id"  name="attr$attribute.id" inherit="$!attribute.inherit" class='#validate( "default"  $attribute.mandatory )'>
-						<option value="">[$i18n.getString( "please_select" )]</option>
-						#foreach ($option in $attribute.attributeOptions )
-							<option value="$option.id" #if("$value"=="$option.name") selected #end>$option.name</option>
-						#end
-					</select>
-				#else
-					<input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$attribute.mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
-				#end
-			</td>		
-		</tr>
-	#end
-#end
-	
-<!-- PROGRAM ENROLLMENT -->
-
-#if($!program)
-	<tr><td>&nbsp;</td></tr>
-	<tr><th colspan="2" class="heading-column">$i18n.getString( "program_enrollment" )</th></tr>
-	<tr>
-		<tr>
-		<td class='text-column'><label for="enrollmentDate">$encoder.htmlEncode($program.dateOfEnrollmentDescription) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td colspan='2' class='input-column'><input type="text" id="enrollmentDate" name="enrollmentDate" class="{validate:{required:true}}"></td>
-	</tr>
-	#if($!program.displayIncidentDate=='true')
-		<tr>
-			<td class='text-column'><label for="dateOfIncident">$encoder.htmlEncode($program.dateOfIncidentDescription) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-			<td colspan='2' class='input-column'><input type="text" id="dateOfIncident" name="dateOfIncident"  class="{validate:{required:true}}"></td>
-		</tr>
-		<script>
-			#if($program.selectEnrollmentDatesInFuture=='true' || $program.selectIncidentDatesInFuture=='true'  )
-				datePickerInRange( 'dateOfIncident' , 'enrollmentDate', false, true );
-			#else
-				datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate', false, true );
-			#end
-		</script>
-	#else
-		<script>datePickerValid( 'enrollmentDate', true );</script>
-	#end
-#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js	2014-02-11 10:16:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js	2014-02-17 16:09:10 +0000
@@ -151,6 +151,9 @@
 	this.add = function( programId, related, params, isContinue)
 	{
 		if( !this.validate(programId) ) return;
+		if(programId!=''){
+			params += '&programId=' + programId;
+		}
 		
 		$.ajax({
 		  type: "POST",

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm	2014-02-17 15:00:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm	2014-02-17 16:09:10 +0000
@@ -1,8 +1,25 @@
 
+#if($program)
+	<input type='hidden' id='trackedEntityId' name='trackedEntityId' value='$program.trackedEntity.id'>
+#else
+	<tr>
+		<th colspan="2" class="heading-column">$i18n.getString( "demographics" ) </th>
+	</tr>
+	<tr>
+		<td class='text-column'><label>$i18n.getString('tracked_entity')<em title="$i18n.getString( 'required' )" class="required">*</em> </label></td>
+		<td class="input-column">
+			<select type='hidden' id='trackedEntityId' name='trackedEntityId' value='$program.trackedEntity.id'>
+				<option value=''>[$i18n.getString('please_select')]</option>
+				#foreach($trackedEntity in $trackedEntities)
+				<option value='$trackedEntity.id' #if($entityInstance.trackedEntity.id==$trackedEntity.id) selected #end >$trackedEntity.displayName</option>
+				#end
+			</select>
+		</td>	
+	</tr>
+#end
+
 #if($!customRegistrationForm)
 	$customRegistrationForm
-#elseif($!trackedEntityForm)
-	#parse( "/dhis-web-caseentry/defaultTrackedEntityInstanceForm.vm" )
 #else
 	## Macro for generating the jQuery validation rules 
 	#macro( validate $type $require )
@@ -12,25 +29,7 @@
 		{validate:{required:true}}
 	  #end
 	#end
-	<tr>
-		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
-	</tr>
-	#if($program)
-		<input type='hidden' id='trackedEntityId' name='trackedEntityId' value='$program.trackedEntity.id'>
-	#else
-		<tr>
-			<td class='text-column'><label>$i18n.getString('tracked_entity')<em title="$i18n.getString( 'required' )" class="required">*</em> </label></td>
-			<td class="input-column">
-				<select type='hidden' id='trackedEntityId' name='trackedEntityId' value='$program.trackedEntity.id'>
-					<option value=''>[$i18n.getString('please_select')]</option>
-					#foreach($trackedEntity in $trackedEntities)
-					<option value='$trackedEntity.id' #if($entityInstance.trackedEntity.id==$trackedEntity.id) selected #end >$trackedEntity.displayName</option>
-					#end
-				</select>
-			</td>	
-		</tr>
-	#end
-
+	
 #foreach ($attributeGroup in $attributeGroups )
 	 #set($attributesByGroup = $!attributesMap.get($attributeGroup.displayName))
 	 #if( $attributesByGroup && $attributesByGroup.size() > 0 )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm	2014-02-17 15:00:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm	2014-02-17 16:09:10 +0000
@@ -90,9 +90,9 @@
 		</tr>
 		
 		<tr>
-			<td><label for="dataEntryMethod">$i18n.getString( "tracked_entity" ) </label></td>
+			<td><label for="dataEntryMethod">$i18n.getString( "tracked_entity" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 			<td>
-				<select id='trackedEntityId' name='trackedEntityId' style="width: 335px;">
+				<select id='trackedEntityId' name='trackedEntityId' style="width: 335px;" class="{validate:{required:true}}">
 					<option value=''>[$i18n.getString('please_select')]</option>
 					#foreach($trackedEntity in $trackedEntities)
 					<option value='$trackedEntity.id'>$trackedEntity.displayName</option>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm	2014-02-17 15:00:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm	2014-02-17 16:09:10 +0000
@@ -2,13 +2,8 @@
 
 <ul class="introList">
     #introListImgItem( "attribute.action" "attribute" "patient" )
-<<<<<<< TREE
-    #introListImgItem( "attributeVisitSchedule.action" "tracked_entity_attribute_visit_schedule" "patient" )
-    #introListImgItem( "attributeGroup.action" "tracked_entity_attribute_group" "patient" )
-=======
     #introListImgItem( "attributeVisitSchedule.action" "attribute_visit_schedule" "patient" )
     #introListImgItem( "attributeGroup.action" "attribute_group" "patient" )
->>>>>>> MERGE-SOURCE
     #introListImgItem( "relationshipType.action" "relationship_type" "patient" )
     #introListImgItem( "trackedEntity.action" "tracked_entity" "patient" )
     #introListImgItem( "trackedEntityForm.action" "tracked_entity_form" "pivottable" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm	2014-02-17 15:00:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm	2014-02-17 16:09:10 +0000
@@ -63,7 +63,7 @@
 		</tr>
 
 		<tr>
-			<td><label for="type">$i18n.getString( "type" ) </label></td>
+			<td><label for="type">$i18n.getString( "type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 			<td>
 				<select style="width: 336px;" id="type" name="type" onchange='programOnChange();' class="{validate:{required:true}}">
 					<option value='1' #if( $program.type=='1' ) selected #end>$i18n.getString('multiple_events_with_registration')</option>
@@ -86,9 +86,9 @@
 		</tr>
 		
 		<tr>
-			<td><label for="dataEntryMethod">$i18n.getString( "tracked_entity" ) </label></td>
+			<td><label for="dataEntryMethod">$i18n.getString( "tracked_entity" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 			<td>
-				<select id='trackedEntityId' name='trackedEntityId' style="width: 335px;">
+				<select id='trackedEntityId' name='trackedEntityId' style="width: 335px;" class="{validate:{required:true}}">
 					<option value=''>[$i18n.getString('please_select')]</option>
 					#foreach($trackedEntity in $trackedEntities)
 					<option value='$trackedEntity.id' #if($trackedEntity.id==$program.trackedEntity.id) selected #end >$trackedEntity.displayName</option>