← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4899: Jquerified and removed now obsolete files

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 4899 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-10-11 16:55:19 +0200
message:
  Jquerified and removed now obsolete files
removed:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseInput.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseStatus.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseSuccess.vm
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetStatusAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.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-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetStatusAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetStatusAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetStatusAction.java	2011-10-11 14:54:46 +0000
@@ -67,18 +67,11 @@
     // Output
     // -------------------------------------------------------------------------
     
-    private String statusMessage = new String();
-
-    public String getStatusMessage()
-    {
-        return statusMessage;
-    }
+    private String message = "";
     
-    private boolean finished = false;
-
-    public boolean getFinished()
+    public String getMessage()
     {
-        return finished;
+        return message;
     }
 
     // -------------------------------------------------------------------------
@@ -87,6 +80,8 @@
 
     public String execute()
     {
+        boolean finished = false;
+        
         if ( processIsRunning( PROCESS_KEY_REPORT ) )
         {
             String id = getCurrentRunningProcess( PROCESS_KEY_REPORT );
@@ -97,18 +92,18 @@
             {
                 MessageState state = (MessageState) executor.getState();
                 
-                statusMessage = i18n.getString( state.getMessage() );
+                message = i18n.getString( state.getMessage() );
                 
                 finished = state.isEnded();
             }
         }
         else
         {
-            statusMessage = i18n.getString( "no_process_running" );
+            message = i18n.getString( "no_process_running" );
             
             finished = false;
         }
         
-        return SUCCESS;        
+        return finished ? SUCCESS : INPUT;        
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2011-10-11 14:17:16 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2011-10-11 14:54:46 +0000
@@ -307,7 +307,7 @@
     </action>
 
     <action name="createTable" class="org.hisp.dhis.reporting.tablecreator.action.CreateTableAction">
-      <result name="success" type="velocity-xml">/dhis-web-reporting/responseSuccess.vm</result>
+      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 
@@ -332,7 +332,8 @@
     </action>
 
     <action name="getStatus" class="org.hisp.dhis.reporting.tablecreator.action.GetStatusAction">
-      <result name="success" type="velocity-xml">/dhis-web-reporting/responseStatus.vm</result>
+      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+      <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2011-06-23 14:38:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2011-10-11 14:54:46 +0000
@@ -48,12 +48,9 @@
 
     if ( doDataMart )
     {
-        var url = "createTable.action?" + getUrlParams();
-
-        var request = new Request();
-        request.setCallbackSuccess( getReportStatus );
-        request.send( url );
-    } else
+    	$.get( "createTable.action?" + getUrlParams(), getReportStatus );
+    } 
+    else
     {
         viewReport();
     }
@@ -61,27 +58,18 @@
 
 function getReportStatus()
 {
-    var url = "getStatus.action";
-
-    var request = new Request();
-    request.setResponseTypeXML( "status" );
-    request.setCallbackSuccess( reportStatusReceived );
-    request.send( url );
-}
-
-function reportStatusReceived( xmlObject )
-{
-    var statusMessage = getElementValue( xmlObject, "statusMessage" );
-    var finished = getElementValue( xmlObject, "finished" );
-
-    if ( finished == "true" )
-    {
-        setMessage( i18n_process_completed );
-        viewReport();
-    } else
-    {
-        setTimeout( "getReportStatus();", 1500 );
-    }
+	$.get( "getStatus.action", function( json )
+	{
+		if ( json.response == "success" ) // Finished
+		{
+			setMessage( i18n_process_completed );
+        	viewReport();
+		}
+		else
+		{
+			setTimeout( "getReportStatus();", 1500 );
+		}
+	} );
 }
 
 function viewReport( urlParams )
@@ -93,7 +81,8 @@
     if ( mode == MODE_REPORT )
     {
         window.location.href = "renderReport.action?type=" + reportType + "&" + getUrlParams();
-    } else
+    } 
+    else
     // MODE_TABLE
     {
         window.location.href = "exportTable.action?type=html&" + getUrlParams();

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js	2011-10-11 14:15:32 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js	2011-10-11 14:54:46 +0000
@@ -147,7 +147,7 @@
 		setInnerHTML( 'doUnitsField', parseBool( json.table.doUnits ) );
 
 		showDetails();
-	});
+	} );
 }
 
 function parseBool( bool )
@@ -169,7 +169,8 @@
 
         disable( "doOrganisationUnits" );
         disable( "doPeriods" );
-    } else
+    } 
+    else
     {
         enable( "doOrganisationUnits" );
         enable( "doPeriods" );

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseInput.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseInput.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseInput.vm	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<message type="input">$encoder.xmlEncode( $message )</message>

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseStatus.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseStatus.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseStatus.vm	1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<status>
-	<statusMessage>$statusMessage</statusMessage>
-	<finished>$finished</finished>
-</status>

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseSuccess.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseSuccess.vm	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<message type="success">$encoder.xmlEncode( $message )</message>