← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9703: Small change in custom person registration form.

 

------------------------------------------------------------
revno: 9703
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-04 10:48:00 +0700
message:
  Small change in custom person registration form.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientRegistrationForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java	2013-02-01 08:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java	2013-02-04 03:48:00 +0000
@@ -101,6 +101,11 @@
         this.programId = programId;
     }
 
+    public Integer getProgramId()
+    {
+        return programId;
+    }
+
     private Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
 
     private Collection<PatientIdentifierType> identifierTypes = new HashSet<PatientIdentifierType>();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientRegistrationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientRegistrationForm.js	2013-02-01 08:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientRegistrationForm.js	2013-02-04 03:48:00 +0000
@@ -7,7 +7,16 @@
 	window.location.href='viewPatientRegistrationForm.action?programId=' + programId + '&id=' + registrationFormId;
 }
 
-function removeRegistrationForm( registrationFormId, name )
+function removeRegistrationForm( registrationFormId, name, programId, programName )
 {
 	removeItem( registrationFormId, name, i18n_confirm_delete, 'delRegistrationFormAction.action' );	
+	
+	if(programId=='')
+	{
+		jQuery('#programId').prepend('<option value="" selected>' + i18n_please_select + '</option>');
+	}
+	else
+	{
+		jQuery('#programId').append('<option value="' + programId + '" selected>' + programName + '</option>');
+	}
 }
\ 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/patientRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm	2013-02-02 10:34:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm	2013-02-04 03:48:00 +0000
@@ -1,35 +1,30 @@
 <h3>$i18n.getString( "patient_registration_form_management" ) #openHelp( "program" )</h3>
 
 <table class="mainPageTable">
-	
+	#set($display = 'block')
+	#foreach( $registrationForm in $registrationForms )
+		#if( $!registrationForm.program )
+		#else
+			#set($display = 'none')
+		#end
+	#end
 	<tr>
-		#if( $programs.size() > 0 )
 		<td>
 			<label>$i18n.getString('program')</label>
 			<select name="programId" id="programId" style="width:20em" >
+				#if( $display == 'block' )
 				<option value=''>[$i18n.getString('please_select')]</option>
+				#end
 				#foreach($program in $programs)
 					<option value='$program.id'>$encoder.htmlEncode($program.displayName)</option>
 				#end
 			</select>
 		</td>
-		#end
-		
-		#set($display = 'block')
-		#if( $programs.size() == 0 )
-			#foreach( $registrationForm in $registrationForms )
-				#if( $registrationForm.progam )
-				#else
-					#set($hidden = 'none')
-				#end
-			#end
-		#end
+		#if($programs.size() > 0 || $display == 'block' )
 		<td align="right">
-			<input type="button" value="$i18n.getString( 'add_new' )" onclick="addNewForm();" style="width:70px;display:$display">
+			<input type="button" value="$i18n.getString( 'add_new' )" onclick="addNewForm();" style="width:70px;">
 		</td>
-	#if( $programs.size() == 0 )
-		<input type='hidden' name="programId" id="programId" value="" />
-	#end
+		#end
   </tr>
   <tr>
     <td style="vertical-align:top" colspan='2'>
@@ -58,7 +53,7 @@
 					</td>   					
 					<td style="text-align:center">
 					  <a href="javascript:updateNewForm($registrationForm.id, '$!registrationForm.program.id')" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
-					  <a href="javascript:removeRegistrationForm( '$registrationForm.id', '$encoder.jsEncode( $registrationForm.dataEntryForm.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+					  <a href="javascript:removeRegistrationForm( '$registrationForm.id', '$encoder.jsEncode( $registrationForm.dataEntryForm.name )', '$!registrationForm.program.id', '$encoder.jsEncode( $!registrationForm.program.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
 					</td>
 					
 				  </tr>
@@ -71,4 +66,5 @@
 
 <script type="text/javascript">
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient_registration_form" ) , "'" )';
+	var i18n_please_select = '[' + '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'" )' + ']';
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-02-02 10:34:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-02-04 03:48:00 +0000
@@ -1,4 +1,4 @@
-hh<script type="text/javascript">
+<script type="text/javascript">
   
 	jQuery(document).ready(	function()
 	{