=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java 2013-12-19 23:08:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java 2013-12-22 09:15:53 +0000 @@ -30,6 +30,7 @@ import java.util.Date; import java.util.HashSet; +import java.util.List; import java.util.Set; import javax.servlet.http.HttpServletResponse; @@ -91,13 +92,15 @@ @RequestParam String de, @RequestParam( required = false ) String co, @RequestParam( required = false ) String cc, - @RequestParam( required = false ) Set cp, + @RequestParam( required = false ) String cp, @RequestParam String pe, @RequestParam String ou, @RequestParam( required = false ) String value, @RequestParam( required = false ) String comment, @RequestParam( required = false ) boolean followUp, HttpServletResponse response ) { + List opts = ContextUtils.getQueryParamValues( cp ); + // --------------------------------------------------------------------- // Data element validation // --------------------------------------------------------------------- @@ -135,7 +138,7 @@ // Attribute category combo validation // --------------------------------------------------------------------- - if ( ( cc == null && ( cp != null && !cp.isEmpty() ) || ( cc != null && ( cp == null || cp.isEmpty() ) ) ) ) + if ( ( cc == null && opts != null || ( cc != null && opts == null ) ) ) { ContextUtils.conflictResponse( response, "Both or none of category combination and category options must be present" ); return; @@ -155,11 +158,11 @@ DataElementCategoryOptionCombo attributeOptionCombo = null; - if ( cp != null ) + if ( opts != null ) { Set categoryOptions = new HashSet(); - for ( String id : cp ) + for ( String id : opts ) { DataElementCategoryOption categoryOption = categoryService.getDataElementCategoryOption( id ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2013-12-13 15:09:46 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2013-12-22 09:15:53 +0000 @@ -47,7 +47,10 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; +import java.util.List; import static org.apache.commons.lang.StringUtils.trimToNull; import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY; @@ -80,6 +83,8 @@ public static final String HEADER_LOCATION = "Location"; public static final String DATE_PATTERN = "yyyy-MM-dd"; + + public static final String QUERY_PARAM_SEP = ";"; @Autowired private SystemSettingManager systemSettingManager; @@ -283,6 +288,25 @@ return builder.toString(); } + + /** + * Splits the given query param value into independent values using ; as + * separator. + * + * @param value the query param value. + * @return the list of independent values. + */ + public static List getQueryParamValues( String value ) + { + if ( value == null || value.isEmpty() ) + { + return null; + } + + String[] values = value.split( QUERY_PARAM_SEP ); + + return new ArrayList( Arrays.asList( values ) ); + } /** * Adds basic authentication by adding an Authorization header to the === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-12-21 17:59:39 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-12-22 09:15:53 +0000 @@ -32,6 +32,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.hisp.dhis.api.utils.ContextUtils; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; @@ -53,6 +54,7 @@ import java.util.Collection; import java.util.Date; import java.util.HashSet; +import java.util.List; import java.util.Set; /** @@ -153,9 +155,9 @@ this.cc = cc; } - private Set cp; + private String cp; - public void setCp( Set cp ) + public void setCp( String cp ) { this.cp = cp; } @@ -212,6 +214,8 @@ public String execute() { + List opts = ContextUtils.getQueryParamValues( cp ); + // --------------------------------------------------------------------- // Validation // --------------------------------------------------------------------- @@ -236,13 +240,13 @@ DataElementCategoryOptionCombo attributeOptionCombo = null; - if ( cc != null && cp != null ) + if ( cc != null && opts != null ) { DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( cc ); Set categoryOptions = new HashSet(); - for ( String id : cp ) + for ( String id : opts ) { categoryOptions.add( categoryService.getDataElementCategoryOption( id ) ); } === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-12-21 23:57:23 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-12-22 09:15:53 +0000 @@ -1340,7 +1340,7 @@ // Set min-max values and colorize violation fields - if( !json.locked ) + if ( !json.locked ) { $.safeEach( json.minMaxDataElements, function( i, value ) {