← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1621: Fixed bug #510082

 

------------------------------------------------------------
revno: 1621
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-11 14:21:41 +0100
message:
  Fixed bug #510082
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
  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/viewTableForm.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-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js	2010-03-11 12:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js	2010-03-11 13:21:41 +0000
@@ -1,4 +1,10 @@
 
+// -----------------------------------------------------------------------------
+// Global variables
+// -----------------------------------------------------------------------------
+
+var headerMessageTimeout = -1;
+
 /**
  * Redirects to the translate GUI.
  * 
@@ -449,7 +455,10 @@
 function setHeaderDelayMessage( message )
 {
 	setHeaderMessage( message );
-	setTimeout( "hideHeaderMessage();", 3000 );
+	
+	window.clearTimeout( headerMessageTimeout ); // Clear waiting invocations
+	
+	headerMessageTimeout = window.setTimeout( "hideHeaderMessage();", 3000 );
 }
 
 /**

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2010-03-11 11:56:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2010-03-11 13:21:41 +0000
@@ -278,6 +278,7 @@
 tally_sheet_report = Tally Sheet report
 data_completeness_report = Data Completeness Report
 configuration = Configuration
+generate_before_export = Please generate table before exporting
 based_on_subjective = Based on complete data set registrations
 based_on_objective = Based on compulsory data elements
 deleting_existing_aggregated_data= Deleting existing aggregated data

=== 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	2010-02-17 13:38:15 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js	2010-03-11 13:21:41 +0000
@@ -332,3 +332,40 @@
 {
     window.location.href = 'displayManageTableForm.action';
 }
+
+// -----------------------------------------------------------------------------
+// Export
+// -----------------------------------------------------------------------------
+
+function exportToExcel( id )
+{	
+	verifyAndExport( id, "generateTableDataWorkbook.action?id=" + id );
+}
+
+function exportToHtml( id )
+{
+	verifyAndExport( id, "getTableData.action?id=" + id );
+}
+
+function exportToCsv( id )
+{
+	verifyAndExport( id, "getTableDataExport.action?exportFormat=CSV&id=" + id );
+}
+
+function verifyAndExport( id, url )
+{   
+    $.getJSON( 
+       "verifyReportTable.action",
+       { "id": id },
+       function( json )
+       {
+           if ( json.response == "error" )
+           {
+               setHeaderDelayMessage( i18n_generate_before_export );
+           }
+           else
+           {
+               window.location.href = "generateTableDataWorkbook.action?id=" + id;
+           }
+       } );
+}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm	2010-02-27 21:18:45 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm	2010-03-11 13:21:41 +0000
@@ -37,9 +37,9 @@
 					<td style="text-align:center"><a href="getReportParams.action?id=$table.id&mode=table" title="$i18n.getString( "create" )"><img src="../images/start_process.png" alt="$i18n.getString( "create" )"></a></td>
                     <td style="text-align:center"><a href="displayAddTableForm.action?id=$table.id&mode=$table.mode&dimension=$table.isDimensional()" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a></td>
                     <td style="text-align:center"><a href="displayTable.action?id=$table.id" title="$i18n.getString( "display" )"><img src="../images/display.png" alt="$i18n.getString( "display" )"></a></td>
-                    <td style="text-align:center"><a href="generateTableDataWorkbook.action?id=$table.id" title="$i18n.getString( "export_to_excel" )"><img src="../images/excel.png" alt="$i18n.getString( "export_to_excel" )"></a></td>
-                    <td style="text-align:center"><a href="getTableData.action?id=$table.id" title="$i18n.getString( "export_to_html" )"><img src="../images/html.png" alt="$i18n.getString( "export_to_html" )"></a></td>
-                    <td style="text-align:center"><a href="getTableDataExport.action?id=$table.id&exportFormat=CSV" title="$i18n.getString( "export_to_csv" )"><img src="../images/csv.png" alt="$i18n.getString( "export_to_csv" )"></a></td>
+                    <td style="text-align:center"><a href="javascript:exportToExcel( $table.id )" title="$i18n.getString( "export_to_excel" )"><img src="../images/excel.png" alt="$i18n.getString( "export_to_excel" )"></a></td>
+                    <td style="text-align:center"><a href="javascript:exportToHtml( $table.id )" title="$i18n.getString( "export_to_html" )"><img src="../images/html.png" alt="$i18n.getString( "export_to_html" )"></a></td>
+                    <td style="text-align:center"><a href="javascript:exportToCsv( $table.id )" title="$i18n.getString( "export_to_csv" )"><img src="../images/csv.png" alt="$i18n.getString( "export_to_csv" )"></a></td>
                     <td style="text-align:center"><a href="javascript:addReportTableToDashboard( '$table.id' )" title="$i18n.getString( 'add_to_dashboard' )"><img src="../images/add_to_dashboard.png" alt="$i18n.getString( 'add_to_dashboard' )"></a></td>
                     <td style="text-align:center"><a href="javascript:removeTable( $table.id, '$encoder.jsEncode( $table.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a></td>
 					<td style="text-align:center"><a href="javascript:showTableDetails( $table.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a></td>
@@ -70,6 +70,7 @@
 </table>
 
 <script type="text/javascript">
+	var i18n_generate_before_export = '$encoder.jsEscape( $i18n.getString( "generate_before_export" ) , "'")';
 	var i18n_confirm_add_report_table_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_report_table_to_dashboard" ) , "'")';
     var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_table" ) , "'")';
     var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';