← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16735: Data entry, rendering indicators for section forms

 

------------------------------------------------------------
revno: 16735
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-09-17 12:40:52 +0200
message:
  Data entry, rendering indicators for section forms
modified:
  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/webapp/dhis-web-dataentry/sectionForm.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java


--
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/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	2014-08-20 14:06:29 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2014-09-17 10:40:52 +0000
@@ -337,13 +337,14 @@
                 dataSet.getSections().add( section );
 
                 section.getDataElements().addAll( orderedDataElements.get( orderedCategoryCombos.get( i ) ) );
+                section.setIndicators( new ArrayList<>( dataSet.getIndicators() ) );
             }
 
             displayMode = DataSet.TYPE_SECTION;
         }
 
         // ---------------------------------------------------------------------
-        // For multi-org unit we only support section forms
+        // For multi-org unit only section forms supported
         // ---------------------------------------------------------------------
 
         if ( CodeGenerator.isValidCode( multiOrganisationUnit ) )
@@ -372,7 +373,7 @@
 
             displayMode = DataSet.TYPE_SECTION_MULTIORG;
         }
-
+        
         if ( displayMode.equals( DataSet.TYPE_SECTION ) )
         {
             getSectionForm( dataElements, dataSet );
@@ -396,7 +397,7 @@
         Collections.sort( sections, new SectionOrderComparator() );
 
         for ( Section section : sections )
-        {
+        {            
             DataElementCategoryCombo sectionCategoryCombo = section.getCategoryCombo();
 
             if ( sectionCategoryCombo != null )

=== 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	2014-08-29 16:13:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2014-09-17 10:40:52 +0000
@@ -17,23 +17,24 @@
         #foreach( $section in $sections )
             <div id="tab-${section.uid}">
                 #set( $categoryComboId = $sectionCombos.get( $section.id ) )
-                #renderSection( $categoryComboId $section.dataElements )
+                #renderSection( $categoryComboId $section.dataElements $section.indicators )
             </div>
         #end
     </div>
 #else
     #foreach( $section in $sections )
         #set( $categoryComboId = $sectionCombos.get( $section.id ) )
-        #renderSection( $categoryComboId $section.dataElements $section.displayName $section.description )
+        #renderSection( $categoryComboId $section.dataElements $section.indicators $section.displayName $section.description )
     #end
 #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
+@param $categoryComboId category combo identifier.
+@param $dataElements data elements to be rendered in section.
+@param $indicators indicators to be rendered in section.
+@param $args.title include if you want a title rendered in section.
 *#
-#macro( renderSection $categoryComboId $dataElements $title $description )
+#macro( renderSection $categoryComboId $dataElements $indicators $title $description )
 <table class="formSection" style="margin-bottom: 20px;">
 #if( $!title )
 <tr>
@@ -54,6 +55,7 @@
     #set( $optionsMap = $orderedOptionsMap.get( $categoryComboId ) )
     #set( $colRepeat = $catColRepeat.get( $categoryComboId ) )
     #set( $hasFilterInSection = false )
+    #set( $mark = 0 )
 
     #foreach( $category in $categories )
     #set( $categoryOptions = $optionsMap.get( $category.id ) )
@@ -69,8 +71,6 @@
     </tr>
     #end
 
-    #set( $count = 0 )
-    #set( $mark = 0 )
     #set( $optionCombos = $orderedCategoryOptionCombos.get( $categoryComboId )  )
     #foreach( $optionCombo in $optionCombos )<span id="${optionCombo.uid}-optioncombo" class="hidden">${encoder.htmlEncode( $optionCombo.displayName )}</span>
     #end
@@ -80,7 +80,6 @@
     #else
     #set( $mark = 1 )
     #end
-    #set( $count = $count + 1 )
     <tr>
     <td id="${dataElement.uid}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end>
     <span id="${dataElement.uid}-dataelement" #if( $decoration && $dataElement.hasDescription() ) title="$!{dataElement.description}"#end >
@@ -115,6 +114,26 @@
     #end
 	</table>
     </div>
+    
+    #if( $indicators.size() > 0 )
+    #set( $mark = 0 )
+    <div class="indicatorArea">
+    <table>
+    #foreach( $indicator in $indicators )
+    #if( $mark == 1 )
+    #set( $mark = 0 )
+    #else
+    #set( $mark = 1 )
+    #end
+    <tr>
+      <td #if( $mark == 1 )class="alt"#else class="reg"#end><span>$indicator.displayName</span></td>
+      <td><input id="indicator${indicator.id}" indicatorid="${indicator.uid}" name="indicator" type="text" class="indicator"></td>
+    </tr>
+    #end
+    </table>
+    </div>
+    #end
+    
     </td>
   </tr>
 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2014-09-03 01:48:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2014-09-17 10:40:52 +0000
@@ -153,6 +153,13 @@
   box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06);
 }
 
+.indicatorArea
+{
+  margin-top: 20px;
+  padding-top: 16px;
+  border-top: 1px solid #ddd;
+}
+
 /* jQuery UI tab style overrides for data value history view */
 
 #historyTabs

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java	2014-09-16 16:40:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java	2014-09-17 10:40:52 +0000
@@ -145,7 +145,8 @@
 
         if ( dataSet != null ) // Check if version must be updated
         {
-            if ( !( equalsNullSafe( sectionName, section.getName() ) && dataElements.equals( section.getDataElements() ) ) )
+            if ( !( equalsNullSafe( sectionName, section.getName() ) && 
+                dataElements.equals( section.getDataElements() ) && indicators.equals( section.getIndicators() ) ) )
             {
                 dataSetService.updateDataSet( dataSet.increaseVersion() );
             }