← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5131: Fixed bug in data entry, zero value storage did not work properly. Fixed bug in static report fil...

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 5131 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-11-09 19:43:55 +0100
message:
  Fixed bug in data entry, zero value storage did not work properly. Fixed bug in static report file download, incorrect mime type for certain files. Fixed bug in add new rport table ui validation of report params.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/LoadDocumentAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js


--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-10-27 12:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-11-09 11:06:08 +0000
@@ -170,7 +170,7 @@
  */
 function isChecked( checkboxId )
 {
-	return jQuery( "#" + checkboxId ) && jQuery( "#" + checkboxId ).attr("checked");   
+	return jQuery( "#" + checkboxId ).length && jQuery( "#" + checkboxId ).is( ":checked" );   
 }
 
 /**

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/LoadDocumentAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/LoadDocumentAction.java	2011-10-31 12:46:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/LoadDocumentAction.java	2011-11-09 11:06:08 +0000
@@ -33,8 +33,6 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.document.Document;
 import org.hisp.dhis.document.DocumentService;
 import org.hisp.dhis.external.location.LocationManager;
@@ -46,8 +44,6 @@
 public class LoadDocumentAction
     extends StreamActionSupport
 {
-    private static final Log log = LogFactory.getLog( LoadDocumentAction.class );
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -77,8 +73,6 @@
         this.id = id;
     }
 
-    private Document document;
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -87,26 +81,28 @@
     protected String execute( HttpServletResponse response, OutputStream out )
         throws Exception
     {
-        document = documentService.getDocument( id );
+        Document document = documentService.getDocument( id );
 
         InputStream in = locationManager.getInputStream( document.getUrl(), DocumentService.DIR );
 
         IOUtils.copy( in, out );
 
-        log.info( "Document " + document.getName() + ", " + document.getUrl() + ", " + document.getContentType() );
-
         return SUCCESS;
     }
 
     @Override
     protected String getContentType()
     {
+        Document document = documentService.getDocument( id );
+        
         return document != null ? document.getContentType() : null;
     }
 
     @Override
     protected String getFilename()
     {
+        Document document = documentService.getDocument( id );
+        
         return document != null ? document.getUrl() : null;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java	2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java	2011-11-09 11:06:08 +0000
@@ -31,6 +31,8 @@
 
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.system.util.StreamUtils;
 
@@ -43,6 +45,8 @@
 public abstract class StreamActionSupport
     implements Action
 {
+    private static final Log log = LogFactory.getLog( StreamActionSupport.class );
+
     // -------------------------------------------------------------------------
     // ActionSupport implementation
     // -------------------------------------------------------------------------
@@ -54,7 +58,15 @@
         
         HttpServletResponse response = ServletActionContext.getResponse();
         
-        ContextUtils.configureResponse( response, getContentType(), disallowCache(), getFilename(), attachment() );
+        String contentType = getContentType();
+        boolean disallowCache = disallowCache();
+        String filename = getFilename();
+        boolean attachment = attachment();
+        
+        ContextUtils.configureResponse( response, contentType, disallowCache, filename, attachment );
+        
+        log.info( "Content type: " + contentType + ", disallow cache: " + 
+            disallowCache + ", filename: " + filename + ", attachment: " + attachment );
         
         try
         {

=== 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-10-27 18:28:20 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-11-09 18:18:11 +0000
@@ -86,6 +86,9 @@
  */
 function saveVal( dataElementId, optionComboId )
 {
+	dataElementId = parseInt( dataElementId );
+	optionComboId = parseInt( optionComboId );
+	
     var dataElementName = getDataElementName( dataElementId );
     var fieldId = '#' + dataElementId + '-' + optionComboId + '-val';
     var value = $( fieldId ).val();