dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01982
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 651: Updated vn-reports module.
------------------------------------------------------------
revno: 651
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-09-09 16:19:35 +0700
message:
Updated vn-reports module.
added:
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/GetInformationAction.java
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ImportDataAction.java
local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/importData.vm
local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/style/style.css
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
local/vn/dhis-api-vn/src/main/java/org/hisp/dhis/vn/report/ReportExcelInterface.java
local/vn/dhis-web-chr-form/pom.xml
local/vn/dhis-web-vn-report/pom.xml
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/UploadExcelFileAction.java
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ViewDataFromExcelFileAction.java
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/action/UpdateReportExcelAction.java
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/export/action/SelectFormAction.java
local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/utils/ExcelUtils.java
local/vn/dhis-web-vn-report/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module.properties
local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module_vi_VN.properties
local/vn/dhis-web-vn-report/src/main/resources/struts.xml
local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/javascript/imports.js
local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/menu.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/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2009-09-07 14:32:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2009-09-09 09:19:35 +0000
@@ -56,6 +56,7 @@
dhis-web-validationrule-local-in = Validation Analysis
dhis-web-mapping = GIS
dhis-web-vn-report = Excel Reports
+dhis-web-chr-form = Child Health Record
#-- Common --------------------------------------------------------------------#
=== modified file 'local/vn/dhis-api-vn/src/main/java/org/hisp/dhis/vn/report/ReportExcelInterface.java'
--- local/vn/dhis-api-vn/src/main/java/org/hisp/dhis/vn/report/ReportExcelInterface.java 2009-09-07 07:34:18 +0000
+++ local/vn/dhis-api-vn/src/main/java/org/hisp/dhis/vn/report/ReportExcelInterface.java 2009-09-09 09:19:35 +0000
@@ -85,5 +85,5 @@
public String getGroup() ;
- public void setGroup(String group) ;
+ public void setGroup(String group) ;
}
=== modified file 'local/vn/dhis-web-chr-form/pom.xml'
--- local/vn/dhis-web-chr-form/pom.xml 2009-09-06 15:51:11 +0000
+++ local/vn/dhis-web-chr-form/pom.xml 2009-09-09 09:19:35 +0000
@@ -10,7 +10,7 @@
</parent>
<artifactId>dhis-web-chr-form</artifactId>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<name>DHIS Childreport Form</name>
<build>
=== modified file 'local/vn/dhis-web-vn-report/pom.xml'
--- local/vn/dhis-web-vn-report/pom.xml 2009-09-07 07:56:07 +0000
+++ local/vn/dhis-web-vn-report/pom.xml 2009-09-09 09:19:35 +0000
@@ -10,7 +10,7 @@
</parent>
<artifactId>dhis-web-vn-report</artifactId>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<name>DHIS Vietnam Report</name>
<build>
=== added file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/GetInformationAction.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/GetInformationAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/GetInformationAction.java 2009-09-09 09:19:35 +0000
@@ -0,0 +1,140 @@
+package org.hisp.dhis.vn.imports.action;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.vn.report.ReportExcelInterface;
+import org.hisp.dhis.vn.report.ReportExcelService;
+import org.hisp.dhis.vn.report.action.ActionSupport;
+
+public class GetInformationAction
+ extends ActionSupport
+{
+
+ // -------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------
+
+ private OrganisationUnitSelectionManager organisationUnitSelectionManager;
+
+ public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
+ {
+ this.organisationUnitSelectionManager = organisationUnitSelectionManager;
+ }
+
+ private ReportExcelService reportExcelService;
+
+ public void setReportExcelService( ReportExcelService reportExcelService )
+ {
+ this.reportExcelService = reportExcelService;
+ }
+
+ // -------------------------------------------------------------
+ // Input && Ouput
+ // -------------------------------------------------------------
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+ this.organisationUnit = organisationUnit;
+ }
+
+ private List<ReportExcelInterface> reportExcels;
+
+ public List<ReportExcelInterface> getReportExcels()
+ {
+ return reportExcels;
+ }
+
+ private List<Period> periods;
+
+ public List<Period> getPeriods()
+ {
+ return periods;
+ }
+
+ public void setPeriods( List<Period> periods )
+ {
+ this.periods = periods;
+ }
+
+ private File fileExcel;
+
+ public File getFileExcel()
+ {
+ return fileExcel;
+ }
+
+ public void setFileExcel( File fileExcel )
+ {
+ this.fileExcel = fileExcel;
+ }
+
+ // -------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ // //----------------------------------------------------------
+ // //get maximum of sheet
+ // int max = 1;
+ // maxSheet = 1;
+ // ----------------------------------------------------------
+ // get selected Organisation unit
+ organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
+ System.out.println( "selected orgunit : " + organisationUnit );
+ // ----------------------------------------------------------
+ // init reportExcels Object
+ reportExcels = new ArrayList<ReportExcelInterface>();
+ // get reports list for organisation unit
+ List<ReportExcelInterface> listReports = new ArrayList<ReportExcelInterface>( reportExcelService.getALLReport() );
+
+ if ( organisationUnit == null )
+ {
+ reportExcels.addAll( listReports );
+ }
+ else
+ {
+
+ for ( ReportExcelInterface report : listReports )
+ {
+
+ Collection<OrganisationUnit> orgUnits = report.getOrganisationAssocitions();
+ // check report's organisationUnit belongs to orgUnits
+ for ( OrganisationUnit orgUnit : orgUnits )
+ {
+ if ( organisationUnit.getId() == orgUnit.getId() )
+ {
+ reportExcels.add( report );
+
+ break;
+ } // end if
+ }// end for orgUnits
+
+ }// end for reports
+ } // end else if organisationUnit
+
+ // ----------------------------------------------------------
+ //
+
+ if ( fileExcel != null )
+ {
+ message = i18n.getString( "upload_file" ) + " " + i18n.getString( "success" ) + " <br> ' "
+ + fileExcel.getName() + " '";
+ }
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ImportDataAction.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ImportDataAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ImportDataAction.java 2009-09-09 09:19:35 +0000
@@ -0,0 +1,201 @@
+package org.hisp.dhis.vn.imports.action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ */
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Locale;
+
+import jxl.Sheet;
+import jxl.Workbook;
+import jxl.WorkbookSettings;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.Operand;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.vn.report.ReportExcelInterface;
+import org.hisp.dhis.vn.report.ReportExcelService;
+import org.hisp.dhis.vn.report.ReportItem;
+import org.hisp.dhis.vn.report.action.ActionSupport;
+import org.hisp.dhis.vn.report.utils.ExcelUtils;
+
+public class ImportDataAction
+ extends ActionSupport
+{
+ // --------------------------------------------------------------------
+ // Dependencies
+ // --------------------------------------------------------------------
+
+ private DataValueService dataValueService;
+
+ public void setDataValueService( DataValueService dataValueService )
+ {
+ this.dataValueService = dataValueService;
+ }
+
+ private ReportExcelService reportExcelService;
+
+ public void setReportExcelService( ReportExcelService reportExcelService )
+ {
+ this.reportExcelService = reportExcelService;
+ }
+
+ private OrganisationUnitSelectionManager organisationUnitSelectionManager;
+
+ public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
+ {
+ this.organisationUnitSelectionManager = organisationUnitSelectionManager;
+ }
+
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+
+ public void setDataElementCategoryOptionComboService(
+ DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ {
+ this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
+ }
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ // --------------------------------------------------------------------
+ // Input && Output
+ // --------------------------------------------------------------------
+
+ private Integer reportId;
+
+ public void setReportId( Integer reportId )
+ {
+ this.reportId = reportId;
+ }
+
+ private String uploadFileName;
+
+ public void setUploadFileName( String uploadFileName )
+ {
+ this.uploadFileName = uploadFileName;
+ }
+
+ private Integer periodId;
+
+ public void setPeriodId( Integer periodId )
+ {
+ this.periodId = periodId;
+ }
+
+ // --------------------------------------------------------------------
+ // Action Implementation
+ // --------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ // template report excel
+ ReportExcelInterface report = reportExcelService.getReport( reportId );
+
+ // organisation unit
+ OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
+
+ // file saves values
+ File upload = new File( uploadFileName );
+ WorkbookSettings ws = new WorkbookSettings();
+ ws.setLocale( new Locale( "en", "EN" ) );
+ Workbook templateWorkbook = Workbook.getWorkbook( upload, ws );
+
+ // get reportItems of the template report
+ Collection<ReportItem> reportItems = report.getReportItems();
+
+ Sheet sheet = templateWorkbook.getSheet( 0 );
+
+ // get period
+ Period period = periodService.getPeriod( periodId.intValue() );
+
+ for ( ReportItem reportItem : reportItems )
+ {
+ if ( reportItem.getItemType().equals( ReportItem.TYPE.DATAELEMENT ) )
+ {
+
+ String value = ExcelUtils.readValue( reportItem.getRow(), reportItem.getColumn(), sheet );
+
+ // Get expression of the reportItem
+ Operand operand = expressionService.getOperandsInExpression( reportItem.getExpression() ).iterator()
+ .next();
+
+ // dateelement of the reportItem
+ DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
+
+ DataElementCategoryOptionCombo optionCombo = dataElementCategoryOptionComboService
+ .getDataElementCategoryOptionCombo( operand.getOptionComboId() );
+
+ // logged username
+ String storedBy = currentUserService.getCurrentUsername();
+
+ DataValue dataValue = dataValueService
+ .getDataValue( organisationUnit, dataElement, period, optionCombo );
+
+ // if dataValue is not exist, that means data not input
+ // add value into database
+ if ( dataValue == null )
+ {
+ dataValue = new DataValue( dataElement, period, organisationUnit, value + "", storedBy, new Date(),
+ null, optionCombo );
+ dataValueService.addDataValue( dataValue );
+ }
+ // if dataValue is exist, update new value
+ else
+ {
+ dataValue.setValue( value + "" );
+ dataValue.setTimestamp( new Date() );
+ dataValue.setStoredBy( storedBy );
+
+ dataValueService.updateDataValue( dataValue );
+
+ }// end if
+ }
+ }
+
+ message = i18n.getString( "success" );
+
+ return SUCCESS;
+ }
+
+}
\ No newline at end of file
=== modified file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/UploadExcelFileAction.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/UploadExcelFileAction.java 2009-09-01 13:30:48 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/UploadExcelFileAction.java 2009-09-09 09:19:35 +0000
@@ -7,12 +7,13 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.vn.report.action.ActionSupport;
import org.hisp.dhis.vn.report.state.ReportLocationManager;
import com.opensymphony.xwork2.Action;
public class UploadExcelFileAction
- implements Action
+ extends ActionSupport
{
// -------------------------------------------
// Dependency
@@ -54,9 +55,23 @@
this.upload = upload;
}
+ private File fileExcel ;
+
+ public File getFileExcel()
+ {
+ return fileExcel;
+ }
+
+ public void setFileExcel( File fileExcel )
+ {
+ this.fileExcel = fileExcel;
+ }
+
// -------------------------------------------------------------------------
// Action
// -------------------------------------------------------------------------
+
+
public String execute()
throws Exception
@@ -75,7 +90,9 @@
{
FileReader in = new FileReader( upload );
- FileWriter out = new FileWriter( new File( directory, fileName ) );
+ fileExcel = new File( directory, fileName );
+
+ FileWriter out = new FileWriter( fileExcel );
int c;
@@ -85,6 +102,9 @@
in.close();
out.close();
+ // message = i18n.getString( "upload" ) + " " + i18n.getString( "success" ) + " '" + fileExcel.getName() + "'";
+
+ return SUCCESS;
}
catch ( IOException e )
{
=== modified file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ViewDataFromExcelFileAction.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ViewDataFromExcelFileAction.java 2009-07-13 00:23:50 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/imports/action/ViewDataFromExcelFileAction.java 2009-09-09 09:19:35 +0000
@@ -97,9 +97,7 @@
System.out.println("Sheet no: " + 3);
File excel = new File( reportLocationManager.getDirectory( organisationUnit ), fileName );
-
- System.out.println("Sheet no: " + excel.getAbsolutePath());
-
+
Workbook templateWorkbook = Workbook.getWorkbook( excel );
System.out.println("Sheet no: " + 5);
=== modified file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/action/UpdateReportExcelAction.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/action/UpdateReportExcelAction.java 2009-09-07 07:34:18 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/action/UpdateReportExcelAction.java 2009-09-09 09:19:35 +0000
@@ -127,8 +127,7 @@
{
report = reportService.getReport( id.intValue() );
- report.setExcelTemplateFile( excel );
-
+ report.setExcelTemplateFile( excel );
report.setGroup(CodecUtils.unescape( group));
if ( periodCol == null || periodRow == null )
=== modified file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/export/action/SelectFormAction.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/export/action/SelectFormAction.java 2009-09-07 07:34:18 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/export/action/SelectFormAction.java 2009-09-09 09:19:35 +0000
@@ -26,6 +26,7 @@
*/
package org.hisp.dhis.vn.report.export.action;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -117,6 +118,18 @@
this.reportService = reportService;
}
+ private File fileExcel;
+
+ public File getFileExcel()
+ {
+ return fileExcel;
+ }
+
+ public void setFileExcel( File fileExcel )
+ {
+ this.fileExcel = fileExcel;
+ }
+
public String execute()
throws Exception
{
=== modified file 'local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/utils/ExcelUtils.java'
--- local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/utils/ExcelUtils.java 2009-07-13 00:23:50 +0000
+++ local/vn/dhis-web-vn-report/src/main/java/org/hisp/dhis/vn/report/utils/ExcelUtils.java 2009-09-09 09:19:35 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.vn.report.utils;
import jxl.Cell;
+import jxl.NumberCell;
import jxl.Sheet;
import jxl.write.Formula;
import jxl.write.Label;
@@ -106,5 +107,20 @@
sheet.addCell( new Formula( column - 1, row - 1, formula, format ) );
}
}
+
+ public static String readValue( int row, int column, Sheet sheet )
+ {
+//
+// NumberCell _cell =(NumberCell) sheet.getCell(column,row);
+// System.out.println("\n\n\n number value = " + _cell.getValue());
+//
+ Cell cell = sheet.getCell( column - 1, row - 1 );
+ System.out.println("\n\n\n string value = " + cell.getContents() +
+ "\n column = " + column + "\n row = " + row);
+
+ return cell.getContents();
+
+// return cell.getValue();
+ }
}
=== modified file 'local/vn/dhis-web-vn-report/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-vn-report/src/main/resources/META-INF/dhis/beans.xml 2009-09-07 16:54:40 +0000
+++ local/vn/dhis-web-vn-report/src/main/resources/META-INF/dhis/beans.xml 2009-09-09 09:19:35 +0000
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
@@ -407,6 +406,47 @@
<!-- Import Excel Files -->
+ <bean
+ id="org.hisp.dhis.vn.imports.action.GetInformationAction"
+ class="org.hisp.dhis.vn.imports.action.GetInformationAction"
+ scope="prototype">
+ <property name="organisationUnitSelectionManager"
+ ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ <property name="reportExcelService"
+ ref="org.hisp.dhis.vn.report.ReportExcelService" />
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.vn.imports.action.ImportDataAction"
+ class="org.hisp.dhis.vn.imports.action.ImportDataAction"
+ scope="prototype">
+
+ <property name="dataValueService"
+ ref="org.hisp.dhis.datavalue.DataValueService" />
+
+ <property name="reportExcelService"
+ ref="org.hisp.dhis.vn.report.ReportExcelService" />
+
+ <property name="organisationUnitSelectionManager"
+ ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+
+ <property name="expressionService"
+ ref="org.hisp.dhis.expression.ExpressionService" />
+
+ <property name="dataElementService"
+ ref="org.hisp.dhis.dataelement.DataElementService" />
+
+ <property name="dataElementCategoryOptionComboService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService" />
+
+ <property name="currentUserService"
+ ref="org.hisp.dhis.user.CurrentUserService" />
+
+ <property name="periodService"
+ ref="org.hisp.dhis.period.PeriodService" />
+
+ </bean>
+
<bean
id="org.hisp.dhis.vn.imports.action.GetListExcelFileByOrganisationAction"
class="org.hisp.dhis.vn.imports.action.GetListExcelFileByOrganisationAction"
=== modified file 'local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module.properties'
--- local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module.properties 2009-09-09 05:41:45 +0000
+++ local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module.properties 2009-09-09 09:19:35 +0000
@@ -98,9 +98,12 @@
serial = Serial
jumping_step = Jumping Step
rename = Rename
+template_excel_file = Template excel file
+import = Import data
+dhis-web-chr-form = Child Health Records
select_all_at_level = Select All At Level
unselect_all_at_level = Un-Select All At Level
remove_all = Un-Select All
define_associations = Report Associations
-
+import_excel_file = Import excel file
=== modified file 'local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module_vi_VN.properties 2009-09-07 08:21:46 +0000
+++ local/vn/dhis-web-vn-report/src/main/resources/org/hisp/dhis/vn/i18n_module_vi_VN.properties 2009-09-09 09:19:35 +0000
@@ -124,3 +124,5 @@
serial = S\u1ed1 th\u1ee9 t\u1ef1
jumping_step = D\u00f2ng tr\u1ed1ng
rename = Rename
+template_excel_file = Template excel file
+import = Import data
\ No newline at end of file
=== modified file 'local/vn/dhis-web-vn-report/src/main/resources/struts.xml'
--- local/vn/dhis-web-vn-report/src/main/resources/struts.xml 2009-09-07 16:54:40 +0000
+++ local/vn/dhis-web-vn-report/src/main/resources/struts.xml 2009-09-09 09:19:35 +0000
@@ -260,9 +260,6 @@
</result>
</action>
-
-
-
<!-- Export Report-->
<action name="getOrganisation"
@@ -366,6 +363,37 @@
<!-- Import Excel File -->
+ <action name="getInformation"
+ class="org.hisp.dhis.vn.imports.action.UploadExcelFileAction">
+ <result name="success" type="chain">
+ selectFormChain</result>
+ <interceptor-ref name="fileUploadStack" />
+ </action>
+
+ <action name="selectFormChain"
+ class="org.hisp.dhis.vn.report.export.action.SelectFormAction">
+ <result name="success" type="chain">getInformationChain
+ </result>
+ </action>
+
+ <action name="getInformationChain"
+ class="org.hisp.dhis.vn.imports.action.GetInformationAction">
+ <interceptor-ref name="organisationUnitTreeStack" />
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-vn-report/importData.vm</param>
+ <param name="menu">/dhis-web-vn-report/menuWithTree.vm</param>
+ <param name="menuTreeHeight">220</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/imports.js, javascript/export.js</param>
+ <param name="stylesheets">style/style.css</param>
+ </action>
+
+ <action name="importData" class="org.hisp.dhis.vn.imports.action.ImportDataAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-vn-report/responseSuccess.vm</result>
+ <result name="error" type="velocity-xml">
+ /dhis-web-vn-report/responseError.vm</result>
+ </action>
+
<action name="getExcelFileByOrganisationUnit"
class="org.hisp.dhis.vn.imports.action.GetListExcelFileByOrganisationAction">
<interceptor-ref name="organisationUnitTreeStack" />
@@ -378,15 +406,20 @@
<action name="uploadExcelFile"
class="org.hisp.dhis.vn.imports.action.UploadExcelFileAction">
- <result name="success" type="redirect">
- getExcelFileByOrganisationUnit.action</result>
+ <result name="success" type="chain">
+ getInformation</result>
<interceptor-ref name="fileUploadStack" />
</action>
<action name="deleteExcelFile"
class="org.hisp.dhis.vn.imports.action.DeleteExcelFileAction">
- <result name="success" type="redirect">
+ <!--
+ <result name="success" type="redirect">
getExcelFileByOrganisationUnit.action</result>
+ -->
+ <result name="success" type="velocity-xml">
+ /dhis-web-vn-report/dataelement/responseElementGroupsAndCombosList.vm
+ </result>
</action>
<action name="viewExcelFileDataValue"
=== added file 'local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/importData.vm'
--- local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/importData.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/importData.vm 2009-09-09 09:19:35 +0000
@@ -0,0 +1,50 @@
+<body>
+#if($!fileExcel)
+<div id="messageUpload"> $!message </div>
+ <span id="message" style="top:70px;right:5px;position:fixed;width:200px;z-index:100009" onclick="hideById(this.id);"></span>
+
+<!-- <input type="hidden" name="uploadFileName" id="uploadFileName" value="$!fileExcel">-->
+<input type="hidden" name="uploadFileName" id="uploadFileName" value="E:\data\Bieu 1 - TX.xls">
+ #end
+<h2>$!encoder.htmlEncode($!organisationUnit.name)</h2>
+<table width="50%">
+ <tr>
+ <form name="uploadfile" action="getInformation.action" method="post" enctype="multipart/form-data">
+ <td width="18%" style=" width:25% ">$i18n.getString( 'select_excel_file' )</td>
+ <td width="82%">
+ <input type="file" id="upload" name="upload" value="$!fileExcel;" >
+ <input name="submit" type="submit" value="$i18n.getString( 'upload_file' )" /> </td>
+ </form>
+ </tr>
+ <tr>
+ <td>$i18n.getString( 'template_excel_file' )</td>
+ <td><select type="text" id="reportId" name="reportId" style="min-width:20em; width:100%">
+ #foreach($reportExcel in $reportExcels)
+ <option value="$!reportExcel.id">$!encoder.htmlEncode($!reportExcel.name)</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( 'period' )</td>
+ <td>
+ <input type="button" value="<<" onclick="lastYear();" #if(!$organisationUnit) disabled #end/><input type="button" value=">>" #if(!$organisationUnit) disabled #end onclick="nextYear()"/>
+ <select name="periodId" id="periodId" style="min-width:20em; width:100%" type="text">
+ #foreach($period in $periods)
+ <option value='$period.id'>$format.formatPeriod( $period )</option>
+ #end
+
+ </select></td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+
+</table>
+<hr>
+<input type="button" name="import" id="import" onClick="javascript: importData();" value="$i18n.getString('import')">
+
+
+</body>
+
=== modified file 'local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/javascript/imports.js'
--- local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/javascript/imports.js 2009-09-01 11:25:50 +0000
+++ local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/javascript/imports.js 2009-09-09 09:19:35 +0000
@@ -1,5 +1,7 @@
function organisationUnitSelected( orgUnits ){
- window.location = "getExcelFileByOrganisationUnit.action";
+ //window.location = "getExcelFileByOrganisationUnit.action";
+ window.location = "getInformation.action";
+
}
selection.setListenerFunction( organisationUnitSelected );
@@ -70,4 +72,31 @@
var name = node.getElementsByTagName('name')[0].firstChild.nodeValue;
addOption('period', name, id);
}
-}
\ No newline at end of file
+}
+
+function importData(){
+
+ var reportId = document.getElementById('reportId').value;
+ var upload = document.getElementById('uploadFileName').value;
+ var periodId = document.getElementById('periodId').value;
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( Completed );
+ url = 'importData.action?reportId='+reportId;
+ url += '&uploadFileName='+ upload;
+ url += '&periodId='+ periodId;
+
+ request.send(url);
+}
+
+function Completed( xmlObject ){
+
+ if(document.getElementById('message') != null){
+ document.getElementById('message').style.display = 'block';
+ document.getElementById('message').innerHTML = xmlObject.firstChild.nodeValue;
+ }
+
+ //window.location.reload();
+
+}
=== modified file 'local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/menu.vm'
--- local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/menu.vm 2009-09-07 08:21:46 +0000
+++ local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/menu.vm 2009-09-09 09:19:35 +0000
@@ -5,7 +5,8 @@
<h2>$i18n.getString( "generate_report" )</h2>
<ul>
<li><a href="selectReportParamerter.action">$i18n.getString( "generate_report" ) </a></li>
- <li><a href="getExcelFileByOrganisationUnit.action">$i18n.getString( "import_excel_file_manager" ) </a></li>
+ <!-- <li><a href="getExcelFileByOrganisationUnit.action">$i18n.getString( "import_excel_file_manager" ) </a></li> -->
+ <li><a href="getInformation.action">$i18n.getString( "import_excel_file" ) </a></li>
<li><a href="selectDataSetCompletedReport.action">$i18n.getString( "dataset_completed_report" ) </a></li>
</ul>
=== added file 'local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/style/style.css'
--- local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/style/style.css 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-vn-report/src/main/webapp/dhis-web-vn-report/style/style.css 2009-09-09 09:19:35 +0000
@@ -0,0 +1,10 @@
+
+#messageUpload
+{
+ color: black;
+ padding: 5px;
+ background-color: #D5FFC5;
+ border: 1px solid black;
+ font-size: 14px;
+ text-align: right;
+}
\ No newline at end of file