dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38971
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19785: add attributes to categoryOption/categoryOptionGroup
------------------------------------------------------------
revno: 19785
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-19 12:26:31 +0700
message:
add attributes to categoryOption/categoryOptionGroup
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.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/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2015-03-20 07:08:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2015-08-19 05:26:31 +0000
@@ -86,6 +86,10 @@
private boolean trackedEntityAttributeAttribute;
+ private boolean categoryOptionAttribute;
+
+ private boolean categoryOptionGroupAttribute;
+
private boolean mandatory;
private Integer sortOrder;
@@ -316,6 +320,32 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isCategoryOptionAttribute()
+ {
+ return categoryOptionAttribute;
+ }
+
+ public void setCategoryOptionAttribute( boolean categoryOptionAttribute )
+ {
+ this.categoryOptionAttribute = categoryOptionAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isCategoryOptionGroupAttribute()
+ {
+ return categoryOptionGroupAttribute;
+ }
+
+ public void setCategoryOptionGroupAttribute( boolean categoryOptionGroupAttribute )
+ {
+ this.categoryOptionGroupAttribute = categoryOptionGroupAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public OptionSet getOptionSet()
{
return optionSet;
@@ -372,6 +402,8 @@
programStageAttribute = attribute.isProgramStageAttribute();
trackedEntityAttribute = attribute.isTrackedEntityAttribute();
trackedEntityAttributeAttribute = attribute.isTrackedEntityAttributeAttribute();
+ categoryOptionAttribute = attribute.isCategoryOptionAttribute();
+ categoryOptionGroupAttribute = attribute.isCategoryOptionGroupAttribute();
mandatory = attribute.isMandatory();
if ( strategy.isReplace() )
@@ -410,6 +442,8 @@
.add( "programStageAttribute", programStageAttribute )
.add( "trackedEntityAttribute", trackedEntityAttribute )
.add( "trackedEntityAttributeAttribute", trackedEntityAttributeAttribute )
+ .add( "categoryOptionAttribute", categoryOptionAttribute )
+ .add( "categoryOptionGroupAttribute", categoryOptionGroupAttribute )
.add( "mandatory", mandatory )
.add( "attributeValues", attributeValues )
.toString();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2015-06-16 10:59:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2015-08-19 05:26:31 +0000
@@ -193,13 +193,27 @@
List<Attribute> getTrackedEntityAttributes();
/**
- * Gets attributes which are associated with programs.
+ * Gets attributes which are associated with tracked entity attributes
*
- * @return a set of attributes which are associated with programs.
+ * @return a set of attributes which are associated with tracked entity attributes
*/
List<Attribute> getTrackedEntityAttributeAttributes();
/**
+ * Gets attributes which are associated with category option attributes
+ *
+ * @return a set of attributes which are associated with category option attributes
+ */
+ List<Attribute> getCategoryOptionAttributes();
+
+ /**
+ * Gets attributes which are associated with category option group attributes
+ *
+ * @return a set of attributes which are associated with category option group attributes
+ */
+ List<Attribute> getCategoryOptionGroupAttributes();
+
+ /**
* Gets the number of attributes.
*
* @return the number of attributes.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2015-08-19 05:26:31 +0000
@@ -132,9 +132,23 @@
List<Attribute> getTrackedEntityAttributes();
/**
- * Gets attributes which are associated with programs.
+ * Gets attributes which are associated with tracked entity attributes
*
- * @return a set of attributes which are associated with programs.
+ * @return a set of attributes which are associated with tracked entity attributes
*/
List<Attribute> getTrackedEntityAttributeAttributes();
+
+ /**
+ * Gets attributes which are associated with category option attributes
+ *
+ * @return a set of attributes which are associated with category option attributes
+ */
+ List<Attribute> getCategoryOptionAttributes();
+
+ /**
+ * Gets attributes which are associated with category option group attributes
+ *
+ * @return a set of attributes which are associated with category option group attributes
+ */
+ List<Attribute> getCategoryOptionGroupAttributes();
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-08-19 05:26:31 +0000
@@ -205,6 +205,18 @@
}
@Override
+ public List<Attribute> getCategoryOptionAttributes()
+ {
+ return new ArrayList<>( i18n( i18nService, attributeStore.getCategoryOptionAttributes() ) );
+ }
+
+ @Override
+ public List<Attribute> getCategoryOptionGroupAttributes()
+ {
+ return new ArrayList<>( i18n( i18nService, attributeStore.getCategoryOptionGroupAttributes() ) );
+ }
+
+ @Override
public int getAttributeCount()
{
return attributeStore.getCount();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2015-08-19 05:26:31 +0000
@@ -28,14 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.List;
-
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeStore;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author mortenoh
*/
@@ -47,97 +47,111 @@
@SuppressWarnings( "unchecked" )
public List<Attribute> getDataElementAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "dataElementAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "dataElementAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getDataElementGroupAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "dataElementGroupAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "dataElementGroupAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getIndicatorAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "indicatorAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "indicatorAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getIndicatorGroupAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "indicatorGroupAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "indicatorGroupAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getDataSetAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "dataSetAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "dataSetAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getOrganisationUnitAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "organisationUnitAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "organisationUnitAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getOrganisationUnitGroupAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "organisationUnitGroupAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "organisationUnitGroupAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getOrganisationUnitGroupSetAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "organisationUnitGroupSetAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "organisationUnitGroupSetAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getUserAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "userAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "userAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getUserGroupAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "userGroupAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "userGroupAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getProgramAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "programAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "programAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getProgramStageAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "programStageAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "programStageAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getTrackedEntityAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "trackedEntityAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "trackedEntityAttribute", true ) ).list() );
}
@Override
@SuppressWarnings( "unchecked" )
public List<Attribute> getTrackedEntityAttributeAttributes()
{
- return new ArrayList<Attribute>( getCriteria( Restrictions.eq( "trackedEntityAttributeAttribute", true ) ).list() );
+ return new ArrayList<>( getCriteria( Restrictions.eq( "trackedEntityAttributeAttribute", true ) ).list() );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public List<Attribute> getCategoryOptionAttributes()
+ {
+ return new ArrayList<>( getCriteria( Restrictions.eq( "categoryOptionAttribute", true ) ).list() );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public List<Attribute> getCategoryOptionGroupAttributes()
+ {
+ return new ArrayList<>( getCriteria( Restrictions.eq( "categoryOptionGroupAttribute", true ) ).list() );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-08-18 22:46:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-08-19 05:26:31 +0000
@@ -764,6 +764,8 @@
executeSql( "UPDATE attribute SET programstageattribute=false WHERE programstageattribute IS NULL" );
executeSql( "UPDATE attribute SET trackedentityattribute=false WHERE trackedentityattribute IS NULL" );
executeSql( "UPDATE attribute SET trackedentityattributeattribute=false WHERE trackedentityattributeattribute IS NULL" );
+ executeSql( "UPDATE attribute SET categoryoptionattribute=false WHERE categoryoptionattribute IS NULL" );
+ executeSql( "UPDATE attribute SET categoryoptiongroupattribute=false WHERE categoryoptiongroupattribute IS NULL" );
executeSql( "ALTER TABLE trackedentityattributedimension DROP COLUMN operator" );
executeSql( "ALTER TABLE trackedentitydataelementdimension DROP COLUMN operator" );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2015-03-20 07:08:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2015-08-19 05:26:31 +0000
@@ -49,6 +49,10 @@
<property name="trackedEntityAttributeAttribute" not-null="false" />
+ <property name="categoryOptionAttribute" not-null="false" />
+
+ <property name="categoryOptionGroupAttribute" not-null="false" />
+
<property name="sortOrder" />
<set name="attributeValues" inverse="true" lazy="true">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2015-08-06 12:24:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2015-08-19 05:26:31 +0000
@@ -183,6 +183,20 @@
this.trackedEntityAttributeAttribute = trackedEntityAttributeAttribute;
}
+ private boolean categoryOptionAttribute;
+
+ public void setCategoryOptionAttribute( boolean categoryOptionAttribute )
+ {
+ this.categoryOptionAttribute = categoryOptionAttribute;
+ }
+
+ private boolean categoryOptionGroupAttribute;
+
+ public void setCategoryOptionGroupAttribute( boolean categoryOptionGroupAttribute )
+ {
+ this.categoryOptionGroupAttribute = categoryOptionGroupAttribute;
+ }
+
private String optionSetUid;
public void setOptionSetUid( String optionSetUid )
@@ -226,6 +240,8 @@
attribute.setProgramStageAttribute( programStageAttribute );
attribute.setTrackedEntityAttribute( trackedEntityAttribute );
attribute.setTrackedEntityAttributeAttribute( trackedEntityAttributeAttribute );
+ attribute.setCategoryOptionAttribute( categoryOptionAttribute );
+ attribute.setCategoryOptionGroupAttribute( categoryOptionGroupAttribute );
attribute.setOptionSet( optionSet );
attributeService.addAttribute( attribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2015-08-06 12:24:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2015-08-19 05:26:31 +0000
@@ -29,7 +29,6 @@
*/
import com.opensymphony.xwork2.Action;
-
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
@@ -190,6 +189,20 @@
this.trackedEntityAttributeAttribute = trackedEntityAttributeAttribute;
}
+ private boolean categoryOptionAttribute;
+
+ public void setCategoryOptionAttribute( boolean categoryOptionAttribute )
+ {
+ this.categoryOptionAttribute = categoryOptionAttribute;
+ }
+
+ private boolean categoryOptionGroupAttribute;
+
+ public void setCategoryOptionGroupAttribute( boolean categoryOptionGroupAttribute )
+ {
+ this.categoryOptionGroupAttribute = categoryOptionGroupAttribute;
+ }
+
private String optionSetUid;
public void setOptionSetUid( String optionSetUid )
@@ -238,6 +251,8 @@
attribute.setProgramStageAttribute( programStageAttribute );
attribute.setTrackedEntityAttribute( trackedEntityAttribute );
attribute.setTrackedEntityAttributeAttribute( trackedEntityAttributeAttribute );
+ attribute.setCategoryOptionAttribute( categoryOptionAttribute );
+ attribute.setCategoryOptionGroupAttribute( categoryOptionGroupAttribute );
attributeService.updateAttribute( attribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2015-07-31 10:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2015-08-19 05:26:31 +0000
@@ -387,3 +387,5 @@
user_account_invitations=User account invitations
pending_invitations=Pending invitations
expired_invitations=Expired invitations
+category_option=Category Option
+category_option_group=Category Option Group
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2015-04-20 10:37:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2015-08-19 05:26:31 +0000
@@ -63,6 +63,8 @@
<input type="checkbox" id="programStageAttribute" name="programStageAttribute" value="true" /><label for="programStageAttribute">$i18n.getString( 'program_stage' )</label> <br />
<input type="checkbox" id="trackedEntityAttribute" name="trackedEntityAttribute" value="true" /><label for="trackedEntityAttribute">$i18n.getString( 'tracked_entity' )</label> <br />
<input type="checkbox" id="trackedEntityAttributeAttribute" name="trackedEntityAttributeAttribute" value="true" /><label for="trackedEntityAttributeAttribute">$i18n.getString( 'tracked_entity_attribute' )</label> <br />
+ <input type="checkbox" id="categoryOptionAttribute" name="categoryOptionAttribute" value="true" /><label for="categoryOptionAttribute">$i18n.getString( 'category_option' )</label> <br />
+ <input type="checkbox" id="categoryOptionGroupAttribute" name="categoryOptionGroupAttribute" value="true" /><label for="categoryOptionGroupAttribute">$i18n.getString( 'category_option_group' )</label> <br />
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2015-04-20 10:37:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2015-08-19 05:26:31 +0000
@@ -64,6 +64,9 @@
<input type="checkbox" id="programStageAttribute" name="programStageAttribute" value="true" #if( $attribute.programStageAttribute ) checked="checked" #end /><label for="programStageAttribute">$i18n.getString( 'program_stage' )</label> <br />
<input type="checkbox" id="trackedEntityAttribute" name="trackedEntityAttribute" value="true" #if( $attribute.trackedEntityAttribute ) checked="checked" #end /><label for="trackedEntityAttribute">$i18n.getString( 'tracked_entity' )</label> <br />
<input type="checkbox" id="trackedEntityAttributeAttribute" name="trackedEntityAttributeAttribute" value="true" #if( $attribute.trackedEntityAttributeAttribute ) checked="checked" #end /><label for="trackedEntityAttributeAttribute">$i18n.getString( 'tracked_entity_attribute' )</label> <br />
+ <input type="checkbox" id="categoryOptionAttribute" name="categoryOptionAttribute" value="true" #if( $attribute.categoryOptionAttribute ) checked="checked" #end /><label for="categoryOptionAttribute">$i18n.getString( 'category_option' ) <br />
+ <input type="checkbox" id="categoryOptionGroupAttribute" name="categoryOptionGroupAttribute" value="true" #if( $attribute.categoryOptionGroupAttribute ) checked="checked" #end /><label for="categoryOptionGroupAttribute">$i18n.getString( 'category_option_group' ) <br />
+ </label> <br />
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java 2015-08-19 05:26:31 +0000
@@ -28,18 +28,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.calendar.CalendarService;
import org.hisp.dhis.calendar.DateTimeUnit;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
-
-import com.opensymphony.xwork2.Action;
-
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -51,19 +52,18 @@
// Dependencies
// -------------------------------------------------------------------------
+ @Autowired
private DataElementCategoryService dataElementCategoryService;
- public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
- {
- this.dataElementCategoryService = dataElementCategoryService;
- }
-
@Autowired
private CalendarService calendarService;
@Autowired
private OrganisationUnitSelectionManager selectionManager;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -103,6 +103,13 @@
this.endDate = endDate;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -141,7 +148,13 @@
dataElementCategoryOption.setCode( StringUtils.trimToNull( code ) );
dataElementCategoryOption.setStartDate( sDate );
dataElementCategoryOption.setEndDate( eDate );
- dataElementCategoryOption.getOrganisationUnits().addAll ( selectionManager.getSelectedOrganisationUnits() );
+ dataElementCategoryOption.getOrganisationUnits().addAll( selectionManager.getSelectedOrganisationUnits() );
+
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( dataElementCategoryOption.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
dataElementCategoryService.addDataElementCategoryOption( dataElementCategoryOption );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java 2015-08-19 05:26:31 +0000
@@ -28,12 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.paging.ActionPagingSupport;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* @author Chau Thu Tran
*/
@@ -54,6 +62,9 @@
@Autowired
private OrganisationUnitSelectionManager selectionManager;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -83,6 +94,20 @@
return moreOptionsPresent;
}
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ private Map<Integer, String> attributeValues = new HashMap<>();
+
+ public Map<Integer, String> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -94,9 +119,13 @@
selectionManager.setSelectedOrganisationUnits( dataElementCategoryOption.getOrganisationUnits() );
+ attributes = new ArrayList<>( attributeService.getCategoryOptionAttributes() );
+
+ attributeValues = AttributeUtils.getAttributeValueMap( dataElementCategoryOption.getAttributeValues() );
+
moreOptionsPresent = dataElementCategoryOption.getStartDate() != null
- || dataElementCategoryOption.getEndDate() != null
- || !dataElementCategoryOption.getOrganisationUnits().isEmpty();
+ || dataElementCategoryOption.getEndDate() != null
+ || !dataElementCategoryOption.getOrganisationUnits().isEmpty();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java 2015-08-19 05:26:31 +0000
@@ -29,11 +29,14 @@
*/
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
+import java.util.List;
/**
* @author Jim Grace
@@ -49,16 +52,32 @@
@Autowired
private OrganisationUnitSelectionManager selectionManager;
+ @Autowired
+ private AttributeService attributeService;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute()
- throws Exception
+ throws Exception
{
selectionManager.setSelectedOrganisationUnits( new ArrayList<OrganisationUnit>() );
+ attributes = new ArrayList<>( attributeService.getCategoryOptionAttributes() );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2015-08-19 05:26:31 +0000
@@ -28,18 +28,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.calendar.CalendarService;
import org.hisp.dhis.calendar.DateTimeUnit;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-
-import com.opensymphony.xwork2.Action;
-
+import org.hisp.dhis.system.util.AttributeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
+import java.util.List;
/**
* @author Chau Thu Tran
@@ -52,19 +53,18 @@
// Dependencies
// -------------------------------------------------------------------------
+ @Autowired
private DataElementCategoryService dataElementCategoryService;
- public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
- {
- this.dataElementCategoryService = dataElementCategoryService;
- }
-
@Autowired
private CalendarService calendarService;
@Autowired
private OrganisationUnitSelectionManager selectionManager;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -111,6 +111,13 @@
this.endDate = endDate;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -130,7 +137,7 @@
public String execute()
{
code = StringUtils.trimToNull( code );
-
+
Date sDate = null;
Date eDate = null;
@@ -153,7 +160,13 @@
categoryOption.setStartDate( sDate );
categoryOption.setEndDate( eDate );
categoryOption.getOrganisationUnits().clear();
- categoryOption.getOrganisationUnits().addAll ( selectionManager.getSelectedOrganisationUnits() );
+ categoryOption.getOrganisationUnits().addAll( selectionManager.getSelectedOrganisationUnits() );
+
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( categoryOption.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
dataElementCategoryService.updateDataElementCategoryOption( categoryOption );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java 2015-08-19 05:26:31 +0000
@@ -31,11 +31,14 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
/**
@@ -51,6 +54,9 @@
@Autowired
private DataElementCategoryService dataElementCategoryService;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -83,6 +89,13 @@
this.coSelected = coSelected;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -100,6 +113,12 @@
categoryOptionGroup.addCategoryOption( dataElementCategoryService.getDataElementCategoryOption( id ) );
}
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( categoryOptionGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
dataElementCategoryService.saveCategoryOptionGroup( categoryOptionGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java 2015-08-19 05:26:31 +0000
@@ -28,15 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* @author Chau Thu Tran
- *
* @version $ GetCategoryOptionGroupAction.java Feb 12, 2014 11:27:01 PM $
*/
public class GetCategoryOptionGroupAction
@@ -49,6 +54,9 @@
@Autowired
private DataElementCategoryService dataElementCategoryService;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -67,6 +75,13 @@
return categoryOptionGroup;
}
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -77,7 +92,8 @@
{
categoryOptionGroup = dataElementCategoryService.getCategoryOptionGroup( id );
+ attributes = new ArrayList<>( attributeService.getDataElementAttributes() );
+
return SUCCESS;
}
-
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java 2015-08-19 05:26:31 +0000
@@ -29,14 +29,19 @@
*/
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @author Chau Thu Tran
@@ -51,6 +56,9 @@
@Autowired
private DataElementCategoryService dataElementCategoryService;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input && Output
// -------------------------------------------------------------------------
@@ -76,6 +84,21 @@
return categoryOptions;
}
+ private List<Attribute> attributes;
+
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ private Map<Integer, String> attributeValues = new HashMap<>();
+
+ public Map<Integer, String> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -88,6 +111,10 @@
categoryOptions = new ArrayList<>( categoryOptionGroup.getMembers() );
+ attributes = new ArrayList<>( attributeService.getCategoryOptionGroupAttributes() );
+
+ attributeValues = AttributeUtils.getAttributeValueMap( categoryOptionGroup.getAttributeValues() );
+
Collections.sort( categoryOptions );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java 2015-08-19 05:26:31 +0000
@@ -31,11 +31,14 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
/**
@@ -51,6 +54,9 @@
@Autowired
private DataElementCategoryService dataElementCategoryService;
+ @Autowired
+ private AttributeService attributeService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -90,6 +96,13 @@
this.coSelected = coSelected;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -109,6 +122,12 @@
categoryOptionGroup.addCategoryOption( dataElementCategoryService.getDataElementCategoryOption( id ) );
}
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( categoryOptionGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
dataElementCategoryService.updateCategoryOptionGroup( categoryOptionGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-08-19 03:02:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-08-19 05:26:31 +0000
@@ -28,11 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.commons.collection.ListUtils;
@@ -47,10 +43,13 @@
import org.hisp.dhis.option.OptionService;
import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.system.util.AttributeUtils;
-
-import com.opensymphony.xwork2.Action;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
/**
* @author Torgeir Lorange Ostby
*/
@@ -198,9 +197,9 @@
{
this.selectedOptionSetId = selectedOptionSetId;
}
-
+
private Integer selectedCommentOptionSetId;
-
+
public void setSelectedCommentOptionSetId( Integer selectedCommentOptionSetId )
{
this.selectedCommentOptionSetId = selectedCommentOptionSetId;
@@ -234,9 +233,9 @@
dataElement.setCode( StringUtils.trimToNull( code ) );
dataElement.setDescription( StringUtils.trimToNull( description ) );
dataElement.setFormName( StringUtils.trimToNull( formName ) );
- dataElement.setDomainType( DataElementDomain.fromValue( domainType ) );
+ dataElement.setDomainType( DataElementDomain.fromValue( domainType ) );
dataElement.setType( valueType );
-
+
if ( DataElement.VALUE_TYPE_STRING.equalsIgnoreCase( valueType ) )
{
dataElement.setTextType( textType );
@@ -245,7 +244,7 @@
{
dataElement.setNumberType( numberType );
}
-
+
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setZeroIsSignificant( zeroIsSignificant );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-08-19 03:02:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-08-19 05:26:31 +0000
@@ -28,11 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.commons.collection.ListUtils;
@@ -50,10 +46,13 @@
import org.hisp.dhis.option.OptionService;
import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.system.util.AttributeUtils;
-
-import com.opensymphony.xwork2.Action;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
/**
* @author Torgeir Lorange Ostby
*/
@@ -220,7 +219,7 @@
}
private Integer selectedCommentOptionSetId;
-
+
public void setSelectedCommentOptionSetId( Integer selectedCommentOptionSetId )
{
this.selectedCommentOptionSetId = selectedCommentOptionSetId;
@@ -254,9 +253,9 @@
dataElement.setCode( StringUtils.trimToNull( code ) );
dataElement.setDescription( StringUtils.trimToNull( description ) );
dataElement.setFormName( StringUtils.trimToNull( formName ) );
- dataElement.setDomainType( DataElementDomain.fromValue( domainType ) );
+ dataElement.setDomainType( DataElementDomain.fromValue( domainType ) );
dataElement.setType( valueType );
-
+
if ( DataElement.VALUE_TYPE_STRING.equalsIgnoreCase( valueType ) )
{
dataElement.setTextType( textType );
@@ -267,7 +266,7 @@
dataElement.setNumberType( numberType );
dataElement.setTextType( null );
}
-
+
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setZeroIsSignificant( zeroIsSignificant );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2015-08-19 03:02:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2015-08-19 05:26:31 +0000
@@ -61,7 +61,7 @@
<!-- Data Element Group -->
<bean id="org.hisp.dhis.dd.action.dataelementgroup.ShowAddDataElementGroupForm" class="org.hisp.dhis.dd.action.dataelementgroup.ShowAddDataElementGroupForm"
- scope="prototype">
+ scope="prototype">
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
@@ -71,7 +71,7 @@
</bean>
<bean id="org.hisp.dhis.dd.action.dataelementgroup.RenameDEGroupNameEditorAction" class="org.hisp.dhis.dd.action.dataelementgroup.RenameDEGroupNameEditorAction"
- scope="prototype"/>
+ scope="prototype" />
<bean id="org.hisp.dhis.dd.action.dataelementgroup.GetDataElementGroupListAction" class="org.hisp.dhis.dd.action.dataelementgroup.GetDataElementGroupListAction"
scope="prototype">
@@ -203,7 +203,7 @@
</bean>
<bean id="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction" class="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction"
- scope="prototype"/>
+ scope="prototype" />
<bean id="org.hisp.dhis.dd.action.indicatorgroup.AssignGroupsForIndicatorAction" class="org.hisp.dhis.dd.action.indicatorgroup.AssignGroupsForIndicatorAction"
scope="prototype">
@@ -283,8 +283,8 @@
<!-- Indicator -->
<bean id="org.hisp.dhis.dd.action.indicator.ShowAddIndicatorForm" class="org.hisp.dhis.dd.action.indicator.ShowAddIndicatorForm"
- scope="prototype">
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
+ scope="prototype">
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
<property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
</bean>
@@ -364,19 +364,20 @@
<!-- CategoryOption -->
+ <bean id="org.hisp.dhis.dd.action.category.ShowAddDataElementCategoryOptionAction"
+ class="org.hisp.dhis.dd.action.category.ShowAddDataElementCategoryOptionAction" scope="prototype"/>
+
<bean id="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionListAction" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionListAction"
scope="prototype">
<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction"
scope="prototype">
- <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
<bean id="org.hisp.dhis.dd.action.category.UpdateDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.UpdateDataElementCategoryOptionAction"
scope="prototype">
- <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
<bean id="org.hisp.dhis.dd.action.category.RemoveDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.RemoveDataElementCategoryOptionAction"
@@ -384,16 +385,16 @@
<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
- <bean id="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionAction"
+ <bean id="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionAction"
scope="prototype">
<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction"
scope="prototype">
<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
<!-- CategoryCombo -->
<bean id="org.hisp.dhis.dd.action.categorycombo.GetDataElementCategoryListAction" class="org.hisp.dhis.dd.action.categorycombo.GetDataElementCategoryListAction"
@@ -432,85 +433,89 @@
</bean>
<!-- CategoryOptionGroup -->
-
+
+ <bean id="org.hisp.dhis.dd.action.categoryoptiongroup.ShowAddCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.ShowAddCategoryOptionGroupAction"
+ scope="prototype">
+ </bean>
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.AddCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.AddCategoryOptionGroupAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.GetCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.GetCategoryOptionGroupAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.GetCategoryOptionGroupListAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.GetCategoryOptionGroupListAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.RemoveCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.RemoveCategoryOptionGroupAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.ShowUpdateCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.ShowUpdateCategoryOptionGroupAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.UpdateCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.UpdateCategoryOptionGroupAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroup.ValidateCategoryOptionGroupAction" class="org.hisp.dhis.dd.action.categoryoptiongroup.ValidateCategoryOptionGroupAction"
scope="prototype">
</bean>
-
- <!-- CategoryOptionGroupSet -->
-
+
+ <!-- CategoryOptionGroupSet -->
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.AddCategoryOptionGroupSetAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.AddCategoryOptionGroupSetAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.GetCategoryOptionGroupSetAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.GetCategoryOptionGroupSetAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.GetCategoryOptionGroupSetListAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.GetCategoryOptionGroupSetListAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.RemoveCategoryOptionGroupSetAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.RemoveCategoryOptionGroupSetAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.ShowUpdateCategoryOptionGroupSetAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.ShowUpdateCategoryOptionGroupSetAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.UpdateCategoryOptionGroupSetAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.UpdateCategoryOptionGroupSetAction"
scope="prototype">
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.categoryoptiongroupset.ValidateCategoryOptionGroupSetAction" class="org.hisp.dhis.dd.action.categoryoptiongroupset.ValidateCategoryOptionGroupSetAction"
scope="prototype">
</bean>
-
- <!-- CategoryOptionCombo -->
+
+ <!-- CategoryOptionCombo -->
<bean id="org.hisp.dhis.dd.action.category.GetCategoryOptionComboListAction" class="org.hisp.dhis.dd.action.category.GetCategoryOptionComboListAction"
scope="prototype">
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.category.GetCategoryOptionComboAction" class="org.hisp.dhis.dd.action.category.GetCategoryOptionComboAction"
scope="prototype">
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.category.UpdateCategoryOptionComboAction" class="org.hisp.dhis.dd.action.category.UpdateCategoryOptionComboAction"
scope="prototype">
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
<bean id="org.hisp.dhis.dd.action.category.ValidateCategoryOptionComboAction" class="org.hisp.dhis.dd.action.category.ValidateCategoryOptionComboAction"
scope="prototype">
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
-
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2014-12-20 13:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2015-08-19 05:26:31 +0000
@@ -601,7 +601,7 @@
<param name="anyAuthorities">F_CATEGORY_OPTION_GROUP_PUBLIC_ADD, F_CATEGORY_OPTION_GROUP_PRIVATE_ADD</param>
</action>
- <action name="showAddCategoryOptionGroupForm" class="org.hisp.dhis.dd.action.NoAction">
+ <action name="showAddCategoryOptionGroupForm" class="org.hisp.dhis.dd.action.categoryoptiongroup.ShowAddCategoryOptionGroupAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm</param>
<param name="javascripts">javascript/categoryOptionGroup.js</param>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm 2014-09-26 06:23:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm 2015-08-19 05:26:31 +0000
@@ -1,25 +1,26 @@
<script type="text/javascript">
- jQuery(function() {
- validation('addCategoryOptionGroupForm', function ( form ) {
- form.submit();
- },function(){
- $("#coSelected").find("option").attr("selected", "selected");
- if(jQuery("#coSelected option").length > 0 ){
- setFieldValue('hasOptions', 'true');
- }
- });
-
- checkValueIsExist("name", "validateCategoryOptionGroup.action");
- checkValueIsExist( "shortName", "validateCategoryOptionGroup.action" );
- checkValueIsExist( "code", "validateCategoryOptionGroup.action" );
-
- $('#coAvailable').selected({
- url: '../api/categoryOptions.json',
- target: $('#coSelected'),
- search: $('#coAvailableSearch'),
- iterator: 'categoryOptions'
- });
- });
+ jQuery(function() {
+ validation('addCategoryOptionGroupForm', function(form) {
+ form.submit();
+ }, function() {
+ #tblDynamicAttributesJavascript()
+ $("#coSelected").find("option").attr("selected", "selected");
+ if( jQuery("#coSelected option").length > 0 ) {
+ setFieldValue('hasOptions', 'true');
+ }
+ });
+
+ checkValueIsExist("name", "validateCategoryOptionGroup.action");
+ checkValueIsExist("shortName", "validateCategoryOptionGroup.action");
+ checkValueIsExist("code", "validateCategoryOptionGroup.action");
+
+ $('#coAvailable').selected({
+ url: '../api/categoryOptions.json',
+ target: $('#coSelected'),
+ search: $('#coAvailableSearch'),
+ iterator: 'categoryOptions'
+ });
+ });
</script>
<h3>$i18n.getString( "create_new_category_option_group" )</h3>
@@ -45,6 +46,8 @@
</tr>
</table>
+#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
#jqSelected({
"prefix": "co",
"i18n_available": "available_category_options",
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm 2014-11-28 08:10:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm 2015-08-19 05:26:31 +0000
@@ -1,24 +1,31 @@
<script type="text/javascript">
- jQuery(document).ready( function() {
- validation( 'addDataElementCategoryOptionForm', function(form){
- form.submit();
- });
- $('#startDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
- $('#endDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
-
- selection.setOfflineLevel( 1 );
- selection.setMultipleSelectionAllowed( true );
- selection.setUnselectAllowed( true );
- selection.setAutoSelectRoot( false );
- selection.clearSelected();
-
- checkValueIsExist( "name", "validateDataElementCategoryOption.action" );
- checkValueIsExist( "shortName", "validateDataElementCategoryOption.action" );
- checkValueIsExist( "code", "validateDataElementCategoryOption.action" );
-
- dhis2.period.picker.createInstance('#startDate');
- dhis2.period.picker.createInstance('#endDate');
- });
+ jQuery(document).ready(function() {
+ validation2('addDataElementCategoryOptionForm', function(form) {
+ form.submit()
+ }, {
+ 'beforeValidateHandler': function() {
+ listValidator('memberValidator', 'categoryOptions');
+ #tblDynamicAttributesJavascript()
+ },
+ 'rules': getValidationRules("dateElementCategoryOption")
+ });
+
+ $('#startDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
+ $('#endDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
+
+ selection.setOfflineLevel(1);
+ selection.setMultipleSelectionAllowed(true);
+ selection.setUnselectAllowed(true);
+ selection.setAutoSelectRoot(false);
+ selection.clearSelected();
+
+ checkValueIsExist("name", "validateDataElementCategoryOption.action");
+ checkValueIsExist("shortName", "validateDataElementCategoryOption.action");
+ checkValueIsExist("code", "validateDataElementCategoryOption.action");
+
+ dhis2.period.picker.createInstance('#startDate');
+ dhis2.period.picker.createInstance('#endDate');
+ });
var i18n_specify_category_option_name = '$encoder.jsEscape( $i18n.getString( "specify_category_option_name" ) , "'")';
var i18n_category_option_name_already_exists = '$encoder.jsEscape( $i18n.getString( "category_option_name_already_exists" ) , "'")';
@@ -36,10 +43,10 @@
<h3>$i18n.getString( "create_new_data_element_category_option" )</h3>
<form id="addDataElementCategoryOptionForm" name="addDataElementCategoryOptionForm" action="addDataElementCategoryOption.action" method="post" class="inputForm">
-
+
<table>
<tr>
- <th colspan="2">$i18n.getString( "details" )</th>
+ <th colspan="2">$i18n.getString( "details" )</th>
</tr>
<tr>
<td style="width: 100px"><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
@@ -54,11 +61,13 @@
<td><input type="text" id="code" name="code"/></td>
</tr>
</table>
-
+
+ #tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
<div id="showMoreOptions" style="margin: 20px 0;"><a href="javascript:showMoreOrFewerOptions()">$i18n.getString( "show_more_options" )</a></div>
-
+
<div id="moreOptions" style="display:none">
-
+
<table>
<tr>
<td style="width: 100px"><label for="startDate">$i18n.getString( 'start_date' )</label></td>
@@ -89,5 +98,5 @@
<input type="submit" value="$i18n.getString( 'add' )" style="width:10em">
<input type="button" onclick="dhis2.commons.redirectCurrentPage( 'categoryOption.action' )" value="$i18n.getString( 'cancel' )" style="width:10em"/>
</p>
-
+
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm 2014-11-28 08:10:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm 2015-08-19 05:26:31 +0000
@@ -1,28 +1,33 @@
<script type="text/javascript">
- jQuery(document).ready( function() {
- validation2( 'editDataElementCategoryOptionForm', function( form ){ form.submit()}, {
- 'beforeValidateHandler': function() { listValidator( 'memberValidator', 'categoryOptions' ); },
- 'rules': getValidationRules("dateElementCategoryOption")
- });
-
- $('#startDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
- $('#endDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
-
- selection.clearSelected(); // Sync ouwt from server
- selection.setOfflineLevel( 1 );
- selection.setMultipleSelectionAllowed( true );
- selection.setUnselectAllowed( true );
- selection.setAutoSelectRoot( false );
-
- #if ( $moreOptionsPresent ) showMoreOrFewerOptions(); #end
-
- checkValueIsExist( "name", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id} );
- checkValueIsExist( "shortName", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id} );
- checkValueIsExist( "code", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id} );
-
- dhis2.period.picker.createInstance('#startDate');
- dhis2.period.picker.createInstance('#endDate');
- });
+ jQuery(document).ready(function() {
+ validation2('editDataElementCategoryOptionForm', function(form) {
+ form.submit()
+ }, {
+ 'beforeValidateHandler': function() {
+ listValidator('memberValidator', 'categoryOptions');
+ #tblDynamicAttributesJavascript()
+ },
+ 'rules': getValidationRules("dateElementCategoryOption")
+ });
+
+ $('#startDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
+ $('#endDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
+
+ selection.clearSelected(); // Sync ouwt from server
+ selection.setOfflineLevel(1);
+ selection.setMultipleSelectionAllowed(true);
+ selection.setUnselectAllowed(true);
+ selection.setAutoSelectRoot(false);
+
+ #if ( $moreOptionsPresent ) showMoreOrFewerOptions(); #end
+
+ checkValueIsExist("name", "validateDataElementCategoryOption.action", { id: $dataElementCategoryOption.id});
+ checkValueIsExist("shortName", "validateDataElementCategoryOption.action", { id: $dataElementCategoryOption.id});
+ checkValueIsExist("code", "validateDataElementCategoryOption.action", { id: $dataElementCategoryOption.id});
+
+ dhis2.period.picker.createInstance('#startDate');
+ dhis2.period.picker.createInstance('#endDate');
+ });
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_category_option" ) , "'")';
var i18n_specify_category_option_name = '$encoder.jsEscape( $i18n.getString( "specify_category_option_name" ) , "'")';
@@ -62,6 +67,8 @@
</tr>
</table>
+ #tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
<div id="showMoreOptions" style="margin: 20px 0;"><a href="javascript:showMoreOrFewerOptions()">$i18n.getString( "show_more_options" )</a></div>
<div id="moreOptions" style="display:none">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm 2014-11-14 12:22:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm 2015-08-19 05:26:31 +0000
@@ -1,34 +1,34 @@
<script type="text/javascript">
- jQuery(function() {
- validation( 'updateCategoryOptionGroupForm', function( form )
- {
- form.submit();
- },function(){
- $("#coSelected").find("option").attr("selected", "selected");
- if(jQuery("#coSelected option").length > 0 ){
- setFieldValue('hasOptions', 'true');
- }
- });
-
- checkValueIsExist( "name", "validateCategoryOptionGroup.action", {
- id : getFieldValue( 'id' )
- } );
-
- checkValueIsExist( "shortName", "validateCategoryOptionGroup.action", {
- id : getFieldValue( 'id' )
- } );
-
- checkValueIsExist( "code", "validateCategoryOptionGroup.action", {
- id : getFieldValue( 'id' )
- } );
-
- $('#coAvailable').selected({
- url: '../api/categoryOptions.json',
- target: $('#coSelected'),
- search: $('#coAvailableSearch'),
- iterator: 'categoryOptions'
- });
- });
+ jQuery(function() {
+ validation('updateCategoryOptionGroupForm', function(form) {
+ form.submit();
+ }, function() {
+ #tblDynamicAttributesJavascript()
+ $("#coSelected").find("option").attr("selected", "selected");
+ if( jQuery("#coSelected option").length > 0 ) {
+ setFieldValue('hasOptions', 'true');
+ }
+ });
+
+ checkValueIsExist("name", "validateCategoryOptionGroup.action", {
+ id: getFieldValue('id')
+ });
+
+ checkValueIsExist("shortName", "validateCategoryOptionGroup.action", {
+ id: getFieldValue('id')
+ });
+
+ checkValueIsExist("code", "validateCategoryOptionGroup.action", {
+ id: getFieldValue('id')
+ });
+
+ $('#coAvailable').selected({
+ url: '../api/categoryOptions.json',
+ target: $('#coSelected'),
+ search: $('#coAvailableSearch'),
+ iterator: 'categoryOptions'
+ });
+ });
</script>
<h3>$i18n.getString( "edit_category_option_group" )</h3>
@@ -59,6 +59,8 @@
</tr>
</table>
+#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
#jqSelected({
"prefix": "co",
"i18n_available": "available_category_options",