=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm 2013-06-24 07:16:54 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm 2013-06-25 09:01:34 +0000 @@ -368,91 +368,3 @@ #end #end - -################################################################################################## -## Data Entry Macros -################################################################################################## - -#* - @param $categoryComboId - @param $dataElements Data Elements to be rendered in your section - @param $args.title Include if you want a title rendered in your section -*# -#macro( renderSection $categoryComboId $dataElements $args ) - -#if( $!args.title ) - - - -#end - - - -
-

$encoder.htmlEncode( $args.title )

-
-
- - #set( $colCount = $numberOfTotalColumns.get( $categoryComboId ) ) - #set( $categories = $orderedCategories.get( $categoryComboId ) ) - #set( $optionsMap = $orderedOptionsMap.get( $categoryComboId ) ) - #set( $colRepeat = $catColRepeat.get( $categoryComboId ) ) - #set( $hasFilterInSection = false ) - - #foreach( $category in $categories ) - #set( $categoryOptions = $optionsMap.get( $category.id ) ) - #set( $colCount = $colCount / $categoryOptions.size() ) - - - #set( $cols = $colRepeat.get( $category.id ) ) - #foreach( $col in $cols ) - #foreach( $categoryOption in $categoryOptions ) - - #end - #end - - #end - - #set( $count = 0 ) - #set( $mark = 0 ) - #set( $optionCombos = $orderedCategoryOptionCombos.get( $categoryComboId ) ) - #foreach( $optionCombo in $optionCombos ) - #end - #foreach( $dataElement in $dataElements ) - #if( $mark == 1 ) - #set( $mark = 0 ) - #else - #set( $mark = 1 ) - #end - #set( $count = $count + 1 ) - - - #foreach( $optionCombo in $optionCombos ) - #set( $dataEntryId = "${dataElement.uid}-${optionCombo.uid}-val" ) - #set( $commentId = "${dataElement.uid}-${optionCombo.uid}-comment" ) - #set( $greyedField = false ) - #set( $greyedField = $greyedFields.get( "${dataElement.uid}:${optionCombo.uid}" ) ) - #if( $dataElement.type == "bool" ) - - #elseif( $dataElement.type == "trueOnly" ) - - #else - #if( $dataElement.optionSet ) - - #else - - #end - #end - - #set( $tabIndex = $tabIndex + 1 ) - #end - - #end -
#if( $hasFilterInSection == false )#set( $hasFilterInSection = true )#end#if( $categoryOption.isDefault() )${i18n.getString( "value" )}#else ${encoder.htmlEncode( $categoryOption.displayName )}#end
${encoder.htmlEncode( $dataElement.getFormNameFallback() )}
-
-
-#end === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2013-06-24 07:16:54 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2013-06-25 09:01:34 +0000 @@ -28,6 +28,7 @@ */ import com.opensymphony.xwork2.Action; +import org.hisp.dhis.common.CodeGenerator; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategory; @@ -307,6 +308,30 @@ String displayMode = dataSet.getDataSetType(); + if ( displayMode.equals( DataSet.TYPE_DEFAULT ) ) + { + DataSet newDataSet = new DataSet(); + newDataSet.mergeWith( dataSet ); + dataSet = newDataSet; + + for ( int i = 0; i < orderedCategoryCombos.size(); i++ ) + { + Section section = new Section(); + section.setId( i ); + section.setSortOrder( i ); + + // generate a random uid so that equals work + section.setUid( CodeGenerator.generateCode() ); + + section.setDataSet( dataSet ); + dataSet.getSections().add( section ); + + section.getDataElements().addAll( orderedDataElements.get( orderedCategoryCombos.get( i ) ) ); + } + + displayMode = DataSet.TYPE_SECTION; + } + // --------------------------------------------------------------------- // For multi-org unit we only support custom forms // --------------------------------------------------------------------- @@ -337,6 +362,7 @@ displayMode = DataSet.TYPE_SECTION_MULTIORG; } + if ( displayMode.equals( DataSet.TYPE_SECTION ) ) { getSectionForm( dataElements, dataSet ); === removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2013-06-24 07:16:54 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 1970-01-01 00:00:00 +0000 @@ -1,8 +0,0 @@ - -#set( $tabIndex = 1 ) -#set( $hasAccess = $auth.hasAccess( "dhis-web-dataentry", "saveValue" ) ) - -#foreach( $categoryCombo in $orderedCategoryCombos ) - #set( $dataElements = $orderedDataElements.get( $categoryCombo ) ) - #renderSection( $categoryCombo.id $dataElements ) -#end === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2013-06-24 07:16:54 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2013-06-25 09:01:34 +0000 @@ -4,5 +4,89 @@ #foreach( $section in $sections ) #set( $categoryComboId = $sectionCombos.get( $section.id ) ) - #renderSection( $categoryComboId, $section.dataElements, {"title": $section.displayName } ) + #renderSection( $categoryComboId, $section.dataElements, $section.displayName ) +#end + +#* + @param $categoryComboId + @param $dataElements Data Elements to be rendered in your section + @param $args.title Include if you want a title rendered in your section +*# +#macro( renderSection $categoryComboId $dataElements $title ) + +#if( $!title ) + + + +#end + + + +
+

$encoder.htmlEncode( $title )

+
+
+ + #set( $colCount = $numberOfTotalColumns.get( $categoryComboId ) ) + #set( $categories = $orderedCategories.get( $categoryComboId ) ) + #set( $optionsMap = $orderedOptionsMap.get( $categoryComboId ) ) + #set( $colRepeat = $catColRepeat.get( $categoryComboId ) ) + #set( $hasFilterInSection = false ) + + #foreach( $category in $categories ) + #set( $categoryOptions = $optionsMap.get( $category.id ) ) + #set( $colCount = $colCount / $categoryOptions.size() ) + + + #set( $cols = $colRepeat.get( $category.id ) ) + #foreach( $col in $cols ) + #foreach( $categoryOption in $categoryOptions ) + + #end + #end + + #end + + #set( $count = 0 ) + #set( $mark = 0 ) + #set( $optionCombos = $orderedCategoryOptionCombos.get( $categoryComboId ) ) + #foreach( $optionCombo in $optionCombos ) + #end + #foreach( $dataElement in $dataElements ) + #if( $mark == 1 ) + #set( $mark = 0 ) + #else + #set( $mark = 1 ) + #end + #set( $count = $count + 1 ) + + + #foreach( $optionCombo in $optionCombos ) + #set( $dataEntryId = "${dataElement.uid}-${optionCombo.uid}-val" ) + #set( $commentId = "${dataElement.uid}-${optionCombo.uid}-comment" ) + #set( $greyedField = false ) + #set( $greyedField = $greyedFields.get( "${dataElement.uid}:${optionCombo.uid}" ) ) + #if( $dataElement.type == "bool" ) + + #elseif( $dataElement.type == "trueOnly" ) + + #else + #if( $dataElement.optionSet ) + + #else + + #end + #end + + #set( $tabIndex = $tabIndex + 1 ) + #end + + #end +
#if( $hasFilterInSection == false )#set( $hasFilterInSection = true )#end#if( $categoryOption.isDefault() )${i18n.getString( "value" )}#else ${encoder.htmlEncode( $categoryOption.displayName )}#end
${encoder.htmlEncode( $dataElement.getFormNameFallback() )}
+
+
#end