← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 266: Impl export to HTML for report table

 

------------------------------------------------------------
revno: 266
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-04-30 13:38:35 +0200
message:
  Impl export to HTML for report table
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/html.png
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableDataAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableData.vm
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
  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/xwork.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/html.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/html.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/html.png	2009-04-30 11:38:35 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableDataAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableDataAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableDataAction.java	2009-04-30 11:38:35 +0000
@@ -0,0 +1,85 @@
+package org.hisp.dhis.reporting.tablecreator.action;
+
+import org.hisp.dhis.reporttable.ReportTableData;
+import org.hisp.dhis.reporttable.ReportTableService;
+
+import com.opensymphony.xwork.Action;
+
+/*
+ * Copyright (c) 2004-2007, 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.
+ */
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class GetTableDataAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ReportTableService reportTableService;
+
+    public void setReportTableService( ReportTableService reportTableService )
+    {
+        this.reportTableService = reportTableService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private ReportTableData data;
+
+    public ReportTableData getData()
+    {
+        return data;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        data = reportTableService.getReportTableData( id );
+        
+        return SUCCESS;
+    }    
+}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2009-04-28 18:39:58 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2009-04-30 11:38:35 +0000
@@ -266,6 +266,13 @@
       ref="org.hisp.dhis.workbook.WorkbookService"/>
   </bean>
   
+  <bean id="org.hisp.dhis.reporting.tablecreator.action.GetTableDataAction"
+    class="org.hisp.dhis.reporting.tablecreator.action.GetTableDataAction"
+    scope="prototype">
+    <property name="reportTableService"
+      ref="org.hisp.dhis.reporttable.ReportTableService"/>
+  </bean>
+  
   <!-- ReportViewer -->
   
   <bean id="org.hisp.dhis.reporting.reportviewer.action.AddReportAction"
@@ -371,7 +378,7 @@
     <property name="indicatorService"
       ref="org.hisp.dhis.indicator.IndicatorService"/>
   </bean>
-  
+    
   <!-- Custom DataSet Report -->
 	
   <!-- DataAccess -->

=== 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	2009-04-28 18:39:58 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2009-04-30 11:38:35 +0000
@@ -243,3 +243,4 @@
 type = Type
 export_to_csv = Export to CSV
 export_to_excel = Export to Excel
+export_to_html = Export to HTML

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml	2009-04-28 18:39:58 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml	2009-04-30 11:38:35 +0000
@@ -244,6 +244,12 @@
       </result>
     </action>
     
+    <action name="getTableData" class="org.hisp.dhis.reporting.tablecreator.action.GetTableDataAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="page">/dhis-web-reporting/responseReportTableData.vm</param>
+      <param name="menu">/dhis-web-reporting/menu.vm</param>
+    </action>      
+    
     <!-- PivotTable -->
     
     <action name="displayPivotTableForm" class="org.hisp.dhis.reporting.action.NoAction">

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableData.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableData.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableData.vm	2009-04-30 11:38:35 +0000
@@ -0,0 +1,52 @@
+
+<style type="text/css">
+	
+.reportTableHeader
+{
+  text-align: left;
+  color: #3f5d8e;
+  font-weight: bold;
+  border-style: solid;
+  border-width: 1px;
+  border-color: #cad5e5;
+  padding-left: 7px;
+  height: 19px;
+  background-color: #ebf0f6;
+}
+ 
+</style>
+
+#macro( alternate $mark )
+    #if( $mark ) class="listAlternateRow"#else class="listRow"#end
+#end
+
+<html>
+	<head>
+		<link type="text/css" rel="stylesheet" href="css/stylesheet.css">
+	</head>
+    <body>
+        <table class="listTable">
+            <tr>
+                <td style="text-align:center" colspan="$data.columns.values().size()"><h3>$data.name</h3></td>
+            </tr>
+            <tr>
+            #foreach( $column in $data.prettyPrintColumns )
+                <td class="reportTableHeader">$column</td>
+            #end
+            </tr>
+            #set( $mark = false )
+            #foreach( $row in $data.rows )
+                <tr>
+                #foreach( $value in $row.values() )
+                    <td#alternate( $mark )>$value</td>
+                #end
+                </tr>
+                #if( $mark )
+                    #set( $mark = false )
+                #else
+                    #set( $mark = true )
+                #end
+            #end
+        </table>
+    </body>
+</html>

=== 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	2009-04-28 18:39:58 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm	2009-04-30 11:38:35 +0000
@@ -13,8 +13,9 @@
 				<col width="20">
                 <col width="20">
                 <col width="20">
+                <col width="20">
 		        <tr>
-                    <td colspan="7" style="text-align:right">
+                    <td colspan="8" style="text-align:right">
                     	<input type="button" value="$i18n.getString( 'add_indicator_reporttable' )" style="width:250px" onclick="window.location.href='displayAddTableForm.action?mode=indicators'"><br>
                     	<input type="button" value="$i18n.getString( 'add_dataelement_reporttable' )" style="width:250px" onclick="window.location.href='displayAddTableForm.action?mode=dataelements'"><br>
                         <input type="button" value="$i18n.getString( 'add_dataelement_category_reporttable' )" style="width:250px" onclick="window.location.href='displayAddTableForm.action?mode=dataelements&category=true'"><br>
@@ -23,7 +24,7 @@
                 </tr>
 				<tr>
 					<th>$i18n.getString( "name" )</th>
-					<th colspan="6">$i18n.getString( "operations" )</th>
+					<th colspan="7">$i18n.getString( "operations" )</th>
 				</tr>
 				#set( $mark = false )
 				#foreach ( $table in $tables )
@@ -32,6 +33,7 @@
 					<td style="text-align:center"#alternate( $mark )><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"#alternate( $mark )><a href="displayAddTableForm.action?id=$table.id&mode=$table.mode&category=$table.hasCategoryOptionCombos()" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a></td>
                     <td style="text-align:center"#alternate( $mark )><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"#alternate( $mark )><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"#alternate( $mark )><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"#alternate( $mark )><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"#alternate( $mark )><a href="javascript:showTableDetails( $table.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a></td>



--
Trunk
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.