dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19089
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8190: Sort identifiers/attributes linked to a program in Enrollment form.
------------------------------------------------------------
revno: 8190
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-09-22 19:23:40 +0700
message:
Sort identifiers/attributes linked to a program in Enrollment form.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.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/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/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/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-09-22 12:23:40 +0000
@@ -27,8 +27,8 @@
package org.hisp.dhis.program;
-import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
@@ -88,9 +88,9 @@
private Boolean displayIncidentDate;
- private Collection<PatientIdentifierType> patientIdentifierTypes;
+ private List<PatientIdentifierType> patientIdentifierTypes;
- private Collection<PatientAttribute> patientAttributes;
+ private List<PatientAttribute> patientAttributes;
// -------------------------------------------------------------------------
// Constructors
@@ -253,22 +253,22 @@
this.patientValidationCriteria = patientValidationCriteria;
}
- public Collection<PatientIdentifierType> getPatientIdentifierTypes()
+ public List<PatientIdentifierType> getPatientIdentifierTypes()
{
return patientIdentifierTypes;
}
- public void setPatientIdentifierTypes( Collection<PatientIdentifierType> patientIdentifierTypes )
+ public void setPatientIdentifierTypes( List<PatientIdentifierType> patientIdentifierTypes )
{
this.patientIdentifierTypes = patientIdentifierTypes;
}
- public Collection<PatientAttribute> getPatientAttributes()
+ public List<PatientAttribute> getPatientAttributes()
{
return patientAttributes;
}
- public void setPatientAttributes( Collection<PatientAttribute> patientAttributes )
+ public void setPatientAttributes( List<PatientAttribute> patientAttributes )
{
this.patientAttributes = patientAttributes;
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-09-22 12:23:40 +0000
@@ -45,15 +45,19 @@
<property name="displayIncidentDate" />
- <set name="patientIdentifierTypes" table="program_patientIdentifierTypes">
- <key column="programid" foreign-key="fk_program_patientIdentifierTypes_programid" />
- <many-to-many column="patientidentifiertypeid" class="org.hisp.dhis.patient.PatientIdentifierType" foreign-key="fk_program_patientIdentifierTypes_patientidentifiertypeid" />
- </set>
-
- <set name="patientAttributes" table="program_patientAttributes">
- <key column="programid" foreign-key="fk_program_patientAttributes_programid" />
- <many-to-many column="patientattributeid" class="org.hisp.dhis.patient.PatientAttribute" foreign-key="fk_program_patientAttributes_patientattributeid" />
- </set>
+ <list name="patientIdentifierTypes" table="program_patientIdentifierTypes">
+ <key column="programid" foreign-key="fk_program_patientIdentifierTypes_programid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="patientidentifiertypeid" class="org.hisp.dhis.patient.PatientIdentifierType"
+ foreign-key="fk_program_patientIdentifierTypes_patientidentifiertypeid" />
+ </list>
+
+ <list name="patientAttributes" table="program_patientAttributes">
+ <key column="programid" foreign-key="fk_program_patientAttributes_programid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="patientattributeid" class="org.hisp.dhis.patient.PatientAttribute"
+ foreign-key="fk_program_patientAttributes_patientattributeid" />
+ </list>
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-09-07 07:57:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-09-22 12:23:40 +0000
@@ -83,7 +83,7 @@
private Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
- private Collection<PatientIdentifierType> identifierTypes;
+ private List<PatientIdentifierType> identifierTypes;
private Collection<PatientAttribute> noGroupAttributes = new HashSet<PatientAttribute>();
=== 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 2012-09-22 09:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-09-22 12:23:40 +0000
@@ -30,7 +30,7 @@
<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" class="{validate:{required:true}}">
+ <select id="gender" name="gender">
<option value="M">$i18n.getString( "male" )</option>
<option value="F" selected>$i18n.getString( "female" )</option>
<option value="T">$i18n.getString( "transgender" )</option>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2012-09-07 09:18:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2012-09-22 12:23:40 +0000
@@ -28,9 +28,7 @@
package org.hisp.dhis.patient.action.program;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
import org.hisp.dhis.patient.Patient;
@@ -192,8 +190,8 @@
program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility );
program.setDisplayIncidentDate( displayIncidentDate );
- Collection<PatientIdentifierType> identifierTypes = new HashSet<PatientIdentifierType>();
- Collection<PatientAttribute> patientAttributes = new HashSet<PatientAttribute>();
+ List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
+ List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
int index = 0;
for ( String selectedPropertyId : selectedPropertyIds )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java 2012-09-22 12:23:40 +0000
@@ -28,11 +28,11 @@
package org.hisp.dhis.patient.action.program;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeService;
import org.hisp.dhis.patient.PatientIdentifierType;
@@ -166,8 +166,8 @@
for ( Program program : programs )
{
- availableIdentifierTypes.removeAll( program.getPatientIdentifierTypes() );
- availableAttributes.removeAll( program.getPatientAttributes() );
+ availableIdentifierTypes.removeAll( new HashSet<PatientIdentifierType>( program.getPatientIdentifierTypes() ) );
+ availableAttributes.removeAll( new HashSet<PatientAttribute>( program.getPatientAttributes() ) );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2012-09-22 12:23:40 +0000
@@ -28,8 +28,6 @@
package org.hisp.dhis.patient.action.program;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import org.hisp.dhis.patient.Patient;
@@ -188,8 +186,8 @@
program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility );
program.setDisplayIncidentDate(displayIncidentDate);
- Collection<PatientIdentifierType> identifierTypes = new HashSet<PatientIdentifierType>();
- Collection<PatientAttribute> patientAttributes = new HashSet<PatientAttribute>();
+ List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
+ List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
int index = 0;
for( String selectedPropertyId : selectedPropertyIds )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2012-09-22 12:23:40 +0000
@@ -109,6 +109,10 @@
</table>
</div>
</td>
+ <td>
+ <a href="javascript:moveUpPropertyList()"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownPropertyList()"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
</tr>
<tr>
<td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2012-09-17 06:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2012-09-22 12:23:40 +0000
@@ -161,4 +161,47 @@
}
}
return ctrlPressed;
+}
+
+//-----------------------------------------------------------------------------
+//Move Table Row Up and Down
+//-----------------------------------------------------------------------------
+
+function moveUpPropertyList()
+{
+ var selectedList = jQuery("#selectedList");
+
+ jQuery("#selectedList").find("tr").each( function( i, item ){
+ item = jQuery(item);
+ if( item.hasClass("selected") )
+ {
+ var prev = item.prev('#selectedList tr');
+ if (prev.length == 1)
+ {
+ prev.before(item);
+ }
+ }
+ });
+}
+
+function moveDownPropertyList()
+{
+ var selectedList = jQuery("#selectedList");
+ var items = new Array();
+ jQuery("#selectedList").find("tr").each( function( i, item ){
+ items.push(jQuery(item));
+ });
+
+ for( var i=items.length-1;i>=0;i--)
+ {
+ var item = items[i];
+ if( item.hasClass("selected") )
+ {
+ var next = item.next('#selectedList tr');
+ if (next.length == 1)
+ {
+ next.after(item);
+ }
+ }
+ }
}
\ 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/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2012-09-22 12:23:40 +0000
@@ -127,6 +127,10 @@
</table>
</div>
</td>
+ <td>
+ <a href="javascript:moveUpPropertyList()"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownPropertyList()"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
</tr>
<tr>
<td>