← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1230: show selected organisation when generate excel report

 

------------------------------------------------------------
revno: 1230
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Wed 2009-12-16 10:44:27 +0700
message:
  show selected organisation when generate excel report
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GetReportExcelsByGroupAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseListReport.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-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GetReportExcelsByGroupAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GetReportExcelsByGroupAction.java	2009-09-15 08:36:01 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GetReportExcelsByGroupAction.java	2009-12-16 03:44:27 +0000
@@ -31,6 +31,7 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.reportexcel.ReportExcel;
 import org.hisp.dhis.reportexcel.ReportExcelService;
@@ -65,6 +66,8 @@
 
     private String group;
 
+    private OrganisationUnit organisationUnit;
+
     // -------------------------------------------
     // Getter & Setter
     // -------------------------------------------
@@ -74,6 +77,11 @@
         this.currentUserService = currentUserService;
     }
 
+    public OrganisationUnit getOrganisationUnit()
+    {
+        return organisationUnit;
+    }
+
     public List<ReportExcel> getReports()
     {
         return reports;
@@ -97,7 +105,9 @@
     public String execute()
         throws Exception
     {
-        if ( organisationUnitSelectionManager.getSelectedOrganisationUnit() != null )
+        organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
+        
+        if ( organisationUnit != null )
         {
 
             reports = new ArrayList<ReportExcel>( reportService.getReportExcels( currentUserService.getCurrentUser(),

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js	2009-12-09 10:26:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js	2009-12-16 03:44:27 +0000
@@ -1,6 +1,6 @@
 function organisationUnitSelected( orgUnits )
 {	
-	window.location.reload();
+	getReportExcelsByGroup();	
 }
 
 selection.setListenerFunction( organisationUnitSelected );
@@ -26,6 +26,34 @@
 		var name = item.getElementsByTagName('name')[0].firstChild.nodeValue;
 		addOption('report',name,id);	
 	}
+	
+	try{
+	
+		var selectedOrganisationUnit = xmlObject.getElementsByTagName('organisationUnit')[0].firstChild.nodeValue;
+		
+		byId("selectedOrganisationUnit").innerHTML = selectedOrganisationUnit; 
+		
+		enable("group");
+		enable("report");
+		enable("period");
+		enable("generate_report");
+		enable("previewButton");
+		enable("nextPeriod");
+		enable("lastPeriod");		
+	
+	}catch(e){
+		disable("group");
+		disable("report");
+		disable("period");
+		disable("generate_report");
+		disable("previewButton");
+		disable("nextPeriod");
+		disable("lastPeriod");		
+	}
+	
+	
+	
+	
 }
 
 function lastPeriod() {

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm	2009-12-09 10:26:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm	2009-12-16 03:44:27 +0000
@@ -1,9 +1,13 @@
 <h2>$i18n.getString( "generate_report" )</h2>
 <table>	
 	<tr>
+		<td><label>$i18n.getString('organisation')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><span id="selectedOrganisationUnit"></span></td>
+    </tr>
+	<tr>
 		<td><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td >
-			<select type="text" id="group" name="group" style="min-width:20em" onchange="getReportExcelsByGroup()" #if(!$organisationUnit) disabled #end>
+			<select type="text" id="group" name="group" style="min-width:20em" onchange="getReportExcelsByGroup()" >
 				#foreach($group in $groups)
 					<option value='$group' #if( $group == $reportGroup ) selected="selected" #end>$encoder.htmlEncode( $group )</option>				
 				#end
@@ -13,7 +17,7 @@
 	<tr>
 		<td><label>$i18n.getString('reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select type="text" id="report" name="report" style="min-width:20em" #if(!$organisationUnit) disabled #end>
+			<select type="text" id="report" name="report" style="min-width:20em" >
 
 			</select>
 		</td>
@@ -21,13 +25,13 @@
 	<tr>
 		<td></td>
 		<td>
-			<input type="button" value="<<" onclick="lastPeriod();" #if(!$organisationUnit) disabled #end/><input type="button" value=">>" #if(!$organisationUnit) disabled #end onclick="nextPeriod()"/>
+			<input type="button" value="<<" onclick="lastPeriod();" id="lastPeriod"/><input type="button" value=">>"  onclick="nextPeriod()" id="nextPeriod"/>
 		</td>
     </tr>
 	<tr>
 		<td><label>$i18n.getString('period')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select type="text" id="period" style="min-width:20em" #if(!$organisationUnit) disabled #end>
+			<select type="text" id="period" style="min-width:20em" >
 				#foreach($period in $periods)
 					<option value='$period.id'>$format.formatPeriod( $period )</option>				
 				#end
@@ -48,8 +52,8 @@
 <br/>
 <hr/>
 <p>
-<input type="button" value='$i18n.getString( "preview_report" )' onclick="previewReport();" #if(!$organisationUnit) disabled #end/>
-<input name="generate_report" id="generate_report"  type="button" onClick="generateReportExcel();" value='$i18n.getString( "generate_report" )' #if(!$organisationUnit) disabled #end/>
+<input type="button" value='$i18n.getString( "preview_report" )' onclick="previewReport();" id="previewButton"/>
+<input name="generate_report" id="generate_report"  type="button" onClick="generateReportExcel();" value='$i18n.getString( "generate_report" )' />
 </p>
 
 <div id="previewDiv">

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseListReport.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseListReport.vm	2009-12-09 09:22:09 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseListReport.vm	2009-12-16 03:44:27 +0000
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <reports>	
+	<organisationUnit>$!encoder.htmlEncode($organisationUnit.name)</organisationUnit>
 	#foreach($report in $reports)
 	<report>
 		<id>$report.id</id>