=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-09-15 14:27:07 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-09-15 22:53:29 +0000 @@ -220,16 +220,16 @@ } else if ( dynamicInputMatcher.find() && dynamicInputMatcher.groupCount() > 0 ) { - String categoryOptionComboUid = dynamicInputMatcher.group( 2 ); - DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( categoryOptionComboUid ); + int categoryOptionComboId = Integer.parseInt( dynamicInputMatcher.group( 2 ) ); + DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( categoryOptionComboId ); displayValue = categoryOptionCombo != null ? "value=\"[ " + categoryOptionCombo.getDisplayName() + " ]\"" : "[ " + i18n.getString( "cat_option_combo_not_exist" ) + " ]"; displayTitle = categoryOptionCombo != null ? "title=\"" + categoryOptionCombo.getDisplayName() + "\"" : "[ " + i18n.getString( "cat_option_combo_not_exist" ) + " ]"; } else if ( dynamicSelectMatcher.find() && dynamicSelectMatcher.groupCount() > 0 ) { - String categoryComboUid = dynamicSelectMatcher.group( 2 ); - DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboUid ); + int categoryComboId = Integer.parseInt( dynamicSelectMatcher.group( 2 ) ); + DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboId ); displayValue = categoryCombo != null ? "value=\"[ " + categoryCombo.getDisplayName() + " ]\"" : "[ " + i18n.getString( "cat_combo_not_exist" ); displayTitle = categoryCombo != null ? "title=\"" + categoryCombo.getDisplayName() + "\"" : "[ " + i18n.getString( "cat_combo_not_exist" ); @@ -270,6 +270,9 @@ Map dataElementMap = getDataElementMap( dataSet ); + Set dataElementsNotInForm = new HashSet( dataSet.getDataElements() ); + dataElementsNotInForm.removeAll( getDataElementsInDataEntryForm( dataSet ) ); + while ( inputMatcher.find() ) { // ----------------------------------------------------------------- @@ -279,6 +282,7 @@ String inputHtml = inputMatcher.group(); Matcher identifierMatcher = IDENTIFIER_PATTERN.matcher( inputHtml ); + Matcher dynamicSelectMatcher = DYNAMIC_SELECT_PATTERN.matcher( inputHtml ); if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 ) { @@ -325,6 +329,9 @@ inputMatcher.appendReplacement( sb, inputHtml ); } + else if ( dynamicSelectMatcher.find() && dynamicSelectMatcher.groupCount() > 0 ) + { + } } inputMatcher.appendTail( sb ); === 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 2012-09-15 21:52:33 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java 2012-09-15 22:53:29 +0000 @@ -99,7 +99,7 @@ return; } - Period period = PeriodType.createPeriodExternalId( pe ); //TODO change to ISO + Period period = PeriodType.getPeriodFromIsoString( pe ); if ( period == null ) { === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetCategoryOptionCombosAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetCategoryOptionCombosAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetCategoryOptionCombosAction.java 2012-09-15 22:53:29 +0000 @@ -32,6 +32,7 @@ import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import com.opensymphony.xwork2.Action; @@ -52,6 +53,13 @@ { this.dataElementService = dataElementService; } + + private DataElementCategoryService categoryService; + + public void setCategoryService( DataElementCategoryService categoryService ) + { + this.categoryService = categoryService; + } // ------------------------------------------------------------------------- // Input @@ -64,6 +72,13 @@ this.id = id; } + private Integer categoryComboId; + + public void setCategoryComboId( Integer categoryComboId ) + { + this.categoryComboId = categoryComboId; + } + // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- @@ -95,6 +110,15 @@ } } } + else if ( categoryComboId != null ) + { + DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboId ); + + if ( categoryCombo != null ) + { + categoryOptionCombos = categoryCombo.getOptionCombos(); + } + } return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-09-03 19:53:34 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-09-15 22:53:29 +0000 @@ -351,6 +351,7 @@ + '; oEditor.insertHtml( template ); } @@ -388,16 +388,16 @@ * A unique code is used to associate the data element drop down with the input * fields for each category option combo. The format for input field identifier is: * - * "--dyninput" + * "--dyninput" */ function insertDynamicElement() { var oEditor = $("#designTextarea").ckeditorGet(); var $option = $("#dynamicElementSelector option:selected"); if( $option.length !== 0 ) { - var categoryOptionComboUid = $option.val(); + var categoryOptionComboId = $option.val(); var categoryOptionComboName = $option.text(); - var id = currentDynamicElementCode + "-" + categoryOptionComboUid + "-dyninput"; + var id = currentDynamicElementCode + "-" + categoryOptionComboId + "-dyninput"; var template = ''; oEditor.insertHtml( template ); @@ -413,16 +413,16 @@ $("#dynamicElementSelect").hide(); $("#dynamicElementInsert").show(); - var categoryComboUid = $("#categoryComboSelect option:selected").val(); + var categoryComboId = $("#categoryComboSelect option:selected").val(); var categoryComboName = $("#categoryComboSelect option:selected").text(); currentDynamicElementCode = getRandomCode(); - currentCategoryComboUid = categoryComboUid; + currentCategoryComboId = categoryComboId; currentCategoryComboName = categoryComboName; clearListById( "dynamicElementSelector" ); - var optionCombos = $.getJSON( "../api/categoryCombos/" + categoryComboUid + ".json", function( json ) { + var optionCombos = $.getJSON( "../dhis-web-commons-ajax-json/getCategoryOptionCombos.action?categoryComboId=" + categoryComboId, function( json ) { $.each( json.categoryOptionCombos, function( index, value ) { addOptionById( "dynamicElementSelector", value.id, value.name ); } ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2012-09-13 14:34:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2012-09-15 22:53:29 +0000 @@ -134,7 +134,7 @@
$i18n.getString( "select_category_combo_for_which_to_insert" )