← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2190: Compressed dataentry screen html. Now at 1/3 of original transfer size.

 

------------------------------------------------------------
revno: 2190
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-11-26 20:56:18 +0100
message:
  Compressed dataentry screen html. Now at 1/3 of original transfer size.
modified:
  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/javascript/entry.js
  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/sectionForm.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/defaultForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm	2010-11-26 17:21:10 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm	2010-11-26 19:56:18 +0000
@@ -1,4 +1,5 @@
 <input type="hidden" value="$organisationUnit.id" id="organisationUnitId"/>
+<input type="hidden" value="$zeroValueSaveMode" id="zeroValueSaveMode"/>
 
 #set( $tabIndex = 1 )
 #foreach( $categoryCombo in $orderedCategoryCombos )
@@ -8,7 +9,7 @@
   #set( $categories = $orderedCategories.get( $categoryCombo.id )  )
   #set( $optionsMap = $orderedOptionsMap.get( $categoryCombo.id )  )
   #set( $colRepeat = $catColRepeat.get( $categoryCombo.id )  )
-    
+
   #foreach( $category in $categories )
   #set( $categoryOptions = $optionsMap.get( $category.id ) )
   #set( $colCount = $colCount / $categoryOptions.size() )
@@ -28,8 +29,7 @@
   #set( $dataElements = $orderedDataElements.get( $categoryCombo )  )
   #set( $optionCombos = $orderdCategoryOptionCombos.get( $categoryCombo.id )  )
   #set( $mark = 0 )
-  #foreach( $optionCombo in $optionCombos )
-  <span id="value[option${optionCombo.id}].name" class="hidden">${optionCombo.name}</span>
+  #foreach( $optionCombo in $optionCombos )<span id="value[option${optionCombo.id}].name" class="hidden">${optionCombo.name}</span>
   #end
   #foreach( $dataElement in $dataElements )
   #if( $mark == 1 )
@@ -37,7 +37,7 @@
   #else
   #set( $mark = 1 )
   #end
-        				 
+
   #set( $count = $count + 1 )
   #set( $calculatedValue = false )
   #set( $calculatedValue = $calculatedValueMap.get( $dataElement ) )                        
@@ -84,10 +84,10 @@
       #end
       </select>
       #else
-      <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue(${dataElement.id},${optionCombo.id},'$encoder.jsEncode( ${dataElement.name} )',${zeroValueSaveMode})" ondblclick="viewHistory(${dataElement.id},${optionCombo.id},true)" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>                                
+      <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveVal(${dataElement.id},${optionCombo.id})" ondblclick="viewHist(${dataElement.id},${optionCombo.id})" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>                                
       #end
     #else
-    <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue(${dataElement.id},${optionCombo.id},'$encoder.jsEncode( $dataElement.name )',${zeroValueSaveMode})" ondblclick="viewHistory(${dataElement.id},${optionCombo.id},true)" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
+    <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveVal(${dataElement.id},${optionCombo.id})" ondblclick="viewHist(${dataElement.id},${optionCombo.id})" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
     #end
     </td>
     #set( $tabIndex = $tabIndex + 1 )

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2010-11-24 20:34:35 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2010-11-26 19:56:18 +0000
@@ -3,6 +3,14 @@
 // Save
 // -----------------------------------------------------------------------------
 
+function saveVal( dataElementId, optionComboId )
+{
+	var zeroValueSaveMode = document.getElementById( 'zeroValueSaveMode' ).value;
+	var dataElementName = document.getElementById( 'value[' + dataElementId + '].name' ).innerHTML;
+	
+	saveValue( dataElementId, optionComboId, dataElementName, zeroValueSaveMode );
+}
+
 function saveValue( dataElementId, optionComboId, dataElementName, zeroValueSaveMode )
 {
     var field = document.getElementById( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');

=== 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	2010-11-24 20:34:35 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-26 19:56:18 +0000
@@ -520,6 +520,11 @@
 // History
 // -----------------------------------------------------------------------------
 
+function viewHist( dataElementId, optionComboId )
+{
+	viewHistory( dataElementId, optionComboId, true );
+}
+
 function viewHistory( dataElementId, optionComboId, showComment )
 {
     window.open( 'viewHistory.action?dataElementId=' + dataElementId + '&optionComboId=' + optionComboId + '&showComment=' + showComment, '_blank', 'width=580,height=710,scrollbars=yes' );

=== 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	2010-11-26 17:21:10 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2010-11-26 19:56:18 +0000
@@ -1,4 +1,6 @@
 <input type="hidden" value="$organisationUnit.id" id="organisationUnitId"/>
+<input type="hidden" value="$zeroValueSaveMode" id="zeroValueSaveMode"/>
+
 #set( $marker = 0 )
 #set( $tabIndex = 1 )
 
@@ -46,8 +48,7 @@
       #set( $count = 0 )
       #set( $mark = 0 )
       #set( $optionCombos = $orderdCategoryOptionCombos.get( $categoryComboId )  )
-      #foreach( $optionCombo in $optionCombos )
-      <span id="value[option${optionCombo.id}].name" class="hidden">${optionCombo.name}</span>
+      #foreach( $optionCombo in $optionCombos )<span id="value[option${optionCombo.id}].name" class="hidden">${optionCombo.name}</span>
       #end
       #foreach( $dataElement in $section.dataElements )
       #if( $mark == 1 )
@@ -104,10 +105,10 @@
             #end
 		  </select>
 	      #else
-          <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue(${dataElement.id},${optionCombo.id},'$encoder.jsEncode( ${dataElement.name} )',${zeroValueSaveMode})" ondblclick="viewHistory(${dataElement.id},${optionCombo.id},true)" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked )disabled="disabled"#end #if( $greyedField )class="gray" disabled="disabled"#end>
+          <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveVal(${dataElement.id},${optionCombo.id})" ondblclick="viewHist(${dataElement.id},${optionCombo.id})" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked )disabled="disabled"#end #if( $greyedField )class="gray" disabled="disabled"#end>
           #end
         #else
-        <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveValue(${dataElement.id},${optionCombo.id},'$encoder.jsEncode( ${dataElement.name} )',${zeroValueSaveMode})" ondblclick="viewHistory(${dataElement.id},${optionCombo.id},true)" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked )disabled="disabled"#end #if( $greyedField )class="gray" disabled="disabled"#end>
+        <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveMultiDimensionalValue") ) onchange="saveVal(${dataElement.id},${optionCombo.id})" ondblclick="viewHist(${dataElement.id},${optionCombo.id})" #else disabled="disabled" #end onkeypress="return keyPress(event,this)" class="entryField" #if( $minMaxError )style="background-color:#ffcccc"#end tabindex="$tabIndex" #if( $locked )disabled="disabled"#end #if( $greyedField )class="gray" disabled="disabled"#end>
         #end
       </td>
       #set( $tabIndex = $tabIndex + 1 )