dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02519
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 839: Modify Advanced report excel function
------------------------------------------------------------
revno: 839
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2009-10-09 13:06:43 +0700
message:
Modify Advanced report excel function
added:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/SelectAdvancedExportFormAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm
modified:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml
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/individual.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/menu.vm
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.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.
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/SelectAdvancedExportFormAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/SelectAdvancedExportFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/SelectAdvancedExportFormAction.java 2009-10-09 06:06:43 +0000
@@ -0,0 +1,121 @@
+package org.hisp.dhis.reportexcel.export.advance.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.comparator.PeriodComparator;
+import org.hisp.dhis.report.ReportService;
+import org.hisp.dhis.reportexcel.ReportExcelService;
+import org.hisp.dhis.reportexcel.export.action.SelectionManager;
+import org.hisp.dhis.reportexcel.utils.DateUtils;
+
+import com.opensymphony.xwork2.Action;
+
+public class SelectAdvancedExportFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ private PeriodService periodService;
+
+ private SelectionManager selectionManager;
+
+ private ReportExcelService reportService;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
+
+ private List<Period> periods;
+
+ private List<String> reportGroups;
+
+ // -------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------
+
+ public void setReportService( ReportExcelService reportService )
+ {
+ this.reportService = reportService;
+ }
+
+ public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+ {
+ return organisationUnitGroups;
+ }
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ public List<Period> getPeriods()
+ {
+ return periods;
+ }
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ public void setSelectionManager( SelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
+ public List<String> getReportGroups()
+ {
+ return reportGroups;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+
+ public String execute()
+ throws Exception
+ {
+ // Report groups list
+ reportGroups = new ArrayList<String>( reportService.getReportExcelGroups() );
+
+ // Periods list
+ PeriodType periodType = periodService.getPeriodTypeByClass( MonthlyPeriodType.class );
+
+ Date firstDateOfThisYear = DateUtils.getFirstDayOfYear( DateUtils.getCurrentYear() );
+
+ Date endDateOfThisMonth = DateUtils.getEndDate( DateUtils.getCurrentMonth(), DateUtils.getCurrentYear() );
+
+ periods = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType( periodType,
+ firstDateOfThisYear, endDateOfThisMonth ) );
+
+ Collections.sort( periods, new PeriodComparator() );
+
+ selectionManager.setSeletedYear( DateUtils.getCurrentYear() );
+
+ // Organisation groups list
+ organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService
+ .getAllOrganisationUnitGroups() );
+
+ Collections.sort( organisationUnitGroups, new OrganisationUnitGroupNameComparator() );
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-10-09 01:47:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-10-09 06:06:43 +0000
@@ -686,12 +686,21 @@
<!-- GERERATE ADVANCE -->
<bean
- id="org.hisp.dhis.reportexcel.export.advance.action.GetOrganisationUnitGroupListAction"
- class="org.hisp.dhis.reportexcel.export.advance.action.GetOrganisationUnitGroupListAction"
+ id="org.hisp.dhis.reportexcel.export.advance.action.SelectAdvancedExportFormAction"
+ class="org.hisp.dhis.reportexcel.export.advance.action.SelectAdvancedExportFormAction"
scope="prototype">
<property name="organisationUnitGroupService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</property>
+ <property name="periodService">
+ <ref bean="org.hisp.dhis.period.PeriodService" />
+ </property>
+ <property name="selectionManager">
+ <ref bean="org.hisp.dhis.reportexcel.export.action.SelectionManager" />
+ </property>
+ <property name="reportService">
+ <ref bean="org.hisp.dhis.reportexcel.ReportExcelService" />
+ </property>
</bean>
<bean
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2009-10-09 01:47:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2009-10-09 06:06:43 +0000
@@ -141,4 +141,5 @@
available_periods = Available periods
selected_periods = Selected periods
generate = Generate report
-bookmark = Bookmark
\ No newline at end of file
+bookmark = Bookmark
+generate_advanced_report = Generate advanced report
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2009-10-09 01:47:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2009-10-09 06:06:43 +0000
@@ -159,4 +159,5 @@
available_periods = Available periods
selected_periods = Selected periods
generate = Generate report
-bookmark = Bookmark
\ No newline at end of file
+bookmark = Bookmark
+generate_advanced_report = Generate advanced report
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-08 09:18:37 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-09 06:06:43 +0000
@@ -627,15 +627,15 @@
<!-- GERERATE ADVANCE -->
- <action name="organisationUnitGroupList"
- class="org.hisp.dhis.reportexcel.export.advance.action.GetOrganisationUnitGroupListAction">
- <result name="success" type="velocity-xml">
- /dhis-web-excel-reporting/responseOrganisationUnitGroupObjects.vm
- </result>
- <result name="error" type="velocity-xml">
- /dhis-web-excel-reporting/responseError.vm</result>
- </action>
-
+ <action name="selectAdvancedExportForm"
+ class="org.hisp.dhis.reportexcel.export.advance.action.SelectAdvancedExportFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-excel-reporting/advancedReport.vm</param>
+ <param name="menu">/dhis-web-excel-reporting/menu.vm</param>
+ <param name="menuTreeHeight">250</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/export.js,javascript/commons.js,javascript/preview.js</param>
+ </action>
+
<action name="generateAdvancedReportExcel"
class="org.hisp.dhis.reportexcel.export.action.GenerateReportExcelFlowAction">
<result name="CATEGORY" type="chain">
@@ -678,10 +678,10 @@
<action name="openIndividualReportExcel"
class="org.hisp.dhis.reportexcel.export.individual.action.OpenIndividualReportExcelAction">
<interceptor-ref name="organisationUnitTreeStack" />
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-excel-reporting/individualReportExcel.vm</param>
- <param name="menu">/dhis-web-excel-reporting/menuWithTree.vm</param>
- <param name="menuTreeHeight">220</param>
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-excel-reporting/individualReportExcel.vm</param>
+ <param name="menu">/dhis-web-excel-reporting/menuWithTree.vm</param>
+ <param name="menuTreeHeight">220</param>
<param name="javascripts">javascript/individual.js,
javascript/commons.js,
../dhis-web-commons/ouwt/ouwt.js,
@@ -705,11 +705,11 @@
/dhis-web-excel-reporting/responseSuccess.vm</result>
</action>
- <action name="cleanUpReportExcel"
- class="org.hisp.dhis.reportexcel.action.CleanUpReportExcelAction">
- <result name="success" type="velocity-xml">
- /dhis-web-excel-reporting/responseSuccess.vm</result>
- </action>
+ <action name="cleanUpReportExcel"
+ class="org.hisp.dhis.reportexcel.action.CleanUpReportExcelAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-excel-reporting/responseSuccess.vm</result>
+ </action>
</package>
</struts>
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm 2009-10-09 06:06:43 +0000
@@ -0,0 +1,70 @@
+<h2>$i18n.getString( "generate_report" )</h2>
+<table >
+ <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="width:20em" onchange="getReportExcelsByGroup()" >
+ #foreach($reportGroup in $reportGroups)
+ <option value='$reportGroup'>$reportGroup</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <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="width:20em">
+ #foreach($report in $reports)
+ <option value='$report.id'>$encoder.htmlEncode( $report.name )</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="button" value="<<" onclick="lastYear();" /><input type="button" value=">>" onclick="nextYear()"/>
+ </td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString('period')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select type="text" id="period" name="period" style="width:20em" >
+ #foreach($period in $periods)
+ <option value='$period.id'>$format.formatPeriod( $period )</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString('choose_orgunit_group')<em title="$i18n.getString( 'required' )" class="required">*</em> </td>
+ <td><select id="availableOrgunitGroups" name="availableOrgunitGroups" style="width:20em" >
+ #foreach($organisationUnitGroup in $organisationUnitGroups)
+ <option value="$organisationUnitGroup.id">$organisationUnitGroup.name</option>
+ #end
+ </select></td>
+ </tr>
+</table>
+<div id="actions" style="width:200px text-align:right">
+
+</div>
+<div id="orgUnitTree">
+
+</div>
+
+
+
+<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="hideById(this.id);"></span>
+<br>
+<hr>
+<p>
+<input name="generate_report" id="generate_report" type="button" onClick="generateAdvancedReportExcel()" value='$i18n.getString( "generate_report" )' />
+</p>
+<span id="info" style="display:none;top:70px;right:5px;position:fixed;" onclick="hideById(this.id)">
+
+</span>
+<span id="loading" style="display:none;position:fixed;"><img src="../images/ajax-loader.gif" /></span>
+
+<script>
+ getReportExcelsByGroup();
+</script>
\ No newline at end of file
=== 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-10-07 05:38:43 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js 2009-10-09 06:06:43 +0000
@@ -50,11 +50,11 @@
function generateReportExcel() {
- if(byId('advancedCheck').checked){
-
- generateAdvancedReportExcel();
-
- }else{
+ //if(byId('advancedCheck').checked){
+
+ //generateAdvancedReportExcel();
+
+ //}else{
$("#loading").showAtCenter( true );
$.post("generateReportExcel.action",{
reportId:$('#report').val(),
@@ -64,7 +64,7 @@
deleteDivEffect();
$("#loading").hide();
},'xml');
- }
+ //}
}
function generateAdvancedReportExcel() {
@@ -82,40 +82,6 @@
}
-function openGenerateAdvance() {
-
- if(byId('advancedCheck').checked)
- {
- var availableList = byId('availableOrgunitGroups');
-
- if(availableList.options.length == 0){
-
- $.get("organisationUnitGroupList.action",
- {},
- function (data){
-
- var xmlObject = data.getElementsByTagName('organisationUnitGroups')[0];
- var availableObjectList = xmlObject.getElementsByTagName('organisationUnitGroup');
-
- for(var i=0;i<availableObjectList.length;i++){
- var element = availableObjectList.item(i);
- var name = element.getElementsByTagName('id')[0].firstChild.nodeValue;
- var label = element.getElementsByTagName('name')[0].firstChild.nodeValue;
- availableList.add(new Option(label, name),null);
- }
- },'xml');
- }
-
- byId('availableOrgunitGroups').disabled = false;
-
- }else{
- byId('availableOrgunitGroups').disabled = true;
- }
-
-
-}
-
-
generic_type = '';
function validateGenerateReport(message) {
@@ -171,6 +137,8 @@
function openPreviewReport() {
var reportId = $('#report').val();
- var periodId = $('#period').val();
- window.open("openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId + "&sheetId=1", "_blank", "width=900,height=600,scrollbars=yes,menubar=yes,resizable=yes");
+
+ var periodId = $('#period').val();
+
+ window.open("openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId, "_blank", "width=900,height=600,scrollbars=yes,menubar=yes,resizable=yes");
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js 2009-10-08 07:28:59 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js 2009-10-09 06:06:43 +0000
@@ -220,6 +220,7 @@
request.setCallbackSuccess( getListPeriodCompleted );
request.send( '../dhis-web-commons-ajax/getPeriods.action?name=' + $("#availabelPeriodTypes").val());
}
+
function getListPeriodCompleted( xmlObject ){
clearListById('availablePeriods');
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/menu.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/menu.vm 2009-09-25 06:10:21 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/menu.vm 2009-10-09 06:06:43 +0000
@@ -2,11 +2,13 @@
<h2><a href="selectExportReportParam.action">$i18n.getString( "generate_report" ) </a></h2>
<ul>
- <li><a href="selectExportReportParam.action">$i18n.getString( "generate_report" ) </a></li>
+ <li><a href="selectExportReportParam.action">$i18n.getString( "generate_report" ) </a></li>
+ <li><a href="selectAdvancedExportForm.action">$i18n.getString( "generate_advanced_report" ) </a></li>
<li><a href="getInformation.action">$i18n.getString( "import_excel_file_manager" ) </a></li>
<li><a href="selectDataSetCompletedReport.action">$i18n.getString( "dataset_completed_report" ) </a></li>
<li><a href="viewDataEntryStatus.action">$i18n.getString( "data_status" )</a></li>
-
+ <li><a href="openIndividualReportExcel.action">$i18n.getString( "individual_report" )</a></li>
+
</ul>
<script type="text/javascript">
=== 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-10-09 01:47:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm 2009-10-09 06:06:43 +0000
@@ -1,18 +1,15 @@
<h2>$i18n.getString( "generate_report" )</h2>
-<table width="100%">
+<table >
<tr>
- <td width="264" ><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td width="555" >
+ <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>
#foreach($group in $groups)
<option value='$group'>$encoder.htmlEncode( $group )</option>
#end
</select>
</td>
- <td width="496" align="left" style="width:300px;vertical-align:top" ><input type="checkbox" id="advancedCheck" name="advancedCheck" onChange="javascript : openGenerateAdvance();" />
- $i18n.getString('generate_report_by_orgunit_group')
- </td>
- </tr>
+ </tr>
<tr>
<td><label>$i18n.getString('reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
@@ -22,9 +19,7 @@
#end
</select>
</td>
- <td width="496" rowspan="3" align="left" style="width:300px;vertical-align:top" ><select size="5" id="availableOrgunitGroups" name="availableOrgunitGroups" style="min-width:200px; max-width:200px " disabled>
- </select></td>
- </tr>
+ </tr>
<tr>
<td></td>
<td>