dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32795
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16705: Add user interface for defining codes for category option combos.
------------------------------------------------------------
revno: 16705
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-12 21:17:36 +0700
message:
Add user interface for defining codes for category option combos.
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombo.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetCategoryOptionComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetCategoryOptionComboListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateCategoryOptionComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOptionCombo.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateCategoryOptionCombo.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.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
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
--
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/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2014-09-12 14:17:36 +0000
@@ -28,14 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.concept.Concept;
-import org.hisp.dhis.hierarchy.HierarchyViolationException;
-
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.hisp.dhis.concept.Concept;
+import org.hisp.dhis.hierarchy.HierarchyViolationException;
+
/**
* @author Abyot Asalefew
*/
@@ -382,6 +382,14 @@
DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( String uid );
/**
+ * Retrieves the DataElementCategoryOptionCombo with the given uid.
+ *
+ * @param code the code of the DataElementCategoryOptionCombo.
+ * @return the DataElementCategoryOptionCombo.
+ */
+ DataElementCategoryOptionCombo getDataElementCategoryOptionComboByCode( String code );
+
+ /**
* Retrieves the DataElementCategoryOptionCombos with the given identifiers.
*
* @param identifiers the identifiers of the
@@ -425,7 +433,22 @@
* @return a Collection of DataElementCategoryOptionCombos.
*/
Collection<DataElementCategoryOptionCombo> getAllDataElementCategoryOptionCombos();
-
+
+ /**
+ * Returns {@link DataElementCategoryOptionCombo} list with paging
+ *
+ * @param min First result
+ * @param max Maximum results
+ *
+ * @return a collection of all category-option-combo
+ */
+ Collection<DataElementCategoryOptionCombo> getOptionCombosBetween( int min, int max );
+
+ /**
+ * Returns The number of all DataElementCategoryOptionCombo available
+ */
+ Integer getOptionComboCount();
+
/**
* Generates and persists a default DataElementCategory,
* DataElementCategoryOption, DataElementCategoryCombo and
=== 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 2014-09-08 13:02:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2014-09-12 14:17:36 +0000
@@ -493,6 +493,11 @@
{
return categoryOptionComboStore.getByUid( uid );
}
+
+ public DataElementCategoryOptionCombo getDataElementCategoryOptionComboByCode( String code )
+ {
+ return categoryOptionComboStore.getByCode( code );
+ }
public Collection<DataElementCategoryOptionCombo> getDataElementCategoryOptionCombos(
final Collection<Integer> identifiers )
@@ -558,6 +563,16 @@
return categoryOptionComboStore.getAll();
}
+ public Collection<DataElementCategoryOptionCombo> getOptionCombosBetween( int min, int max )
+ {
+ return categoryOptionComboStore.getAllOrderedLastUpdated( min, max );
+ }
+
+ public Integer getOptionComboCount()
+ {
+ return categoryOptionComboStore.getCount();
+ }
+
public void generateDefaultDimension()
{
// ---------------------------------------------------------------------
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombo.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombo.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombo.vm 2014-09-12 14:17:36 +0000
@@ -0,0 +1,8 @@
+{ "dataElementCategoryOptionCombo":
+ {
+ "id": "$!{optionCombo.id}",
+ "uid": "$!{optionCombo.uid}",
+ "name": "$encoder.jsonEncode( $!{optionCombo.name} )",
+ "code": "$!{optionCombo.code}"
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetCategoryOptionComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetCategoryOptionComboAction.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/GetCategoryOptionComboAction.java 2014-09-12 14:17:36 +0000
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2004-2014, 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 org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ UpdateCategoryOptionComboAction.java Sep 12, 2014 6:56:40 PM $
+ */
+public class GetCategoryOptionComboAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input && Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private DataElementCategoryOptionCombo optionCombo;
+
+ public DataElementCategoryOptionCombo getOptionCombo()
+ {
+ return optionCombo;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ optionCombo = categoryService.getDataElementCategoryOptionCombo( id );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetCategoryOptionComboListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetCategoryOptionComboListAction.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/GetCategoryOptionComboListAction.java 2014-09-12 14:17:36 +0000
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2004-2014, 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.List;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author Chau Thu Tran
+ * @version GetCategoryOptionComboListAction.java Sep 12, 2014 6:56:40 PM $
+ */
+public class GetCategoryOptionComboListAction
+ extends ActionPagingSupport<DataElementCategoryOptionCombo>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<DataElementCategoryOptionCombo> optionCombos;
+
+ public List<DataElementCategoryOptionCombo> getOptionCombos()
+ {
+ return optionCombos;
+ }
+
+ private DataElementCategoryOptionCombo defaultCategoryOptionCombo;
+
+ public DataElementCategoryOptionCombo getDefaultCategoryOptionCombo()
+ {
+ return defaultCategoryOptionCombo;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ defaultCategoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+
+ this.paging = createPaging( categoryService.getOptionComboCount() );
+ optionCombos = new ArrayList<>( categoryService.getOptionCombosBetween( paging.getStartPos(),
+ paging.getPageSize() ) );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateCategoryOptionComboAction.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/UpdateCategoryOptionComboAction.java 2014-09-12 14:17:36 +0000
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004-2014, 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 org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ UpdateCategoryOptionComboAction.java Sep 12, 2014 6:56:40 PM $
+ */
+public class UpdateCategoryOptionComboAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( id );
+ optionCombo.setCode( code );
+
+ categoryService.updateDataElementCategoryOptionCombo( optionCombo );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateCategoryOptionComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateCategoryOptionComboAction.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/ValidateCategoryOptionComboAction.java 2014-09-12 14:17:36 +0000
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2004-2014, 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 org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ValidateCategoryOptionComboAction.java Sep 12, 2014 6:56:40 PM $
+ */
+public class ValidateCategoryOptionComboAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ DataElementCategoryOptionCombo match = categoryService.getDataElementCategoryOptionComboByCode( code );
+
+ if ( match != null && match.getId() != id )
+ {
+ message = i18n.getString( "code_in_use" );
+
+ return INPUT;
+ }
+
+ 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 2014-07-16 15:41:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2014-09-12 14:17:36 +0000
@@ -540,4 +540,26 @@
scope="prototype">
</bean>
+ <!-- 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/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 2014-08-29 12:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2014-09-12 14:17:36 +0000
@@ -235,4 +235,7 @@
show_fewer_options=Show fewer options
id=Id
min=Min
-max=Max
\ No newline at end of file
+max=Max
+category_option_combo = Category option combo
+intro_category_option_combo = View and edit data element category option combos. Category Option Combo are fine-grained break-downs of catagory.
+edit_data_element_category_option_combo = Edit data element category option combo
\ 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 2014-07-25 06:49:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2014-09-12 14:17:36 +0000
@@ -730,7 +730,43 @@
<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <!-- CategoryOptionCombo -->
+
+ <action name="categoryOptionCombo"
+ class="org.hisp.dhis.dd.action.category.GetCategoryOptionComboListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/categoryOptionCombo.vm</param>
+ <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
+ <param name="anyAuthorities">F_CATEGORY_OPTION_COMBO_PUBLIC_ADD, F_CATEGORY_OPTION_COMBO_PRIVATE_ADD</param>
+ </action>
+
+ <action name="showUpdateCategoryOptionComboForm"
+ class="org.hisp.dhis.dd.action.category.GetCategoryOptionComboAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/updateCategoryOptionCombo.vm</param>
+ <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
+ <param name="anyAuthorities">F_CATEGORY_OPTION_COMBO_PUBLIC_ADD, F_CATEGORY_OPTION_COMBO_PRIVATE_ADD</param>
+ </action>
+
+ <action name="updateCategoryOptionCombo"
+ class="org.hisp.dhis.dd.action.category.UpdateCategoryOptionComboAction">
+ <result name="success" type="redirect">categoryOptionCombo.action</result>
+ <param name="anyAuthorities">F_CATEGORY_OPTION_COMBO_PUBLIC_ADD, F_CATEGORY_OPTION_COMBO_PRIVATE_ADD</param>
+ </action>
+ <action name="validateCategoryOptionCombo"
+ class="org.hisp.dhis.dd.action.category.ValidateCategoryOptionComboAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ </action>
+
+ <action name="getCategoryOptionCombo"
+ class="org.hisp.dhis.dd.action.category.GetCategoryOptionComboAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonCategoryOptionCombo.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm 2014-02-16 14:24:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm 2014-09-12 14:17:36 +0000
@@ -5,6 +5,7 @@
#introListImgItem( "dataElementGroup.action" "data_element_group" "dataelement" )
#introListImgItem( "dataElementGroupEditor.action" "data_element_group_editor" "dataelement" )
#introListImgItem( "dataElementGroupSet.action" "data_element_group_set" "groupset" )
+ #introListImgItem( "categoryOptionCombo.action" "category_option_combo" "category" )
#introListImgItem( "categoryOption.action" "category_option" "category" )
#introListImgItem( "category.action" "category" "category" )
#introListImgItem( "categoryCombo.action" "category_combo" "category" )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm 2014-03-02 22:04:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm 2014-09-12 14:17:36 +0000
@@ -5,6 +5,7 @@
<li><a href="dataElementGroup.action">$i18n.getString( "data_element_group" ) </a></li>
<li><a href="dataElementGroupEditor.action">$i18n.getString( "data_element_group_editor" ) </a></li>
<li><a href="dataElementGroupSet.action">$i18n.getString( "data_element_group_set" ) </a></li>
+ <li><a href="categoryOptionCombo.action">$i18n.getString( "category_option_combo" ) </a></li>
<li><a href="categoryOption.action">$i18n.getString( "category_option" ) </a></li>
<li><a href="category.action">$i18n.getString( "category" ) </a></li>
<li><a href="categoryCombo.action">$i18n.getString( "category_combination" ) </a></li>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOptionCombo.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOptionCombo.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOptionCombo.vm 2014-09-12 14:17:36 +0000
@@ -0,0 +1,83 @@
+
+<script type="text/javascript">
+ jQuery(document).ready(function(){
+
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+ });
+
+ function showDataElementCategoryOptionDetails( context ) {
+ jQuery.post( 'getCategoryOptionCombo.action', { id: context.id } ,
+ function ( json ) {
+
+ setInnerHTML( 'nameField', json.dataElementCategoryOptionCombo.name );
+ setInnerHTML( 'codeField', json.dataElementCategoryOptionCombo.code );
+ setInnerHTML( 'idField', json.dataElementCategoryOptionCombo.uid );
+
+ showDetails();
+ });
+ }
+
+ function showUpdateDataElementCategoryOptionForm( context ) {
+ location.href = 'showUpdateCategoryOptionComboForm.action?id=' + context.id;
+ }
+
+</script>
+
+<h3>$i18n.getString( "data_element_category_option_management" )</h3>
+
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateDataElementCategoryOptionForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="showDataElementCategoryOptionDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table class="listTable" id="categoryOptionComboList">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $optionCombo in $optionCombos )
+ #if( $optionCombo.id != $defaultCategoryOptionCombo.id )
+ <tr id="tr${optionCombo.id}" data-id="$!optionCombo.id" data-uid="$!optionCombo.uid" data-type="CategoryOption" data-name="$encoder.htmlEncode( $!optionCombo.displayName )"
+ data-can-manage="$security.canManage( $optionCombo )"
+ data-can-update="$security.canUpdate( $optionCombo )">
+ <td>$encoder.htmlEncode( $!optionCombo.displayName )</td>
+ </tr>
+ #end
+ #end
+ </tbody>
+
+ </table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </td>
+
+ <td id="detailsData">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
+ <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
+ </div>
+
+ <div id="warningArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateCategoryOptionCombo.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateCategoryOptionCombo.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateCategoryOptionCombo.vm 2014-09-12 14:17:36 +0000
@@ -0,0 +1,40 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+ validation( 'addCategoryOptionComboForm', function(form){
+ form.submit();
+ })
+
+ checkValueIsExist( "code", "validateCategoryOptionCombo.action", {id: $optionCombo.id} );
+ });
+
+</script>
+
+<h3>$i18n.getString( "edit_data_element_category_option_combo" )</h3>
+
+<form id="addCategoryOptionComboForm" name="addCategoryOptionComboForm" action="updateCategoryOptionCombo.action" method="post" class="inputForm">
+
+ <input type="hidden" id="id" name="id" value="$optionCombo.id"/>
+
+ <table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td style="width: 100px"><label>$i18n.getString( "name" )</label></td>
+ <td><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $optionCombo.displayName )" readonly /></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "code" )</label></td>
+ <td><input type="text" id="code" name="code" value="$!encoder.htmlEncode( $optionCombo.code )" /></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" onclick="dhis2.commons.redirectCurrentPage( 'categoryOptionCombo.action' )" value="$i18n.getString( 'cancel' )" style="width:10em"/></p>
+ </td>
+ </tr>
+ </table>
+
+</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2014-07-09 09:08:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2014-09-12 14:17:36 +0000
@@ -65,6 +65,8 @@
F_CATEGORY_OPTION_GROUP_SET_PUBLIC_ADD=Add/Update Public Category Option Group Set
F_CATEGORY_OPTION_GROUP_SET_PRIVATE_ADD=Add/Update Private Category Option Group Set
F_CATEGORY_OPTION_GROUP_SET_DELETE = Delete Category Option Group Set
+F_CATEGORY_OPTION_COMBO_PUBLIC_ADD=Add/Update Public Data Element Category Option Combo
+F_CATEGORY_OPTION_COMBO_PRIVATE_ADD=Add/Update Private Data Element Category Option Combo
F_DATAELEMENTGROUP_PUBLIC_ADD=Add/Update Public Data Element Groups
F_DATAELEMENTGROUP_PRIVATE_ADD=Add/Update Private Data Element Groups
F_DATAELEMENTGROUP_DELETE=Delete Data Element Groups