=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml' --- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2014-03-26 17:39:16 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2014-04-04 17:43:59 +0000 @@ -37,6 +37,8 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/SaveAttributeInListNoProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/SaveAttributeInListNoProgramAction.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/SaveAttributeInListNoProgramAction.java 2014-04-04 17:43:59 +0000 @@ -41,8 +41,6 @@ public class SaveAttributeInListNoProgramAction implements Action { - private final String PREFIX_ATTRIBUTE = "attr"; - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- @@ -58,9 +56,9 @@ // Input/Output // ------------------------------------------------------------------------- - private String[] selectedAttributeIds; + private Integer[] selectedAttributeIds; - public void setSelectedAttributeIds( String[] selectedAttributeIds ) + public void setSelectedAttributeIds( Integer[] selectedAttributeIds ) { this.selectedAttributeIds = selectedAttributeIds; } @@ -74,23 +72,17 @@ { Collection attributes = attributeService.getAllTrackedEntityAttributes(); - int indexAttr = 1; + int index = 1; if ( selectedAttributeIds != null ) { - for ( String objectId : selectedAttributeIds ) + for ( Integer objectId : selectedAttributeIds ) { - // Identifier type - String[] id = objectId.split( "_" ); - if ( id[0].equals( PREFIX_ATTRIBUTE ) ) - { - TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( Integer - .parseInt( id[1] ) ); - attribute.setDisplayInListNoProgram( true ); - attribute.setSortOrderInListNoProgram( indexAttr ); - attributeService.updateTrackedEntityAttribute( attribute ); - indexAttr++; - attributes.remove( attribute ); - } + TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( objectId ); + attribute.setDisplayInListNoProgram( true ); + attribute.setSortOrderInListNoProgram( index ); + attributeService.updateTrackedEntityAttribute( attribute ); + index++; + attributes.remove( attribute ); } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAttributeInListNoProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAttributeInListNoProgramAction.java 2014-03-20 15:05:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAttributeInListNoProgramAction.java 2014-04-04 17:43:59 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; +import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeSortOrderInListNoProgramComparator; import com.opensymphony.xwork2.Action; @@ -89,7 +90,7 @@ selectedAttributes = new ArrayList( attributeService.getTrackedEntityAttributesDisplayInList( true ) ); - Collections.sort( availableAttributes, IdentifiableObjectNameComparator.INSTANCE ); + Collections.sort( selectedAttributes, new TrackedEntityAttributeSortOrderInListNoProgramComparator() ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAttributeVisitScheduleFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAttributeVisitScheduleFormAction.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAttributeVisitScheduleFormAction.java 2014-04-04 17:43:59 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; +import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeSortOrderComparator; import com.opensymphony.xwork2.Action; @@ -88,7 +89,7 @@ selectedAttributes = new ArrayList( attributeService.getTrackedEntityAttributesByDisplayOnVisitSchedule( true ) ); - Collections.sort( availableAttributes, IdentifiableObjectNameComparator.INSTANCE ); + Collections.sort( selectedAttributes, new TrackedEntityAttributeSortOrderComparator() ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml 2014-03-24 19:24:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml 2014-04-04 17:43:59 +0000 @@ -172,7 +172,7 @@ - index.action + attribute.action F_TRACKED_ENTITY_ATTRIBUTE_PUBLIC_ADD, F_TRACKED_ENTITY_ATTRIBUTE_PRIVATE_ADD === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/attributeInListNoProgram.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/attributeInListNoProgram.vm 2014-02-07 20:25:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/attributeInListNoProgram.vm 2014-04-04 17:43:59 +0000 @@ -34,7 +34,7 @@ @@ -47,7 +47,7 @@