← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11380: category rendering in vertically rendered multiorg forms, still needs minor fixes

 

------------------------------------------------------------
revno: 11380
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-11 11:19:05 +0700
message:
  category rendering in vertically rendered multiorg forms, still needs minor fixes
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm


--
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-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm	2013-07-10 07:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm	2013-07-11 04:19:05 +0000
@@ -43,14 +43,14 @@
 
     #if( !$isDefaultCategory )
         #foreach( $category in $categories )
-            #set( $categoryOptions = $optionsMap.get( $category.id ) )
-            #set( $colCount = $colCount / $categoryOptions.size() )
+            #set( $categoryOptions1 = $optionsMap.get( $category.id ) )
+            #set( $colCount = $colCount / $categoryOptions1.size() )
             <tr colspan="$colCount">
             #set( $cols = $colRepeat.get( $category.id ) )
 
             #foreach( $dataElement in $section.dataElements )
                 #foreach( $col in $cols )
-                    #foreach( $categoryOption in $categoryOptions )
+                    #foreach( $categoryOption in $categoryOptions1 )
                         <th colspan="$colCount"><span align="center">${encoder.htmlEncode( $categoryOption.displayName )}</span></th>
                     #end
                 #end
@@ -183,6 +183,54 @@
             #end
         </tr>
         #else
+        #set( $catIndex = 0 )
+        #foreach( $optionCombo in $optionCombos )
+        #set( $velocityCount0 = $velocityCount - 1 )
+        #set( $catPart = $velocityCount0 % $categories.size() )
+        #if( $catPart == 0 ) #set( $catIndex = $catIndex + 1 ) #end
+        #set( $catCount = $catIndex - 1)
+        #set( $category1 = $categories.get( 0 ) )
+        #set( $category2 = $categories.get( 1 ) )
+        #set( $categoryOptions1 = $optionsMap.get( $category1.id ) )
+        #set( $categoryOptions2 = $optionsMap.get( $category2.id ) )
+        <tr>
+            #if( $velocityCount == 1 )
+                <td rowspan="$colCount" #if( $mark == 1 )class="alt"#else class="reg"#end>${encoder.htmlEncode( $dataElement.displayName )}</td>
+            #end
+
+            #set( $catRowSpan = $colCount / 2)
+
+            #if( ($velocityCount % $catRowSpan) != 0 )
+                <td rowspan="$catRowSpan" #if( $mark == 1 )class="alt"#else class="reg"#end>$categoryOptions1.get( $catCount ).displayName</td>
+            #end
+
+            <td #if( $mark == 1 )class="alt"#else class="reg"#end>$categoryOptions2.get( $catPart ).displayName</td>
+
+            #foreach( $organisationUnit in $organisationUnits )
+                <span class="hidden" id="${dataElement.uid}-dataelement">${encoder.htmlEncode( $dataElement.getFormNameFallback() )}</span>
+                #set( $dataEntryId = "${organisationUnit.id}-${dataElement.uid}-${optionCombo.uid}-val" )
+                #set( $greyedField = false )
+                #set( $greyedField = $greyedFields.get( "$dataElement.uid:$optionCombo.uid" ) )
+                #if( $dataElement.type == "bool" )
+                <td><select name="entryselect" id="$dataEntryId" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end>
+                  <option value="">[$i18n.getString( "no_value" )]</option>
+                  <option value="true">$i18n.getString( "yes" )</option>
+                  <option value="false">$i18n.getString( "no" )</option>
+                </select></td>
+                #elseif( $dataElement.type == 'trueOnly' )
+                    <td><input name="entrytrueonly" id="$dataEntryId" type="checkbox" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
+                #else
+                    #if( $dataElement.optionSet )
+                        <td><input name="entryoptionset" id="$dataEntryId" type="text" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
+                    #else
+                        <td><input name="entryfield" id="$dataEntryId" type="text" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
+                    #end
+                #end
+                </td>
+                #set( $tabIndex = $tabIndex + 1 )
+            #end
+        </tr>
+        #end
         #end
     #end
 	</table>