← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2329: Add Max-length propety for Patient Attribute object.

 

------------------------------------------------------------
revno: 2329
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-12-10 12:57:24 +0700
message:
  Add Max-length propety for Patient Attribute object.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.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/patient/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2010-11-22 10:23:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2010-12-10 05:57:24 +0000
@@ -58,6 +58,8 @@
     private boolean mandatory;
 
     private boolean inheritable;
+    
+    private Integer noChars;
 
     private Boolean groupBy;
 
@@ -135,6 +137,16 @@
         attributeOptions.add( option );
     }
 
+    public Integer getNoChars()
+    {
+        return noChars;
+    }
+
+    public void setNoChars( Integer noChars )
+    {
+        this.noChars = noChars;
+    }
+
     public Boolean isGroupBy()
     {
         return groupBy;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2010-11-22 10:23:44 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2010-12-10 05:57:24 +0000
@@ -19,6 +19,8 @@
 	
 	<property name="inheritable" column="inheritable" />
 	
+	<property name="noChars"/>
+	
 	<property name="groupBy" column="groupby" />
 	
 	<many-to-one name="patientMobileSetting" column="patientMobileSettingId" foreign-key="fk_patient_mobile_setting"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java	2010-11-15 08:35:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java	2010-12-10 05:57:24 +0000
@@ -107,6 +107,13 @@
         this.attrOptions = attrOptions;
     }
 
+    private Integer noChars;
+
+    public void setNoChars( Integer noChars )
+    {
+        this.noChars = noChars;
+    }
+
     private boolean groupBy;
 
     public void setGroupBy( boolean groupBy )
@@ -128,8 +135,10 @@
         patientAttribute.setValueType( valueType );
         patientAttribute.setMandatory( mandatory );
         patientAttribute.setInheritable( inheritable );
+        patientAttribute.setNoChars (noChars);
+        
         patientAttribute.setGroupBy( groupBy );
-        if ( groupBy == true )
+        if ( groupBy )
         {
             PatientAttribute patientAtt = patientAttributeService.getPatientAttributeByGroupBy( true );
             if ( patientAtt != null )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java	2010-11-15 08:35:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java	2010-12-10 05:57:24 +0000
@@ -121,6 +121,13 @@
         this.attrOptions = attrOptions;
     }
 
+    private Integer noChars;
+
+    public void setNoChars( Integer noChars )
+    {
+        this.noChars = noChars;
+    }
+    
     private boolean groupBy;
 
     public void setGroupBy( boolean groupBy )
@@ -142,8 +149,9 @@
         patientAttribute.setValueType( valueType );
         patientAttribute.setMandatory( mandatory );
         patientAttribute.setInheritable( inheritable );
-
-        if ( groupBy == true )
+        patientAttribute.setNoChars( noChars );
+        
+        if ( groupBy )
         {
             PatientAttribute patientAtt = patientAttributeService.getPatientAttributeByGroupBy( true );
             if ( patientAtt != null )
@@ -154,6 +162,8 @@
             patientAttribute.setMandatory( true );
         }
         patientAttribute.setGroupBy( groupBy );
+        
+        
         HttpServletRequest request = ServletActionContext.getRequest();
 
         Collection<PatientAttributeOption> attributeOptions = patientAttributeOptionService.get( patientAttribute );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2010-12-10 05:57:24 +0000
@@ -70,7 +70,13 @@
 		</td>		
 		<td></td>				
 	</tr>
-    
+    <tr>
+		<td width="30em"><label for="noChar">$i18n.getString( "no_of_char" )</label></td>
+		<td>
+			<input type="text" name="noChars" id="noChars" class="{validate:{required:false, number:true}}" style="min-width:30em" >
+		</td>		
+		<td></td>				
+	</tr>
     <tr>
         <td width="20em"><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
         <td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-12-10 04:02:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-12-10 05:57:24 +0000
@@ -219,7 +219,7 @@
 							#end
 						</select>
 					#else 
-						<input type="text"  id="attr$attribute.id"  name="attr$attribute.id"  class=' #validate( $attribute.valueType  $attribute.mandatory )'   >
+						<input type="text"  id="attr$attribute.id"  name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
 					#end
 				</td>		
 			</tr>
@@ -255,7 +255,7 @@
 							#end
 						</select>
 					#else 
-						<input type="text"  id="attr$attribute.id" name="attr$attribute.id"   class=' #validate( $attribute.valueType  $attribute.mandatory )'    >
+						<input type="text"  id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
 					#end
 				</td>		
 			</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2010-12-10 05:57:24 +0000
@@ -72,8 +72,14 @@
 		</td>		
 		<td></td>				
 	</tr>
-	
-      <tr>
+	<tr>
+		<td width="30em"><label for="noChar">$i18n.getString( "no_of_char" )</label></td>
+		<td>
+			<input type="text" name="noChars" id="noChars" class="{validate:{required:false, number:true}}" style="min-width:30em" value="$!patientAttribute.noChars">
+		</td>		
+		<td></td>				
+	</tr>
+    <tr>
         <td>$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
         <td>
             <select id="valueType" name="valueType" style="min-width:30.5em" onchange="ATTRIBUTE_OPTION.selectValueType(this);">
@@ -84,7 +90,7 @@
                 <option value="COMBO" #if( $patientAttribute.valueType == 'COMBO' ) selected="selected" #end>$i18n.getString( "attribute_combo_type" )</option>
             </select>
         </td>
-      </tr>
+    </tr>
       <tr>
     	<td width="20em"><label for="groupBy">$i18n.getString( "groupBy" )</td>
     	<td><input type="checkbox" name="groupBy" value="true" #if( $patientAttribute.groupBy == 'true' ) checked #end></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-11-09 09:07:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-12-10 05:57:24 +0000
@@ -9,28 +9,7 @@
 #end
 
 <script>
-	/* jQuery(document).ready(	function(){
-		validation( 'updatePatientForm', validateUpdatePatient );		
-		datePickerValid( 'birthDate' );
-		jQuery("#birthDate").rules("add",{required:true,dateISO:true,datelessthanequaltoday:true});		
-		jQuery("#btnRepresentativeInfo").cluetip({local:"#representativeInfo"});	
-	}); */
-
-	/* jQuery(document).ready(	function(){
-
-		jQuery("#birthDate").rules("add",{required:true,dateISO:true,datelessthanequaltoday:true});		
-		jQuery("#btnRepresentativeInfo").cluetip({local:"#representativeInfo"});
-		
-		jQuery("#updatePatientForm").validate({
-				 meta:"validate"
-				,errorElement:"span"
-				,submitHandler: function(form)
-					{
-						validateUpdatePatient();
-					}
-			});
-	});		*/
-
+	
 	jQuery(document).ready(	function(){
 
 		datePickerValid( 'birthDate' );	
@@ -191,11 +170,12 @@
 	#set( $identifier = "" )
 	#set( $identifier = $identiferMap.get( $identifierType.id ) )
 	<tr>
-			<td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-			<td><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" style="width:30em" /></td>	
+		<td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+		<td><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" style="width:30em" /></td>	
 	</tr>
 	#end
 	<tr><td>&nbsp;</td></tr>
+	<tr><td>&nbsp;</td></tr>
 	
 	<!-- ATTRIBUTES IN GROUPS -->
 	
@@ -228,7 +208,7 @@
 							#end
 							</select>
 						#else 
-							<input type="text"  id="attr$attribute.id"  name="attr$attribute.id"   value="$!attributeValue" class=' #validate( $attribute.valueType  $attribute.mandatory )'  >
+							<input type="text"  id="attr$attribute.id"  name="attr$attribute.id"   value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
 						#end
 					</td>		
 				</tr>
@@ -265,8 +245,8 @@
 							<option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
 						#end
 						</select>
-					#else 
-						<input type="text"  id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" style="width:30em" class=' #validate( $attribute.valueType  $attribute.mandatory )'>
+					#else
+						<input type="text"  id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" style="width:30em" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
 					#end
 				</td>		
 			</tr>