dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25017
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12326: WorkInProgress: Using OptionSet object for EquipementTypeAttribute & ModelTypeAttribute objects
------------------------------------------------------------
revno: 12326
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-30 13:17:15 +0100
message:
WorkInProgress: Using OptionSet object for EquipementTypeAttribute & ModelTypeAttribute objects
removed:
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttributeOption.hbm.xml
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttributeOption.hbm.xml
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/equipment/EquipmentTypeAttribute.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttribute.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentAttributeValue.hbm.xml
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttribute.hbm.xml
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelAttributeValue.hbm.xml
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttribute.hbm.xml
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/AddEquipmentTypeAttributeAction.java
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/ShowUpdateEquipmentTypeAttributeAction.java
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/UpdateEquipmentTypeAttributeAction.java
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddColdChainModelTypeAttributeForm.java
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddModelTypeAttributeAction.java
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/ShowUpdateModelTypeAttributeFormAction.java
local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/UpdateModelTypeAttributeAction.java
local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-ccem/src/main/resources/org/hisp/dhis/ccem/i18n_module.properties
local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addColdChainModelTypeAttributeForm.vm
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addEquipmentTypeAttributeForm.vm
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addEquipmentTypeAttributeForm.js
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addModelTypeAttributeForm.js
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateEquipmentTypeAttributeForm.js
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateModelTypeAttributeForm.js
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateEquipmentTypeAttibuteForm.vm
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateModelTypeAttibuteForm.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 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/equipment/EquipmentTypeAttribute.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/equipment/EquipmentTypeAttribute.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/equipment/EquipmentTypeAttribute.java 2013-09-30 12:17:15 +0000
@@ -3,9 +3,24 @@
import java.util.HashSet;
import java.util.Set;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
+import org.hisp.dhis.option.OptionSet;
+
+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.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
//public class EquipmentTypeAttribute implements Serializable
+
+@JacksonXmlRootElement( localName = "equipmentTypeAttribute", namespace = DxfNamespaces.DXF_2_0 )
public class EquipmentTypeAttribute extends BaseNameableObject
{
/**
@@ -25,11 +40,11 @@
public static final String TYPE_MODEL = "MODEL";
- private int id;
-
- private String name;
-
- private String description;
+ //private int id;
+
+ //private String name;
+
+ //private String description;
private String valueType;
@@ -44,6 +59,8 @@
private Set<EquipmentTypeAttributeOption> attributeOptions;
+ private OptionSet optionSet;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -94,7 +111,11 @@
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
-
+
+ /*
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public int getId()
{
return id;
@@ -105,6 +126,9 @@
this.id = id;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getName()
{
return name;
@@ -115,6 +139,9 @@
this.name = name;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getDescription()
{
return description;
@@ -124,7 +151,10 @@
{
this.description = description;
}
-
+*/
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getValueType()
{
return valueType;
@@ -135,6 +165,9 @@
this.valueType = valueType;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isMandatory()
{
return mandatory;
@@ -145,6 +178,9 @@
this.mandatory = mandatory;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Integer getNoChars()
{
return noChars;
@@ -172,6 +208,16 @@
attributeOptions.add( option );
}
+ public OptionSet getOptionSet()
+ {
+ return optionSet;
+ }
+
+ public void setOptionSet(OptionSet optionSet)
+ {
+ this.optionSet = optionSet;
+ }
+
/*
public boolean isDisplay()
{
@@ -183,4 +229,27 @@
this.display = display;
}
*/
+
+ /*
+ public void mergeWith(IdentifiableObject other )
+ {
+
+ super.mergeWith( other );
+ if ( other.getClass().isInstance( this ) )
+ {
+ EquipmentTypeAttribute equipmentTypeAttribute= (EquipmentTypeAttribute) other;
+
+ id = equipmentTypeAttribute.getId();
+ mandatory = equipmentTypeAttribute.isMandatory();
+ noChars = equipmentTypeAttribute.getNoChars();
+ valueType = equipmentTypeAttribute.getValueType() == null ? valueType : equipmentTypeAttribute.getValueType();
+ name =equipmentTypeAttribute.getName() == null ? name : equipmentTypeAttribute.getName();
+ description = equipmentTypeAttribute.getDescription() == null ? description : equipmentTypeAttribute.getDescription();
+
+ attributeOptions.clear();
+ attributeOptions.addAll(equipmentTypeAttribute.getAttributeOptions());
+
+ }
+ }
+ */
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttribute.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttribute.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/model/ModelTypeAttribute.java 2013-09-30 12:17:15 +0000
@@ -3,6 +3,7 @@
import java.util.Set;
import org.hisp.dhis.common.BaseNameableObject;
+import org.hisp.dhis.option.OptionSet;
public class ModelTypeAttribute extends BaseNameableObject
{
@@ -40,6 +41,8 @@
private Set<ModelTypeAttributeOption> attributeOptions;
+ private OptionSet optionSet;
+
// -------------------------------------------------------------------------
// Default Constructors
// -------------------------------------------------------------------------
@@ -170,4 +173,15 @@
{
this.display = display;
}
+
+ public OptionSet getOptionSet()
+ {
+ return optionSet;
+ }
+
+ public void setOptionSet(OptionSet optionSet)
+ {
+ this.optionSet = optionSet;
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentAttributeValue.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentAttributeValue.hbm.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentAttributeValue.hbm.xml 2013-09-30 12:17:15 +0000
@@ -15,8 +15,8 @@
<property name="value" />
- <many-to-one name="equipmentTypeAttributeOption" class="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOption" column="equipmenttypeattributeoptionid"
- foreign-key="fk_equipment_equipmenttypeattributeoptionid" />
+ <!-- <many-to-one name="equipmentTypeAttributeOption" class="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOption" column="equipmenttypeattributeoptionid"
+ foreign-key="fk_equipment_equipmenttypeattributeoptionid" /> -->
</class>
</hibernate-mapping>
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttribute.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttribute.hbm.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttribute.hbm.xml 2013-09-30 12:17:15 +0000
@@ -1,14 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
<hibernate-mapping>
<class name="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttribute" table="equipmenttypeattribute">
<id name="id" column="equipmenttypeattributeid">
<generator class="native"/>
</id>
-
+
+ &identifiableProperties;
+
<property name="name" not-null="true" unique="true" length="160"/>
<property name="description" not-null="false" length="250"/>
@@ -21,10 +25,15 @@
<property name="noChars" />
+ <!--
<set name="attributeOptions">
<key column="equipmenttypeattributeid" />
<one-to-many class="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOption" />
</set>
+ -->
+
+ <many-to-one name="optionSet" class="org.hisp.dhis.option.OptionSet" column="optionsetid"
+ foreign-key="fk_equipmenttypeattribute_optionsetid" />
</class>
</hibernate-mapping>
=== removed file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttributeOption.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttributeOption.hbm.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/EquipmentTypeAttributeOption.hbm.xml 1970-01-01 00:00:00 +0000
@@ -1,19 +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">
-
-<hibernate-mapping>
- <class name="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOption" table="equipmenttypeattributeoption">
- <id name="id" column="equipmenttypeattributeoptionid">
- <generator class="native"/>
- </id>
-
- <property name="name" not-null="true" length="160"/>
- <!--<property name="name" not-null="true" unique="true" length="160"/>-->
-
- <many-to-one name="equipmentTypeAttribute" column="equipmenttypeattributeid" class="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttribute"
- foreign-key="fk_equipmenttypetypeattributeoption_equipmenttypeattributeid" />
-
- </class>
-</hibernate-mapping>
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelAttributeValue.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelAttributeValue.hbm.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelAttributeValue.hbm.xml 2013-09-30 12:17:15 +0000
@@ -15,8 +15,8 @@
<property name="value" />
- <many-to-one name="modelTypeAttributeOption" class="org.hisp.dhis.coldchain.model.ModelTypeAttributeOption" column="modeltypeattributeoptionid"
- foreign-key="fk_modeldatavlaue_modeltypeattributeoptionid" />
+ <!-- <many-to-one name="modelTypeAttributeOption" class="org.hisp.dhis.coldchain.model.ModelTypeAttributeOption" column="modeltypeattributeoptionid"
+ foreign-key="fk_modeldatavlaue_modeltypeattributeoptionid" /> -->
</class>
</hibernate-mapping>
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttribute.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttribute.hbm.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttribute.hbm.xml 2013-09-30 12:17:15 +0000
@@ -21,10 +21,15 @@
<property name="display" column="display" not-null="true" />
+ <!--
<set name="attributeOptions">
<key column="modeltypeattributeid" />
<one-to-many class="org.hisp.dhis.coldchain.model.ModelTypeAttributeOption" />
</set>
+ -->
+
+ <many-to-one name="optionSet" class="org.hisp.dhis.option.OptionSet" column="optionsetid"
+ foreign-key="fk_modeltypeattribute_optionsetid" />
</class>
</hibernate-mapping>
=== removed file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttributeOption.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttributeOption.hbm.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/ModelTypeAttributeOption.hbm.xml 1970-01-01 00:00:00 +0000
@@ -1,19 +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">
-
-<hibernate-mapping>
- <class name="org.hisp.dhis.coldchain.model.ModelTypeAttributeOption" table="modeltypeattributeoption">
- <id name="id" column="modeltypeattributeoptionid">
- <generator class="native"/>
- </id>
-
- <property name="name" not-null="true" length="160"/>
- <!--<property name="name" not-null="true" unique="true" length="160"/>-->
-
- <many-to-one name="modelTypeAttribute" column="modeltypeattributeid" class="org.hisp.dhis.coldchain.model.ModelTypeAttribute"
- foreign-key="fk_modeltypeattributeoption_modeltypeAttributeid" />
-
- </class>
-</hibernate-mapping>
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/AddEquipmentTypeAttributeAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/AddEquipmentTypeAttributeAction.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/AddEquipmentTypeAttributeAction.java 2013-09-30 12:17:15 +0000
@@ -6,6 +6,9 @@
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOption;
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOptionService;
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService;
+import org.hisp.dhis.coldchain.model.ModelTypeAttribute;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import com.opensymphony.xwork2.Action;
@@ -23,12 +26,18 @@
private EquipmentTypeAttributeOptionService equipmentTypeAttributeOptionService;
- public void setEquipmentTypeAttributeOptionService(
- EquipmentTypeAttributeOptionService equipmentTypeAttributeOptionService )
+ public void setEquipmentTypeAttributeOptionService( EquipmentTypeAttributeOptionService equipmentTypeAttributeOptionService )
{
this.equipmentTypeAttributeOptionService = equipmentTypeAttributeOptionService;
}
+ private OptionService optionService;
+
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -82,7 +91,13 @@
this.display = display;
}
-
+ private Integer optionSetId;
+
+ public void setOptionSetId(Integer optionSetId)
+ {
+ this.optionSetId = optionSetId;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -99,8 +114,18 @@
equipmentTypeAttribute.setValueType( valueType );
//equipmentTypeAttribute.setDisplay( display );
+ if ( EquipmentTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
+ {
+ if( optionSetId != -1 )
+ {
+ OptionSet optionSet = optionService.getOptionSet( optionSetId );
+ equipmentTypeAttribute.setOptionSet( optionSet );
+ }
+ }
+
equipmentTypeAttributeService.addEquipmentTypeAttribute( equipmentTypeAttribute );
+ /*
if ( EquipmentTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
{
EquipmentTypeAttributeOption opt = null;
@@ -113,6 +138,7 @@
equipmentTypeAttributeOptionService.addEquipmentTypeAttributeOption( opt );
}
}
+ */
return SUCCESS;
}
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/ShowUpdateEquipmentTypeAttributeAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/ShowUpdateEquipmentTypeAttributeAction.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/ShowUpdateEquipmentTypeAttributeAction.java 2013-09-30 12:17:15 +0000
@@ -1,7 +1,12 @@
package org.hisp.dhis.ccem.equipmenttype.action;
+import java.util.ArrayList;
+import java.util.List;
+
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttribute;
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import com.opensymphony.xwork2.Action;
@@ -10,13 +15,21 @@
// -------------------------------------------------------------------------
// Dependency
// -------------------------------------------------------------------------
- private EquipmentTypeAttributeService equipmentTypeAttributeService;
+
+ private EquipmentTypeAttributeService equipmentTypeAttributeService;
public void setEquipmentTypeAttributeService( EquipmentTypeAttributeService equipmentTypeAttributeService )
{
this.equipmentTypeAttributeService = equipmentTypeAttributeService;
}
+ private OptionService optionService;
+
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -34,6 +47,13 @@
return equipmentTypeAttribute;
}
+ private List<OptionSet> optionSets;
+
+ public List<OptionSet> getOptionSets()
+ {
+ return optionSets;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -42,6 +62,8 @@
{
equipmentTypeAttribute = equipmentTypeAttributeService.getEquipmentTypeAttribute( id );
+ optionSets = new ArrayList<OptionSet>( optionService.getAllOptionSets() );
+
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/UpdateEquipmentTypeAttributeAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/UpdateEquipmentTypeAttributeAction.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/equipmenttype/action/UpdateEquipmentTypeAttributeAction.java 2013-09-30 12:17:15 +0000
@@ -11,6 +11,9 @@
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOption;
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOptionService;
import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService;
+import org.hisp.dhis.coldchain.model.ModelTypeAttribute;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import com.opensymphony.xwork2.Action;
@@ -30,12 +33,18 @@
private EquipmentTypeAttributeOptionService equipmentTypeAttributeOptionService;
- public void setEquipmentTypeAttributeOptionService(
- EquipmentTypeAttributeOptionService equipmentTypeAttributeOptionService )
+ public void setEquipmentTypeAttributeOptionService( EquipmentTypeAttributeOptionService equipmentTypeAttributeOptionService )
{
this.equipmentTypeAttributeOptionService = equipmentTypeAttributeOptionService;
}
+ private OptionService optionService;
+
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -95,6 +104,12 @@
this.display = display;
}
+ private Integer optionSetId;
+
+ public void setOptionSetId(Integer optionSetId)
+ {
+ this.optionSetId = optionSetId;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -110,7 +125,22 @@
equipmentTypeAttribute.setNoChars( noChars );
equipmentTypeAttribute.setValueType( valueType );
//equipmentTypeAttribute.setDisplay( display );
+
+ if ( EquipmentTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
+ {
+ if( optionSetId != -1 )
+ {
+ OptionSet optionSet = optionService.getOptionSet( optionSetId );
+ equipmentTypeAttribute.setOptionSet( optionSet );
+ }
+ else
+ {
+ equipmentTypeAttribute.setOptionSet( null );
+ }
+ }
+
+ /*
HttpServletRequest request = ServletActionContext.getRequest();
Collection<EquipmentTypeAttributeOption> attributeOptions = equipmentTypeAttributeOptionService.get( equipmentTypeAttribute );
@@ -145,6 +175,7 @@
}
}
}
+ */
equipmentTypeAttributeService.updateEquipmentTypeAttribute( equipmentTypeAttribute );
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddColdChainModelTypeAttributeForm.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddColdChainModelTypeAttributeForm.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddColdChainModelTypeAttributeForm.java 2013-09-30 12:17:15 +0000
@@ -1,5 +1,11 @@
package org.hisp.dhis.ccem.model.action;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
+
import com.opensymphony.xwork2.Action;
public class AddColdChainModelTypeAttributeForm implements Action
@@ -7,24 +13,33 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
+ private OptionService optionService;
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
+ private List<OptionSet> optionSets;
+
+ public List<OptionSet> getOptionSets()
+ {
+ return optionSets;
+ }
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute()
- throws Exception
+ public String execute() throws Exception
{
-
-
+ optionSets = new ArrayList<OptionSet>( optionService.getAllOptionSets() );
+
return SUCCESS;
}
-
}
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddModelTypeAttributeAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddModelTypeAttributeAction.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/AddModelTypeAttributeAction.java 2013-09-30 12:17:15 +0000
@@ -6,6 +6,8 @@
import org.hisp.dhis.coldchain.model.ModelTypeAttributeOption;
import org.hisp.dhis.coldchain.model.ModelTypeAttributeOptionService;
import org.hisp.dhis.coldchain.model.ModelTypeAttributeService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import com.opensymphony.xwork2.Action;
@@ -28,6 +30,13 @@
{
this.modelTypeAttributeOptionService = modelTypeAttributeOptionService;
}
+
+ private OptionService optionService;
+
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
// -------------------------------------------------------------------------
// Input/Output
@@ -82,11 +91,18 @@
this.display = display;
}
+ private Integer optionSetId;
+
+ public void setOptionSetId(Integer optionSetId)
+ {
+ this.optionSetId = optionSetId;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute() throws Exception
+ public String execute() throws Exception
{
ModelTypeAttribute modelTypeAttribute = new ModelTypeAttribute();
@@ -97,8 +113,18 @@
modelTypeAttribute.setNoChars( noChars );
modelTypeAttribute.setDisplay( display );
+ if ( ModelTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
+ {
+ if( optionSetId != -1 )
+ {
+ OptionSet optionSet = optionService.getOptionSet( optionSetId );
+ modelTypeAttribute.setOptionSet( optionSet );
+ }
+ }
+
modelTypeAttributeService.addModelTypeAttribute( modelTypeAttribute );
+ /*
if ( ModelTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
{
ModelTypeAttributeOption option = null;
@@ -111,6 +137,7 @@
modelTypeAttributeOptionService.addModelTypeAttributeOption( option );
}
}
+ */
return SUCCESS;
}
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/ShowUpdateModelTypeAttributeFormAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/ShowUpdateModelTypeAttributeFormAction.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/ShowUpdateModelTypeAttributeFormAction.java 2013-09-30 12:17:15 +0000
@@ -1,7 +1,12 @@
package org.hisp.dhis.ccem.model.action;
+import java.util.ArrayList;
+import java.util.List;
+
import org.hisp.dhis.coldchain.model.ModelTypeAttribute;
import org.hisp.dhis.coldchain.model.ModelTypeAttributeService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import com.opensymphony.xwork2.Action;
@@ -19,6 +24,12 @@
this.modelTypeAttributeService = modelTypeAttributeService;
}
+ private OptionService optionService;
+
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
// -------------------------------------------------------------------------
// Input/Output
@@ -38,6 +49,13 @@
return modelTypeAttribute;
}
+ private List<OptionSet> optionSets;
+
+ public List<OptionSet> getOptionSets()
+ {
+ return optionSets;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -47,6 +65,8 @@
{
modelTypeAttribute = modelTypeAttributeService.getModelTypeAttribute( id );
+ optionSets = new ArrayList<OptionSet>( optionService.getAllOptionSets() );
+
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/UpdateModelTypeAttributeAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/UpdateModelTypeAttributeAction.java 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/model/action/UpdateModelTypeAttributeAction.java 2013-09-30 12:17:15 +0000
@@ -7,10 +7,13 @@
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.equipment.EquipmentTypeAttribute;
import org.hisp.dhis.coldchain.model.ModelTypeAttribute;
import org.hisp.dhis.coldchain.model.ModelTypeAttributeOption;
import org.hisp.dhis.coldchain.model.ModelTypeAttributeOptionService;
import org.hisp.dhis.coldchain.model.ModelTypeAttributeService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import com.opensymphony.xwork2.Action;
@@ -35,6 +38,14 @@
{
this.modelTypeAttributeOptionService = modelTypeAttributeOptionService;
}
+
+ private OptionService optionService;
+
+ public void setOptionService(OptionService optionService)
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
@@ -75,8 +86,6 @@
this.mandatory = mandatory;
}
-
-
private List<String> attrOptions;
public void setAttrOptions( List<String> attrOptions )
@@ -98,14 +107,19 @@
this.display = display;
}
+ private Integer optionSetId;
+
+ public void setOptionSetId(Integer optionSetId)
+ {
+ this.optionSetId = optionSetId;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute()
- throws Exception
- {
-
+ public String execute() throws Exception
+ {
ModelTypeAttribute modelTypeAttribute = modelTypeAttributeService.getModelTypeAttribute( id );
modelTypeAttribute.setName( name );
@@ -116,7 +130,20 @@
modelTypeAttribute.setNoChars( noChars );
modelTypeAttribute.setDisplay( display );
-
+ if ( ModelTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
+ {
+ if( optionSetId != -1 )
+ {
+ OptionSet optionSet = optionService.getOptionSet( optionSetId );
+ modelTypeAttribute.setOptionSet( optionSet );
+ }
+ else
+ {
+ modelTypeAttribute.setOptionSet( null );
+ }
+ }
+
+ /*
HttpServletRequest request = ServletActionContext.getRequest();
Collection<ModelTypeAttributeOption> attributeOptions = modelTypeAttributeOptionService.getModelTypeAttributeOptions( modelTypeAttribute );
@@ -153,6 +180,7 @@
}
}
}
+ */
modelTypeAttributeService.updateModelTypeAttribute( modelTypeAttribute );
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml 2013-09-30 12:17:15 +0000
@@ -24,6 +24,7 @@
<bean id="org.hisp.dhis.ccem.model.action.AddColdChainModelTypeAttributeForm"
class="org.hisp.dhis.ccem.model.action.AddColdChainModelTypeAttributeForm"
scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<!-- Add -->
@@ -33,7 +34,8 @@
<property name="modelTypeAttributeService"
ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeService" />
<property name="modelTypeAttributeOptionService"
- ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeOptionService" />
+ ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeOptionService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<!-- show details -->
@@ -63,18 +65,17 @@
<bean id="org.hisp.dhis.ccem.model.action.ShowUpdateModelTypeAttributeFormAction"
class="org.hisp.dhis.ccem.model.action.ShowUpdateModelTypeAttributeFormAction"
scope="prototype">
- <property name="modelTypeAttributeService"
- ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeService" />
+ <property name="modelTypeAttributeService" ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<!-- Update -->
<bean id="org.hisp.dhis.ccem.model.action.UpdateModelTypeAttributeAction"
class="org.hisp.dhis.ccem.model.action.UpdateModelTypeAttributeAction"
scope="prototype">
- <property name="modelTypeAttributeService"
- ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeService" />
- <property name="modelTypeAttributeOptionService"
- ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeOptionService" />
+ <property name="modelTypeAttributeService" ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeService" />
+ <property name="modelTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.model.ModelTypeAttributeOptionService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<!-- Validation -->
@@ -365,6 +366,7 @@
scope="prototype">
<property name="equipmentTypeAttributeService" ref="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService" />
<property name="equipmentTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOptionService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.ccem.equipmenttype.action.ValidateEquipmentTypeAttributeAction"
class="org.hisp.dhis.ccem.equipmenttype.action.ValidateEquipmentTypeAttributeAction"
@@ -375,12 +377,14 @@
class="org.hisp.dhis.ccem.equipmenttype.action.ShowUpdateEquipmentTypeAttributeAction"
scope="prototype">
<property name="equipmentTypeAttributeService" ref="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.ccem.equipmenttype.action.UpdateEquipmentTypeAttributeAction"
class="org.hisp.dhis.ccem.equipmenttype.action.UpdateEquipmentTypeAttributeAction"
scope="prototype">
<property name="equipmentTypeAttributeService" ref="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeService" />
<property name="equipmentTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.equipment.EquipmentTypeAttributeOptionService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.ccem.equipmenttype.action.RemoveEquipmentTypeAttributeAction"
class="org.hisp.dhis.ccem.equipmenttype.action.RemoveEquipmentTypeAttributeAction"
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/org/hisp/dhis/ccem/i18n_module.properties'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/org/hisp/dhis/ccem/i18n_module.properties 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/org/hisp/dhis/ccem/i18n_module.properties 2013-09-30 12:17:15 +0000
@@ -152,7 +152,7 @@
html = HTML
xls = XLS
csv = CSV
-text = TEXT
+text = Text
pdf = PDF
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml 2013-09-30 12:17:15 +0000
@@ -299,7 +299,7 @@
<param name="javascripts">javascript/equipmentTypeAttribute.js</param>
</action>
- <action name="showAddEquipmentTypeAttributeForm" class="org.hisp.dhis.ccem.action.NoAction">
+ <action name="showAddEquipmentTypeAttributeForm" class="org.hisp.dhis.ccem.model.action.AddColdChainModelTypeAttributeForm">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-ccem/addEquipmentTypeAttributeForm.vm</param>
<param name="menu">/dhis-web-maintenance-ccem/menu.vm</param>
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addColdChainModelTypeAttributeForm.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addColdChainModelTypeAttributeForm.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addColdChainModelTypeAttributeForm.vm 2013-09-30 12:17:15 +0000
@@ -62,12 +62,25 @@
</td>
<td></td>
</tr>
+ <!--
<tr id="attributeComboRow">
<td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
</td>
<td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
</tr>
+ -->
+ <tr id="attributeComboRow">
+ <td><label for="optionSetId">$i18n.getString( "option_set" )</label></td>
+ <td>
+ <select id="optionSetId" name="optionSetId">
+ <option value="-1">Please Select</option>
+ #foreach( $optionSet in $optionSets )
+ <option value="$optionSet.id">$optionSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
</tbody>
<tr>
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addEquipmentTypeAttributeForm.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addEquipmentTypeAttributeForm.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addEquipmentTypeAttributeForm.vm 2013-09-30 12:17:15 +0000
@@ -65,13 +65,26 @@
</td>
<td></td>
</tr>
+
+ <tr>
+ <td><label for="optionSetId">$i18n.getString( "option_set" )</label></td>
+ <td>
+ <select id="optionSetId" name="optionSetId">
+ <option value="-1">Please Select</option>
+ #foreach( $optionSet in $optionSets )
+ <option value="$optionSet.id">$optionSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+<!--
<tr id="attributeComboRow">
<td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
</td>
<td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
</tr>
-
+-->
</tbody>
<tr>
<td></td>
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addEquipmentTypeAttributeForm.js'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addEquipmentTypeAttributeForm.js 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addEquipmentTypeAttributeForm.js 2013-09-30 12:17:15 +0000
@@ -1,6 +1,6 @@
jQuery(document).ready( function(){
validation( 'addEquipmentTypeAttributeForm', function(form){
- if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ if( isSubmit ) {
form.submit(i18n_field_is_required);
}
}, function(){
@@ -8,10 +8,12 @@
var fields = jQuery("#addEquipmentTypeAttributeForm").serializeArray();
jQuery.each(fields, function(i, field) {
+ /*
if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
setInnerHTML("attrMessage", i18n_field_is_required);
isSubmit = false;
}
+ */
});
});
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addModelTypeAttributeForm.js'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addModelTypeAttributeForm.js 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/addModelTypeAttributeForm.js 2013-09-30 12:17:15 +0000
@@ -1,6 +1,6 @@
jQuery(document).ready( function(){
validation( 'addModelTypeAttributeForm', function(form){
- if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ if( isSubmit ) {
form.submit(i18n_field_is_required);
}
}, function(){
@@ -8,10 +8,11 @@
var fields = jQuery("#addModelTypeAttributeForm").serializeArray();
jQuery.each(fields, function(i, field) {
+ /*
if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
setInnerHTML("attrMessage", i18n_field_is_required);
isSubmit = false;
- }
+ }*/
});
});
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateEquipmentTypeAttributeForm.js'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateEquipmentTypeAttributeForm.js 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateEquipmentTypeAttributeForm.js 2013-09-30 12:17:15 +0000
@@ -1,6 +1,6 @@
jQuery(document).ready( function(){
validation( 'updateEquipmentTypeAttributeForm', function(form){
- if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ if( isSubmit ) {
form.submit(i18n_field_is_required);
}
}, function(){
@@ -8,10 +8,12 @@
var fields = $("#addEquipmentTypeAttributeForm").serializeArray();
jQuery.each(fields, function(i, field) {
+ /*
if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
setInnerHTML("attrMessage", i18n_field_is_required);
isSubmit = false;
}
+ */
});
});
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateModelTypeAttributeForm.js'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateModelTypeAttributeForm.js 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/updateModelTypeAttributeForm.js 2013-09-30 12:17:15 +0000
@@ -1,6 +1,6 @@
jQuery(document).ready( function(){
validation( 'updateModelTypeAttributeForm', function(form){
- if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ if( isSubmit ) {
form.submit(i18n_field_is_required);
}
}, function(){
@@ -8,10 +8,12 @@
var fields = $("#updateModelTypeAttributeForm").serializeArray();
jQuery.each(fields, function(i, field) {
+ /*
if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
setInnerHTML("attrMessage", i18n_field_is_required);
isSubmit = false;
}
+ */
});
});
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateEquipmentTypeAttibuteForm.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateEquipmentTypeAttibuteForm.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateEquipmentTypeAttibuteForm.vm 2013-09-30 12:17:15 +0000
@@ -66,7 +66,20 @@
</select>
</td>
</tr>
+
+ <tr id="attributeComboRow">
+ <td><label for="optionSetId">$i18n.getString( "option_set" )</label></td>
+ <td>
+ <select id="optionSetId" name="optionSetId">
+ <option value="-1">Please Select</option>
+ #foreach( $optionSet in $optionSets )
+ <option value="$optionSet.id" #if($optionSet.id == $equipmentTypeAttribute.optionSet.id ) selected #end >$optionSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <!--
<tr id="attributeComboRow">
<td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td >
@@ -80,6 +93,7 @@
</table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a></td>
<td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
</tr>
+ -->
</tbody>
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateModelTypeAttibuteForm.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateModelTypeAttibuteForm.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/updateModelTypeAttibuteForm.vm 2013-09-30 12:17:15 +0000
@@ -63,7 +63,20 @@
</select>
</td>
</tr>
-
+
+ <tr id="attributeComboRow">
+ <td><label for="optionSetId">$i18n.getString( "option_set" )</label></td>
+ <td>
+ <select id="optionSetId" name="optionSetId">
+ <option value="-1">Please Select</option>
+ #foreach( $optionSet in $optionSets )
+ <option value="$optionSet.id" #if($optionSet.id == $modelTypeAttribute.optionSet.id ) selected #end >$optionSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <!--
<tr id="attributeComboRow">
<td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td >
@@ -77,6 +90,7 @@
</table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a></td>
<td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
</tr>
+ -->
</tbody>
<tr>