dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13228
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4189: Moved data element type from form to javascript
------------------------------------------------------------
revno: 4189
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-07-21 19:38:11 +0200
message:
Moved data element type from form to javascript
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java
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
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.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-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 2011-07-21 14:01:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2011-07-21 17:38:11 +0000
@@ -239,8 +239,7 @@
final String historyCode = " ondblclick='javascript:viewHist( $DATAELEMENTID, $OPTIONCOMBOID )' ";
- final String metaDataCode = "<span id=\"$DATAELEMENTID-dataelement\" style=\"display:none\">$DATAELEMENTNAME</span>"
- + "<span id=\"$DATAELEMENTID-type\" class=\"hidden\">$DATAELEMENTTYPE</span>";
+ final String metaDataCode = "<span id=\"$DATAELEMENTID-dataelement\" style=\"display:none\">$DATAELEMENTNAME</span>"; //TODO read from js
StringBuffer sb = new StringBuffer();
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java 2011-07-21 14:11:46 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java 2011-07-21 17:38:11 +0000
@@ -96,6 +96,13 @@
return significantZeros;
}
+ private Collection<DataElement> dataElements;
+
+ public Collection<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
private Collection<Indicator> indicators;
public Collection<Indicator> getIndicators()
@@ -120,6 +127,8 @@
significantZeros = dataElementService.getDataElementsByZeroIsSignificant( true );
+ dataElements = dataElementService.getAllDataElements(); //TODO with data sets only
+
indicators = indicatorService.getIndicatorsWithDataSets();
dataSets = dataSetService.getAllDataSets();
=== 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 2011-07-21 14:01:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2011-07-21 17:38:11 +0000
@@ -36,8 +36,7 @@
#set( $count = $count + 1 )
<tr>
<td style="#if( $mark == 1 )background-color:#e0e0e0;#end padding-right:50px;">
- <span id="${dataElement.id}-dataelement" title="$!encoder.htmlEncode( $dataElement.description )">${encoder.htmlEncode( $dataElement.name )}</span>
- <span id="${dataElement.id}-type" class="hidden">$dataElement.getDetailedNumberType()</span>
+ <span id="${dataElement.id}-dataelement">${encoder.htmlEncode( $dataElement.name )}</span>
</td>
#foreach( $optionCombo in $optionCombos )
#set( $dataEntryId = "${dataElement.id}-${optionCombo.id}-val" )
=== 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 2011-07-21 14:01:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2011-07-21 17:38:11 +0000
@@ -9,7 +9,6 @@
* {optioncomboid}-optioncombo // name of category option combo
* {dataelementid}-{optioncomboid}-min // min value for data value
* {dataelementid}-{optioncomboid}-max // max value for data value
- * {dataelementid}-type // data element type
*/
// -----------------------------------------------------------------------------
@@ -95,7 +94,7 @@
var fieldId = '#' + dataElementId + '-' + optionComboId + '-val';
var value =$( fieldId ).val();
- var type = $( '#' + dataElementId + '-type' ).html();
+ var type = dataElements[dataElementId].type;
$( fieldId ).css( 'background-color', COLOR_YELLOW );
=== 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 2011-07-21 14:01:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-07-21 17:38:11 +0000
@@ -1,6 +1,9 @@
// Identifiers for which zero values are, insignificant, also used in entry.js, populated in select.vm
var significantZeros = [];
+// Array with associative arrays for each data element, populated in select.vm
+var dataElements = [];
+
// Associative array with [indicator id, expression] for indicators in form, also used in entry.js, populated in select.vm
var indicatorFormulas = [];
=== 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 2011-07-21 14:01:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2011-07-21 17:38:11 +0000
@@ -53,7 +53,7 @@
#set( $count = $count + 1 )
<tr>
<td style="#if( $mark == 1 )background-color:#e0e0e0;#end padding-right:50px;">
- <span id="${dataElement.id}-dataelement" title="$!{encoder.htmlEncode( $dataElement.description )}">${encoder.htmlEncode( $dataElement.name )}</span><span id="${dataElement.id}-type" class="hidden">$dataElement.getDetailedNumberType()</span>
+ <span id="${dataElement.id}-dataelement">${encoder.htmlEncode( $dataElement.name )}</span>
</td>
#foreach( $optionCombo in $optionCombos )
#set( $dataEntryId = "${dataElement.id}-${optionCombo.id}-val" )
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2011-07-21 11:52:46 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2011-07-21 17:38:11 +0000
@@ -24,6 +24,14 @@
#foreach( $dataElement in $significantZeros )
${dataElement.id}#if( $velocityCount < $size1 ),#end #end ];
+dataElements = {
+#set( $size2 = $dataElements.size() )
+#foreach( $dataElement in $dataElements )
+"${dataElement.id}": {
+"type":"${dataElement.getDetailedNumberType()}"
+}#if( $velocityCount < $size2 ),#end
+#end };
+
#foreach( $indicator in $indicators )
indicatorFormulas['${indicator.id}'] = '($!{indicator.explodedNumerator})/($!{indicator.explodedDenominator})*($!{indicator.indicatorType.factor})';
#end
@@ -32,7 +40,6 @@
#set( $size3 = $dataSets.size() )
#foreach( $dataSet in $dataSets )
"${dataSet.id}": {
-"id":"${dataSet.id}",
"name":"$!encoder.jsonEncode( ${dataSet.name} )",
"periodType":"$!encoder.jsonEncode( ${dataSet.periodType.name} )"
}#if( $velocityCount < $size3 ),#end