=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-03-31 03:17:35 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-04-08 04:43:57 +0000 @@ -78,6 +78,8 @@ private OptionSet optionSet; + private TrackedEntity trackedEntity; + private String expression; private Boolean displayOnVisitSchedule = false; @@ -345,6 +347,20 @@ } @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public TrackedEntity getTrackedEntity() + { + return trackedEntity; + } + + public void setTrackedEntity( TrackedEntity trackedEntity ) + { + this.trackedEntity = trackedEntity; + } + + @JsonProperty @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getConfidential() === 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 2015-03-18 13:03:25 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2015-04-08 04:43:57 +0000 @@ -27,6 +27,9 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-03-19 05:16:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-04-08 04:43:57 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.opensymphony.xwork2.Action; import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.legend.LegendService; @@ -36,10 +37,9 @@ import org.hisp.dhis.system.util.AttributeUtils; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; +import org.hisp.dhis.trackedentity.TrackedEntityService; import org.springframework.beans.factory.annotation.Autowired; -import com.opensymphony.xwork2.Action; - import java.util.List; /** @@ -67,11 +67,14 @@ } @Autowired + private TrackedEntityService trackedEntityService; + + @Autowired private OptionService optionService; @Autowired private PeriodService periodService; - + @Autowired private LegendService legendService; @@ -144,7 +147,14 @@ { this.optionSetId = optionSetId; } - + + private Integer trackedEntityId; + + public void setTrackedEntityId( Integer trackedEntityId ) + { + this.trackedEntityId = trackedEntityId; + } + private Integer legendSetId; public void setLegendSetId( Integer legendSetId ) @@ -160,12 +170,12 @@ } private Boolean confidential; - + public void setConfidential( Boolean confidential ) { this.confidential = confidential; } - + private List jsonAttributeValues; public void setJsonAttributeValues( List jsonAttributeValues ) @@ -213,7 +223,7 @@ { programScope = true; } - + trackedEntityAttribute.setOrgunitScope( orgunitScope ); trackedEntityAttribute.setProgramScope( programScope ); } @@ -221,7 +231,11 @@ { trackedEntityAttribute.setOptionSet( optionService.getOptionSet( optionSetId ) ); } - + else if ( valueType.equals( TrackedEntityAttribute.TYPE_TRACKER_ASSOCIATE ) ) + { + trackedEntityAttribute.setTrackedEntity( trackedEntityService.getTrackedEntity( trackedEntityId ) ); + } + if ( legendSetId != null ) { trackedEntityAttribute.setLegendSet( legendService.getLegendSet( legendSetId ) ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java 2015-03-19 09:29:29 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java 2015-04-08 04:43:57 +0000 @@ -40,8 +40,10 @@ import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.system.util.AttributeUtils; +import org.hisp.dhis.trackedentity.TrackedEntity; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; +import org.hisp.dhis.trackedentity.TrackedEntityService; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; @@ -64,6 +66,9 @@ private TrackedEntityAttributeService trackedEntityAttributeService; @Autowired + private TrackedEntityService trackedEntityService; + + @Autowired private ProgramService programService; @Autowired @@ -138,6 +143,13 @@ return attributeValues; } + private List trackedEntities; + + public List getTrackedEntities() + { + return trackedEntities; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -160,9 +172,11 @@ optionSets = new ArrayList<>( optionService.getAllOptionSets() ); legendSets = legendService.getAllLegendSets(); attributes = new ArrayList<>( attributeService.getTrackedEntityAttributeAttributes() ); + trackedEntities = new ArrayList<>( trackedEntityService.getAllTrackedEntity() ); Collections.sort( optionSets ); Collections.sort( legendSets ); + Collections.sort( trackedEntities ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-03-19 05:16:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-04-08 04:43:57 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.opensymphony.xwork2.Action; import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.legend.LegendService; @@ -36,10 +37,9 @@ import org.hisp.dhis.system.util.AttributeUtils; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; +import org.hisp.dhis.trackedentity.TrackedEntityService; import org.springframework.beans.factory.annotation.Autowired; -import com.opensymphony.xwork2.Action; - import java.util.List; /** @@ -67,6 +67,9 @@ } @Autowired + private TrackedEntityService trackedEntityService; + + @Autowired private OptionService optionService; @Autowired @@ -138,6 +141,13 @@ this.optionSetId = optionSetId; } + private Integer trackedEntityId; + + public void setTrackedEntityId( Integer trackedEntityId ) + { + this.trackedEntityId = trackedEntityId; + } + private Integer legendSetId; public void setLegendSetId( Integer legendSetId ) @@ -167,12 +177,12 @@ } private Boolean confidential; - + public void setConfidential( Boolean confidential ) { this.confidential = confidential; } - + private List jsonAttributeValues; public void setJsonAttributeValues( List jsonAttributeValues ) @@ -228,6 +238,10 @@ { trackedEntityAttribute.setOptionSet( optionService.getOptionSet( optionSetId ) ); } + else if ( valueType.equals( TrackedEntityAttribute.TYPE_TRACKER_ASSOCIATE ) ) + { + trackedEntityAttribute.setTrackedEntity( trackedEntityService.getTrackedEntity( trackedEntityId ) ); + } if ( legendSetId != null ) { === 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 2015-03-19 11:14:12 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml 2015-04-08 04:43:57 +0000 @@ -368,7 +368,7 @@ /dhis-web-maintenance-program/programStageList.vm javascript/programStage.js - + /main.vm @@ -377,7 +377,7 @@ style/basic.css F_PROGRAMSTAGE_ADD - + programStage.action?id=${id} @@ -814,8 +814,8 @@ plainTextError - - /dhis-web-maintenance-program/jsonOptions.vm @@ -959,9 +959,10 @@ - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - /dhis-web-commons/ajax/jsonResponseError.vm + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + /dhis-web-commons/ajax/jsonResponseError.vm plainTextError @@ -1075,7 +1076,8 @@ class="org.hisp.dhis.trackedentity.action.programindicator.GetProgramIndicatorDescriptionAction"> /dhis-web-commons/ajax/jsonResponseSuccess.vm - + + /dhis-web-commons/ajax/jsonResponseError.vm === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2015-03-19 09:29:29 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2015-04-08 04:43:57 +0000 @@ -91,7 +91,7 @@ - + @@ -102,16 +102,27 @@ - + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js 2014-07-02 12:11:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js 2015-04-08 04:43:57 +0000 @@ -82,19 +82,25 @@ function typeOnChange() { var type = getFieldValue('valueType'); - if( type=="optionSet"){ + + hideById("optionSetRow"); + disable("optionSetId"); + hideById("trackedEntityRow"); + disable("trackedEntityId"); + + if( type == "optionSet" ) { showById("optionSetRow"); enable("optionSetId"); } - else{ - hideById("optionSetRow"); - disable("optionSetId"); + else if( type == "trackerAssociate" ) { + showById("trackedEntityRow"); + enable("trackedEntityId"); } - - if( type=="number" || type=='string' || type=='letter' || type=='phoneNumber' ){ + + if( type == "number" || type == 'string' || type == 'letter' || type == 'phoneNumber' ) { enable("unique"); } - else{ + else { disable("unique"); } } @@ -119,4 +125,3 @@ jQuery('#valueType [value=optionSet]').show(); } } - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2015-03-19 09:29:29 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2015-04-08 04:43:57 +0000 @@ -87,19 +87,19 @@ - + - + - - - + + + - - + + - + + + + + + +