dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38127
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19463: Remove the TrackedEntityForm object; Include an association for Program and DataEntryForm.
------------------------------------------------------------
revno: 19463
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-06-19 14:35:50 +0700
message:
Remove the TrackedEntityForm object; Include an association for Program and DataEntryForm.
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityFormSchemaDescriptor.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityForm.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormStore.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormDeletionHandler.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityFormStore.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityForm.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormServiceTest.java
dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormStoreTest.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityFormController.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetTrackedEntityFormListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/RemoveTrackedEntityFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntityForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm
renamed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveTrackedEntityFormSettingAction.java => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveProgramEntryFormSettingAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowTrackedEntityFormAction.java => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewTrackedEntityFormAction.java => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/trackedEntityForm.js => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewTrackedEntityForm.js => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewProgramEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewTrackedEntityForm.vm => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
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/webapp/dhis-web-maintenance-program/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/menu.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveProgramEntryFormSettingAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewProgramEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.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 2015-04-08 11:07:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2015-06-19 07:35:50 +0000
@@ -34,6 +34,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
@@ -44,6 +45,7 @@
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.schema.annotation.PropertyRange;
@@ -132,6 +134,8 @@
*/
private Set<AttributeValue> attributeValues = new HashSet<>();
+ private DataEntryForm dataEntryForm;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -616,6 +620,19 @@
this.attributeValues = attributeValues;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( localName = "dataEntryForm", namespace = DxfNamespaces.DXF_2_0 )
+ public DataEntryForm getDataEntryForm()
+ {
+ return dataEntryForm;
+ }
+
+ public void setDataEntryForm( DataEntryForm dataEntryForm )
+ {
+ this.dataEntryForm = dataEntryForm;
+ }
+
@Override
public void mergeWith( IdentifiableObject other, MergeStrategy strategy )
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2015-06-16 17:43:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2015-06-19 07:35:50 +0000
@@ -28,10 +28,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
import java.util.List;
+import java.util.regex.Pattern;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.trackedentity.TrackedEntity;
+import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.user.User;
import org.hisp.dhis.validation.ValidationCriteria;
@@ -41,8 +46,25 @@
*/
public interface ProgramService
{
+
String ID = ProgramService.class.getName();
+ final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?/>)", Pattern.DOTALL );
+
+ final Pattern DYNAMIC_ATTRIBUTE_PATTERN = Pattern.compile( "attributeid=\"(\\w+)\"" );
+
+ final Pattern PROGRAM_PATTERN = Pattern.compile( "programid=\"(\\w+)\"" );
+
+ final Pattern VALUE_TAG_PATTERN = Pattern.compile( "value=\"(.*?)\"", Pattern.DOTALL );
+
+ final Pattern TITLE_TAG_PATTERN = Pattern.compile( "title=\"(.*?)\"", Pattern.DOTALL );
+
+ final Pattern SUGGESTED_VALUE_PATTERN = Pattern.compile( "suggested=('|\")(\\w*)('|\")" );
+
+ final Pattern CLASS_PATTERN = Pattern.compile( "class=('|\")(\\w*)('|\")" );
+
+ final Pattern STYLE_PATTERN = Pattern.compile( "style=('|\")([\\w|\\d\\:\\;]+)('|\")" );
+
/**
* Adds an {@link Program}
*
@@ -87,7 +109,7 @@
* Returns all {@link Program}.
*
* @return a collection of all Program, or an empty collection if there are
- * no Programs.
+ * no Programs.
*/
List<Program> getAllPrograms();
@@ -117,8 +139,8 @@
* Get {@link Program} by the current user and a certain type
*
* @param type The type of program. There are three types, include Multi
- * events with registration, Single event with registration and
- * Single event without registration.
+ * events with registration, Single event with registration and
+ * Single event without registration.
* @return Program list by a type specified
*/
List<Program> getProgramsByCurrentUser( int type );
@@ -136,8 +158,8 @@
* Get {@link Program} by a type
*
* @param type The type of program. There are three types, include Multi
- * events with registration, Single event with registration and
- * Single event without registration
+ * events with registration, Single event with registration and
+ * Single event without registration
* @return Program list by a type specified
*/
List<Program> getPrograms( int type );
@@ -145,9 +167,9 @@
/**
* Get {@link Program} assigned to an {@link OrganisationUnit} by a type
*
- * @param type The type of program. There are three types, include Multi
- * events with registration, Single event with registration and
- * Single event without registration
+ * @param type The type of program. There are three types, include Multi
+ * events with registration, Single event with registration and
+ * Single event without registration
* @param orgunit Where programs assigned
* @return Program list by a type specified
*/
@@ -187,10 +209,10 @@
* Returns {@link Program} list with paging
*
* @param name Keyword for searching by name
- * @param min First result
- * @param max Maximum results
- * @return a List of all Program, or an empty collection if
- * there are no Program.
+ * @param min First result
+ * @param max Maximum results
+ * @return a List of all Program, or an empty collection if there are no
+ * Program.
*/
List<Program> getProgramBetweenByName( String name, int min, int max );
@@ -204,8 +226,7 @@
*
* @param min First result
* @param max Maximum results
- * @return a List of all Program, or an empty List if
- * there are no Program.
+ * @return a List of all Program, or an empty List if there are no Program.
*/
List<Program> getProgramsBetween( int min, int max );
@@ -220,9 +241,22 @@
* Get {@link Program} by the current user and a certain type
*
* @param type The type of program. There are three types, include Multi
- * events with registration, Single event with registration and
- * Single event without registration.
+ * events with registration, Single event with registration and
+ * Single event without registration.
* @return Program list by a type specified
*/
List<Program> getByCurrentUser( int type );
+
+ /**
+ * @param htmlCode
+ * @param program
+ * @param healthWorkers
+ * @param instance
+ * @param programInstance
+ * @param i18n
+ * @param format
+ * @return
+ */
+ String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection<User> healthWorkers,
+ TrackedEntityInstance instance, ProgramInstance programInstance, I18n i18n, I18nFormat format );
}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityFormSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityFormSchemaDescriptor.java 2015-04-29 07:11:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityFormSchemaDescriptor.java 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-package org.hisp.dhis.schema.descriptors;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import com.google.common.collect.Lists;
-import org.hisp.dhis.schema.Authority;
-import org.hisp.dhis.schema.AuthorityType;
-import org.hisp.dhis.schema.Schema;
-import org.hisp.dhis.schema.SchemaDescriptor;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.springframework.stereotype.Component;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Component
-public class TrackedEntityFormSchemaDescriptor implements SchemaDescriptor
-{
- public static final String SINGULAR = "trackedEntityForm";
-
- public static final String PLURAL = "trackedEntityForms";
-
- public static final String API_ENDPOINT = "/" + PLURAL;
-
- @Override
- public Schema getSchema()
- {
- Schema schema = new Schema( TrackedEntityForm.class, SINGULAR, PLURAL );
- schema.setRelativeApiEndpoint( API_ENDPOINT );
- schema.setOrder( 1490 );
- schema.setMetadata( false );
-
- schema.getAuthorities().add( new Authority( AuthorityType.CREATE, Lists.newArrayList( "F_TRACKED_ENTITY_FORM_ADD" ) ) );
- schema.getAuthorities().add( new Authority( AuthorityType.UPDATE, Lists.newArrayList( "F_TRACKED_ENTITY_FORM_ADD" ) ) );
- schema.getAuthorities().add( new Authority( AuthorityType.DELETE, Lists.newArrayList( "F_TRACKED_ENTITY_FORM_DELETE" ) ) );
-
- return schema;
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityForm.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityForm.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityForm.java 1970-01-01 00:00:00 +0000
@@ -1,158 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.common.MergeStrategy;
-import org.hisp.dhis.common.view.DetailedView;
-import org.hisp.dhis.common.view.ExportView;
-import org.hisp.dhis.dataentryform.DataEntryForm;
-import org.hisp.dhis.program.Program;
-
-import java.util.Objects;
-
-/**
- * @author Chau Thu Tran
- */
-@JacksonXmlRootElement( localName = "trackedEntityForm", namespace = DxfNamespaces.DXF_2_0 )
-public class TrackedEntityForm
- extends BaseIdentifiableObject
-{
- private static final long serialVersionUID = -6000530171659755186L;
-
- private Program program;
-
- private DataEntryForm dataEntryForm;
-
- // -------------------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------------------
-
- public TrackedEntityForm()
- {
- }
-
- public TrackedEntityForm( DataEntryForm dataEntryForm )
- {
- this.dataEntryForm = dataEntryForm;
- }
-
- public TrackedEntityForm( Program program, DataEntryForm dataEntryForm )
- {
- this.program = program;
- this.dataEntryForm = dataEntryForm;
- }
-
- // -------------------------------------------------------------------------
- // Getters && Setters
- // -------------------------------------------------------------------------
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JsonSerialize( as = BaseIdentifiableObject.class )
- @JacksonXmlProperty( localName = "program", namespace = DxfNamespaces.DXF_2_0 )
- public Program getProgram()
- {
- return program;
- }
-
- public void setProgram( Program program )
- {
- this.program = program;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( localName = "dataEntryForm", namespace = DxfNamespaces.DXF_2_0 )
- public DataEntryForm getDataEntryForm()
- {
- return dataEntryForm;
- }
-
- public void setDataEntryForm( DataEntryForm dataEntryForm )
- {
- this.dataEntryForm = dataEntryForm;
- }
-
- @Override
- public int hashCode()
- {
- return 31 * super.hashCode() + Objects.hash( program, dataEntryForm );
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null || getClass() != obj.getClass() )
- {
- return false;
- }
- if ( !super.equals( obj ) )
- {
- return false;
- }
-
- final TrackedEntityForm other = (TrackedEntityForm) obj;
-
- return Objects.equals( this.program, other.program ) && Objects.equals( this.dataEntryForm, other.dataEntryForm );
- }
-
- @Override
- public void mergeWith( IdentifiableObject other, MergeStrategy strategy )
- {
- super.mergeWith( other, strategy );
-
- if ( other.getClass().isInstance( this ) )
- {
- TrackedEntityForm trackedEntityForm = (TrackedEntityForm) other;
-
- if ( strategy.isReplace() )
- {
- program = trackedEntityForm.getProgram();
- dataEntryForm = trackedEntityForm.getDataEntryForm();
- }
- else if ( strategy.isMerge() )
- {
- program = trackedEntityForm.getProgram() == null ? program : trackedEntityForm.getProgram();
- dataEntryForm = trackedEntityForm.getDataEntryForm() == null ? dataEntryForm : trackedEntityForm.getDataEntryForm();
- }
- }
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormService.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormService.java 1970-01-01 00:00:00 +0000
@@ -1,141 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.user.User;
-
-/**
- * @author Chau Thu Tran
- *
- * @version TrackedEntityFormService.java 9:35:44 AM Jan 31, 2013 $
- */
-public interface TrackedEntityFormService
-{
- final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?/>)", Pattern.DOTALL );
-
- final Pattern DYNAMIC_ATTRIBUTE_PATTERN = Pattern.compile( "attributeid=\"(\\w+)\"" );
-
- final Pattern PROGRAM_PATTERN = Pattern.compile( "programid=\"(\\w+)\"" );
-
- final Pattern VALUE_TAG_PATTERN = Pattern.compile( "value=\"(.*?)\"", Pattern.DOTALL );
-
- final Pattern TITLE_TAG_PATTERN = Pattern.compile( "title=\"(.*?)\"", Pattern.DOTALL );
-
- final Pattern SUGGESTED_VALUE_PATTERN = Pattern.compile( "suggested=('|\")(\\w*)('|\")" );
-
- final Pattern CLASS_PATTERN = Pattern.compile( "class=('|\")(\\w*)('|\")" );
-
- final Pattern STYLE_PATTERN = Pattern.compile( "style=('|\")([\\w|\\d\\:\\;]+)('|\")" );
-
- // --------------------------------------------------------------------------
- // ProgramDataEntryService
- // --------------------------------------------------------------------------
-
- /**
- * Adds an {@link TrackedEntityForm}
- *
- * @param trackedEntityForm The to TrackedEntityForm add.
- *
- * @return A generated unique id of the added {@link TrackedEntityForm}.
- */
- int saveTrackedEntityForm( TrackedEntityForm trackedEntityForm );
-
- /**
- * Deletes a {@link TrackedEntityForm}.
- *
- * @param trackedEntityForm the TrackedEntityForm to delete.
- */
- void deleteTrackedEntityForm( TrackedEntityForm trackedEntityForm );
-
- /**
- * Updates an {@link TrackedEntityForm}.
- *
- * @param instanceAttribute the TrackedEntityForm to update.
- */
- void updateTrackedEntityForm( TrackedEntityForm trackedEntityForm );
-
- /**
- * Returns a {@link TrackedEntityForm}.
- *
- * @param id the id of the TrackedEntityForm to return.
- *
- * @return the TrackedEntityForm with the given id
- */
- TrackedEntityForm getTrackedEntityForm( int id );
-
- /**
- * Returns all {@link TrackedEntityForm}
- *
- * @return a collection of all TrackedEntityForm, or an empty collection if
- * there are no TrackedEntityForms.
- */
- List<TrackedEntityForm> getAllTrackedEntityForms();
-
- /**
- * Get tracked entity form of a program
- *
- * @param program Program
- *
- * @return TrackedEntityForm
- */
- TrackedEntityForm getFormsWithProgram( Program program );
-
- /**
- * Get tracked entity form which doesn't belong to any program
- *
- * @return TrackedEntityForm
- */
- TrackedEntityForm getFormsWithoutProgram();
-
- /**
- * Prepares the custom registration by injecting required javascripts and
- * drop down lists.
- *
- * @param htmlCode the HTML code of the data entry form.
- * @param program Program which include a custom entry form
- * @param healthWorkers DHIS users list
- * @param instance TrackedEntityInstance
- * @param programInstance Program-instance of the instance
- * @param i18n the i18n object
- * @param format the I18nFormat object
- *
- * @return HTML code for the form.
- */
- String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection<User> healthWorkers,
- TrackedEntityInstance instance, ProgramInstance programInstance, I18n i18n, I18nFormat format );
-
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormStore.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormStore.java 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.program.Program;
-
-/**
- * @author Chau Thu Tran
- */
-public interface TrackedEntityFormStore
- extends GenericIdentifiableObjectStore<TrackedEntityForm>
-{
- String ID = TrackedEntityFormStore.class.getName();
-
- /**
- * Get tracked entity form of a program
- *
- * @param program Program
- * @return TrackedEntityForm
- */
- TrackedEntityForm get( Program program );
-
- /**
- * Get tracked entity form which doesn't belong to any program
- *
- * @return TrackedEntityForm
- */
- TrackedEntityForm getFormsWithoutProgram();
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java 2015-04-09 19:00:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java 2015-06-19 07:35:50 +0000
@@ -71,6 +71,10 @@
executeSql( "ALTER TABLE program DROP COLUMN displayonallorgunit" );
upgradeProgramStageDataElements();
+
+ executeSql( "UPDATE program SET dataentryformid =(SELECT trackedentityform.dataentryformid FROM trackedentityform WHERE program.programid=trackedentityform.programid) " +
+ "WHERE program.programid = (SELECT trackedentityform.programid FROM trackedentityform WHERE program.programid = trackedentityform.programid)" );
+// executeSql( "drop table trackedentityform");
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2015-06-16 17:43:23 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2015-06-19 07:35:50 +0000
@@ -31,17 +31,30 @@
import static org.hisp.dhis.i18n.I18nUtils.i18n;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
import java.util.List;
import java.util.Set;
+import java.util.regex.Matcher;
+import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.option.Option;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.trackedentity.TrackedEntity;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
+import org.hisp.dhis.trackedentity.TrackedEntityInstance;
+import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
+import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserService;
import org.hisp.dhis.validation.ValidationCriteria;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Sets;
@@ -53,6 +66,16 @@
public class DefaultProgramService
implements ProgramService
{
+ private static final String TAG_OPEN = "<";
+
+ private static final String TAG_CLOSE = "/>";
+
+ private static final String PROGRAM_INCIDENT_DATE = "dateOfIncident";
+
+ private static final String PROGRAM_ENROLLMENT_DATE = "enrollmentDate";
+
+ private static final String DOB_FIELD = "@DOB_FIELD";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -85,6 +108,12 @@
this.userService = userService;
}
+ @Autowired
+ private TrackedEntityAttributeService attributeService;
+
+ @Autowired
+ private TrackedEntityAttributeValueService attributeValueService;
+
// -------------------------------------------------------------------------
// Implementation methods
// -------------------------------------------------------------------------
@@ -278,4 +307,261 @@
return programs;
}
+
+
+ @Override
+ public String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection<User> healthWorkers,
+ TrackedEntityInstance instance, ProgramInstance programInstance, I18n i18n, I18nFormat format )
+ {
+ int index = 1;
+
+ StringBuffer sb = new StringBuffer();
+
+ Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode );
+
+ boolean hasBirthdate = false;
+ boolean hasAge = false;
+
+ while ( inputMatcher.find() )
+ {
+ // -----------------------------------------------------------------
+ // Get HTML input field code
+ // -----------------------------------------------------------------
+
+ String inputHtml = inputMatcher.group();
+ Matcher dynamicAttrMatcher = DYNAMIC_ATTRIBUTE_PATTERN.matcher( inputHtml );
+ Matcher programMatcher = PROGRAM_PATTERN.matcher( inputHtml );
+
+ index++;
+
+ String hidden = "";
+ String style = "";
+ Matcher classMarcher = CLASS_PATTERN.matcher( inputHtml );
+ if ( classMarcher.find() )
+ {
+ hidden = classMarcher.group( 2 );
+ }
+
+ Matcher styleMarcher = STYLE_PATTERN.matcher( inputHtml );
+ if ( styleMarcher.find() )
+ {
+ style = styleMarcher.group( 2 );
+ }
+
+ if ( dynamicAttrMatcher.find() && dynamicAttrMatcher.groupCount() > 0 )
+ {
+ String uid = dynamicAttrMatcher.group( 1 );
+ TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
+
+ if ( attribute == null )
+ {
+ inputHtml = "<input value='[" + i18n.getString( "missing_instance_attribute" ) + " " + uid
+ + "]' title='[" + i18n.getString( "missing_instance_attribute" ) + " " + uid + "]'>/";
+ }
+ else
+ {
+ // Get value
+ String value = "";
+ if ( instance != null )
+ {
+ TrackedEntityAttributeValue attributeValue = attributeValueService
+ .getTrackedEntityAttributeValue( instance, attribute );
+ if ( attributeValue != null )
+ {
+ value = attributeValue.getValue();
+ }
+ }
+
+ inputHtml = getAttributeField( inputHtml, attribute, program, value, i18n, index, hidden, style );
+
+ }
+
+ }
+ else if ( programMatcher.find() && programMatcher.groupCount() > 0 )
+ {
+ String property = programMatcher.group( 1 );
+
+ // Get value
+ String value = "";
+ if ( programInstance != null )
+ {
+ value = format.formatDate( ((Date) getValueFromProgram( StringUtils.capitalize( property ),
+ programInstance )) );
+ }
+
+ inputHtml = "<input id=\"" + property + "\" name=\"" + property + "\" tabindex=\"" + index
+ + "\" value=\"" + value + "\" " + TAG_CLOSE;
+ if ( property.equals( PROGRAM_ENROLLMENT_DATE ) )
+ {
+ if ( program != null && program.getSelectEnrollmentDatesInFuture() )
+ {
+ inputHtml += "<script>datePicker(\"" + property + "\", true);</script>";
+ }
+ else
+ {
+ inputHtml += "<script>datePickerValid(\"" + property + "\", true);</script>";
+ }
+ }
+ else if ( property.equals( PROGRAM_INCIDENT_DATE ) )
+ {
+ if ( program != null && program.getSelectIncidentDatesInFuture() )
+ {
+ inputHtml += "<script>datePicker(\"" + property + "\", true);</script>";
+ }
+ else
+ {
+ inputHtml += "<script>datePickerValid(\"" + property + "\", true);</script>";
+ }
+ }
+ }
+
+ inputMatcher.appendReplacement( sb, inputHtml );
+ }
+
+ inputMatcher.appendTail( sb );
+
+ String entryForm = sb.toString();
+ String dobType = "";
+ if ( hasBirthdate && hasAge )
+ {
+ dobType = "<select id=\'dobType\' name=\"dobType\" style=\'width:120px\' onchange=\'dobTypeOnChange(\"instanceForm\")\' >";
+ dobType += "<option value=\"V\" >" + i18n.getString( "verified" ) + "</option>";
+ dobType += "<option value=\"D\" >" + i18n.getString( "declared" ) + "</option>";
+ dobType += "<option value=\"A\" >" + i18n.getString( "approximated" ) + "</option>";
+ dobType += "</select>";
+ }
+ else if ( hasBirthdate )
+ {
+ dobType = "<input type=\'hidden\' id=\'dobType\' name=\"dobType\" value=\'V\'>";
+ }
+ else if ( hasAge )
+ {
+ dobType = "<input type=\'hidden\' id=\'dobType\' name=\"dobType\" value=\'A\'>";
+ }
+
+ entryForm = entryForm.replaceFirst( DOB_FIELD, dobType );
+ entryForm = entryForm.replaceAll( DOB_FIELD, "" );
+
+ return entryForm;
+ }
+
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private String getAttributeField( String inputHtml, TrackedEntityAttribute attribute, Program program,
+ String value, I18n i18n, int index, String hidden, String style )
+ {
+ boolean mandatory = false;
+ boolean allowDateInFuture = false;
+
+ if ( program != null && program.getAttribute( attribute ) != null )
+ {
+ ProgramTrackedEntityAttribute programAttribute = program.getAttribute( attribute );
+ mandatory = programAttribute.isMandatory();
+ allowDateInFuture = programAttribute.getAllowFutureDate();
+ }
+
+ inputHtml = TAG_OPEN + "input id=\"attr" + attribute.getId() + "\" name=\"attr" + attribute.getId()
+ + "\" tabindex=\"" + index + "\" style=\"" + style + "\"";
+
+ inputHtml += "\" class=\"" + hidden + " {validate:{required:" + mandatory;
+ if ( TrackedEntityAttribute.TYPE_NUMBER.equals( attribute.getValueType() ) )
+ {
+ inputHtml += ",number:true";
+ }
+ else if ( TrackedEntityAttribute.TYPE_PHONE_NUMBER.equals( attribute.getValueType() ) )
+ {
+ inputHtml += ",phone:true";
+ }
+ inputHtml += "}}\" ";
+
+
+ if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_PHONE_NUMBER ) )
+ {
+ inputHtml += " phoneNumber value=\"" + value + "\"" + TAG_CLOSE;
+ }
+ else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_TRUE_ONLY ) )
+ {
+ inputHtml += " type='checkbox' value='true' ";
+ if ( value.equals( "true" ) )
+ {
+ inputHtml += " checked ";
+ }
+ }
+ else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_BOOL ) )
+ {
+ inputHtml = inputHtml.replaceFirst( "input", "select" ) + ">";
+
+ if ( value.equals( "" ) )
+ {
+ inputHtml += "<option value=\"\" selected>" + i18n.getString( "no_value" ) + "</option>";
+ inputHtml += "<option value=\"true\">" + i18n.getString( "yes" ) + "</option>";
+ inputHtml += "<option value=\"false\">" + i18n.getString( "no" ) + "</option>";
+ }
+ else if ( value.equals( "true" ) )
+ {
+ inputHtml += "<option value=\"\">" + i18n.getString( "no_value" ) + "</option>";
+ inputHtml += "<option value=\"true\" selected >" + i18n.getString( "yes" ) + "</option>";
+ inputHtml += "<option value=\"false\">" + i18n.getString( "no" ) + "</option>";
+ }
+ else if ( value.equals( "false" ) )
+ {
+ inputHtml += "<option value=\"\">" + i18n.getString( "no_value" ) + "</option>";
+ inputHtml += "<option value=\"true\">" + i18n.getString( "yes" ) + "</option>";
+ inputHtml += "<option value=\"false\" selected >" + i18n.getString( "no" ) + "</option>";
+ }
+
+ inputHtml += "</select>";
+ }
+ else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
+ {
+ inputHtml = inputHtml.replaceFirst( "input", "select" ) + ">";
+ inputHtml += "<option value=\"\" selected>" + i18n.getString( "no_value" ) + "</option>";
+ for ( Option option : attribute.getOptionSet().getOptions() )
+ {
+ String optionValue = option.getName();
+ inputHtml += "<option value=\"" + optionValue + "\" ";
+ if ( optionValue.equals( value ) )
+ {
+ inputHtml += " selected ";
+ }
+ inputHtml += ">" + optionValue + "</option>";
+ }
+ inputHtml += "</select>";
+ }
+ else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_DATE ) )
+ {
+ String jQueryCalendar = "<script>";
+ if( allowDateInFuture ){
+ jQueryCalendar += "datePicker";
+ }
+ else{
+ jQueryCalendar += "datePickerValid";
+ }
+ jQueryCalendar += "(\"attr" + attribute.getId() + "\", false, false);</script>";
+
+ inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
+ inputHtml += jQueryCalendar;
+ }
+ else
+ {
+ inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
+ }
+
+ return inputHtml;
+ }
+
+ private Object getValueFromProgram( String property, ProgramInstance programInstance )
+ {
+ try
+ {
+ return ProgramInstance.class.getMethod( "get" + property ).invoke( programInstance );
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ return null;
+ }
}
=== removed file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java 1970-01-01 00:00:00 +0000
@@ -1,392 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.regex.Matcher;
-
-import org.apache.commons.lang3.StringUtils;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.option.Option;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
-import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
-import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
-import org.hisp.dhis.user.User;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author Chau Thu Tran
- */
-@Transactional
-public class DefaultTrackedEntityFormService
- implements TrackedEntityFormService
-{
- private static final String TAG_OPEN = "<";
-
- private static final String TAG_CLOSE = "/>";
-
- private static final String PROGRAM_INCIDENT_DATE = "dateOfIncident";
-
- private static final String PROGRAM_ENROLLMENT_DATE = "enrollmentDate";
-
- private static final String DOB_FIELD = "@DOB_FIELD";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private TrackedEntityFormStore formStore;
-
- public void setFormStore( TrackedEntityFormStore formStore )
- {
- this.formStore = formStore;
- }
-
- private TrackedEntityAttributeService attributeService;
-
- public void setAttributeService( TrackedEntityAttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
- private TrackedEntityAttributeValueService attributeValueService;
-
- public void setAttributeValueService( TrackedEntityAttributeValueService attributeValueService )
- {
- this.attributeValueService = attributeValueService;
- }
-
- // -------------------------------------------------------------------------
- // TrackedEntityForm implementation
- // -------------------------------------------------------------------------
-
- @Override
- public int saveTrackedEntityForm( TrackedEntityForm registrationForm )
- {
- return formStore.save( registrationForm );
- }
-
- @Override
- public void deleteTrackedEntityForm( TrackedEntityForm registrationForm )
- {
- formStore.delete( registrationForm );
- }
-
- @Override
- public void updateTrackedEntityForm( TrackedEntityForm registrationForm )
- {
- formStore.update( registrationForm );
- }
-
- @Override
- public TrackedEntityForm getTrackedEntityForm( int id )
- {
- return formStore.get( id );
- }
-
- @Override
- public List<TrackedEntityForm> getAllTrackedEntityForms()
- {
- return formStore.getAll();
- }
-
- @Override
- public TrackedEntityForm getFormsWithProgram( Program program )
- {
- return formStore.get( program );
- }
-
- @Override
- public TrackedEntityForm getFormsWithoutProgram()
- {
- return formStore.getFormsWithoutProgram();
- }
-
- @Override
- public String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection<User> healthWorkers,
- TrackedEntityInstance instance, ProgramInstance programInstance, I18n i18n, I18nFormat format )
- {
- int index = 1;
-
- StringBuffer sb = new StringBuffer();
-
- Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode );
-
- boolean hasBirthdate = false;
- boolean hasAge = false;
-
- while ( inputMatcher.find() )
- {
- // -----------------------------------------------------------------
- // Get HTML input field code
- // -----------------------------------------------------------------
-
- String inputHtml = inputMatcher.group();
- Matcher dynamicAttrMatcher = DYNAMIC_ATTRIBUTE_PATTERN.matcher( inputHtml );
- Matcher programMatcher = PROGRAM_PATTERN.matcher( inputHtml );
-
- index++;
-
- String hidden = "";
- String style = "";
- Matcher classMarcher = CLASS_PATTERN.matcher( inputHtml );
- if ( classMarcher.find() )
- {
- hidden = classMarcher.group( 2 );
- }
-
- Matcher styleMarcher = STYLE_PATTERN.matcher( inputHtml );
- if ( styleMarcher.find() )
- {
- style = styleMarcher.group( 2 );
- }
-
- if ( dynamicAttrMatcher.find() && dynamicAttrMatcher.groupCount() > 0 )
- {
- String uid = dynamicAttrMatcher.group( 1 );
- TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
-
- if ( attribute == null )
- {
- inputHtml = "<input value='[" + i18n.getString( "missing_instance_attribute" ) + " " + uid
- + "]' title='[" + i18n.getString( "missing_instance_attribute" ) + " " + uid + "]'>/";
- }
- else
- {
- // Get value
- String value = "";
- if ( instance != null )
- {
- TrackedEntityAttributeValue attributeValue = attributeValueService
- .getTrackedEntityAttributeValue( instance, attribute );
- if ( attributeValue != null )
- {
- value = attributeValue.getValue();
- }
- }
-
- inputHtml = getAttributeField( inputHtml, attribute, program, value, i18n, index, hidden, style );
-
- }
-
- }
- else if ( programMatcher.find() && programMatcher.groupCount() > 0 )
- {
- String property = programMatcher.group( 1 );
-
- // Get value
- String value = "";
- if ( programInstance != null )
- {
- value = format.formatDate( ((Date) getValueFromProgram( StringUtils.capitalize( property ),
- programInstance )) );
- }
-
- inputHtml = "<input id=\"" + property + "\" name=\"" + property + "\" tabindex=\"" + index
- + "\" value=\"" + value + "\" " + TAG_CLOSE;
- if ( property.equals( PROGRAM_ENROLLMENT_DATE ) )
- {
- if ( program != null && program.getSelectEnrollmentDatesInFuture() )
- {
- inputHtml += "<script>datePicker(\"" + property + "\", true);</script>";
- }
- else
- {
- inputHtml += "<script>datePickerValid(\"" + property + "\", true);</script>";
- }
- }
- else if ( property.equals( PROGRAM_INCIDENT_DATE ) )
- {
- if ( program != null && program.getSelectIncidentDatesInFuture() )
- {
- inputHtml += "<script>datePicker(\"" + property + "\", true);</script>";
- }
- else
- {
- inputHtml += "<script>datePickerValid(\"" + property + "\", true);</script>";
- }
- }
- }
-
- inputMatcher.appendReplacement( sb, inputHtml );
- }
-
- inputMatcher.appendTail( sb );
-
- String entryForm = sb.toString();
- String dobType = "";
- if ( hasBirthdate && hasAge )
- {
- dobType = "<select id=\'dobType\' name=\"dobType\" style=\'width:120px\' onchange=\'dobTypeOnChange(\"instanceForm\")\' >";
- dobType += "<option value=\"V\" >" + i18n.getString( "verified" ) + "</option>";
- dobType += "<option value=\"D\" >" + i18n.getString( "declared" ) + "</option>";
- dobType += "<option value=\"A\" >" + i18n.getString( "approximated" ) + "</option>";
- dobType += "</select>";
- }
- else if ( hasBirthdate )
- {
- dobType = "<input type=\'hidden\' id=\'dobType\' name=\"dobType\" value=\'V\'>";
- }
- else if ( hasAge )
- {
- dobType = "<input type=\'hidden\' id=\'dobType\' name=\"dobType\" value=\'A\'>";
- }
-
- entryForm = entryForm.replaceFirst( DOB_FIELD, dobType );
- entryForm = entryForm.replaceAll( DOB_FIELD, "" );
-
- return entryForm;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private String getAttributeField( String inputHtml, TrackedEntityAttribute attribute, Program program,
- String value, I18n i18n, int index, String hidden, String style )
- {
- boolean mandatory = false;
- boolean allowDateInFuture = false;
-
- if ( program != null && program.getAttribute( attribute ) != null )
- {
- ProgramTrackedEntityAttribute programAttribute = program.getAttribute( attribute );
- mandatory = programAttribute.isMandatory();
- allowDateInFuture = programAttribute.getAllowFutureDate();
- }
-
- inputHtml = TAG_OPEN + "input id=\"attr" + attribute.getId() + "\" name=\"attr" + attribute.getId()
- + "\" tabindex=\"" + index + "\" style=\"" + style + "\"";
-
- inputHtml += "\" class=\"" + hidden + " {validate:{required:" + mandatory;
- if ( TrackedEntityAttribute.TYPE_NUMBER.equals( attribute.getValueType() ) )
- {
- inputHtml += ",number:true";
- }
- else if ( TrackedEntityAttribute.TYPE_PHONE_NUMBER.equals( attribute.getValueType() ) )
- {
- inputHtml += ",phone:true";
- }
- inputHtml += "}}\" ";
-
-
- if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_PHONE_NUMBER ) )
- {
- inputHtml += " phoneNumber value=\"" + value + "\"" + TAG_CLOSE;
- }
- else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_TRUE_ONLY ) )
- {
- inputHtml += " type='checkbox' value='true' ";
- if ( value.equals( "true" ) )
- {
- inputHtml += " checked ";
- }
- }
- else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_BOOL ) )
- {
- inputHtml = inputHtml.replaceFirst( "input", "select" ) + ">";
-
- if ( value.equals( "" ) )
- {
- inputHtml += "<option value=\"\" selected>" + i18n.getString( "no_value" ) + "</option>";
- inputHtml += "<option value=\"true\">" + i18n.getString( "yes" ) + "</option>";
- inputHtml += "<option value=\"false\">" + i18n.getString( "no" ) + "</option>";
- }
- else if ( value.equals( "true" ) )
- {
- inputHtml += "<option value=\"\">" + i18n.getString( "no_value" ) + "</option>";
- inputHtml += "<option value=\"true\" selected >" + i18n.getString( "yes" ) + "</option>";
- inputHtml += "<option value=\"false\">" + i18n.getString( "no" ) + "</option>";
- }
- else if ( value.equals( "false" ) )
- {
- inputHtml += "<option value=\"\">" + i18n.getString( "no_value" ) + "</option>";
- inputHtml += "<option value=\"true\">" + i18n.getString( "yes" ) + "</option>";
- inputHtml += "<option value=\"false\" selected >" + i18n.getString( "no" ) + "</option>";
- }
-
- inputHtml += "</select>";
- }
- else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
- {
- inputHtml = inputHtml.replaceFirst( "input", "select" ) + ">";
- inputHtml += "<option value=\"\" selected>" + i18n.getString( "no_value" ) + "</option>";
- for ( Option option : attribute.getOptionSet().getOptions() )
- {
- String optionValue = option.getName();
- inputHtml += "<option value=\"" + optionValue + "\" ";
- if ( optionValue.equals( value ) )
- {
- inputHtml += " selected ";
- }
- inputHtml += ">" + optionValue + "</option>";
- }
- inputHtml += "</select>";
- }
- else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_DATE ) )
- {
- String jQueryCalendar = "<script>";
- if( allowDateInFuture ){
- jQueryCalendar += "datePicker";
- }
- else{
- jQueryCalendar += "datePickerValid";
- }
- jQueryCalendar += "(\"attr" + attribute.getId() + "\", false, false);</script>";
-
- inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
- inputHtml += jQueryCalendar;
- }
- else
- {
- inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
- }
-
- return inputHtml;
- }
-
- private Object getValueFromProgram( String property, ProgramInstance programInstance )
- {
- try
- {
- return ProgramInstance.class.getMethod( "get" + property ).invoke( programInstance );
- }
- catch ( Exception ex )
- {
- ex.printStackTrace();
- }
- return null;
- }
-
-}
=== removed file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormDeletionHandler.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityFormDeletionHandler.java 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.system.deletion.DeletionHandler;
-
-/**
- * @author Chau Thu Tran
- */
-public class TrackedEntityFormDeletionHandler
- extends DeletionHandler
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private TrackedEntityFormService formService;
-
- public void setFormService( TrackedEntityFormService formService )
- {
- this.formService = formService;
- }
-
- // -------------------------------------------------------------------------
- // DeletionHandler implementation
- // -------------------------------------------------------------------------
-
- @Override
- public String getClassName()
- {
- return TrackedEntityForm.class.getSimpleName();
- }
-
- @Override
- public void deleteProgram( Program program )
- {
- TrackedEntityForm form = formService.getFormsWithProgram( program );
-
- if ( form != null )
- {
- formService.deleteTrackedEntityForm( form );
- }
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityFormStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityFormStore.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityFormStore.java 1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-package org.hisp.dhis.trackedentity.hibernate;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormStore;
-
-/**
- * @author Chau Thu Tran
- */
-public class HibernateTrackedEntityFormStore
- extends HibernateIdentifiableObjectStore<TrackedEntityForm>
- implements TrackedEntityFormStore
-{
- @Override
- public TrackedEntityForm get( Program program )
- {
- return (TrackedEntityForm) getCriteria( Restrictions.eq( "program", program ) ).uniqueResult();
- }
-
- @Override
- public TrackedEntityForm getFormsWithoutProgram()
- {
- return (TrackedEntityForm) getCriteria( Restrictions.isNull( "program" ) ).uniqueResult();
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml 2015-06-11 18:44:52 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml 2015-06-19 07:35:50 +0000
@@ -349,25 +349,6 @@
<property name="sessionFactory" ref="sessionFactory" />
</bean>
- <!-- TrackedEntityForm -->
-
- <bean id="org.hisp.dhis.trackedentity.TrackedEntityFormService"
- class="org.hisp.dhis.trackedentity.DefaultTrackedEntityFormService">
- <property name="formStore"
- ref="org.hisp.dhis.trackedentity.TrackedEntityFormStore" />
- <property name="attributeService"
- ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
- <property name="attributeValueService"
- ref="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService" />
- </bean>
-
- <bean id="org.hisp.dhis.trackedentity.TrackedEntityFormStore"
- class="org.hisp.dhis.trackedentity.hibernate.HibernateTrackedEntityFormStore">
- <property name="clazz"
- value="org.hisp.dhis.trackedentity.TrackedEntityForm" />
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
-
<!-- TrackedEntityInstanceReminder -->
<bean
@@ -415,7 +396,6 @@
<value>trackedentityattribute</value>
<value>trackedentityattributegroup</value>
<value>trackedentityinstancereminder</value>
- <value>trackedentityform</value>
<value>program</value>
<value>programindicator</value>
<value>programstage</value>
@@ -546,13 +526,6 @@
</bean>
<bean
- id="org.hisp.dhis.trackedentity.TrackedEntityFormDeletionHandler"
- class="org.hisp.dhis.trackedentity.TrackedEntityFormDeletionHandler">
- <property name="formService"
- ref="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
- </bean>
-
- <bean
id="org.hisp.dhis.eventchart.EventChartDeletionHandler"
class="org.hisp.dhis.eventchart.EventChartDeletionHandler">
</bean>
@@ -588,7 +561,6 @@
<ref bean="org.hisp.dhis.programrule.ProgramRuleDeletionHandler" />
<ref bean="org.hisp.dhis.programrule.ProgramRuleVariableDeletionHandler" />
<ref bean="org.hisp.dhis.programrule.ProgramRuleActionDeletionHandler" />
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityFormDeletionHandler" />
<ref bean="org.hisp.dhis.eventchart.EventChartDeletionHandler" />
<ref bean="org.hisp.dhis.eventreport.EventReportDeletionHandler" />
</list>
@@ -657,9 +629,6 @@
pointcut="execution( * org.hisp.dhis.caseaggregation.CaseAggregationConditionService.delete*(..) )"
method="intercept" />
<aop:before
- pointcut="execution( * org.hisp.dhis.trackedentity.TrackedEntityFormService.delete*(..) )"
- method="intercept" />
- <aop:before
pointcut="execution( * org.hisp.dhis.eventchart.EventChartService.delete*(..) )"
method="intercept" />
<aop:before
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2015-03-30 09:25:24 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2015-06-19 07:35:50 +0000
@@ -91,6 +91,9 @@
<many-to-one name="trackedEntity" class="org.hisp.dhis.trackedentity.TrackedEntity"
column="trackedentityid" foreign-key="fk_program_trackedentityid" />
+ <many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm"
+ column="dataentryformid" foreign-key="fk_program_dataentryformid" cascade="all" />
+
<!-- Dynamic attribute values -->
<set name="attributeValues" table="programattributevalues">
=== removed file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityForm.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityForm.hbm.xml 2014-12-05 15:27:18 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityForm.hbm.xml 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-<?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"
- [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
- >
-
-<hibernate-mapping>
- <class name="org.hisp.dhis.trackedentity.TrackedEntityForm" table="trackedentityform">
-
- <id name="id" column="trackedentityformid">
- <generator class="native" />
- </id>
-
- &identifiableProperties;
-
- <property name="name" column="name" length="230" />
-
- <many-to-one name="program" class="org.hisp.dhis.program.Program"
- column="programid" foreign-key="fk_trackedentityform_programid" />
-
- <many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm"
- column="dataentryformid" foreign-key="fk_trackedentityform_dataentryformid" cascade="all" />
-
- </class>
-</hibernate-mapping>
=== removed file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormServiceTest.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormServiceTest.java 1970-01-01 00:00:00 +0000
@@ -1,198 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-import java.util.List;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataentryform.DataEntryForm;
-import org.hisp.dhis.dataentryform.DataEntryFormService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStage;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- */
-public class TrackedEntityFormServiceTest
- extends DhisSpringTest
-{
- @Autowired
- private TrackedEntityFormService entityFormService;
-
- @Autowired
- private DataEntryFormService dataEntryFormService;
-
- @Autowired
- private ProgramService programService;
-
- @Autowired
- private OrganisationUnitService organisationUnitService;
-
- private TrackedEntityForm entityFormA;
-
- private TrackedEntityForm entityFormB;
-
- private TrackedEntityForm entityFormC;
-
- private Program programA;
-
- private Program programB;
-
- private DataEntryForm dataEntryForm;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- throws Exception
- {
- OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
- organisationUnitService.addOrganisationUnit( organisationUnit );
-
- programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
- programService.addProgram( programA );
-
- programB = createProgram( 'B', new HashSet<ProgramStage>(), organisationUnit );
- programService.addProgram( programB );
-
- DataEntryForm dataEntryFormA = new DataEntryForm( "DataEntryForm-A" );
- dataEntryFormService.addDataEntryForm( dataEntryFormA );
-
- DataEntryForm dataEntryFormB = new DataEntryForm( "DataEntryForm-B" );
- dataEntryFormService.addDataEntryForm( dataEntryFormB );
-
- DataEntryForm dataEntryFormC = new DataEntryForm( "DataEntryForm-C" );
- dataEntryFormService.addDataEntryForm( dataEntryFormC );
-
- entityFormA = new TrackedEntityForm( programA, dataEntryForm );
- entityFormB = new TrackedEntityForm( programB, dataEntryForm );
- entityFormC = new TrackedEntityForm( dataEntryForm );
- }
-
- @Test
- public void testsaveTrackedEntityForm()
- {
- int idA = entityFormService.saveTrackedEntityForm( entityFormA );
- int idB = entityFormService.saveTrackedEntityForm( entityFormB );
-
- assertNotNull( entityFormService.getTrackedEntityForm( idA ) );
- assertNotNull( entityFormService.getTrackedEntityForm( idB ) );
- }
-
- @Test
- public void testdeleteTrackedEntityForm()
- {
- int idA = entityFormService.saveTrackedEntityForm( entityFormA );
- int idB = entityFormService.saveTrackedEntityForm( entityFormB );
-
- assertNotNull( entityFormService.getTrackedEntityForm( idA ) );
- assertNotNull( entityFormService.getTrackedEntityForm( idB ) );
-
- entityFormService.deleteTrackedEntityForm( entityFormA );
-
- assertNull( entityFormService.getTrackedEntityForm( idA ) );
- assertNotNull( entityFormService.getTrackedEntityForm( idB ) );
-
- entityFormService.deleteTrackedEntityForm( entityFormB );
-
- assertNull( entityFormService.getTrackedEntityForm( idA ) );
- assertNull( entityFormService.getTrackedEntityForm( idB ) );
- }
-
- @Test
- public void testUpdateentityForm()
- {
- int idA = entityFormService.saveTrackedEntityForm( entityFormA );
-
- assertNotNull( entityFormService.getTrackedEntityForm( idA ) );
-
- entityFormA.setName( "B" );
- entityFormService.updateTrackedEntityForm( entityFormA );
-
- assertEquals( "B", entityFormService.getTrackedEntityForm( idA ).getName() );
- }
-
- @Test
- public void testgetTrackedEntityFormById()
- {
- int idA = entityFormService.saveTrackedEntityForm( entityFormA );
- int idB = entityFormService.saveTrackedEntityForm( entityFormB );
-
- assertEquals( entityFormA, entityFormService.getTrackedEntityForm( idA ) );
- assertEquals( entityFormB, entityFormService.getTrackedEntityForm( idB ) );
- }
-
- @Test
- public void testGetAllentityForms()
- {
- entityFormService.saveTrackedEntityForm( entityFormA );
- entityFormService.saveTrackedEntityForm( entityFormB );
-
- List<TrackedEntityForm> forms = entityFormService.getAllTrackedEntityForms();
- assertEquals( 2, forms.size() );
- assertTrue( forms.contains( entityFormA ) );
- assertTrue( forms.contains( entityFormB ) );
- }
-
- @Test
- public void testgetTrackedEntityFormByProgram()
- {
- entityFormService.saveTrackedEntityForm( entityFormA );
- entityFormService.saveTrackedEntityForm( entityFormB );
- entityFormService.saveTrackedEntityForm( entityFormC );
-
- TrackedEntityForm form = entityFormService.getFormsWithProgram( programA );
- assertEquals( entityFormA, form );
- }
-
- @Test
- public void testGetCommonentityForm()
- {
- entityFormService.saveTrackedEntityForm( entityFormA );
- entityFormService.saveTrackedEntityForm( entityFormB );
- entityFormService.saveTrackedEntityForm( entityFormC );
-
- TrackedEntityForm form = entityFormService.getFormsWithoutProgram();
- assertEquals( entityFormC, form );
- }
-
-}
=== removed file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormStoreTest.java 2015-06-02 10:18:48 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityFormStoreTest.java 1970-01-01 00:00:00 +0000
@@ -1,129 +0,0 @@
-package org.hisp.dhis.trackedentity;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashSet;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataentryform.DataEntryForm;
-import org.hisp.dhis.dataentryform.DataEntryFormService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStage;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Chau Thu Tran
- */
-public class TrackedEntityFormStoreTest
- extends DhisSpringTest
-{
- @Autowired
- private TrackedEntityFormStore entityFormStore;
-
- @Autowired
- private DataEntryFormService dataEntryFormService;
-
- @Autowired
- private ProgramService programService;
-
- @Autowired
- private OrganisationUnitService organisationUnitService;
-
- private TrackedEntityForm entityFormA;
-
- private TrackedEntityForm entityFormB;
-
- private TrackedEntityForm entityFormC;
-
- private Program programA;
-
- private Program programB;
-
- private DataEntryForm dataEntryForm;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- throws Exception
- {
- OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
- organisationUnitService.addOrganisationUnit( organisationUnit );
-
- programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
- programService.addProgram( programA );
-
- programB = createProgram( 'B', new HashSet<ProgramStage>(), organisationUnit );
- programService.addProgram( programB );
-
- DataEntryForm dataEntryFormA = new DataEntryForm( "DataEntryForm-A" );
- dataEntryFormService.addDataEntryForm( dataEntryFormA );
-
- DataEntryForm dataEntryFormB = new DataEntryForm( "DataEntryForm-B" );
- dataEntryFormService.addDataEntryForm( dataEntryFormB );
-
- DataEntryForm dataEntryFormC = new DataEntryForm( "DataEntryForm-C" );
- dataEntryFormService.addDataEntryForm( dataEntryFormC );
-
- entityFormA = new TrackedEntityForm( programA, dataEntryForm );
- entityFormB = new TrackedEntityForm( programB, dataEntryForm );
- entityFormC = new TrackedEntityForm( dataEntryForm );
- }
-
- @Test
- public void testGetentityFormByProgram()
- {
- entityFormStore.save( entityFormA );
- entityFormStore.save( entityFormB );
- entityFormStore.save( entityFormC );
-
- TrackedEntityForm form = entityFormStore.get( programA );
- assertEquals( entityFormA, form );
- }
-
- @Test
- public void testGetCommonentityForm()
- {
- entityFormStore.save( entityFormA );
- entityFormStore.save( entityFormB );
- entityFormStore.save( entityFormC );
-
- TrackedEntityForm form = entityFormStore.getFormsWithoutProgram();
- assertEquals( entityFormC, form );
- }
-
-}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2015-06-02 05:55:14 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2015-06-19 07:35:50 +0000
@@ -32,6 +32,7 @@
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.commons.filter.MetaDataFilter;
import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.dashboard.DashboardItem;
import org.hisp.dhis.dataapproval.DataApprovalLevel;
@@ -54,7 +55,6 @@
import org.hisp.dhis.eventchart.EventChart;
import org.hisp.dhis.eventreport.EventReport;
import org.hisp.dhis.expression.Expression;
-import org.hisp.dhis.commons.filter.MetaDataFilter;
import org.hisp.dhis.i18n.locale.I18nLocale;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
@@ -76,14 +76,14 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramIndicator;
import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.programrule.ProgramRule;
-import org.hisp.dhis.programrule.ProgramRuleAction;
-import org.hisp.dhis.programrule.ProgramRuleVariable;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.ProgramValidation;
+import org.hisp.dhis.programrule.ProgramRule;
+import org.hisp.dhis.programrule.ProgramRuleAction;
+import org.hisp.dhis.programrule.ProgramRuleVariable;
import org.hisp.dhis.relationship.Relationship;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
@@ -93,7 +93,6 @@
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
import org.hisp.dhis.trackedentity.TrackedEntityAudit;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValue;
@@ -680,15 +679,6 @@
{
}
- public String allowDeleteTrackedEntityForm( TrackedEntityForm entityForm )
- {
- return null;
- }
-
- public void deleteTrackedEntityForm( TrackedEntityForm entityForm )
- {
- }
-
public String allowDeleteConstant( Constant constant )
{
return null;
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityFormController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityFormController.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityFormController.java 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-package org.hisp.dhis.webapi.controller.event;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import org.hisp.dhis.schema.descriptors.TrackedEntityFormSchemaDescriptor;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.webapi.controller.AbstractCrudController;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Controller
-@RequestMapping( value = TrackedEntityFormSchemaDescriptor.API_ENDPOINT )
-public class TrackedEntityFormController
- extends AbstractCrudController<TrackedEntityForm>
-{
-}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java 2015-06-19 07:35:50 +0000
@@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
+import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -51,8 +52,6 @@
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
import org.hisp.dhis.trackedentity.TrackedEntityService;
import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeGroupSortOrderComparator;
import org.hisp.dhis.user.User;
@@ -83,14 +82,7 @@
{
this.programService = programService;
}
-
- private TrackedEntityFormService trackedEntityFormService;
-
- public void setTrackedEntityFormService( TrackedEntityFormService trackedEntityFormService )
- {
- this.trackedEntityFormService = trackedEntityFormService;
- }
-
+
private ProgramDataEntryService programDataEntryService;
public void setProgramDataEntryService( ProgramDataEntryService programDataEntryService )
@@ -153,9 +145,9 @@
private Program program;
- private TrackedEntityForm trackedEntityForm;
+ private DataEntryForm trackedEntityForm;
- public TrackedEntityForm getTrackedEntityForm()
+ public DataEntryForm getTrackedEntityForm()
{
return trackedEntityForm;
}
@@ -204,27 +196,15 @@
organisationUnit = selectionManager.getSelectedOrganisationUnit();
healthWorkers = organisationUnit.getUsers();
- if ( programId == null || programId.isEmpty() )
- {
- trackedEntityForm = trackedEntityFormService.getFormsWithoutProgram();
-
- if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
- {
- customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
- .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, null, null, i18n,
- format );
- }
- }
- else
+ if ( programId != null )
{
program = programService.getProgram( programId );
- trackedEntityForm = trackedEntityFormService.getFormsWithProgram( program );
+ trackedEntityForm = program.getDataEntryForm();
- if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
+ if ( trackedEntityForm != null )
{
- customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
- .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, null, null, i18n,
- format );
+ customRegistrationForm = programService.prepareDataEntryFormForAdd( trackedEntityForm.getHtmlCode(),
+ program, healthWorkers, null, null, i18n, format );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java 2015-06-19 07:35:50 +0000
@@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
+import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.program.Program;
@@ -51,8 +52,6 @@
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
import org.hisp.dhis.trackedentity.TrackedEntityService;
@@ -96,13 +95,6 @@
this.relationshipTypeService = relationshipTypeService;
}
- private TrackedEntityFormService trackedEntityFormService;
-
- public void setTrackedEntityFormService( TrackedEntityFormService trackedEntityFormService )
- {
- this.trackedEntityFormService = trackedEntityFormService;
- }
-
private TrackedEntityAttributeGroupService attributeGroupService;
public void setAttributeGroupService( TrackedEntityAttributeGroupService attributeGroupService )
@@ -211,10 +203,6 @@
return healthWorkers;
}
- public void setTrackedEntityForm( TrackedEntityForm trackedEntityForm )
- {
- this.trackedEntityForm = trackedEntityForm;
- }
private String programId;
@@ -230,13 +218,18 @@
return attributesMap;
}
- private TrackedEntityForm trackedEntityForm;
+ private DataEntryForm trackedEntityForm;
- public TrackedEntityForm getTrackedEntityForm()
+ public DataEntryForm getTrackedEntityForm()
{
return trackedEntityForm;
}
+ public void setTrackedEntityForm( DataEntryForm trackedEntityForm )
+ {
+ this.trackedEntityForm = trackedEntityForm;
+ }
+
private String customRegistrationForm;
public String getCustomRegistrationForm()
@@ -292,21 +285,10 @@
healthWorkers = entityInstance.getOrganisationUnit().getUsers();
Program program = null;
- if ( programId == null || programId.isEmpty() )
- {
- trackedEntityForm = trackedEntityFormService.getFormsWithoutProgram();
-
- if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
- {
- customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
- .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, entityInstance,
- null, i18n, format );
- }
- }
- else
+ if ( programId != null )
{
program = programService.getProgram( programId );
- trackedEntityForm = trackedEntityFormService.getFormsWithProgram( program );
+ trackedEntityForm = program.getDataEntryForm();
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( entityInstance,
program, ProgramInstance.STATUS_ACTIVE );
@@ -317,10 +299,9 @@
{
programInstance = programInstances.iterator().next();
}
- if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
+ if ( trackedEntityForm != null )
{
- customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
- .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, entityInstance,
+ customRegistrationForm = programService.prepareDataEntryFormForAdd( trackedEntityForm.getHtmlCode(), program, healthWorkers, entityInstance,
programInstance, i18n, format );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2015-06-19 07:35:50 +0000
@@ -35,6 +35,7 @@
import java.util.List;
import java.util.Map;
+import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -49,8 +50,6 @@
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
import org.hisp.dhis.trackedentity.TrackedEntityService;
@@ -90,13 +89,6 @@
this.programService = programService;
}
- private TrackedEntityFormService trackedEntityFormService;
-
- public void setTrackedEntityFormService( TrackedEntityFormService trackedEntityFormService )
- {
- this.trackedEntityFormService = trackedEntityFormService;
- }
-
private TrackedEntityAttributeService attributeService;
public void setAttributeService( TrackedEntityAttributeService attributeService )
@@ -228,9 +220,9 @@
return orgunitCountIdentifier;
}
- private TrackedEntityForm trackedEntityForm;
+ private DataEntryForm trackedEntityForm;
- public TrackedEntityForm getTrackedEntityForm()
+ public DataEntryForm getTrackedEntityForm()
{
return trackedEntityForm;
}
@@ -325,26 +317,14 @@
organisationUnit = selectionManager.getSelectedOrganisationUnit();
healthWorkers = organisationUnit.getUsers();
- if ( programId == null || programId.isEmpty() )
- {
- trackedEntityForm = trackedEntityFormService.getFormsWithoutProgram();
-
- if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
- {
- customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
- .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, null, null, i18n,
- format );
- }
- }
- else
+ if ( programId != null )
{
program = programService.getProgram( programId );
- trackedEntityForm = trackedEntityFormService.getFormsWithProgram( program );
+ trackedEntityForm = program.getDataEntryForm();
- if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
+ if ( trackedEntityForm != null )
{
- customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
- .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, null, null, i18n,
+ customRegistrationForm = programService.prepareDataEntryFormForAdd( trackedEntityForm.getHtmlCode(), program, healthWorkers, null, null, i18n,
format );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2015-05-18 17:05:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2015-06-19 07:35:50 +0000
@@ -184,8 +184,6 @@
<property name="selectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="trackedEntityFormService"
- ref="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
<property name="programDataEntryService"
ref="org.hisp.dhis.program.ProgramDataEntryService" />
<property name="attributeService"
@@ -366,8 +364,6 @@
</property>
<property name="relationshipTypeService"
ref="org.hisp.dhis.relationship.RelationshipTypeService" />
- <property name="trackedEntityFormService"
- ref="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
<property name="attributeGroupService">
<ref bean="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService" />
</property>
@@ -414,9 +410,6 @@
<property name="programService">
<ref bean="org.hisp.dhis.program.ProgramService" />
</property>
- <property name="trackedEntityFormService">
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
- </property>
<property name="attributeGroupService">
<ref bean="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService" />
</property>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetTrackedEntityFormListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetTrackedEntityFormListAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetTrackedEntityFormListAction.java 1970-01-01 00:00:00 +0000
@@ -1,118 +0,0 @@
-package org.hisp.dhis.trackedentity.action.dataentryform;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- *
- * @version GetTrackedEntityFormListAction.java 11:06:37 AM Jan 31, 2013 $
- */
-public class GetTrackedEntityFormListAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependency
- // -------------------------------------------------------------------------
-
- private TrackedEntityFormService formService;
-
- public void setFormService( TrackedEntityFormService formService )
- {
- this.formService = formService;
- }
-
- private ProgramService programService;
-
- public void setProgramService( ProgramService programService )
- {
- this.programService = programService;
- }
-
- // -------------------------------------------------------------------------
- // Getters & Setters
- // -------------------------------------------------------------------------
-
- private Map<Integer, TrackedEntityForm> mapRegistrationForms = new HashMap<>();
-
- public Map<Integer, TrackedEntityForm> getMapRegistrationForms()
- {
- return mapRegistrationForms;
- }
-
- private List<Program> programs;
-
- public List<Program> getPrograms()
- {
- return programs;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- @Override
- public String execute()
- throws Exception
- {
- Collection<TrackedEntityForm> registrationForms = formService
- .getAllTrackedEntityForms();
-
- for ( TrackedEntityForm registrationForm : registrationForms )
- {
- if ( registrationForm.getProgram() != null )
- {
- mapRegistrationForms.put( registrationForm.getProgram().getId(), registrationForm );
- }
- else
- {
- mapRegistrationForms.put( 0, registrationForm );
- }
- }
-
- programs = programService.getAllPrograms();
-
- Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/RemoveTrackedEntityFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/RemoveTrackedEntityFormAction.java 2015-02-18 14:35:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/RemoveTrackedEntityFormAction.java 1970-01-01 00:00:00 +0000
@@ -1,105 +0,0 @@
-package org.hisp.dhis.trackedentity.action.dataentryform;
-
-/*
- * Copyright (c) 2004-2015, 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.
- */
-
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- *
- * @version RemoveTrackedEntityFormAction.java 10:13:10 AM Jan 31, 2013 $
- */
-public class RemoveTrackedEntityFormAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private TrackedEntityFormService formService;
-
- public void setFormService( TrackedEntityFormService formService )
- {
- this.formService = formService;
- }
-
- private ProgramService programService;
-
- public void setProgramService( ProgramService programService )
- {
- this.programService = programService;
- }
-
- // -------------------------------------------------------------------------
- // Getters & setters
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- @Override
- public String execute()
- throws Exception
- {
- TrackedEntityForm registrationForm = null;
-
- if ( id != null )
- {
- Program program = programService.getProgram( id );
-
- registrationForm = formService.getFormsWithProgram( program );
-
- program.increaseVersion();
- }
- else
- {
- registrationForm = formService.getFormsWithoutProgram();
- }
-
- if ( registrationForm != null )
- {
- formService.deleteTrackedEntityForm( registrationForm );
- }
-
- return SUCCESS;
- }
-}
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveProgramEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveTrackedEntityFormAction.java 2015-06-10 10:20:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SaveProgramEntryFormAction.java 2015-06-19 07:35:50 +0000
@@ -33,17 +33,15 @@
import org.hisp.dhis.dataentryform.DataEntryFormService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
import com.opensymphony.xwork2.Action;
/**
* @author Chau Thu Tran
*
- * @version SaveTrackedEntityFormAction.java 10:26:09 AM Jan 31, 2013 $
+ * @version SaveProgramEntryFormAction.java 10:26:09 AM Jan 31, 2013 $
*/
-public class SaveTrackedEntityFormAction
+public class SaveProgramEntryFormAction
implements Action
{
// -------------------------------------------------------------------------
@@ -64,17 +62,10 @@
this.programService = programService;
}
- private TrackedEntityFormService formService;
-
- public void setFormService( TrackedEntityFormService formService )
- {
- this.formService = formService;
- }
-
// -------------------------------------------------------------------------
// Getters & Setters
// -------------------------------------------------------------------------
-
+
private String name;
public void setName( String name )
@@ -113,54 +104,26 @@
{
name = StringUtils.trimToNull( name );
designTextarea = StringUtils.trimToNull( designTextarea );
-
- TrackedEntityForm registrationForm = null;
-
- Program program = null;
-
- if ( programId == null )
- {
- registrationForm = formService.getFormsWithoutProgram();
- }
- else
- {
- program = programService.getProgram( programId );
- registrationForm = formService.getFormsWithProgram( program );
- }
+
+ Program program = programService.getProgram( programId );
+ DataEntryForm dataEntryForm = program.getDataEntryForm();
// ---------------------------------------------------------------------
// Save data-entry-form
// ---------------------------------------------------------------------
- if ( registrationForm == null )
+ if ( dataEntryForm == null )
{
- registrationForm = new TrackedEntityForm();
- DataEntryForm dataEntryForm = new DataEntryForm( name, designTextarea );
- registrationForm.setDataEntryForm( dataEntryForm );
- if ( programId != null )
- {
- registrationForm.setProgram( program );
- }
+ dataEntryForm = new DataEntryForm( name, designTextarea );
+ program.setDataEntryForm( dataEntryForm );
- formService.saveTrackedEntityForm( registrationForm );
+ programService.updateProgram( program );
}
else
{
- DataEntryForm dataEntryForm = registrationForm.getDataEntryForm();
- if ( dataEntryForm == null )
- {
- dataEntryForm = new DataEntryForm( name, designTextarea );
- dataEntryFormService.addDataEntryForm( dataEntryForm );
- }
- else
- {
- dataEntryForm.setName( name );
- dataEntryForm.setHtmlCode( designTextarea );
- dataEntryFormService.updateDataEntryForm( dataEntryForm );
- }
-
- registrationForm.setDataEntryForm( dataEntryForm );
- formService.updateTrackedEntityForm( registrationForm );
+ dataEntryForm.setName( name );
+ dataEntryForm.setHtmlCode( designTextarea );
+ dataEntryFormService.updateDataEntryForm( dataEntryForm );
}
Integer dataEntryFormId = dataEntryFormService.getDataEntryFormByName( name ).getId();
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveTrackedEntityFormSettingAction.java' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveProgramEntryFormSettingAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveTrackedEntityFormSettingAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SetAutoSaveProgramEntryFormSettingAction.java 2015-06-19 07:35:50 +0000
@@ -35,9 +35,9 @@
/**
* @author Chau Thu Tran
*
- * @version SetAutoSaveTrackedEntityFormSettingAction.java 02:10:07 PM Apr 05, 2013 $
+ * @version SetAutoSaveProgramEntryFormSettingAction.java 02:10:07 PM Apr 05, 2013 $
*/
-public class SetAutoSaveTrackedEntityFormSettingAction
+public class SetAutoSaveProgramEntryFormSettingAction
implements Action
{
// -------------------------------------------------------------------------
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowTrackedEntityFormAction.java' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowProgramEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowTrackedEntityFormAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ShowProgramEntryFormAction.java 2015-06-19 07:35:50 +0000
@@ -36,9 +36,9 @@
/**
* @author Chau Thu Tran
*
- * @version ShowTrackedEntityFormAction.java 10:35:08 AM Jan 31, 2013 $
+ * @version ShowProgramEntryFormAction.java 10:35:08 AM Jan 31, 2013 $
*/
-public class ShowTrackedEntityFormAction
+public class ShowProgramEntryFormAction
implements Action
{
// -------------------------------------------------------------------------
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewTrackedEntityFormAction.java' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewTrackedEntityFormAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java 2015-06-19 07:35:50 +0000
@@ -33,14 +33,13 @@
import java.util.HashSet;
import java.util.List;
+import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
-import org.hisp.dhis.trackedentity.TrackedEntityForm;
-import org.hisp.dhis.trackedentity.TrackedEntityFormService;
import org.hisp.dhis.user.UserSettingService;
import com.opensymphony.xwork2.Action;
@@ -48,9 +47,9 @@
/**
* @author Chau Thu Tran
*
- * @version ViewTrackedEntityFormAction.java 10:35:08 AM Jan 31, 2013 $
+ * @version ViewProgramEntryFormAction.java 10:35:08 AM Jan 31, 2013 $
*/
-public class ViewTrackedEntityFormAction
+public class ViewProgramEntryFormAction
implements Action
{
// -------------------------------------------------------------------------
@@ -63,21 +62,7 @@
{
this.programService = programService;
}
-
- private TrackedEntityAttributeService attributeService;
-
- public void setAttributeService( TrackedEntityAttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
- private TrackedEntityFormService formService;
-
- public void setFormService( TrackedEntityFormService formService )
- {
- this.formService = formService;
- }
-
+
private SystemSettingManager systemSettingManager;
public void setSystemSettingManager( SystemSettingManager systemSettingManager )
@@ -117,9 +102,9 @@
return programAttributes;
}
- private TrackedEntityForm registrationForm;
+ private DataEntryForm registrationForm;
- public TrackedEntityForm getRegistrationForm()
+ public DataEntryForm getRegistrationForm()
{
return registrationForm;
}
@@ -157,23 +142,9 @@
programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
- if ( programId == null )
- {
- registrationForm = formService.getFormsWithoutProgram();
-
- attributes = attributeService.getAllTrackedEntityAttributes();
-
- for ( Program program : programs )
- {
- attributes.removeAll( program.getProgramAttributes() );
- }
- }
- else
- {
- program = programService.getProgram( programId );
- programAttributes = program.getProgramAttributes();
- registrationForm = formService.getFormsWithProgram( program );
- }
+ program = programService.getProgram( programId );
+ programAttributes = program.getProgramAttributes();
+ registrationForm = program.getDataEntryForm();
// ---------------------------------------------------------------------
// Get images
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml 2015-06-02 15:19:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml 2015-06-19 07:35:50 +0000
@@ -479,68 +479,47 @@
<property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
</bean>
- <!-- TrackedEntityForm -->
-
- <bean
- id="org.hisp.dhis.trackedentity.action.dataentryform.GetTrackedEntityFormListAction"
- class="org.hisp.dhis.trackedentity.action.dataentryform.GetTrackedEntityFormListAction"
- scope="prototype">
- <property name="formService">
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
- </property>
- <property name="programService">
- <ref bean="org.hisp.dhis.program.ProgramService" />
- </property>
- </bean>
-
- <bean
- id="org.hisp.dhis.trackedentity.action.dataentryform.RemoveTrackedEntityFormAction"
- class="org.hisp.dhis.trackedentity.action.dataentryform.RemoveTrackedEntityFormAction"
- scope="prototype">
- <property name="formService">
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
- </property>
- <property name="programService">
- <ref bean="org.hisp.dhis.program.ProgramService" />
- </property>
- </bean>
-
- <bean
- id="org.hisp.dhis.trackedentity.action.dataentryform.SaveTrackedEntityFormAction"
- class="org.hisp.dhis.trackedentity.action.dataentryform.SaveTrackedEntityFormAction"
- scope="prototype">
- <property name="dataEntryFormService">
- <ref bean="org.hisp.dhis.dataentryform.DataEntryFormService" />
- </property>
- <property name="programService">
- <ref bean="org.hisp.dhis.program.ProgramService" />
- </property>
- <property name="formService">
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
- </property>
- </bean>
-
- <bean
- id="org.hisp.dhis.trackedentity.action.dataentryform.ShowTrackedEntityFormAction"
- class="org.hisp.dhis.trackedentity.action.dataentryform.ShowTrackedEntityFormAction"
- scope="prototype">
- <property name="dataEntryFormService">
- <ref bean="org.hisp.dhis.dataentryform.DataEntryFormService" />
- </property>
- </bean>
-
- <bean
- id="org.hisp.dhis.trackedentity.action.dataentryform.ViewTrackedEntityFormAction"
- class="org.hisp.dhis.trackedentity.action.dataentryform.ViewTrackedEntityFormAction"
- scope="prototype">
- <property name="programService">
- <ref bean="org.hisp.dhis.program.ProgramService" />
- </property>
- <property name="attributeService">
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
- </property>
- <property name="formService">
- <ref bean="org.hisp.dhis.trackedentity.TrackedEntityFormService" />
+ <!-- Program Data Entry Form -->
+
+ <bean
+ id="org.hisp.dhis.trackedentity.action.dataentryform.RemoveProgramEntryFormAction"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.RemoveProgramEntryFormAction"
+ scope="prototype">
+ <property name="programService">
+ <ref bean="org.hisp.dhis.program.ProgramService" />
+ </property>
+ <property name="dataEntryFormService">
+ <ref bean="org.hisp.dhis.dataentryform.DataEntryFormService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.trackedentity.action.dataentryform.SaveProgramEntryFormAction"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.SaveProgramEntryFormAction"
+ scope="prototype">
+ <property name="dataEntryFormService">
+ <ref bean="org.hisp.dhis.dataentryform.DataEntryFormService" />
+ </property>
+ <property name="programService">
+ <ref bean="org.hisp.dhis.program.ProgramService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.trackedentity.action.dataentryform.ShowProgramEntryFormAction"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.ShowProgramEntryFormAction"
+ scope="prototype">
+ <property name="dataEntryFormService">
+ <ref bean="org.hisp.dhis.dataentryform.DataEntryFormService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.trackedentity.action.dataentryform.ViewProgramEntryFormAction"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.ViewProgramEntryFormAction"
+ scope="prototype">
+ <property name="programService">
+ <ref bean="org.hisp.dhis.program.ProgramService" />
</property>
<property name="systemSettingManager">
<ref bean="org.hisp.dhis.setting.SystemSettingManager" />
@@ -551,8 +530,8 @@
</bean>
<bean
- id="org.hisp.dhis.trackedentity.action.dataentryform.SetAutoSaveTrackedEntityFormSettingAction"
- class="org.hisp.dhis.trackedentity.action.dataentryform.SetAutoSaveTrackedEntityFormSettingAction"
+ id="org.hisp.dhis.trackedentity.action.dataentryform.SetAutoSaveProgramEntryFormSettingAction"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.SetAutoSaveProgramEntryFormSettingAction"
scope="prototype">
<property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-06-10 08:33:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-06-19 07:35:50 +0000
@@ -317,9 +317,8 @@
sort_by = Sort by
block_entry_form_after_completed = Block entry form after completed
select_operator_number_of_visits_for_this_condition = Please select operator number of visit for this condition
-design_tracked_entity_registration_form = Design tracked entity form
+design_prorgam_entry_form = Design program entry form
intro_tracked_entity_form = Create custom tracked entity data capture forms with tracked entity attributes.
-tracked_entity_registration_form_management = Tracked entity form management
properties = Properties
full_name = Full name
birth_date = Date of birth
@@ -328,9 +327,9 @@
is_dead = Is dead
phone_number = Phone number
email = Email
-tracked_entity_registration_details = Tracked entity registration details
-design_tracked_entity_registration_form = Design tracked entity registration form
-confirm_delete_tracked_entity_registration_form = Are you sure you want to delete tracked entity form?
+prorgam_entry_form_details = Program entry form details
+design_prorgam_entry_form_form = Design program entry form form
+confirm_delete_prorgam_entry_form_form = Are you sure you want to delete program entry form?
fixed_attributes = Fixed attributes
attributes = Attributes
left_side_expression = Left side expression
@@ -496,13 +495,12 @@
auto_save_registration_forms = Auto save registration form
show_advanced_options = Show advanced options
hide_advanced_options = Hide advanced options
-tracked_entity_registration_form_manegement = Tracked entity registration form management
program_validation_rule_management=Program validation rule management
confidential = Confidential
available_indicators = Available indicators
selected_indicators = Selected indicators
program_indicator_management_form = Program indicator management form
-auto_save_tracked_entity_registration_forms = Auto-save tracked entity registration forms
+auto_save_prorgam_entry_form_forms = Auto-save program entry forms
filter_by_program = Filter by program
enter_an_attribute = Enter an attribute
enter_a_key = Enter a key
=== 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-06-03 14:47:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml 2015-06-19 07:35:50 +0000
@@ -547,37 +547,28 @@
<!-- Tracked Entity Form -->
- <action name="trackedEntityForm"
- class="org.hisp.dhis.trackedentity.action.dataentryform.GetTrackedEntityFormListAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-program/trackedEntityForm.vm</param>
- <param name="menu">/dhis-web-maintenance-program/menu.vm</param>
- <param name="javascripts">javascript/trackedEntityForm.js</param>
- <param name="requiredAuthorities">F_TRACKED_ENTITY_FORM_MANAGEMENT</param>
- </action>
-
- <action name="viewTrackedEntityForm"
- class="org.hisp.dhis.trackedentity.action.dataentryform.ViewTrackedEntityFormAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-program/viewTrackedEntityForm.vm</param>
+ <action name="viewProgramEntryForm"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.ViewProgramEntryFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-program/viewProgramEntryForm.vm</param>
<param name="javascripts">
../dhis-web-commons/ckeditor/ckeditor.js,
../dhis-web-commons/ckeditor/adapters/jquery.js,
- javascript/viewTrackedEntityForm.js
+ javascript/viewProgramEntryForm.js
</param>
<param name="stylesheets">style/basic.css</param>
<param name="requiredAuthorities">F_TRACKED_ENTITY_FORM_ADD</param>
</action>
- <action name="saveTrackedEntityForm"
- class="org.hisp.dhis.trackedentity.action.dataentryform.SaveTrackedEntityFormAction">
- <result name="success" type="redirect">trackedEntityForm.action
+ <action name="saveProgramEntryForm"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.SaveProgramEntryFormAction">
+ <result name="success" type="redirect">program.action
</result>
<param name="requiredAuthorities">F_TRACKED_ENTITY_FORM_ADD</param>
</action>
- <action name="autoSaveTrackedEntityForm"
- class="org.hisp.dhis.trackedentity.action.dataentryform.SaveTrackedEntityFormAction">
+ <action name="autoSaveProgramEntryForm"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.SaveProgramEntryFormAction">
<result name="success" type="velocity-json">
/dhis-web-commons/ajax/jsonResponseSuccess.vm
</result>
@@ -591,23 +582,23 @@
</result>
</action>
- <action name="removeTrackedEntityForm"
- class="org.hisp.dhis.trackedentity.action.dataentryform.RemoveTrackedEntityFormAction">
- <result name="success" type="redirect">trackedEntityForm.action
+ <action name="removeProgramEntryForm"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.RemoveProgramEntryFormAction">
+ <result name="success" type="redirect">program.action
</result>
<param name="requiredAuthorities">F_TRACKED_ENTITY_FORM_DELETE</param>
</action>
- <action name="showTrackedEntityForm"
- class="org.hisp.dhis.trackedentity.action.dataentryform.ShowTrackedEntityFormAction">
+ <action name="showProgramEntryForm"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.ShowProgramEntryFormAction">
<result name="success" type="velocity">
/dhis-web-maintenance-program/dataEntryFormCode.vm
</result>
<param name="requiredAuthorities">F_TRACKED_ENTITY_FORM_ADD</param>
</action>
- <action name="setAutoSaveTrackedEntityFormSetting"
- class="org.hisp.dhis.trackedentity.action.dataentryform.SetAutoSaveTrackedEntityFormSettingAction">
+ <action name="setAutoSaveProgramEntryFormSetting"
+ class="org.hisp.dhis.trackedentity.action.dataentryform.SetAutoSaveProgramEntryFormSettingAction">
<result name="success" type="velocity-json">
../dhis-web-commons/ajax/jsonResponseSuccess.vm
</result>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm 2015-04-24 10:20:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
-<script>
- jQuery(document).ready( function(){
- validation2( 'addTrackedEntityForm', function( form )
- {
- form.submit();
- },{
- 'rules' : getValidationRules( "trackedEntity" ),
- 'beforeValidateHandler' : function() {
- #tblDynamicAttributesJavascript()
- }
- });
-
- checkValueIsExist( "name", "validateTrackedEntity.action");
- });
-</script>
-
-<h3>$i18n.getString( "create_new_tracked_entity" )</h3>
-<form id="addTrackedEntityForm" action="addTrackedEntity.action" method="post" class="inputForm">
-
-<table id="attrTable">
- <thead>
- <tr><th colspan="2">$i18n.getString( "tracked_entity_details" )</th></tr>
- </thead>
-
- <tbody>
- <tr>
- <td style="width:200px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" "/></td>
- <td></td>
- </tr>
-
- <tr>
- <td><label for="description">$i18n.getString( "description" )</label></td>
- <td><input type="text" id="description" name="description" /></td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
-
-<table>
- <tr>
- <td></td>
- <td>
- <input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
- <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='trackedEntity.action'" style="width:10em"/>
- </td>
- </tr>
-</table>
-<span id='message'></span>
-
-</form>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addTrackedEntity.vm 2015-06-19 07:35:50 +0000
@@ -0,0 +1,53 @@
+<script>
+ jQuery(document).ready( function(){
+ validation2( 'addTrackedEntityForm', function( form )
+ {
+ form.submit();
+ },{
+ 'rules' : getValidationRules( "trackedEntity" ),
+ 'beforeValidateHandler' : function() {
+ #tblDynamicAttributesJavascript()
+ }
+ });
+
+ checkValueIsExist( "name", "validateTrackedEntity.action");
+ });
+</script>
+
+<h3>$i18n.getString( "create_new_tracked_entity" )</h3>
+<form id="addTrackedEntityForm" action="addTrackedEntity.action" method="post" class="inputForm">
+
+<table id="attrTable">
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "tracked_entity_details" )</th></tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td style="width:200px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" "/></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="description">$i18n.getString( "description" )</label></td>
+ <td><input type="text" id="description" name="description" /></td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
+<table>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='trackedEntity.action'" style="width:10em"/>
+ </td>
+ </tr>
+</table>
+<span id='message'></span>
+
+</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm 2015-02-13 13:52:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/index.vm 2015-06-19 07:35:50 +0000
@@ -5,7 +5,6 @@
#if( $security.canView( "trackedEntityAttributeGroup" ) )#introListImgItem( "attributeGroup.action" "attribute_group" "patient" )#end
#if( $security.canView( "relationShipType" ) )#introListImgItem( "relationshipType.action" "relationship_type" "patient" )#end
#if( $security.canView( "trackedEntity" ) )#introListImgItem( "trackedEntity.action" "tracked_entity" "patient" )#end
- #if( $security.canView( "trackedEntityForm" ) )#introListImgItem( "trackedEntityForm.action" "tracked_entity_form" "pivottable" )#end
#if( $security.canView( "program" ) )#introListImgItem( "program.action" "program" "program" )#end
#introListImgItem( "caseAggregation.action" "aggregation_query_builder" "caseaggregationmapping" )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js 2015-05-21 16:37:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js 2015-06-19 07:35:50 +0000
@@ -41,6 +41,10 @@
location.href = 'programReminder.action?id=' + context.id;
}
+function viewProgramEntryForm( context ){
+ location.href = 'viewProgramEntryForm.action?programId=' + context.id;
+}
+
function showProgramDetails( context ) {
jQuery.getJSON("getProgram.action", {
id: context.id
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/trackedEntityForm.js' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/trackedEntityForm.js 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/javascript/programEntryForm.js 2015-06-19 07:35:50 +0000
@@ -6,16 +6,16 @@
});
function defineForm( context ){
- window.location.href='viewTrackedEntityForm.action?programId=' + context.id;
+ window.location.href='viewProgramEntryForm.action?programId=' + context.id;
}
-function removeTrackedEntityForm( context )
+function removeProgramEntryForm( context )
{
var result = window.confirm( i18n_confirm_delete + "\n\n" + context.name );
if ( result )
{
- jQuery.postJSON("removeTrackedEntityForm.action", {id:context.id}
+ jQuery.postJSON("removeProgramEntryForm.action", {id:context.id}
,function(json) {});
}
}
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewTrackedEntityForm.js' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewProgramEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewTrackedEntityForm.js 2014-06-26 21:14:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewProgramEntryForm.js 2015-06-19 07:35:50 +0000
@@ -348,12 +348,12 @@
}
-function deleteRegistrationForm( id, name )
+function deleteProgramEntryForm( id, name )
{
var result = window.confirm( i18n_confirm_delete + '\n\n' + name );
if ( result )
{
- window.location.href = 'delRegistrationEntryFormAction.action?id=' + id;
+ window.location.href = 'removeProgramEntryForm.action?programId=' + id;
}
}
@@ -370,10 +370,10 @@
function setAutoSaveRegistrationSetting(_autoSave)
{
- jQuery.postJSON("setAutoSaveTrackedEntityFormSetting.action", {autoSave:_autoSave}, function(json) {
+ jQuery.postJSON("setAutoSaveProgramEntryFormSetting.action", {autoSave:_autoSave}, function(json) {
autoSave = _autoSave;
if (_autoSave) {
- window.setTimeout( "validateTrackedEntityFormTimeout( false );", 6000 );
+ window.setTimeout( "validateProgramEntryFormTimeout( false );", 6000 );
}
else{
window.clearTimeout(timeOut);
@@ -412,7 +412,7 @@
}
else
{
- autoSaveTrackedEntityForm();
+ autoSaveProgramEntryForm();
}
}
else if ( json.response = 'error' )
@@ -423,9 +423,9 @@
}
}
-function autoSaveTrackedEntityForm()
+function autoSaveProgramEntryForm()
{
- $.postUTF8( 'autoSaveTrackedEntityForm.action',
+ $.postUTF8( 'autoSaveProgramEntryForm.action',
{
name: getFieldValue('name'),
designTextarea: jQuery("#designTextarea").ckeditor().editor.getData(),
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/menu.vm 2015-02-13 12:51:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/menu.vm 2015-06-19 07:35:50 +0000
@@ -4,7 +4,6 @@
#if( $security.canView( "trackedEntityAttributeGroup" ) )<li><a href="attributeGroup.action">$i18n.getString( "tracked_entity_attribute_group" )</a></li>#end
#if( $security.canView( "relationShipType" ) )<li><a href="relationshipType.action">$i18n.getString( "relationship_type" )</a></li>#end
#if( $security.canView( "trackedEntity" ) )<li><a href="trackedEntity.action">$i18n.getString( "tracked_entity" )</a></li>#end
- #if( $security.canView( "trackedEntityForm" ) )<li><a href="trackedEntityForm.action">$i18n.getString( "tracked_entity_form" )</a></li>#end
</ul>
<h2>$i18n.getString( "programs" )</h2>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm 2015-06-10 08:33:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm 2015-06-19 07:35:50 +0000
@@ -7,6 +7,7 @@
<li data-enabled="canUpdate"><a data-target-fn="defineProgramAssociationsForm"><i class="fa fa-plus"></i> $i18n.getString( "assign_program_to_orgunits" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showProgramUserRoleForm"><i class="fa fa-plus"></i> $i18n.getString( "assign_program_to_userroles" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showUpdateProgramForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li data-enabled="canDefinedProgramEntryForm"><a data-target-fn="viewProgramEntryForm"><i class="fa fa-edit"></i> $i18n.getString( "tracked_entity_form" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="programStageManagement"><i class="fa fa-edit"></i> $i18n.getString( "view_program_stages" )</a></li>
<li data-enabled="canManageTemplateMessage"><a data-target-fn="programReminder"><i class="fa fa-edit"></i> $i18n.getString( "view_reminder_message_templates" )</a></li>
<li data-enabled="canManageProgramRule"><a data-target-fn="programRule"><i class="fa fa-edit"></i> $i18n.getString( "view_program_rule" )</a></li>
@@ -47,6 +48,7 @@
<tr id="tr${program.id}" data-id="$!program.id" data-uid="$!program.uid" data-type="Program" data-name="$encoder.htmlEncode( $!program.displayName )"
data-can-manage="$security.canManage( $program )"
data-can-update="$security.canUpdate( $program )"
+ data-can-defined-program-entry-form="#if($program.type!=3)true#{else}false#end"
data-can-manage-template-message="#if($program.type!=3)true#{else}false#end"
data-can-manage-program-rule="#if( $auth.hasAccess( "dhis-web-maintenance-program", "programRule" ) ) true #{else}false#end"
data-can-delete="$security.canDelete( $program )"
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm 2015-06-19 07:35:50 +0000
@@ -0,0 +1,64 @@
+
+<h3>$i18n.getString( "tracked_entity_management" ) #openHelp('tracked_entity')</h3>
+
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateTrackedEntityForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removeTrackedEntity"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showTrackedEntityDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>
+ #filterDiv( "trackedEntity" )
+ </td>
+ <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddTrackedEntityForm.action'" style="width:70px"></td>
+ </tr>
+ </table>
+
+ <table class="listTable">
+ <col>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $trackedEntity in $trackedEntities )
+ <tr id="tr${trackedEntity.id}" data-id="$!trackedEntity.id"
+ data-uid="$!trackedEntity.uid" data-type="TrackedEntity"
+ data-name="$encoder.htmlEncode( $!trackedEntity.displayName )"
+ data-can-manage="$security.canManage( $trackedEntity )"
+ data-can-update="$security.canUpdate( $trackedEntity )"
+ data-can-delete="$security.canDelete( $trackedEntity )">
+ <td>$encoder.htmlEncode( $!trackedEntity.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </td>
+
+ <td id="detailsData">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <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( "id" ):</label><br><span id="idField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_tracked_entity" ) , "'" )';
+</script>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm 2014-08-03 16:27:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntity.vm 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-
-<h3>$i18n.getString( "tracked_entity_management" ) #openHelp('tracked_entity')</h3>
-
-<div id="contextMenu" class="contextMenu">
- <ul id="contextMenuItems" class="contextMenuItems">
- <li><a data-target-fn="showUpdateTrackedEntityForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
- <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
- <li><a data-target-fn="removeTrackedEntity"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
- <li><a data-target-fn="showTrackedEntityDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
- </ul>
-</div>
-
-<table class="mainPageTable">
- <tr>
- <td style="vertical-align:top">
- <table width="100%">
- <tr>
- <td>
- #filterDiv( "trackedEntity" )
- </td>
- <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddTrackedEntityForm.action'" style="width:70px"></td>
- </tr>
- </table>
-
- <table class="listTable">
- <col>
- <thead>
- <tr>
- <th>$i18n.getString( "name" )</th>
- </tr>
- </thead>
- <tbody id="list">
- #foreach( $trackedEntity in $trackedEntities )
- <tr id="tr${trackedEntity.id}" data-id="$!trackedEntity.id"
- data-uid="$!trackedEntity.uid" data-type="TrackedEntity"
- data-name="$encoder.htmlEncode( $!trackedEntity.displayName )"
- data-can-manage="$security.canManage( $trackedEntity )"
- data-can-update="$security.canUpdate( $trackedEntity )"
- data-can-delete="$security.canDelete( $trackedEntity )">
- <td>$encoder.htmlEncode( $!trackedEntity.displayName )</td>
- </tr>
- #end
- </tbody>
- </table>
- <p></p>
- #parse( "/dhis-web-commons/paging/paging.vm" )
- </td>
-
- <td id="detailsData">
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <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( "id" ):</label><br><span id="idField"></span></p>
- </div>
- </td>
- </tr>
-</table>
-
-<script type="text/javascript">
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_tracked_entity" ) , "'" )';
-</script>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntityForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntityForm.vm 2014-11-03 13:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/trackedEntityForm.vm 1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
-
-<h3>$i18n.getString( "tracked_entity_form_management" ) #openHelp( "tracked_entity_form_management" )</h3>
-
-<div id="contextMenu" class="contextMenu">
- <ul id="contextMenuItems" class="contextMenuItems">
- <li><a data-target-fn="defineForm"><i class="fa fa-edit"></i> $i18n.getString( "define_registration_form" )</a></li>
- <li><a data-target-fn="removeTrackedEntityForm"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
- </ul>
-</div>
-
-<table class="mainPageTable">
- <tr><td style="vertical-align:top">
- <table width="100%">
- <tr>
- <td>$i18n.getString( "filter_by_program" )
- <input type="text" onkeyup="filterValues( this.value , 1)" />
- </td>
- </tr>
- </table>
-
- <table class="listTable">
- <col>
- <thead>
- <tr>
- <th>$i18n.getString( "program" )</th>
- </tr>
- </thead>
- <tbody id="list">
- <tr id="tr0" data-id="" data-uid=""
- data-type="trackedEntityForm"
- data-name="$i18n.getString( 'no_program' )">
- #if($mapRegistrationForms.get('0'))
- <td><a>$i18n.getString('no_program')</a></td>
- #else
- <td>$i18n.getString('no_program')</td>
- #end
- </tr>
- #foreach($program in $programs)
- <tr id="tr${program.id}"
- data-id="$!program.id" data-uid="$!program.uid"
- data-type="trackedEntityForm"
- data-name="$encoder.htmlEncode( $!program.displayName )">
-
- #if($mapRegistrationForms.get($program.id))
- <td><a>$encoder.htmlEncode($program.name)</a></td>
- #else
- <td>$encoder.htmlEncode($program.name)</td>
- #end
- </tr>
- #end
- </tbody>
-
- </table>
- </td></tr>
-</table>
-
-<script type="text/javascript">
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_tracked_entity_registration_form" ) , "'" )';
- var i18n_please_select = '[' + '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'" )' + ']';
-</script>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm 2015-06-19 07:35:50 +0000
@@ -0,0 +1,54 @@
+<script>
+ jQuery(document).ready( function(){
+ validation2( 'updateTrackedEntityForm', function( form )
+ {
+ form.submit();
+ },{
+ 'rules' : getValidationRules( "trackedEntity" ),
+ 'beforeValidateHandler' : function() {
+ #tblDynamicAttributesJavascript()
+ }
+ });
+
+ checkValueIsExist( "name", "validateTrackedEntity.action", {id:getFieldValue('id')});
+ });
+</script>
+
+<h3>$i18n.getString( "edit_tracked_entity" )</h3>
+<form id="updateTrackedEntityForm" action="updateTrackedEntity.action" method="post" class="inputForm">
+
+<input type='hidden' id='id' name='id' value='$trackedEntity.id'/>
+
+ <table id="attrTable">
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "tracked_entity_details" )</th></tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td style="width:200px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" class="{validate:{required:true,rangelength:[2,160]}}" value='$encoder.htmlEncode($trackedEntity.name)' /></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="description">$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="description" name="description" class="{validate:{required:true,minlength:2}}" value='$encoder.htmlEncode($trackedEntity.description)' /></td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
+<table>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString( 'update' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='trackedEntity.action'" style="width:10em"/>
+ </td>
+ </tr>
+</table>
+
+</form>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm 2015-04-24 10:20:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateTrackedEntity.vm 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-<script>
- jQuery(document).ready( function(){
- validation2( 'updateTrackedEntityForm', function( form )
- {
- form.submit();
- },{
- 'rules' : getValidationRules( "trackedEntity" ),
- 'beforeValidateHandler' : function() {
- #tblDynamicAttributesJavascript()
- }
- });
-
- checkValueIsExist( "name", "validateTrackedEntity.action", {id:getFieldValue('id')});
- });
-</script>
-
-<h3>$i18n.getString( "edit_tracked_entity" )</h3>
-<form id="updateTrackedEntityForm" action="updateTrackedEntity.action" method="post" class="inputForm">
-
-<input type='hidden' id='id' name='id' value='$trackedEntity.id'/>
-
- <table id="attrTable">
- <thead>
- <tr><th colspan="2">$i18n.getString( "tracked_entity_details" )</th></tr>
- </thead>
-
- <tbody>
- <tr>
- <td style="width:200px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" class="{validate:{required:true,rangelength:[2,160]}}" value='$encoder.htmlEncode($trackedEntity.name)' /></td>
- <td></td>
- </tr>
-
- <tr>
- <td><label for="description">$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="description" name="description" class="{validate:{required:true,minlength:2}}" value='$encoder.htmlEncode($trackedEntity.description)' /></td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
-
-<table>
- <tr>
- <td></td>
- <td>
- <input type="submit" value="$i18n.getString( 'update' )" style="width:10em"/>
- <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='trackedEntity.action'" style="width:10em"/>
- </td>
- </tr>
-</table>
-
-</form>
=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewTrackedEntityForm.vm' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewTrackedEntityForm.vm 2014-11-03 13:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.vm 2015-06-19 07:35:50 +0000
@@ -15,9 +15,7 @@
jQuery('#designTextarea').ckeditor();
- #if($!registrationForm)
- jQuery("#designTextarea").ckeditor().editor.setData('$!encoder.jsEscape( $registrationForm.dataEntryForm.htmlCode , "'" )');
- #end
+ jQuery("#designTextarea").ckeditor().editor.setData('$!encoder.jsEscape( $program.dataEntryForm.htmlCode , "'" )');
});
var i18n_dataelement_is_inserted = '$encoder.jsEscape( $i18n.getString( "dataelement_is_inserted" ) , "'" )';
@@ -52,10 +50,10 @@
}
</style>
-<form id="saveDataEntryForm" name="saveDataEntryForm" action="saveTrackedEntityForm.action" method="get" class="inputForm">
+<form id="saveDataEntryForm" name="saveDataEntryForm" action="saveProgramEntryForm.action" method="get" class="inputForm">
<input type="hidden" name="programId" id="programId" value="$!program.id"/>
-<input type="hidden" name="dataEntryFormId" id="dataEntryFormId" value="$!registrationForm.dataEntryForm.id"/>
+<input type="hidden" name="dataEntryFormId" id="dataEntryFormId" value="$!program.dataEntryForm.id"/>
<h3>$i18n.getString( "tracked_entity_form" )</h3>
<h4>$program.displayName</h4>
@@ -64,14 +62,14 @@
<table id="detailsList" width="100%">
<col/>
<tr>
- <th colspan='3'>$i18n.getString( "tracked_entity_registration_details" )</th>
+ <th colspan='3'>$i18n.getString( "prorgam_entry_form_details" )</th>
</tr>
<tr>
<td>
<label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label>
</td>
<td>
- <input type="text" id="name" value="$!encoder.htmlEncode($registrationForm.dataEntryForm.name)" name="name" class="{validate:{required:true,rangelength:[4,150],alphanumericwithbasicpuncspaces:true,firstletteralphabet:false}}" style="width:30em;" >
+ <input type="text" id="name" value="$!encoder.htmlEncode($program.dataEntryForm.name)" name="name" class="{validate:{required:true,rangelength:[4,150],alphanumericwithbasicpuncspaces:true,firstletteralphabet:false}}" style="width:30em;" >
</td>
</tr>
<tr>
@@ -82,7 +80,7 @@
<table width="100%">
<tr>
<th>
- $i18n.getString( "design_tracked_entity_registration_form" )
+ $i18n.getString( "design_prorgam_entry_form_form" )
</th>
</tr>
<tr>
@@ -100,13 +98,13 @@
<td>
<button type="button" id="saveButton" onclick="isSave='true';validateDataEntryForm();">$i18n.getString( 'save' )</button>
<button type="submit" id="saveAndCloseButton" onclick="isSave='false';"/>$i18n.getString( 'save_and_close' )</button>
- <button type="button" id="cancelButton" onclick="window.location='trackedEntityForm.action'">$i18n.getString( 'cancel' )</button>
+ <button type="button" id="cancelButton" onclick="window.location='program.action'">$i18n.getString( 'cancel' )</button>
<span style="color:#606060">|</span>
<button type="button" id="propertiesButton" onclick="openPropertiesSelector()"/>$i18n.getString( 'insert_properties' )</button>
<button type="button" id="insertImagesButton">$i18n.getString( 'insert_images' )</button>
<span style="color:#606060">|</span>
- <button type="button" id="deleteButton" #if($!registrationForm.dataEntryForm) #else style='display:none;' #end onclick="deleteRegistrationFormFromView();" />$i18n.getString( 'delete_this_form' )</button>
- <input type="checkbox" id="autoSave" name="autoSave" value='$!autoSave' #if($autoSave && $autoSave=="true") checked #end onchange="setAutoSaveRegistrationSetting(this.checked)" />$i18n.getString( 'auto_save_tracked_entity_registration_forms' )
+ <button type="button" id="deleteButton" #if($!program.dataEntryForm) #else style='display:none;' #end onclick="javascript:deleteProgramEntryForm($program.id,'$program.displayName');" />$i18n.getString( 'delete_this_form' )</button>
+ <input type="checkbox" id="autoSave" name="autoSave" value='$!autoSave' #if($autoSave && $autoSave=="true") checked #end onchange="setAutoSaveRegistrationSetting(this.checked)" />$i18n.getString( 'auto_save_prorgam_entry_form_forms' )
</td>
</tr>
</table>
@@ -196,7 +194,7 @@
var i18n_required_fields_valivation = '$encoder.jsEscape( $i18n.getString( "required_fields_valivation" ) , "'" )';
var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'" )';
var i18n_properties = '$encoder.jsEscape( $i18n.getString( "properties" ) , "'" )';
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_tracked_entity_registration_form" ) , "'" )';
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_prorgam_entry_form_form" ) , "'" )';
var i18n_save_unsuccess_please_insert_all_required_fields = '$encoder.jsEscape( $i18n.getString( "save_unsuccess" ) , "'" )' + '. ' + '$encoder.jsEscape( $i18n.getString( "please_insert_all_required_fields" ) , "'" )';
var i18n_validate_success = '$encoder.jsEscape( $i18n.getString( "validate_success" ) , "'" )';
var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'" )';