dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20207
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9131: local vn - Fixed the org-unit-listing importing
------------------------------------------------------------
revno: 9131
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-27 11:26:35 +0700
message:
local vn - Fixed the org-unit-listing importing
modified:
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importitem/ImportReport.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ImportDataOrganizationGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ViewDataOrganizationGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/preview/action/XMLStructureResponseImport.java
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js
--
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 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importitem/ImportReport.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importitem/ImportReport.java 2012-03-29 10:05:35 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importitem/ImportReport.java 2012-11-27 04:26:35 +0000
@@ -214,7 +214,7 @@
return this.getType().equalsIgnoreCase( TYPE.CATEGORY );
}
- public boolean isOrganisationUnitGroupListing()
+ public boolean isOrgUnitGroupListing()
{
return this.getType().equalsIgnoreCase( TYPE.ORGANIZATION_GROUP_LISTING );
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java 2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java 2012-11-27 04:26:35 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.reportsheet.ExportReport;
import org.hisp.dhis.reportsheet.ExportReportService;
import org.hisp.dhis.reportsheet.ReportLocationManager;
@@ -147,24 +148,24 @@
if ( generateByDataSet )
{
DataSet dataSet = dataSetService.getDataSet( selectedDataSetId );
-
+
if ( dataSet == null )
{
message = i18n.getString( "specified_data_set_unavailable" );
return ERROR;
}
-
+
ExportReport exportReport = exportReportService.getExportReportByDataSet( dataSet );
-
+
if ( exportReport == null )
{
message = i18n.getString( "specified_data_set_unassign_to_export_report" );
- return ERROR;
+ return ERROR;
}
-
- exportReportIds[0] = exportReport.getId() + "_";
+
+ exportReportIds[0] = exportReport.getId() + "";
}
if ( exportReportIds == null || exportReportIds.length == 0 )
@@ -185,7 +186,7 @@
for ( String exportReportId : exportReportIds )
{
- Integer reportId = Integer.parseInt( exportReportId.split( "_" )[0] );
+ Integer reportId = Integer.parseInt( exportReportId );
ExportReport exportReport = exportReportService.getExportReport( reportId );
@@ -196,6 +197,16 @@
return ERROR;
}
+ File templateFile = new File( templateDirectory, exportReport.getExcelTemplateFile() );
+
+ if ( templateFile == null || !templateFile.exists() )
+ {
+ message = i18n.getString( "template_file_is_not_exist" );
+
+ return ERROR;
+ }
+
+ /** Validate for exportItems * */
// message = exportReportService.validateEmportItems( exportReport,
// i18n );
//
@@ -204,41 +215,39 @@
// return ERROR;
// }
- Period period = periodService.getPeriodByExternalId( periodIndex );
-
- for ( DataSet ds : exportReport.getDataSets() )
- {
- CalendarPeriodType periodType = (CalendarPeriodType) ds.getPeriodType();
-
- List<Period> periods = periodType.generatePeriods( period.getStartDate() );
- Collection<Period> persistedPeriods = periodService.getPeriodsByPeriodType( periodType );
-
- periods.retainAll( persistedPeriods );
-
- for ( Period p : periods )
- {
- for ( OrganisationUnit o : ds.getSources() )
- {
- if ( dataSetRegistrationService.getCompleteDataSetRegistration( ds, p, o ) == null )
- {
- message = i18n.getString( "org_unit_with_name" ) + " \"" + o.getDisplayName() + " \".";
- message += i18n.getString( "data_set_with_name" ) + " \"" + ds.getDisplayName() + "\" ";
- message += i18n.getString( "uncompleted" );
-
- return ERROR;
- }
- }
- }
- }
-
- File templateFile = new File( templateDirectory, exportReport.getExcelTemplateFile() );
-
- if ( templateFile == null || !templateFile.exists() )
- {
- message = i18n.getString( "template_file_is_not_exist" );
-
- return ERROR;
- }
+ /** Validate for whether data set completed or not * */
+ // Period period = PeriodType.createPeriodExternalId( periodIndex );
+ //
+ // for ( DataSet ds : exportReport.getDataSets() )
+ // {
+ // CalendarPeriodType periodType = (CalendarPeriodType)
+ // ds.getPeriodType();
+ //
+ // List<Period> periods = periodType.generatePeriods(
+ // period.getStartDate() );
+ // Collection<Period> persistedPeriods =
+ // periodService.getPeriodsByPeriodType( periodType );
+ //
+ // periods.retainAll( persistedPeriods );
+ //
+ // for ( Period p : periods )
+ // {
+ // for ( OrganisationUnit o : ds.getSources() )
+ // {
+ // if ( dataSetRegistrationService.getCompleteDataSetRegistration(
+ // ds, p, o ) == null )
+ // {
+ // message = i18n.getString( "org_unit_with_name" ) + " \"" +
+ // o.getDisplayName() + " \".";
+ // message += i18n.getString( "data_set_with_name" ) + " \"" +
+ // ds.getDisplayName() + "\" ";
+ // message += i18n.getString( "uncompleted" );
+ //
+ // return ERROR;
+ // }
+ // }
+ // }
+ // }
}
selectionManager.setSelectedPeriodIndex( periodIndex );
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ImportDataOrganizationGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ImportDataOrganizationGroupAction.java 2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ImportDataOrganizationGroupAction.java 2012-11-27 04:26:35 +0000
@@ -56,7 +56,7 @@
for ( int i = 0; i < importItemIds.length; i++ )
{
OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer.parseInt( importItemIds[i]
- .split( "-" )[0] ) );
+ .split( "_" )[0] ) );
addDataValue( o, period, importItemIds[i].split( "_" )[1], importItemIds[i].split( "_" )[2], oldDataValues,
newDataValues );
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ViewDataOrganizationGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ViewDataOrganizationGroupAction.java 2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/ViewDataOrganizationGroupAction.java 2012-11-27 04:26:35 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.reportsheet.importitem.ImportItem;
import org.hisp.dhis.reportsheet.importitem.ImportReport;
import org.hisp.dhis.reportsheet.preview.action.XMLStructureResponseImport;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Dang Duy Hieu
@@ -53,13 +54,9 @@
// Dependency
// -------------------------------------------------------------------------
+ @Autowired
private OrganisationUnitSelectionManager organisationUnitSelectionManager;
- public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
- {
- this.organisationUnitSelectionManager = organisationUnitSelectionManager;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -95,7 +92,7 @@
List<ImportItem> importItemsSource, List<ImportItem> importItemsDest )
{
int row = 0;
-
+
for ( OrganisationUnitGroup organisationUnitGroup : importReport.getOrganisationUnitGroups() )
{
List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( getOrganisationUnits(
@@ -103,8 +100,8 @@
Collections.sort( organisationUnits, new IdentifiableObjectNameComparator() );
- row ++;
-
+ row++;
+
for ( OrganisationUnit o : organisationUnits )
{
for ( ImportItem importItem : importItemsSource )
@@ -119,7 +116,7 @@
importItemsDest.add( item );
}
- row ++;
+ row++;
}
}
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/preview/action/XMLStructureResponseImport.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/preview/action/XMLStructureResponseImport.java 2012-07-12 10:18:47 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/preview/action/XMLStructureResponseImport.java 2012-11-27 04:26:35 +0000
@@ -43,7 +43,9 @@
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
+import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -249,14 +251,52 @@
private void readingDetailsFormattedCell( Sheet sheet, Cell objCell )
{
+ // The format information
CellStyle format = objCell.getCellStyle();
if ( format != null )
{
- xml.append( "<format align='" + convertAlignmentString( format.getAlignment() ) + "'" );
- xml.append( " width='" + sheet.getColumnWidth( objCell.getColumnIndex() ) + "'" );
- xml.append( " border='" + format.getBorderBottom() + format.getBorderLeft() + format.getBorderRight()
- + format.getBorderTop() + "'/>" );
- }
+ xml.append( "<format a='" + convertAlignmentString( format.getAlignment() ) + "'" );
+ xml.append( " b='"
+ + (format.getBorderBottom() + format.getBorderLeft() + format.getBorderRight() + format.getBorderTop())
+ + "'" );
+
+ Font font = WORKBOOK.getFontAt( format.getFontIndex() );
+
+ if ( font != null )
+ {
+ xml.append( "><font s='" + font.getFontHeightInPoints() + "'" );
+ xml.append( " b='" + (font.getBoldweight() == Font.BOLDWEIGHT_BOLD ? "1" : "0") + "'" );
+ xml.append( " i='" + font.getItalic() + "'" );
+ xml.append( " c='" + getSimilarColor( font.getColor() ) + "'" );
+ xml.append( "/>" );
+
+ xml.append( "</format>" );
+ }
+ else
+ {
+ xml.append( "/>" );
+ }
+ }
+ }
+
+ private String getSimilarColor( short index )
+ {
+ if ( IndexedColors.BLUE.getIndex() == index )
+ {
+ return "blue";
+ }
+
+ if ( IndexedColors.DARK_BLUE.getIndex() == index )
+ {
+ return "darkblue";
+ }
+
+ if ( IndexedColors.BROWN.getIndex() == index )
+ {
+ return "brown";
+ }
+
+ return "";
}
}
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-11-27 04:26:35 +0000
@@ -379,4 +379,5 @@
data_set_with_name = Data set
uncompleted = uncompleted
specified_data_set_unavailable = Selected data set is not exist
-specified_data_set_unassign_to_export_report = Selected data set is not assign to any Export report
\ No newline at end of file
+specified_data_set_unassign_to_export_report = Selected data set is not assign to any Export report
+data_value = data value
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-11-27 04:26:35 +0000
@@ -409,4 +409,5 @@
data_set_with_name = Bi\u1ec3u nh\u1eadp
uncompleted = ch\u01b0a ho\u00e0n t\u1ea5t
specified_data_set_unavailable = M\u1eabu b\u00e1o c\u00e1o n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i
-specified_data_set_unassign_to_export_report = M\u1eabu b\u00e1o c\u00e1o n\u00e0y ch\u01b0a \u0111\u01b0\u1ee3c g\u00e1n v\u00e0o b\u1ea5t k\u1ef3 bi\u1ec3u Xu\u1ea5t n\u00e0o
\ No newline at end of file
+specified_data_set_unassign_to_export_report = M\u1eabu b\u00e1o c\u00e1o n\u00e0y ch\u01b0a \u0111\u01b0\u1ee3c g\u00e1n v\u00e0o b\u1ea5t k\u1ef3 bi\u1ec3u Xu\u1ea5t n\u00e0o
+data_value = gi\u00e1 tr\u1ecb
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm 2012-04-25 05:39:27 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm 2012-11-27 04:26:35 +0000
@@ -57,6 +57,7 @@
var i18n_choose_import_item = '$encoder.jsEscape( $i18n.getString( "choose_import_item" ) , "'")';
var i18n_select_all = '$encoder.jsEscape( $i18n.getString( "select_all" ) , "'")';
var i18n_unselect_all = '$encoder.jsEscape( $i18n.getString( "unselect_all" ) , "'")';
+ var i18n_data_value = '$encoder.jsEscape( $i18n.getString( "data_value" ) , "'")';
#if ( $!fileExcel && $!organisationUnit )
getPeriodsByImportReport( jQuery("#importReportId").val() );
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2012-11-13 07:04:37 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2012-11-27 04:26:35 +0000
@@ -79,6 +79,8 @@
function reportSelected( _periodType )
{
+ setFieldValue( 'selectedPeriodId2', "" );
+
if ( _periodType )
{
currentPeriodTypeName = _periodType;
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js 2012-04-26 06:08:03 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js 2012-11-27 04:26:35 +0000
@@ -26,7 +26,13 @@
periodId: byId('period').value
}, function( json ) {
unLockScreen();
- showSuccessMessage( json.message );
+
+ if ( json.response == "success" )
+ {
+ showSuccessMessage( json.message + " " + importItemIds.length + " " + i18n_data_value, 5000 );
+ } else {
+ showErrorMessage( json.message, 5000 );
+ }
});
}
else showWarningMessage( i18n_choose_import_item );
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js 2012-11-13 07:04:37 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js 2012-11-27 04:26:35 +0000
@@ -83,12 +83,19 @@
function previewExportReport()
{
- jQuery.get( "previewExportReport.action", { showSubItem: !isChecked( 'showSubItem' ) }, previewExportReportReceived );
+ jQuery.get( "previewExportReport.action",
+ {
+ showSubItem: !isChecked( 'showSubItem' ),
+ generateByDefault: getFieldValue( 'generateByDefault' )
+ }, previewExportReportReceived );
}
function previewAdvandReport()
{
- jQuery.get( "previewAdvancedExportReport.action", { organisationGroupId: getFieldValue( 'availableOrgunitGroups' ) }, previewExportReportReceived );
+ jQuery.get( "previewAdvancedExportReport.action",
+ {
+ organisationGroupId: getFieldValue( 'availableOrgunitGroups' )
+ }, previewExportReportReceived );
}
function previewExportReportReceived( parentElement )