dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21052
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9865: Add category option user interface.
------------------------------------------------------------
revno: 9865
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-02-22 21:58:47 +0700
message:
Add category option user interface.
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm
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/GetDataElementCategoryOptionListAction.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
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/UpdateDataElementCategoryOptionAction.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/org/hisp/dhis/dd/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-02-19 16:12:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-02-22 14:58:47 +0000
@@ -152,7 +152,8 @@
public DataElementCategory getDataElementCategoryByName( String name )
{
- List<DataElementCategory> dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryStore.getAllEqName( name ) );
+ List<DataElementCategory> dataElementCategories = new ArrayList<DataElementCategory>(
+ dataElementCategoryStore.getAllEqName( name ) );
if ( dataElementCategories.isEmpty() )
{
@@ -183,24 +184,25 @@
public DataElementCategoryOption getDataElementCategoryOption( int id )
{
- return dataElementCategoryOptionStore.get( id );
+ return i18n( i18nService, dataElementCategoryOptionStore.get( id ) );
}
public DataElementCategoryOption getDataElementCategoryOption( String uid )
{
- return dataElementCategoryOptionStore.getByUid( uid );
+ return i18n( i18nService, dataElementCategoryOptionStore.getByUid( uid ) );
}
public DataElementCategoryOption getDataElementCategoryOptionByName( String name )
{
- List<DataElementCategoryOption> dataElementCategoryOptions = new ArrayList<DataElementCategoryOption>( dataElementCategoryOptionStore.getAllEqName( name ) );
+ List<DataElementCategoryOption> dataElementCategoryOptions = new ArrayList<DataElementCategoryOption>(
+ dataElementCategoryOptionStore.getAllEqName( name ) );
if ( dataElementCategoryOptions.isEmpty() )
{
return null;
}
- return dataElementCategoryOptions.get( 0 );
+ return i18n( i18nService, dataElementCategoryOptions.get( 0 ) );
}
public Collection<DataElementCategoryOption> getDataElementCategoryOptions( final Collection<Integer> identifiers )
@@ -219,7 +221,7 @@
public Collection<DataElementCategoryOption> getAllDataElementCategoryOptions()
{
- return dataElementCategoryOptionStore.getAll();
+ return i18n( i18nService, dataElementCategoryOptionStore.getAll() );
}
// -------------------------------------------------------------------------
@@ -272,7 +274,8 @@
public DataElementCategoryCombo getDataElementCategoryComboByName( String name )
{
- List<DataElementCategoryCombo> dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryComboStore.getAllEqName( name ) );
+ List<DataElementCategoryCombo> dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>(
+ dataElementCategoryComboStore.getAllEqName( name ) );
if ( dataElementCategoryCombos.isEmpty() )
{
@@ -325,7 +328,7 @@
}
} );
}
-
+
public Collection<DataElementCategoryOptionCombo> getDataElementCategoryOptionCombosByUid( Collection<String> uids )
{
return dataElementCategoryOptionComboStore.getByUid( uids );
@@ -650,13 +653,13 @@
@Override
public Collection<DataElementCategoryOption> getDataElementCategoryOptionsBetween( int first, int max )
{
- return dataElementCategoryOptionStore.getAllOrderedName( first, max );
+ return i18n( i18nService, dataElementCategoryOptionStore.getAllOrderedName( first, max ) );
}
@Override
public Collection<DataElementCategoryOption> getDataElementCategoryOptionsBetweenByName( String name, int first,
int max )
{
- return dataElementCategoryOptionStore.getAllLikeNameOrderedName( name, first, max );
+ return i18n( i18nService, dataElementCategoryOptionStore.getAllLikeNameOrderedName( name, first, max ) );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-02-21 04:50:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-02-22 14:58:47 +0000
@@ -530,7 +530,7 @@
filter_value = Filter value
filter_values = Filter values
fill_filter_values_for_all_selected_data_elements = Please fill filter values for all selected data elements
-data_filter = Data filter
+data_filter = Data filters
show_hide_filter_values = Show/hide filter values
use_completed_events = Use completed events
date_period_range = Date period range
@@ -544,7 +544,7 @@
select_all_children = Select all children
total = Total
confirm_delete_date_range_list=Are you sure you want to delete date range list?
-invalid_position = There are 10 positions supported, include : \n 1. Orgunit: Rows; Period: Rows; Data: Filter \n 2. Orgunit: Rows; Period: Columns; Data: Filter \n 3. Orgunit: Rows; Period: Filter; Data: Filter \n 4. Orgunit: Rows; Period: Filter; Data: Columns \n 5. Orgunit: Columns; Period: Rows; Data: Filter \n 6. Orgunit: Columns; Period: Filter; Data: Rows \n 7. Orgunit: Filter; Period: Rows; Data: Filter \n 8. Orgunit: Filter; Period: Rows; Data: Columns \n 9. Orgunit: Filter; Period: Columns; Data: Rows \n 10. Orgunit: Filter; Period: Filter; Data: Rows
+invalid_position = There are 10 positions supported, include : \n 1. Orgunit: Rows; Period: Rows; Data: Filters \n 2. Orgunit: Rows; Period: Columns; Data: Filters \n 3. Orgunit: Rows; Period: Filters; Data: Filters \n 4. Orgunit: Rows; Period: Filters; Data: Columns \n 5. Orgunit: Columns; Period: Rows; Data: Filters \n 6. Orgunit: Columns; Period: Filters; Data: Rows \n 7. Orgunit: Filters; Period: Rows; Data: Filters \n 8. Orgunit: Filters; Period: Rows; Data: Columns \n 9. Orgunit: Filters; Period: Columns; Data: Rows \n 10. Orgunit: Filters; Period: Filters; Data: Rows
please_select_one_position_for_row = Please select one position for row
please_select_one_position_for_filtering = Please select one position for filtering
select_a_dataelement_for_sum_avg_operator = Please select a data element for sum/avg operator
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm 2013-02-22 14:58:47 +0000
@@ -0,0 +1,7 @@
+{ "dataElementCategoryOption":
+ {
+ "id": "${dataElementCategoryOption.id}" ,
+ "name": "$!encoder.jsonEncode( ${dataElementCategoryOption.name} )",
+ "concept": "$!encoder.jsonEncode(${dataElementCategoryOption.concept.name})"
+ }
+}
=== 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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java 2013-02-22 14:58:47 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.concept.ConceptService;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -50,12 +51,19 @@
this.dataElementCategoryService = dataElementCategoryService;
}
+ private ConceptService conceptService;
+
+ public void setConceptService( ConceptService conceptService )
+ {
+ this.conceptService = conceptService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
private Integer categoryId;
-
+
public void setCategoryId( Integer categoryId )
{
this.categoryId = categoryId;
@@ -68,6 +76,20 @@
this.name = name;
}
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ private Integer conceptId;
+
+ public void setConceptId( Integer conceptId )
+ {
+ this.conceptId = conceptId;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -85,16 +107,25 @@
public String execute()
{
- DataElementCategory category = dataElementCategoryService.getDataElementCategory( categoryId );
-
+
dataElementCategoryOption = new DataElementCategoryOption( name );
- dataElementCategoryOption.setCategory( category );
- category.getCategoryOptions().add( dataElementCategoryOption );
-
- dataElementCategoryService.addDataElementCategoryOption( dataElementCategoryOption );
- dataElementCategoryService.updateDataElementCategory( category );
- dataElementCategoryService.updateOptionCombos( category );
-
+ dataElementCategoryOption.setCode( code );
+ dataElementCategoryOption.setConcept( conceptService.getConcept( conceptId ) );
+
+ if ( categoryId != null )
+ {
+ DataElementCategory category = dataElementCategoryService.getDataElementCategory( categoryId );
+ dataElementCategoryOption.setCategory( category );
+ category.getCategoryOptions().add( dataElementCategoryOption );
+ dataElementCategoryService.addDataElementCategoryOption( dataElementCategoryOption );
+ dataElementCategoryService.updateDataElementCategory( category );
+ dataElementCategoryService.updateOptionCombos( category );
+ }
+ else
+ {
+ dataElementCategoryService.addDataElementCategoryOption( dataElementCategoryOption );
+ }
+
return SUCCESS;
}
}
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java 2013-02-22 14:58:47 +0000
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2004-2009, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.dd.action.category;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.concept.Concept;
+import org.hisp.dhis.concept.ConceptService;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version GetDataElementCategoryOptionList.java 8:47:42 AM Feb 22, 2013 $
+ */
+public class GetDataElementCategoryOptionAction
+ extends ActionPagingSupport<DataElementCategoryOption>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService dataElementCategoryService;
+
+ public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+ {
+ this.dataElementCategoryService = dataElementCategoryService;
+ }
+
+ private ConceptService conceptService;
+
+ public void setConceptService( ConceptService conceptService )
+ {
+ this.conceptService = conceptService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private DataElementCategoryOption dataElementCategoryOption;
+
+ public DataElementCategoryOption getDataElementCategoryOption()
+ {
+ return dataElementCategoryOption;
+ }
+
+ private List<Concept> concepts;
+
+ public List<Concept> getConcepts()
+ {
+ return concepts;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ dataElementCategoryOption = dataElementCategoryService.getDataElementCategoryOption( id );
+
+ concepts = new ArrayList<Concept>( conceptService.getAllConcepts() );
+
+ Collections.sort( concepts, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java 2013-02-22 14:58:47 +0000
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2004-2009, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.dd.action.category;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version GetDataElementCategoryOptionListAction.java 8:47:42 AM Feb 22, 2013 $
+ */
+public class GetDataElementCategoryOptionListAction
+ extends ActionPagingSupport<DataElementCategoryOption>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService dataElementCategoryService;
+
+ public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+ {
+ this.dataElementCategoryService = dataElementCategoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+ private List<DataElementCategoryOption> dataElementCategoryOptions;
+
+ public List<DataElementCategoryOption> getDataElementCategoryOptions()
+ {
+ return dataElementCategoryOptions;
+ }
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( dataElementCategoryService.getDataElementCategoryOptionCountByName( key ) );
+
+ dataElementCategoryOptions = new ArrayList<DataElementCategoryOption>(
+ dataElementCategoryService.getDataElementCategoryOptionsBetweenByName( key, paging.getStartPos(),
+ paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( dataElementCategoryService.getDataElementCategoryCount() );
+
+ dataElementCategoryOptions = new ArrayList<DataElementCategoryOption>(
+ dataElementCategoryService.getDataElementCategoryOptionsBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
+ Collections.sort( dataElementCategoryOptions, IdentifiableObjectNameComparator.INSTANCE );
+
+ 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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2013-02-22 14:58:47 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.concept.ConceptService;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -48,11 +49,18 @@
public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
{
this.dataElementCategoryService = dataElementCategoryService;
- }
-
+ }
+
+ private ConceptService conceptService;
+
+ public void setConceptService( ConceptService conceptService )
+ {
+ this.conceptService = conceptService;
+ }
+
// -------------------------------------------------------------------------
// Input
- // -------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
private Integer id;
@@ -68,6 +76,20 @@
this.name = name;
}
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ private Integer conceptId;
+
+ public void setConceptId( Integer conceptId )
+ {
+ this.conceptId = conceptId;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -76,6 +98,9 @@
{
DataElementCategoryOption categoryOption = dataElementCategoryService.getDataElementCategoryOption( id );
categoryOption.setName( name );
+ categoryOption.setCode( code );
+ categoryOption.setConcept( conceptService.getConcept( conceptId ) );
+
dataElementCategoryService.updateDataElementCategoryOption( categoryOption );
return SUCCESS;
=== 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 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2013-02-22 14:58:47 +0000
@@ -474,14 +474,21 @@
<!-- CategoryOption -->
+ <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" />
+ <property name="conceptService" ref="org.hisp.dhis.concept.ConceptService" />
</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" />
+ <property name="conceptService" ref="org.hisp.dhis.concept.ConceptService" />
</bean>
<bean id="org.hisp.dhis.dd.action.category.RemoveDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.RemoveDataElementCategoryOptionAction"
@@ -489,6 +496,12 @@
<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"
+ scope="prototype">
+ <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ <property name="conceptService" ref="org.hisp.dhis.concept.ConceptService" />
+ </bean>
+
<!-- CategoryCombo -->
<bean id="org.hisp.dhis.dd.action.categorycombo.GetDataElementCategoryListAction" class="org.hisp.dhis.dd.action.categorycombo.GetDataElementCategoryListAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-01-28 08:50:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-02-22 14:58:47 +0000
@@ -197,4 +197,9 @@
text_type = Text type
legend_set=Legend set
skip_total_in_reports=Skip category total in reports
-translation_label_formName = Form name
\ No newline at end of file
+translation_label_formName = Form name
+data_element_category_option = Data element category option
+intro_data_element_category_option=Create, modify, view and delete data element category options. Category Option are fine-grained break-downs of catagory.
+data_element_category_option_management = Data element category option management
+create_new_data_element_category_option=Create new data element category option
+edit_data_element_category_option=Edit data element category option
\ No newline at end of file
=== 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 2013-01-30 03:20:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2013-02-22 14:58:47 +0000
@@ -620,17 +620,34 @@
<!-- CategoryOption -->
+ <action name="categoryOption" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm</param>
+ <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
+ <param name="anyAuthorities">F_DATAELEMENT_PUBLIC_ADD, F_DATAELEMENT_PRIVATE_ADD</param>
+ </action>
+
+ <action name="showAddDataElementCategoryOptionForm" class="org.hisp.dhis.dd.action.concept.GetConceptListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm</param>
+ <param name="javascripts">javascript/categoryOption.js</param>
+ <param name="anyAuthorities">F_DATAELEMENT_PUBLIC_ADD, F_DATAELEMENT_PRIVATE_ADD</param>
+ </action>
+
<action name="addDataElementCategoryOption" class="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction">
- <result name="success" type="velocity-json">
- /dhis-web-commons/ajax/jsonCategoryOption.vm
- </result>
+ <result name="success" type="redirect">categoryOption.action</result>
<param name="anyAuthorities">F_DATAELEMENT_PUBLIC_ADD, F_DATAELEMENT_PRIVATE_ADD</param>
</action>
+ <action name="showUpdateDataElementCategoryOptionForm" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm</param>
+ <param name="javascripts">javascript/category.js</param>
+ <param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
+ </action>
+
<action name="updateDataElementCategoryOption" class="org.hisp.dhis.dd.action.category.UpdateDataElementCategoryOptionAction">
- <result name="success" type="velocity-json">
- /dhis-web-commons/ajax/jsonResponseSuccess.vm
- </result>
+ <result name="success" type="redirect">categoryOption.action</result>
<param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
</action>
@@ -640,6 +657,13 @@
</result>
<param name="requiredAuthorities">F_DATAELEMENT_DELETE</param>
</action>
+
+ <action name="getDataElementCategoryOption" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryOptionAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonDataElementCategoryOption.vm
+ </result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
<!-- CategoryCombo -->