← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3588: Case entry - Summary report - Used ajax to show up the generated report when "Generate" pressed.

 

------------------------------------------------------------
revno: 3588
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-12 16:40:29 +0700
message:
  Case entry - Summary report - Used ajax to show up the generated report when "Generate" pressed.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2009-11-12 16:47:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2011-05-12 09:40:29 +0000
@@ -140,7 +140,6 @@
             programId = selectedProgram.getId();
             selectedStateManager.setSelectedProgram( selectedProgram );
         }
-
         else
         {
             programId = null;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-05-12 08:32:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-05-12 09:40:29 +0000
@@ -153,7 +153,7 @@
 	  <result name="success" type="velocity">/content.vm</result>
       <param name="page">/dhis-web-caseentry/loadVisitPlan.vm</param>
       <param name="javascripts">javascript/visitPlan.js</param>  
-	  <param name="stylesheets">/dhis-web-commons/paging/paging.css</param> 
+	  <param name="stylesheets">../dhis-web-commons/paging/paging.css</param> 
     </action>
     
     <!-- Report -->   
@@ -176,9 +176,8 @@
     
     <action name="generateReport" class="org.hisp.dhis.caseentry.action.report.GenerateReportAction">
       <interceptor-ref name="organisationUnitTreeStack"/>            
-      <result name="success" type="velocity">/main.vm</result>
+      <result name="success" type="velocity">/content.vm</result>
       <param name="page">/dhis-web-caseentry/report.vm</param>
-      <param name="menu">/dhis-web-caseentry/reportsMenu.vm</param>    
       <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/report.js</param>
       <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>         
     </action>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2010-09-01 16:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2011-05-12 09:40:29 +0000
@@ -1,3 +1,4 @@
+isAjax = true;
 
 function organisationUnitSelected( orgUnits )
 {
@@ -17,8 +18,7 @@
 	request.setCallbackSuccess( reportValidationCompleted );    
 	request.send( url );
 	
-	return false;   
-    
+	return false;
 }
 
 function reportValidationCompleted( messageElement )
@@ -28,9 +28,7 @@
 	
 	if ( type == 'success' )
 	{
-		window.location.href='generateReport.action?' +			
-			'startDate=' + getFieldValue( 'startDate' ) +
-			'&endDate=' + getFieldValue( 'endDate' ) ;
+		loadGeneratedReport();
 	}
 	else if ( type == 'error' )
 	{
@@ -38,11 +36,21 @@
 	}
 	else if ( type == 'input' )
 	{
-		document.getElementById( 'message' ).innerHTML = message;
-		document.getElementById( 'message' ).style.display = 'block';
+		setMessage( message );
 	}
 }
 
+function loadGeneratedReport()
+{
+	lockScreen();
+
+	jQuery( "#contentDiv" ).load( "generateReport.action",
+	{
+		'startDate': getFieldValue( 'startDate' ),
+		'&endDate': getFieldValue( 'endDate' )
+	}, function() { unLockScreen(); });
+}
+
 function viewRecords( programStageInstanceId ) 
 {
 	var url = 'viewRecords.action?id=' + programStageInstanceId;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js	2011-05-12 08:32:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js	2011-05-12 09:40:29 +0000
@@ -1,5 +1,4 @@
 isAjax = true;
-isShowLoader = false;
 
 function organisationUnitSelected( orgUnits )
 {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm	2011-03-24 17:27:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm	2011-05-12 09:40:29 +0000
@@ -1,13 +1,10 @@
-
-#parse( "/dhis-web-caseentry/reportSelect.vm" )
-
 <table class="mainPageTable">
 <tr>
     <td style="vertical-align:top">    
     <table class="listTable">
-        <col>
+        <col/>
         #foreach( $programStage in $program.programStages )
-            <col>
+		<col/>
         #end       
         <tr>
             <th style="text-align:center">$i18n.getString( "full_name" )</th>
@@ -53,7 +50,7 @@
 
 <div id="detailsArea" style="display:none;overflow:auto;height:250px;width:250px" ondblclick="javascript:hideDetails()">
     <div style="float:right;" onclick="javascript:hideDetails()">
-        <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
+        <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
     </div>              
     <p><label>$i18n.getString( "identifier" ):</label><br><span id="identifierField"></span></p>
     <p><label>$i18n.getString( "attributes" ):</label><br><span id="attributeField"></span></p>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2011-03-24 17:27:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2011-05-12 09:40:29 +0000
@@ -14,7 +14,7 @@
     <tr>
         <td><label for="programId">$i18n.getString( "program" )</label></td>
         <td>
-            <select id="programId" name="programId" style="min-width:350px" onchange="document.getElementById( 'reportForm' ).submit();" #if( $programs.size() == 0 ) disabled="disabled" #end>
+            <select id="programId" name="programId" style="min-width:350px" onchange="document.forms[0].submit();" #if( $!programs && $programs.size() == 0 ) disabled="disabled" #end>
                 <option value="0">[$i18n.getString( "select" )]</option>
                 #foreach( $program in $programs )
                     <option value="$program.id" #if( $programId && $program.id == $programId ) selected="selected" #end>$encoder.htmlEncode( $program.name )</option>
@@ -26,7 +26,7 @@
     <tr>
         <td><label>$i18n.getString( "start_date" )</label></td>
         <td>
-            <input type="text" id="startDate" name="startDate" #if( $startDate ) value="$encoder.htmlEncode( $startDate )" #end>
+            <input type="text" id="startDate" name="startDate" #if( $startDate ) value="$encoder.htmlEncode( $startDate )" #end />
 			<script type="text/javascript">
 				datePicker('startDate');
             </script>  	
@@ -36,7 +36,7 @@
     <tr>
         <td><label>$i18n.getString( "end_date" )</label></td>
         <td>
-            <input type="text" id="endDate" name="endDate" #if( $endDate ) value="$encoder.htmlEncode( $endDate )" #end>
+            <input type="text" id="endDate" name="endDate" #if( $endDate ) value="$encoder.htmlEncode( $endDate )" #end />
             <script type="text/javascript">
 				datePicker('endDate');
             </script> 				
@@ -44,11 +44,13 @@
     </tr>    	                		
 </table>
 <p>
-    <input type="button" value="$i18n.getString( "generate" )" style="width:10em" onclick="validateAndGenerateReport()">                
-    <input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='index.action'" style="width:10em">
+    <input type="button" value="$i18n.getString( 'generate' )" style="width:10em" onclick="validateAndGenerateReport()"/>
+    <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='index.action'" style="width:10em"/>
 </p>  
 </form>
 
 <hr style="clear:both">
 
-<span id="message"></span>
+<div id="contentDiv"></div>
+
+<span id="message"></span>
\ No newline at end of file