← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1273: Completed follow-up analysis

 

------------------------------------------------------------
revno: 1273
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-12-23 15:17:58 +0100
message:
  Completed follow-up analysis
removed:
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/followupForm.vm
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/followup/GetDataValuesMarkedForFollowupAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.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/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2009-12-23 07:35:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2009-12-23 14:17:58 +0000
@@ -296,11 +296,15 @@
 	</bean>
 	
 	<bean id="org.hisp.dhis.de.action.MarkForFollowupAction" class="org.hisp.dhis.de.action.MarkForFollowupAction">
-		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService"/>
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService"/>
+		<property name="dataValueService" 
+			ref="org.hisp.dhis.datavalue.DataValueService"/>
+		<property name="dataElementService" 
+			ref="org.hisp.dhis.dataelement.DataElementService"/>
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService"/>
-		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
-		<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+		<property name="organisationUnitService" 
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+		<property name="categoryService" 
+			ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
 	</bean>
 	
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java	2009-12-23 13:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java	2009-12-23 14:17:58 +0000
@@ -45,11 +45,7 @@
 import com.opensymphony.xwork2.Action;
 
 /**
- * Edit an outlier value identified by a tuple of: (sourceId, dataElementId,
- * periodId)
- * 
  * @author Jon Moen Drange
- * 
  */
 public class EditDataValueAction
     implements Action

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/followup/GetDataValuesMarkedForFollowupAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/followup/GetDataValuesMarkedForFollowupAction.java	2009-12-23 07:54:15 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/followup/GetDataValuesMarkedForFollowupAction.java	2009-12-23 14:17:58 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.validationrule.action.followup;
 
+/*
+ * Copyright (c) 2004-${year}, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 import java.util.Collection;
 
 import org.hisp.dhis.datavalue.DataValueService;
@@ -7,16 +34,27 @@
 
 import com.opensymphony.xwork2.Action;
 
+/**
+ * @author Lars Helge Overland
+ */
 public class GetDataValuesMarkedForFollowupAction
     implements Action
 {
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
     private DataValueService dataValueService;
 
     public void setDataValueService( DataValueService dataValueService )
     {
         this.dataValueService = dataValueService;
     }
-    
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
     private Collection<DeflatedDataValue> dataValues;
     
     public Collection<DeflatedDataValue> getDataValues()
@@ -24,6 +62,10 @@
         return dataValues;
     }
 
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
     public String execute()
     {
         dataValues = dataValueService.getDataValuesMarkedForFollowup();

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2009-12-23 13:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2009-12-23 14:17:58 +0000
@@ -297,4 +297,19 @@
       ref="org.hisp.dhis.datavalue.DataValueService" />
   </bean>
   
+  <bean id="org.hisp.dhis.validationrule.action.followup.MarkForFollowupAction"
+	class="org.hisp.dhis.validationrule.action.followup.MarkForFollowupAction"
+	scope="prototype">    
+    <property name="dataValueService" 
+      ref="org.hisp.dhis.datavalue.DataValueService"/>
+    <property name="dataElementService" 
+      ref="org.hisp.dhis.dataelement.DataElementService"/>
+    <property name="periodService" 
+	  ref="org.hisp.dhis.period.PeriodService"/>
+    <property name="organisationUnitService" 
+      ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+    <property name="categoryService" 
+      ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+  </bean>	
+  
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties	2009-12-23 13:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties	2009-12-23 14:17:58 +0000
@@ -142,4 +142,11 @@
 intro_outlier_analysis = Perform analysis of potential outlier values. Outlier values can be examined and checked for data capture errors.
 view_all = View all
 available_data_elements = Available data elements
-selected_data_elements = Selected data elements
\ No newline at end of file
+selected_data_elements = Selected data elements
+followup_analysis = Follow-up Analysis
+value_must_be_a_number = Value must be a number
+value_is_lower_than_min_value = Value is lower than minimum value
+value_is_higher_than_max_value = Value is higher than maximum value
+mark = Mark
+mark_value_for_followup = Mark value for follow-up
+unmark_value_for_followup = Unmark value for follow-up
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml	2009-12-23 13:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml	2009-12-23 14:17:58 +0000
@@ -223,10 +223,15 @@
     
 	<!-- Followup -->
 	
-	<action name="getDataValuesMarkedForFollowup" class="org.hisp.dhis.validationrule.action.followup.GetDataValuesMarkedForFollowupAction">
-	  <result name="success" type="velocity">/main.vm</result>
-	  <param name="page">/dhis-web-validationrule/followupForm.vm</param>
-      <param name="menu">/dhis-web-validationrule/menu.vm</param>
+	<action name="getFollowupValues" class="org.hisp.dhis.validationrule.action.followup.GetDataValuesMarkedForFollowupAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="page">/dhis-web-validationrule/searchResult.vm</param>
+      <param name="menu">/dhis-web-validationrule/menu.vm</param>
+      <param name="javascripts">javascript/editDataValue.js</param>
+	</action>
+	
+	<action name="markValueForFollowup" class="org.hisp.dhis.validationrule.action.followup.MarkForFollowupAction">
+		<result name="success" type="velocity-xml">/dhis-web-validationrule/responseSuccess.vm</result>
 	</action>
 	
   </package>

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/followupForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/followupForm.vm	2009-12-23 07:54:15 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/followupForm.vm	1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-
-<h3>$i18n.getString( "follow_up" )</h3>
-
-#foreach ( $dataValue in $dataValues )
-	Hey!
-#end
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js	2009-12-23 13:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js	2009-12-23 14:17:58 +0000
@@ -1,4 +1,6 @@
 
+var currentFollowupId = null;
+
 function editValue( valueId )
 {
 	var field = document.getElementById( 'value[' + valueId + '].value' );
@@ -12,7 +14,7 @@
 	{
 		if ( !isInt(field.value) )
 		{
-			alert( "Value must be an integer." );
+			alert( i18n_value_must_be_a_number );
 			
 			field.select();
 	        field.focus(); 
@@ -33,7 +35,7 @@
 				var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, valueId, '#ffcccc' );
 				valueSaver.save();
 				
-				alert( "Value is still lower than the lower boundary." );
+				alert( i18n_value_is_lower_than_min_value );
 				return;
 			}
 			
@@ -42,7 +44,7 @@
 				var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, valueId, '#ffcccc' );
 				valueSaver.save();
 				
-				alert( "Value is still higher than the upper boundary." );
+				alert( i18n_value_is_higher_than_max_value );
 				return;
 			}
 		}
@@ -65,6 +67,40 @@
     return true;
 }
 
+function markValueForFollowup( valueId )
+{	
+	currentFollowupId = valueId;
+	
+    var dataElementId = document.getElementById( 'value[' + valueId + '].dataElement' ).value;
+    var categoryOptionComboId = document.getElementById( 'value[' + valueId + '].categoryOptionCombo' ).value;
+    var periodId = document.getElementById( 'value[' + valueId + '].period' ).value;
+    var sourceId = document.getElementById( 'value[' + valueId + '].source' ).value;
+    
+    var url = 'markValueForFollowup.action?dataElementId=' + dataElementId + '&periodId=' + periodId +
+        '&sourceId=' + sourceId + '&categoryOptionComboId=' + categoryOptionComboId;
+    
+    var request = new Request();
+    request.setResponseTypeXML( 'message' );
+    request.setCallbackSuccess( markValueForFollowupReceived );    
+    request.send( url );
+}
+
+function markValueForFollowupReceived( messageElement )
+{   
+    var message = messageElement.firstChild.nodeValue;
+    var image = document.getElementById( 'value[' + currentFollowupId + '].followup' );
+    
+    if ( message == "marked" )
+    {
+        image.src = "../images/marked.png";
+        image.alt = i18n_unmark_value_for_followup;
+    }
+    else if ( message = "unmarked" )
+    {
+        image.src = "../images/unmarked.png";
+        image.alt = i18n_mark_value_for_followup;   
+    }
+}
 
 //-----------------------------------------------------------------------------
 // Saver object (modified version of dataentry/javascript/general.js)

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm	2009-10-10 14:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm	2009-12-23 14:17:58 +0000
@@ -5,4 +5,5 @@
 	<li><a href="showValidationRuleGroupForm.action">$i18n.getString( "validation_rule_group" )&nbsp;</a></li>
 	<li><a href="showRunValidationForm.action">$i18n.getString( "run_validation" )&nbsp;</a></li>
     <li><a href="outlierAnalysisForm.action">$i18n.getString( "outlier_analysis" )&nbsp;</a></li>
+    <li><a href="getFollowupValues.action">$i18n.getString( "followup_analysis" )&nbsp;</a></li>
 </ul>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm	2009-12-23 13:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm	2009-12-23 14:17:58 +0000
@@ -9,53 +9,32 @@
 
 <span id="info">$dataValues.size() $i18n.getString( "values_found" )</span>
 
-<table class="mainPageTable" cellpadding="0">
+<table class="listTable" style="width:100%">
 	<tr>
 		<th>$i18n.getString( "data_element" )</th>
 		<th>$i18n.getString( "organisation_unit" )</th>
 		<th>$i18n.getString( "period" )</th>
-		<th>$i18n.getString( "min" )</th>
-		<th style="width: 100px">$i18n.getString( "value" )</th>
-		<th>$i18n.getString( "max" )</th>
+		<th style="text-align:center">$i18n.getString( "min" )</th>
+		<th style="width: 100px; text-align:center">$i18n.getString( "value" )</th>
+		<th style="text-align:center">$i18n.getString( "max" )</th>
+		<th style="text-align:center">$i18n.getString( "mark" )</th>
 	</tr>
-	
+    #set( $mark = false )	
 	#set( $count = 0 )
-	#set( $mark = 0 )
-	#foreach( $value in $dataValues )
-	
-		#if( $mark == 1 )
-			#set( $mark = 0 )
-		#else
-			#set( $mark = 1 )
-		#end
-		#set( $count = $count + 1 )
-	
+	
+	#foreach( $value in $dataValues )	
+	#set( $count = $count + 1 )	
 	<tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
 	
-		## data element
-		<td>
-			<span id="value[$count].name">
-				$value.dataElementName
-			</span>
-		</td>
-		
-		## organisation unit
-		<td>
-			$value.sourceName
-		</td>
-		
-		## period
-		<td>
-			$format.formatPeriod( $value.period )
-		</td>
-		
-		## lower bound (min)
-		<td>
-			<div style="text-align:center">$value.min</div>
-		</td>
-		
-		## value
-		<td style="width:100px">
+		<td#alternate( $mark )><span id="value[$count].name">$value.dataElementName</span></td>
+		
+		<td#alternate( $mark )>$value.sourceName</td>
+		
+		<td#alternate( $mark )>$format.formatPeriod( $value.period )</td>
+		
+		<td style="text-align:center"#alternate( $mark )>$value.min</td>
+		
+		<td style="width:100px"#alternate( $mark )>
 			<input id="value[$count].value" value="$value.value"
 				style="width: 95%; text-align: center;" tabindex="$count" type="text" onchange="editValue( $count )">			
             <input type="hidden" id="value[$count].dataElement" value="$value.dataElementId">
@@ -66,13 +45,31 @@
             <input type="hidden" id="value[$count].max" value="$value.max">
 		</td>
 		
-		## upper bound (max)
-		<td>
-			<div style="text-align:center">$value.max</div>
+		<td style="text-align:center"#alternate( $mark )>$value.max</td>
+		
+		<td style="text-align:center"#alternate( $mark )>
+		#if ( $value.followup )
+			<img id="value[$count].followup" src="../images/marked.png" onclick="markValueForFollowup($count)" style="cursor:pointer">
+		#else
+		    <img id="value[$count].followup" src="../images/unmarked.png" onclick="markValueForFollowup($count)" style="cursor:pointer">
+		#end
 		</td>
 		
 	</tr>
+	    #if( $mark )
+            #set( $mark = false )
+        #else
+            #set( $mark = true )
+        #end
 	#end
 </table>
 
 #end
+
+<script type="text/javascript">
+    var i18n_value_must_be_a_number = '$encoder.jsEscape( $i18n.getString( "value_must_be_a_number" ) , "'")';
+    var i18n_value_is_lower_than_min_value = '$encoder.jsEscape( $i18n.getString( "value_is_lower_than_min_value" ) , "'")';
+    var i18n_value_is_higher_than_max_value = '$encoder.jsEscape( $i18n.getString( "value_is_higher_than_max_value" ) , "'")';
+    var i18n_mark_value_for_followup = '$encoder.jsEscape( $i18n.getString( "mark_value_for_followup" ) , "'")';
+    var i18n_unmark_value_for_followup = '$encoder.jsEscape( $i18n.getString( "unmark_value_for_followup" ) , "'")';
+</script>