← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7636: Standard report - Added Show details

 

------------------------------------------------------------
revno: 7636
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-07-19 14:37:36 +0700
message:
  Standard report - Added Show details
added:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReport.vm
modified:
  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/report.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.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-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2012-07-03 16:16:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2012-07-19 07:37:36 +0000
@@ -100,6 +100,11 @@
       <param name="javascripts">javascript/report.js</param>
     </action>
 	
+    <action name="getReport" class="org.hisp.dhis.reporting.reportviewer.action.GetReportAction">
+      <result name="success" type="velocity-json">/dhis-web-reporting/jsonReport.vm</result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
+	
     <action name="getReports" class="org.hisp.dhis.reporting.reportviewer.action.GetAllReportsAction">
       <result name="success" type="velocity-json">/dhis-web-reporting/jsonReports.vm</result>
       <param name="onExceptionReturn">plainTextError</param>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2012-05-21 09:33:12 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2012-07-19 07:37:36 +0000
@@ -34,3 +34,23 @@
         $.get( "addReportToDashboard.action?id=" + id );
     }
 }
+
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showReportDetails( reportId )
+{
+	jQuery.get( 'getReport.action', { "id": reportId }, function( json )
+	{
+		setInnerHTML( 'nameField', json.report.name );
+
+		var reportTableName = json.report.reportTableName;
+		setInnerHTML( 'reportTableNameField', reportTableName ? reportTableName : '[' + i18n_none + ']' );
+
+		var orgGroupSets = json.report.orgGroupSets;
+		setInnerHTML( 'orgGroupSetsField', orgGroupSets == 'true' ? i18n_yes : i18n_no );
+
+		showDetails();
+	});
+}
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReport.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReport.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReport.vm	2012-07-19 07:37:36 +0000
@@ -0,0 +1,8 @@
+{ "report": 
+  {
+    "id": $!{report.id},
+    "name": "$!encoder.jsonEncode( ${report.displayName} )",
+    "reportTableName": "$!encoder.jsonEncode( ${report.reportTable.displayName} )",
+    "orgGroupSets": "$!{report.usingOrgUnitGroupSets}"
+  }
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm	2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm	2012-07-19 07:37:36 +0000
@@ -3,6 +3,9 @@
 		tableSorter( 'listTable' );	
 	});
 
+	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
+	var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+	var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
     var i18n_confirm_remove_report = '$encoder.jsEscape( $i18n.getString( "confirm_remove_report" ) , "'")';
     var i18n_confirm_add_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_to_dashboard" ) , "'")';
 </script>
@@ -18,13 +21,13 @@
 				 <tr>
 				 	<td>#filterDiv( "displayViewReportForm" )</td>
                 	<td colspan="5" style="text-align:right">
-                		<input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='displayAddReportForm.action'" />
+                		<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='displayAddReportForm.action'" />
                 	</td>
                 </tr>
 			</table>
             <table class="listTable" id="listTable">
                 <col>
-                <col width="120px">               
+                <col width="140px">               
                 <thead>               
                 <tr>
                     <th>$i18n.getString( "name" )</th>
@@ -44,6 +47,7 @@
 						#if( $auth.hasAccess( "dhis-web-reporting", "removeReport" ) )
 						<a href="javascript:removeReport( $report.id )" title="$i18n.getString( 'remove_report' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove_report' )"></a>
 						#else <img src="../images/delete-denied.png"> #end
+						<a href="javascript:showReportDetails( $report.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
 					</td>
                 </tr>
                 #end
@@ -55,8 +59,14 @@
         </td>
         <td style="width:20em; padding-left:2em; vertical-align:top">
 
-            <div id="detailsArea" style="display:none; padding-top:1em; padding-bottom:1em"></div>
-            
+			<div id="detailsArea" style="display:none">
+				<div style="float:right">
+					<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( "name" ):</label><br/><span id="nameField"></span></p>
+				<p><label>$i18n.getString( "report_table" ):</label><br/><span id="reportTableNameField"></span></p>
+				<p><label>$i18n.getString( "include_organisation_unit_group_sets" ):</label><br/><span id="orgGroupSetsField"></span></p>
+			</div>
 			<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
 				<div style="float:right">
 					<a href="javascript:hideWarning()" title='$i18n.getString( 'hide_warning' )'><img src="../images/close.png" alt=$i18n.getString( "hide_warning" )'></a>