dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23296
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11324: Add function to add fixed attributes, dynamic attribtues and identifier types into default regist...
------------------------------------------------------------
revno: 11324
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-07-03 22:40:29 +0700
message:
Add function to add fixed attributes, dynamic attribtues and identifier types into default registration form for a program.
added:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDefaultPatientRegistrationFormAcion.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDefaultPatientRegistrationFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/defaultPatientRegistationForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationForm.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientRegistrationForm.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
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/resources/struts.xml
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-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationForm.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationForm.java 2013-07-02 03:54:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationForm.java 2013-07-03 15:40:29 +0000
@@ -27,6 +27,9 @@
package org.hisp.dhis.patient;
+import java.util.List;
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.program.Program;
@@ -36,24 +39,40 @@
* @version PatientRegistrationForm.java 9:33:02 AM Jan 31, 2013 $
*/
public class PatientRegistrationForm
+ extends BaseIdentifiableObject
{
+ private static final long serialVersionUID = -6000530171659755186L;
+
public static String FIXED_ATTRIBUTE_FULLNAME = "fullName";
+
public static String FIXED_ATTRIBUTE_GENDER = "gender";
+
public static String FIXED_ATTRIBUTE_BIRTHDATE = "birthDate";
+
public static String FIXED_ATTRIBUTE_AGE = "age";
+
public static String FIXED_ATTRIBUTE_PHONE_NUMBER = "phoneNumber";
+
public static String FIXED_ATTRIBUTE_DEATH_DATE = "deathDate";
+
public static String FIXED_ATTRIBUTE_REGISTRATION_DATE = "registrationDate";
+
public static String FIXED_ATTRIBUTE_IS_DEAD = "isDead";
+
public static String FIXED_ATTRIBUTE_DOB_TYPE = "dobType";
+
public static String FIXED_ATTRIBUTE_HEALTH_WORKER = "healthWorker";
-
- private Integer id;
private Program program;
private DataEntryForm dataEntryForm;
+ private List<String> fixedAttributes;
+
+ private List<PatientAttribute> dynamicAttributes;
+
+ private List<PatientIdentifierType> identifierTypes;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -72,16 +91,6 @@
// Getters && Setters
// -------------------------------------------------------------------------
- public Integer getId()
- {
- return id;
- }
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
public Program getProgram()
{
return program;
@@ -102,4 +111,34 @@
this.dataEntryForm = dataEntryForm;
}
+ public List<String> getFixedAttributes()
+ {
+ return fixedAttributes;
+ }
+
+ public void setFixedAttributes( List<String> fixedAttributes )
+ {
+ this.fixedAttributes = fixedAttributes;
+ }
+
+ public List<PatientAttribute> getDynamicAttributes()
+ {
+ return dynamicAttributes;
+ }
+
+ public void setDynamicAttributes( List<PatientAttribute> dynamicAttributes )
+ {
+ this.dynamicAttributes = dynamicAttributes;
+ }
+
+ public List<PatientIdentifierType> getIdentifierTypes()
+ {
+ return identifierTypes;
+ }
+
+ public void setIdentifierTypes( List<PatientIdentifierType> identifierTypes )
+ {
+ this.identifierTypes = identifierTypes;
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientRegistrationForm.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientRegistrationForm.hbm.xml 2013-02-01 08:40:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientRegistrationForm.hbm.xml 2013-07-03 15:40:29 +0000
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
<hibernate-mapping>
<class name="org.hisp.dhis.patient.PatientRegistrationForm" table="patientregistrationform">
@@ -9,12 +11,35 @@
<id name="id" column="patientregistrationformid">
<generator class="native" />
</id>
-
+
+ <property name="name" column="name" length="230" />
+
+ &identifiableProperties;
+
<many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid"
foreign-key="fk_patientregistrationform_programid" />
<many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm"
foreign-key="fk_patientregistrationform_dataentryformid" cascade="all" />
+ <list name="fixedAttributes" table="patientregistrationform_fixedAttributes">
+ <cache usage="read-write" />
+ <key column="patientregistrationformid" foreign-key="fk_patientregistrationform_fixedAttributes_patientregistrationformid" />
+ <list-index column="sort_order" />
+ <element type="text" column="fixedattribute" />
+ </list>
+
+ <list name="dynamicAttributes" table="patientregistrationform_attributes">
+ <key column="patientregistrationformid" />
+ <list-index column="sort_order" base="1" />
+ <one-to-many class="org.hisp.dhis.patient.PatientAttribute" />
+ </list>
+
+ <list name="identifierTypes" table="patientregistrationform_identifierTypes">
+ <key column="patientattributegroupid" />
+ <list-index column="sort_order" base="1" />
+ <one-to-many class="org.hisp.dhis.patient.PatientIdentifierType" />
+ </list>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2013-07-02 15:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2013-07-03 15:40:29 +0000
@@ -203,6 +203,13 @@
return orgunitCountIdentifier;
}
+ private PatientRegistrationForm patientRegistrationForm;
+
+ public PatientRegistrationForm getPatientRegistrationForm()
+ {
+ return patientRegistrationForm;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -211,13 +218,13 @@
{
organisationUnit = selectionManager.getSelectedOrganisationUnit();
healthWorkers = organisationUnit.getUsers();
-
+
if ( programId == null )
{
- PatientRegistrationForm patientRegistrationForm = patientRegistrationFormService
+ patientRegistrationForm = patientRegistrationFormService
.getCommonPatientRegistrationForm();
- if ( patientRegistrationForm != null )
+ if ( patientRegistrationForm != null && patientRegistrationForm.getDataEntryForm() != null )
{
customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd(
patientRegistrationForm.getDataEntryForm().getHtmlCode(), healthWorkers, null, null, i18n, format );
@@ -226,10 +233,10 @@
else
{
program = programService.getProgram( programId );
- PatientRegistrationForm patientRegistrationForm = patientRegistrationFormService
+ patientRegistrationForm = patientRegistrationFormService
.getPatientRegistrationForm( program );
- if ( patientRegistrationForm != null )
+ if ( patientRegistrationForm != null && patientRegistrationForm.getDataEntryForm() != null )
{
customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd(
patientRegistrationForm.getDataEntryForm().getHtmlCode(), healthWorkers, null, null, i18n, format );
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm 2013-07-03 15:40:29 +0000
@@ -0,0 +1,221 @@
+
+#if($patientRegistrationForm.fixedAttributes.contains( 'registrationDate' ))
+ <tr id='registrationDateTR'>
+ <td class='text-column'><label for="registration_date">$i18n.getString( "registration_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td class="input-column" colspan='2'>
+ <input type="text" id="registrationDate" name="registrationDate" class="{validate:{required:true}}" value='$!format.formatDate($!patient.registrationDate)'/>
+ </td>
+ </tr>
+#end
+
+<tr>
+ <th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
+</tr>
+
+#if($patientRegistrationForm.fixedAttributes.contains( 'fullName' ))
+ <tr>
+ <td class='text-column'><label for="fullName">$i18n.getString( "full_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td class="input-column"><input type="text" id="fullName" name="fullName" value="$!patient.getFullName()" class="{validate:{required:true, rangelength:[3,50]}}"></td>
+ </tr>
+#end
+
+#if($patientRegistrationForm.fixedAttributes.contains( 'gender' ))
+ <tr>
+ <td class='text-column'><label for="gender">$i18n.getString( "gender" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td class="input-column">
+ <select id="gender" name="gender">
+ <option value="M" #if( $!patient.gender == 'M' ) selected="selected" #end>$i18n.getString( "male" )</option>
+ <option value="F" #if( $!patient.gender == 'F' ) selected="selected" #end>$i18n.getString( "female" )</option>
+ <option value="T" #if( $!patient.gender == 'T' ) selected="selected" #end>$i18n.getString( "transgender" )</option>
+ </select>
+ </td>
+ </tr>
+#end
+
+<tr>
+ <td class='text-column' ><label for="birthDate">$i18n.getString( "date_of_birth" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td class="input-column">
+ <select id='dobType' name="dobType" style='width:120px' onchange='dobTypeOnChange("patientForm")' >
+ <option value="V" #if($patient.dobType=='V') selected #end >$i18n.getString( "verified" )</option>
+ <option value="D" #if($patient.dobType=='D') selected #end >$i18n.getString( "declared" )</option>
+ <option value="A" #if($patient.dobType=='A') selected #end >$i18n.getString( "approximated" )</option>
+ </select>
+ #if($patientRegistrationForm.fixedAttributes.contains( 'birthDate' ))
+ <input type="text" id="birthDate" name="birthDate" value='$!format.formatDate($!patient.birthDate)' style='width:136px;' />
+ #else
+ <input type="text" id="age" name="age" placeholder="$i18n.getString('enter_age_in_years')" value='$!patient.getIntegerValueOfAge()' class="{validate:{number:true}}" style='width:136px;' />
+ #end
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td class="input-column">
+ <input id="memberValidator" class="hidden {validate:{required:true}}"/>
+ </td>
+</tr>
+
+#if($patientRegistrationForm.fixedAttributes.contains( 'phoneNumber' ))
+ <tr>
+ <td class='text-column'><label for="phoneNumber">$i18n.getString( "phone_number" )</label></td>
+ <td class="input-column">
+ <input type="text" id="phoneNumber" name="phoneNumber" class="{validate:{phone:true}}"/>
+ </td>
+ </tr>
+#end
+
+#if($patientRegistrationForm.fixedAttributes.contains( 'healthWorker' ))
+ <tr>
+ <td class='text-column'><label for="healthWorker">$i18n.getString( "health_worker" )</label></td>
+ <td class="input-column">
+ <select id="healthWorkerId" name="healthWorkerId">
+ <option value="">[$i18n.getString("please_select")]</option>
+ #foreach( $healthWorker in $healthWorkers)
+ <option value="$healthWorker.id" #if($patient.healthWorker.id == $healthWorker.id) selected #end>$healthWorker.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+#end
+
+<!-- UNDERAGE -->
+
+#if($!patient.underAge)
+ #set( $representative = $!patient.representative )
+ <tr id="representativeFormDiv" name="representativeFormDiv">
+ <td class='text-column'>$i18n.getString("guardian")</td>
+ <td>
+ $!patient.representative.getFullName() <img src="../images/information.png" alt="$i18n.getString( 'show_details' )" onclick='showRepresentativeInfo()' class='img-button'>
+ </td>
+ </tr>
+#else
+ <tr id="underAgeDiv" name="underAgeDiv">
+ <td class='text-column'>$i18n.getString("has_guardian")</td>
+ <td>
+ <input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true" #if($!patient.underAge == "true") checked="checked" #end/>
+ </td>
+ </tr>
+#end
+
+<!-- DEAD -->
+#if($patientRegistrationForm.fixedAttributes.contains( 'isDead' ))
+ <tr id="deathCheckboxTR">
+ <td class='text-column'>$i18n.getString("is_dead")</td>
+ <td>
+ <input type="checkbox" name="isDead" id="isDead" value="true" #if($!patient.isDead) checked="checked" #end onchange='isDeathOnChange();'/>
+ </td>
+ </tr>
+#end
+
+#if($patientRegistrationForm.fixedAttributes.contains( 'deathDate' ))
+ <tr id='deathDateTR' #if($!patient.isDead) #else class="hidden" #end>
+ <td class='text-column'><label for="deathDate">$i18n.getString("death_date")</label></td>
+ <td class="input-column">
+ <input type="text" name="deathDate" id="deathDate" #if($!patient.deathDate) value="$format.formatDate( $!patient.deathDate )" #end>
+ </td>
+ </tr>
+#end
+
+<tr>
+ <td></td>
+ <td><input type="button" class='button' id='checkDuplicateBtn' name='checkDuplicateBtn' value="$i18n.getString('check_duplicate')" /></td>
+</tr>
+
+<tr><td> </td></tr>
+#set($identifierTypes = $patientRegistrationForm.identifierTypes)
+#if( $identifierTypes.size() > 0)
+ <!--IDENTIFIERS -->
+ <tr><th colspan="2" class="heading-column">$i18n.getString("patient_details")</th></tr>
+ #foreach ($identifierType in $identifierTypes)
+ #if( $identifierType.program )
+ #else
+ #set( $identifier = '' )
+ #set( $identifier = $identiferMap.get( $identifierType.id ) )
+ #if($identifierType.type=='orgunitCount' && $!orgunitCountIdentifier)
+ #set( $identifier = $!orgunitCountIdentifier )
+ #end
+
+ <tr>
+ <td class='text-column'><label>$encoder.htmlEncode($identifierType.displayName) #if($identifierType.mandatory) <em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+ <td class="input-column">
+ <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 }}" />
+ </td>
+ </tr>
+ #end
+ #end
+#end
+
+<!-- ATTRIBUTES IN GROUPS -->
+
+
+#foreach($attribute in $$patientRegistrationForm.dynamicAttributes )
+ #if( $attribute )
+ #set($value = "")
+ #set($value = $patientAttributeValueMap.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> </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>datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate', false, true );</script>
+ #else
+ <script>datePickerValid( 'enrollmentDate', true );</script>
+ #end
+#end
+
+<script>
+ #if($!patient.dobType && $!patient.dobType=='A')
+ showById('age');
+ hideById('birthDate');
+ #else
+ hideById('age');
+ showById('birthDate');
+ #end
+
+ #if( $!patient.phoneNumber && $patient.phoneNumber!="")
+ setFieldValue('phoneNumber',"$!patient.phoneNumber")
+ #else
+ setFieldValue('phoneNumber',"$!phoneNumberAreaCode")
+ #end
+</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2013-07-02 15:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2013-07-03 15:40:29 +0000
@@ -1,6 +1,7 @@
-
#if($!customRegistrationForm)
$customRegistrationForm
+#elseif($!patientRegistrationForm)
+ #parse( "/dhis-web-caseentry/defaultPatientForm.vm" )
#else
## Macro for generating the jQuery validation rules
#macro( validate $type $require )
@@ -10,7 +11,7 @@
{validate:{required:true}}
#end
#end
-
+
#if($!program && $program.disableRegistrationFields )
#else
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDefaultPatientRegistrationFormAcion.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDefaultPatientRegistrationFormAcion.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDefaultPatientRegistrationFormAcion.java 2013-07-03 15:40:29 +0000
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.dataentryform;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientRegistrationForm;
+import org.hisp.dhis.patient.PatientRegistrationFormService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ SaveDefaultPatientRegistrationFormAcion.java Jul 3, 2013 11:05:02
+ * AM $
+ */
+public class SaveDefaultPatientRegistrationFormAcion
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private PatientRegistrationFormService patientRegistrationFormService;
+
+ public void setPatientRegistrationFormService( PatientRegistrationFormService patientRegistrationFormService )
+ {
+ this.patientRegistrationFormService = patientRegistrationFormService;
+ }
+
+ private PatientAttributeService patientAttributeService;
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
+ private PatientIdentifierTypeService identifierTypeService;
+
+ public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+ {
+ this.identifierTypeService = identifierTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private List<String> fixedAttributes;
+
+ public void setFixedAttributes( List<String> fixedAttributes )
+ {
+ this.fixedAttributes = fixedAttributes;
+ }
+
+ private List<Integer> dynamicAttributeIds;
+
+ public void setDynamicAttributeIds( List<Integer> dynamicAttributeIds )
+ {
+ this.dynamicAttributeIds = dynamicAttributeIds;
+ }
+
+ private List<Integer> identifierTypeIds;
+
+ public void setIdentifierTypeIds( List<Integer> identifierTypeIds )
+ {
+ this.identifierTypeIds = identifierTypeIds;
+ }
+
+ private Integer programId;
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ List<PatientAttribute> dynamicAttributes = new ArrayList<PatientAttribute>();
+
+ for ( Integer dynamicAttributeId : dynamicAttributeIds )
+ {
+ dynamicAttributes.add( patientAttributeService.getPatientAttribute( dynamicAttributeId ) );
+ }
+
+ List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
+
+ for ( Integer identifierTypeId : identifierTypeIds )
+ {
+ identifierTypes.add( identifierTypeService.getPatientIdentifierType( identifierTypeId ) );
+ }
+
+ PatientRegistrationForm registrationForm = null;
+
+ Program program = null;
+
+ if ( programId == null )
+ {
+ registrationForm = patientRegistrationFormService.getCommonPatientRegistrationForm();
+ }
+ else
+ {
+ program = programService.getProgram( programId );
+ registrationForm = patientRegistrationFormService.getPatientRegistrationForm( program );
+ }
+
+ // ---------------------------------------------------------------------
+ // Save data-entry-form
+ // ---------------------------------------------------------------------
+
+ if ( registrationForm == null )
+ {
+ registrationForm = new PatientRegistrationForm();
+ registrationForm.setName( name );
+ registrationForm.setFixedAttributes( fixedAttributes );
+ registrationForm.setDynamicAttributes( dynamicAttributes );
+ registrationForm.setIdentifierTypes( identifierTypes );
+ registrationForm.setProgram( program );
+ patientRegistrationFormService.savePatientRegistrationForm( registrationForm );
+ }
+ else
+ {
+ registrationForm.setName( name );
+ registrationForm.setFixedAttributes( fixedAttributes );
+ registrationForm.setDynamicAttributes( dynamicAttributes );
+ registrationForm.setIdentifierTypes( identifierTypes );
+ patientRegistrationFormService.updatePatientRegistrationForm( registrationForm );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDefaultPatientRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDefaultPatientRegistrationFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDefaultPatientRegistrationFormAction.java 2013-07-03 15:40:29 +0000
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.dataentryform;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientRegistrationForm;
+import org.hisp.dhis.patient.PatientRegistrationFormService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ShowDefaultPatientRegistrationFormAction.java Jul 3, 2013 4:47:15
+ * PM $
+ */
+public class ShowDefaultPatientRegistrationFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private PatientRegistrationFormService patientRegistrationFormService;
+
+ public void setPatientRegistrationFormService( PatientRegistrationFormService patientRegistrationFormService )
+ {
+ this.patientRegistrationFormService = patientRegistrationFormService;
+ }
+
+ private PatientAttributeService patientAttributeService;
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
+ private PatientIdentifierTypeService identifierTypeService;
+
+ public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+ {
+ this.identifierTypeService = identifierTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------
+
+ private List<PatientAttribute> attributes;
+
+ public List<PatientAttribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ private List<PatientIdentifierType> identifierTypes;
+
+ public List<PatientIdentifierType> getIdentifierTypes()
+ {
+ return identifierTypes;
+ }
+
+ private Integer programId;
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ private Program program;
+
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ private PatientRegistrationForm registrationForm;
+
+ public PatientRegistrationForm getRegistrationForm()
+ {
+ return registrationForm;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ attributes = new ArrayList<PatientAttribute>( patientAttributeService.getAllPatientAttributes() );
+ identifierTypes = new ArrayList<PatientIdentifierType>( identifierTypeService.getAllPatientIdentifierTypes() );
+
+ if ( programId != null )
+ {
+ program = programService.getProgram( programId );
+ registrationForm = patientRegistrationFormService.getPatientRegistrationForm( program );
+ }
+ else
+ {
+ registrationForm = patientRegistrationFormService.getCommonPatientRegistrationForm();
+ }
+
+ if ( attributes != null && registrationForm != null )
+ {
+ attributes.removeAll( registrationForm.getDynamicAttributes() );
+ }
+
+ if ( identifierTypes != null && registrationForm != null )
+ {
+ identifierTypes.removeAll( registrationForm.getIdentifierTypes() );
+ }
+
+ 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 2013-05-30 06:08:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-07-03 15:40:29 +0000
@@ -556,6 +556,42 @@
<ref bean="org.hisp.dhis.patient.PatientRegistrationFormService" />
</property>
</bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.dataentryform.ShowDefaultPatientRegistrationFormAction"
+ class="org.hisp.dhis.patient.action.dataentryform.ShowDefaultPatientRegistrationFormAction"
+ scope="prototype">
+ <property name="programService">
+ <ref bean="org.hisp.dhis.program.ProgramService" />
+ </property>
+ <property name="patientRegistrationFormService">
+ <ref bean="org.hisp.dhis.patient.PatientRegistrationFormService" />
+ </property>
+ <property name="patientAttributeService">
+ <ref bean="org.hisp.dhis.patient.PatientAttributeService" />
+ </property>
+ <property name="identifierTypeService">
+ <ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.dataentryform.SaveDefaultPatientRegistrationFormAcion"
+ class="org.hisp.dhis.patient.action.dataentryform.SaveDefaultPatientRegistrationFormAcion"
+ scope="prototype">
+ <property name="programService">
+ <ref bean="org.hisp.dhis.program.ProgramService" />
+ </property>
+ <property name="patientRegistrationFormService">
+ <ref bean="org.hisp.dhis.patient.PatientRegistrationFormService" />
+ </property>
+ <property name="patientAttributeService">
+ <ref bean="org.hisp.dhis.patient.PatientAttributeService" />
+ </property>
+ <property name="identifierTypeService">
+ <ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+ </property>
+ </bean>
<bean
id="org.hisp.dhis.patient.action.dataentryform.ShowPatientRegistrationFormAction"
=== 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 2013-07-02 15:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-07-03 15:40:29 +0000
@@ -422,4 +422,21 @@
send_to = Send to
complete_program = Complete program
from_the_day_set = From the day set
-orgunit_count = Organisation unit count
\ No newline at end of file
+orgunit_count = Organisation unit count
+default_registration_form = Default registration form
+available_fixed_attributes = Available fixed attributes
+selected_fixed_attributes = Selected fixed attributes
+available_identifier_types = Available identifier types
+selected_identifier_types = Selected identifier types
+available_dynamic_attributes = Available dynamic attributes
+selected_dynamic_attributes = Selected dynamic attributes
+registrationDate = Registration date
+fullName = Full name
+gender = Gender
+dobType = DOB type
+birthDate = Date of birth
+age = Age(years)
+phoneNumber = Phone number
+deathDate = Date of death
+isDead = Is dead
+healthWorker = Health worker
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-06-29 14:16:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-07-03 15:40:29 +0000
@@ -625,6 +625,24 @@
</result>
</action>
+ <action name="showDefaultPatientRegistrationForm"
+ class="org.hisp.dhis.patient.action.dataentryform.ShowDefaultPatientRegistrationFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-patient/defaultPatientRegistationForm.vm</param>
+ <param name="javascripts">
+ ../dhis-web-commons/ckeditor/ckeditor.js,
+ ../dhis-web-commons/ckeditor/adapters/jquery.js,
+ javascript/patientRegistationForm.js
+ </param>
+ <param name="stylesheets">style/basic.css</param>
+ </action>
+
+ <action name="saveDefaultPatientRegistrationForm"
+ class="org.hisp.dhis.patient.action.dataentryform.SaveDefaultPatientRegistrationFormAcion">
+ <result name="success" type="redirect">patientRegistrationForm.action
+ </result>
+ </action>
+
<!-- Patient Attribute Group -->
<action name="patientAttributeGroup"
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/defaultPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/defaultPatientRegistationForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/defaultPatientRegistationForm.vm 2013-07-03 15:40:29 +0000
@@ -0,0 +1,216 @@
+<h3>$i18n.getString( "create_new_patient_attribute_group" )</h3>
+
+<form id="defaultPatientRegistrationForm" name="defaultPatientRegistrationForm" action="saveDefaultPatientRegistrationForm.action" method="post" onsubmit="selectAllById('fixedAttributes');selectAllById('dynamicAttributeIds');selectAllById('identifierTypeIds');">
+
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "default_registration_form" )</th>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></td>
+ <td><input type="text" id="name" name="name" class="{validate:{required:true}}" value='$!registrationForm.name'/></td>
+ </tr>
+ <tr>
+ <td colspan="2"> </td>
+ </tr>
+</table>
+
+<table>
+ <colgroup>
+ <col style='width:300px'/>
+ <col/>
+ <col style='width:300px'/>
+ </colgroup>
+ <tr>
+ <th>$i18n.getString( "available_fixed_attributes" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_fixed_attributes" )
+ <input type='hidden' id='hasAttributes' name='hasAttributes' class="{validate:{required:true}}">
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <select id="availableFixedAttributes" name='availableFixedAttributes' multiple="multiple" ondblclick="moveSelectedById( 'availableFixedAttributes', 'fixedAttributes' )" style="width:450px;height:270px">
+ #set($hasRegistrationDate = false)
+ #set($hasFullName = false)
+ #set($hasGender = false)
+ #set($hasDobType = false)
+ #set($hasBirthDate = false)
+ #set($hasAge = false)
+ #set($hasPhoneNumber = false)
+ #set($hasDeathDate = false)
+ #set($hasIsDead = false)
+ #set($hasHealthWorker = false)
+ #foreach( $fixedAttribute in $registrationForm.fixedAttributes )
+ #if($fixedAttribute=='registrationDate')
+ #set($hasRegistrationDate = true)
+ #end
+ #if($fixedAttribute=='fullName')
+ #set($hasFullName = true)
+ #end
+ #if($fixedAttribute=='gender')
+ #set($hasGender = true)
+ #end
+ #if($fixedAttribute=='dobType')
+ #set($hasDobType = true)
+ #end
+ #if($fixedAttribute=='birthDate')
+ #set($hasBirthDate = true)
+ #end
+ #if($fixedAttribute=='age')
+ #set($hasAge = true)
+ #end
+ #if($fixedAttribute=='phoneNumber')
+ #set($hasPhoneNumber = true)
+ #end
+ #if($fixedAttribute=='deathDate')
+ #set($hasDeathDate = true)
+ #end
+ #if($fixedAttribute=='isDead')
+ #set($hasIsDead = true)
+ #end
+ #if($fixedAttribute=='healthWorker')
+ #set($hasHealthWorker = true)
+ #end
+ #end
+
+ #if($hasRegistrationDate==false)
+ <option value="registrationDate">$i18n.getString('registration_date')</option>
+ #end
+ #if($hasFullName==false)
+ <option value="fullName">$i18n.getString('full_name')</option>
+ #end
+ #if($hasGender==false)
+ <option value="gender">$i18n.getString('gender')</option>
+ #end
+ #if($hasDobType==false)
+ <option value="dobType">$i18n.getString('dob_type')</option>
+ #end
+ #if($hasBirthDate==false)
+ <option value="birthDate">$i18n.getString('birth_date')</option>
+ #end
+ #if($hasAge==false)
+ <option value="age">$i18n.getString('age_years')</option>
+ #end
+ #if($hasPhoneNumber==false)
+ <option value="phoneNumber">$i18n.getString('phone_number')</option>
+ #end
+ #if($hasDeathDate==false)
+ <option value="deathDate">$i18n.getString('death_date')</option>
+ #end
+ #if($hasIsDead==false)
+ <option value="isDead">$i18n.getString('is_dead')</option>
+ #end
+ #if($hasHealthWorker==false)
+ <option value="healthWorker">$i18n.getString('health_worker')</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="moveSelectedById( 'availableFixedAttributes', 'fixedAttributes' )" class='filterButton'/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="moveSelectedById( 'fixedAttributes', 'availableFixedAttributes' )" class='filterButton'/>
+ <input type="button" value=">>" onclick="moveAllById( 'availableFixedAttributes', 'fixedAttributes' )" class='filterButton' /><br/>
+ <input type="button" value="<<" onclick="moveAllById( 'fixedAttributes', 'availableFixedAttributes' )" class='filterButton' />
+ </td>
+ <td>
+ <select style='width:100%' multiple="multiple" id="fixedAttributes" name="fixedAttributes" ondblclick="moveSelectedById( 'fixedAttributes', 'availableFixedAttributes' )" size="15" >
+ #foreach( $fixedAttribute in $registrationForm.fixedAttributes )
+ <option value='$fixedAttribute'>$i18n.getString($fixedAttribute)</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'fixedAttributes')" title="$i18n.getString( 'move_up' )"><img src="../images/move_up.png" alt="$i18n.getString( 'move_up' )"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'fixedAttributes' )" title="$i18n.getString( 'move_down' )"><img src="../images/move_down.png" alt="$i18n.getString( 'move_up' )"/></a>
+ </td>
+ </tr>
+</table>
+
+<table>
+ <colgroup>
+ <col style='width:300px'/>
+ <col/>
+ <col style='width:300px'/>
+ </colgroup>
+ <tr>
+ <th>$i18n.getString( "available_identifier_types" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_identifier_types" )<th>
+ </tr>
+ <tr>
+ <td>
+ <select id="availableIdentifierTypes" name='availableIdentifierTypes' multiple="multiple" ondblclick="moveSelectedById( 'availableIdentifierTypes', 'identifierTypeIds' )" style="width:450px;height:270px">
+ #foreach($identifierType in $identifierTypes)
+ <option value='$identifierType.id'>$identifierType.displayName</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="moveSelectedById( 'availableIdentifierTypes', 'identifierTypeIds' )" class='filterButton'/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="moveSelectedById( 'identifierTypeIds', 'availableIdentifierTypes' )" class='filterButton'/>
+ <input type="button" value=">>" onclick="moveAllById( 'availableIdentifierTypes', 'identifierTypeIds' )" class='filterButton' /><br/>
+ <input type="button" value="<<" onclick="moveAllById( 'identifierTypeIds', 'availableIdentifierTypes' )" class='filterButton' />
+ </td>
+ <td>
+ <select style='width:100%' multiple="multiple" id="identifierTypeIds" name="identifierTypeIds" ondblclick="moveSelectedById( 'identifierTypeIds', 'availableIdentifierTypes' )" size="15" >
+ #foreach( $identifierType in $registrationForm.identifierTypes )
+ <option value='$identifierType.id'>$identifierType.displayName</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'identifierTypeIds')" title="$i18n.getString( 'move_up' )"><img src="../images/move_up.png" alt="$i18n.getString( 'move_up' )"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'identifierTypeIds' )" title="$i18n.getString( 'move_down' )"><img src="../images/move_down.png" alt="$i18n.getString( 'move_up' )"/></a>
+ </td>
+ </tr>
+</table>
+
+<table>
+ <colgroup>
+ <col style='width:300px'/>
+ <col/>
+ <col style='width:300px'/>
+ </colgroup>
+ <tr>
+ <th>$i18n.getString( "available_dynamic_attributes" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_dynamic_attributes" )</th>
+ </tr>
+ <tr>
+ <td>
+ <select id="availableAttributes" name='availableAttributes' multiple="multiple" ondblclick="moveSelectedById( 'availableAttributes', 'dynamicAttributeIds' )" style="width:450px;height:270px">
+ #foreach($attribute in $attributes)
+ <option value='$attribute.id'>$attribute.displayName</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="moveSelectedById( 'availableAttributes', 'dynamicAttributeIds' )" class='filterButton'/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="moveSelectedById( 'dynamicAttributeIds', 'availableAttributes' )" class='filterButton'/>
+ <input type="button" value=">>" onclick="moveAllById( 'availableAttributes', 'dynamicAttributeIds' )" class='filterButton' /><br/>
+ <input type="button" value="<<" onclick="moveAllById( 'dynamicAttributeIds', 'availableAttributes' )" class='filterButton' />
+ </td>
+ <td>
+ <select style='width:100%' multiple="multiple" id="dynamicAttributeIds" name="dynamicAttributeIds" size="15" ondblclick="moveSelectedById( 'dynamicAttributeIds', 'availableAttributes' )">
+ #foreach( $dynamicAttribute in $registrationForm.dynamicAttributes )
+ <option value='$dynamicAttribute.id'>$dynamicAttribute.displayName</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'dynamicAttributeIds')" title="$i18n.getString( 'move_up' )"><img src="../images/move_up.png" alt="$i18n.getString( 'move_up' )"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'dynamicAttributeIds' )" title="$i18n.getString( 'move_down' )"><img src="../images/move_down.png" alt="$i18n.getString( 'move_up' )"/></a>
+ </td>
+ </tr>
+</table>
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='patientAttributeGroup.action'"/>
+</p>
+
+</form>
+
+<script>
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+</script>
=== 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-06-10 08:45:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientRegistrationForm.js 2013-07-03 15:40:29 +0000
@@ -21,4 +21,9 @@
showById('add_' + programId);
});
}
+}
+
+function showDefaultRegistrationForm( programId )
+{
+ window.location.href='showDefaultPatientRegistrationForm.action?programId=' + programId;
}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm 2013-07-03 15:40:29 +0000
@@ -0,0 +1,65 @@
+
+<h3>$i18n.getString( "patient_identifier_type_management" ) #openHelp( "patient_identifier_type" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+
+ <table class="listTable">
+ <col>
+ <col width="120">
+ <tr>
+ <td></td>
+ <td colspan="4" style="text-align:right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddPatientIdentifierTypeForm.action'" style="width:70px"></td>
+ </tr>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th colspan="4">$i18n.getString( "operations" )</th>
+ </tr>
+
+ <tbody id="list">
+ #foreach( $identifierType in $identifierTypes )
+ <tr id="tr${identifierType.id}">
+
+ <td onclick="showPatientIdentifierTypeDetails( $identifierType.id )">$encoder.htmlEncode( $identifierType.displayName )</td>
+
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="showUpdatePatientIdentifierTypeForm.action?id=$identifierType.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <a href="javascript:translate( 'PatientIdentifierType', '$identifierType.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removePatientIdentifierType( '$identifierType.id', '$encoder.jsEncode( $identifierType.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:showPatientIdentifierTypeDetails( $identifierType.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+
+ </tr>
+ #end
+
+ </tbody>
+
+ </table>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
+ <p><label class="bold">$i18n.getString( "related" ):</label><br><span id="relatedField"></span></p>
+ <p><label class="bold">$i18n.getString( "no_of_char" ):</label><br><span id="noCharsField"></span></p>
+ <p><label class="bold">$i18n.getString( "type" ):</label><br><span id="typeField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patientIdentifierType" ) , "'" )';
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+ var i18n_string = '$encoder.jsEscape( $i18n.getString( "string" ), "'")';
+ var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ), "'")';
+ var i18n_letter_only = '$encoder.jsEscape( $i18n.getString( "letter_only" ), "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ), "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ), "'")';
+ var i18n_all = '$encoder.jsEscape( $i18n.getString( "all" ), "'")';
+</script>
=== 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-06-10 08:45:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm 2013-07-03 15:40:29 +0000
@@ -14,11 +14,11 @@
<table class="listTable">
<col>
<col>
- <col width="40">
+ <col width="100">
<thead>
- <tr>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
<th>$i18n.getString( "program" )</th>
- <th>$i18n.getString( "data_entry" )</th>
<th class="{sorter: false}">$i18n.getString( "operations" )</th>
</tr>
</thead>
@@ -27,6 +27,9 @@
#foreach( $registrationForm in $registrationForms )
<tr id="tr${registrationForm.program.id}">
<td>
+ $encoder.htmlEncode( $registrationForm.name )
+ </td>
+ <td>
#if($registrationForm.program)
$encoder.htmlEncode( $registrationForm.program.name )
#else
@@ -34,12 +37,12 @@
#set($hasCommonForm = 'true')
#end
</td>
- <td>
- $encoder.htmlEncode( $registrationForm.dataEntryForm.name )
- </td>
<td style="text-align:center">
<a id='update_$registrationForm.program.id' href="javascript:updateNewForm($registrationForm.id, '$!registrationForm.program.id')" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
<a id='add_$registrationForm.program.id' href="javascript:addNewForm($registrationForm.program.id)" title="$i18n.getString( 'design_data_entry_form' )" style='display:none;'><img src="../images/add.png" alt="$i18n.getString( 'design_data_entry_form' )" ></a>
+
+ <a href="javascript:showDefaultRegistrationForm('$!registrationForm.program.id');"><img src='../images/edit_layout.png' alt="$i18n.getString( 'design_data_entry_form' )"></a>
+
<a href="javascript:removeRegistrationForm( '$!registrationForm.program.id', '$!encoder.jsEncode( $registrationForm.program.name )')" title="$i18n.getString( "remove" )"><img id='active_$registrationForm.program.id' src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
<img id='define_$registrationForm.program.id' style='display:none;' src='../images/delete-denied.png' title='$i18n.getString("remove")'>
</td>
@@ -52,6 +55,7 @@
<td>[$i18n.getString('none')]</td>
<td style="text-align:center">
<a href="javascript:addNewForm($program.id)" title="$i18n.getString( 'design_data_entry_form' )"><img src="../images/add.png" alt="$i18n.getString( 'design_data_entry_form' )"></a>
+ <a href="javascript:showDefaultRegistrationForm($program.id);"><img src='../images/edit_layout.png' alt="$i18n.getString( 'design_data_entry_form' )"></a>
<img src='../images/delete-denied.png' title='$i18n.getString("remove")'>
</td>
</tr>
@@ -62,6 +66,7 @@
<td>[$i18n.getString('none')]</td>
<td style="text-align:center">
<a href="javascript:addNewForm('')" title="$i18n.getString( 'design_data_entry_form' )"><img src="../images/add.png" alt="$i18n.getString( 'design_data_entry_form' )"></a>
+ <a href="javascript:showDefaultRegistrationForm('');"><img src='../images/edit_layout.png' alt="$i18n.getString( 'design_data_entry_form' )"></a>
<img src='../images/delete-denied.png' title='$i18n.getString("remove")'>
</td>
</tr>
=== 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-07-02 03:54:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-07-03 15:40:29 +0000
@@ -131,7 +131,7 @@
<option value="gender">$i18n.getString('gender') #if($disableRegistrationFields=='false')*#end</option>
<option value="dobType">$i18n.getString('dob_type') #if($disableRegistrationFields=='false')*#end</option>
<option value="birthDate">$i18n.getString('birth_date') #if($disableRegistrationFields=='false')*#end</option>
- <option value="age">$i18n.getString('age_year') #if($disableRegistrationFields=='false')*#end</option>
+ <option value="age">$i18n.getString('age_years') #if($disableRegistrationFields=='false')*#end</option>
<option value="phoneNumber">$i18n.getString('phone_number')</option>
<option value="deathDate">$i18n.getString('death_date')</option>
<option value="isDead">$i18n.getString('is_dead')</option>