dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13125
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4152: local vn
------------------------------------------------------------
revno: 4152
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-07-18 13:50:24 +0700
message:
local vn
- Fixed bug NPE when copy the export item to import report.
- Renamed stuff.
removed:
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/CopyImportItemAction.java
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItem.js
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js
added:
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToExportReportAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToImportReportAction.java
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItems.js
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/import.js
modified:
local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/importItems.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
=== removed file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemAction.java 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemAction.java 1970-01-01 00:00:00 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.hisp.dhis.reportexcel.exportitem.action;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.amplecode.quick.StatementManager;
-import org.hisp.dhis.reportexcel.ExportReportService;
-import org.hisp.dhis.reportexcel.ReportExcel;
-import org.hisp.dhis.reportexcel.ReportExcelItem;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Tran Thanh Tri
- * @version $Id$
- */
-
-public class CopyExportItemAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependency
- // -------------------------------------------------------------------------
-
- private ExportReportService exportReportService;
-
- private StatementManager statementManager;
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer exportReportId;
-
- private Integer sheetNo;
-
- private List<String> exportItems = new ArrayList<String>();
-
- // -------------------------------------------------------------------------
- // Getter & Setter
- // -------------------------------------------------------------------------
-
- public void setExportReportService( ExportReportService exportReportService )
- {
- this.exportReportService = exportReportService;
- }
-
- public void setStatementManager( StatementManager statementManager )
- {
- this.statementManager = statementManager;
- }
-
- public Integer getExportReportId()
- {
- return exportReportId;
- }
-
- public Integer getSheetNo()
- {
- return sheetNo;
- }
-
- public void setExportReportId( Integer exportReportId )
- {
- this.exportReportId = exportReportId;
- }
-
- public void setExportItems( List<String> exportItems )
- {
- this.exportItems = exportItems;
- }
-
- public void setSheetNo( Integer sheetNo )
- {
- this.sheetNo = sheetNo;
- }
-
- public String execute()
- throws Exception
- {
- statementManager.initialise();
-
- ReportExcel exportReport = exportReportService.getExportReport( exportReportId );
-
- for ( String itemId : this.exportItems )
- {
- ReportExcelItem reportItem = exportReportService.getExportItem( Integer.parseInt( itemId ) );
-
- ReportExcelItem newReportItem = new ReportExcelItem();
- newReportItem.setName( reportItem.getName() );
- newReportItem.setItemType( reportItem.getItemType() );
- newReportItem.setPeriodType( reportItem.getPeriodType() );
- newReportItem.setExpression( reportItem.getExpression() );
- newReportItem.setRow( reportItem.getRow() );
- newReportItem.setColumn( reportItem.getColumn() );
- newReportItem.setSheetNo( sheetNo );
- newReportItem.setReportExcel( exportReport );
- exportReportService.addExportItem( newReportItem );
- }
-
- statementManager.destroy();
-
- return SUCCESS;
- }
-}
=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToExportReportAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToExportReportAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToExportReportAction.java 2011-07-18 06:50:24 +0000
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.reportexcel.exportitem.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.amplecode.quick.StatementManager;
+import org.hisp.dhis.reportexcel.ExportReportService;
+import org.hisp.dhis.reportexcel.ReportExcel;
+import org.hisp.dhis.reportexcel.ReportExcelItem;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Tran Thanh Tri
+ * @version $Id$
+ */
+
+public class CopyExportItemToExportReportAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private ExportReportService exportReportService;
+
+ private StatementManager statementManager;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer exportReportId;
+
+ private Integer sheetNo;
+
+ private List<String> exportItems = new ArrayList<String>();
+
+ // -------------------------------------------------------------------------
+ // Getter & Setter
+ // -------------------------------------------------------------------------
+
+ public void setExportReportService( ExportReportService exportReportService )
+ {
+ this.exportReportService = exportReportService;
+ }
+
+ public void setStatementManager( StatementManager statementManager )
+ {
+ this.statementManager = statementManager;
+ }
+
+ public Integer getExportReportId()
+ {
+ return exportReportId;
+ }
+
+ public Integer getSheetNo()
+ {
+ return sheetNo;
+ }
+
+ public void setExportReportId( Integer exportReportId )
+ {
+ this.exportReportId = exportReportId;
+ }
+
+ public void setExportItems( List<String> exportItems )
+ {
+ this.exportItems = exportItems;
+ }
+
+ public void setSheetNo( Integer sheetNo )
+ {
+ this.sheetNo = sheetNo;
+ }
+
+ public String execute()
+ throws Exception
+ {
+ statementManager.initialise();
+
+ ReportExcel exportReport = exportReportService.getExportReport( exportReportId );
+
+ for ( String itemId : this.exportItems )
+ {
+ ReportExcelItem reportItem = exportReportService.getExportItem( Integer.parseInt( itemId ) );
+
+ ReportExcelItem newReportItem = new ReportExcelItem();
+ newReportItem.setName( reportItem.getName() );
+ newReportItem.setItemType( reportItem.getItemType() );
+ newReportItem.setPeriodType( reportItem.getPeriodType() );
+ newReportItem.setExpression( reportItem.getExpression() );
+ newReportItem.setRow( reportItem.getRow() );
+ newReportItem.setColumn( reportItem.getColumn() );
+ newReportItem.setSheetNo( sheetNo );
+ newReportItem.setReportExcel( exportReport );
+ exportReportService.addExportItem( newReportItem );
+ }
+
+ statementManager.destroy();
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToImportReportAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToImportReportAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportitem/action/CopyExportItemToImportReportAction.java 2011-07-18 06:50:24 +0000
@@ -0,0 +1,142 @@
+package org.hisp.dhis.reportexcel.exportitem.action;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Collection;
+
+import org.amplecode.quick.StatementManager;
+import org.hisp.dhis.reportexcel.ExportReportService;
+import org.hisp.dhis.reportexcel.ReportExcelItem;
+import org.hisp.dhis.reportexcel.importitem.ExcelItem;
+import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+
+public class CopyExportItemToImportReportAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private ExportReportService exportReportService;
+
+ public void setExportReportService( ExportReportService exportReportService )
+ {
+ this.exportReportService = exportReportService;
+ }
+
+ private ImportItemService importItemService;
+
+ public void setImportItemService( ImportItemService importItemService )
+ {
+ this.importItemService = importItemService;
+ }
+
+ private StatementManager statementManager;
+
+ public void setStatementManager( StatementManager statementManager )
+ {
+ this.statementManager = statementManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer importReportId;
+
+ private Integer sheetNo;
+
+ private Collection<String> exportItemIds;
+
+ // -------------------------------------------------------------------------
+ // Getter & Setter
+ // -------------------------------------------------------------------------
+
+ public void setImportReportId( Integer importReportId )
+ {
+ this.importReportId = importReportId;
+ }
+
+ public Integer getSheetNo()
+ {
+ return sheetNo;
+ }
+
+ public void setExportItemIds( Collection<String> exportItemIds )
+ {
+ this.exportItemIds = exportItemIds;
+ }
+
+ public void setSheetNo( Integer sheetNo )
+ {
+ this.sheetNo = sheetNo;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ statementManager.initialise();
+
+ ExcelItemGroup importReport = importItemService.getImportReport( importReportId );
+
+ for ( String itemId : exportItemIds )
+ {
+ ReportExcelItem itemSource = exportReportService.getExportItem( Integer.parseInt( itemId ) );
+
+ ExcelItem importItem = new ExcelItem();
+
+ importItem.setName( itemSource.getName() );
+ importItem.setRow( itemSource.getRow() );
+ importItem.setColumn( itemSource.getColumn() );
+ importItem.setExpression( itemSource.getExpression() );
+ importItem.setSheetNo( sheetNo );
+ importItem.setExcelItemGroup( importItemService.getImportReport( importReportId ) );
+
+ importItemService.addImportItem( importItem );
+ }
+
+ importItemService.updateImportReport( importReport );
+
+ statementManager.destroy();
+
+ return SUCCESS;
+ }
+
+}
=== removed file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/CopyImportItemAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/CopyImportItemAction.java 2011-05-26 04:53:43 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/CopyImportItemAction.java 1970-01-01 00:00:00 +0000
@@ -1,142 +0,0 @@
-package org.hisp.dhis.reportexcel.importitem.action;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-
-import org.amplecode.quick.StatementManager;
-import org.hisp.dhis.reportexcel.ExportReportService;
-import org.hisp.dhis.reportexcel.ReportExcelItem;
-import org.hisp.dhis.reportexcel.importitem.ExcelItem;
-import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
-import org.hisp.dhis.reportexcel.importitem.ImportItemService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
-
-public class CopyImportItemAction
- implements Action
-{
- // -------------------------------------------
- // Dependency
- // -------------------------------------------
-
- private ExportReportService exportReportService;
-
- public void setExportReportService( ExportReportService exportReportService )
- {
- this.exportReportService = exportReportService;
- }
-
- private ImportItemService importItemService;
-
- public void setImportItemService( ImportItemService importItemService )
- {
- this.importItemService = importItemService;
- }
-
- private StatementManager statementManager;
-
- public void setStatementManager( StatementManager statementManager )
- {
- this.statementManager = statementManager;
- }
-
- // -------------------------------------------
- // Input
- // -------------------------------------------
-
- private Integer importReportId;
-
- private Integer sheetNo;
-
- private Collection<String> reportItemIds;
-
- // -------------------------------------------
- // Getter & Setter
- // -------------------------------------------
-
- public void setImportReportId( Integer importReportId )
- {
- this.importReportId = importReportId;
- }
-
- public Integer getSheetNo()
- {
- return sheetNo;
- }
-
- public void setReportItemIds( Collection<String> reportItemIds )
- {
- this.reportItemIds = reportItemIds;
- }
-
- public void setSheetNo( Integer sheetNo )
- {
- this.sheetNo = sheetNo;
- }
-
- // -------------------------------------------
- // Action implementation
- // -------------------------------------------
-
- public String execute()
- throws Exception
- {
- statementManager.initialise();
-
- ExcelItemGroup importReport = importItemService.getImportReport( importReportId );
-
- for ( String itemId : reportItemIds )
- {
- ReportExcelItem itemSource = exportReportService.getExportItem( Integer.parseInt( itemId ) );
-
- ExcelItem importItem = new ExcelItem();
-
- importItem.setName( itemSource.getName() );
- importItem.setRow( itemSource.getRow() );
- importItem.setColumn( itemSource.getColumn() );
- importItem.setExpression( itemSource.getExpression() );
- importItem.setSheetNo( sheetNo );
- importItem.setExcelItemGroup( importItemService.getImportReport( importReportId ) );
-
- importItemService.addImportItem( importItem );
- }
-
- importItemService.updateImportReport( importReport );
-
- statementManager.destroy();
-
- return SUCCESS;
- }
-
-}
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-07-08 07:52:59 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-07-18 06:50:24 +0000
@@ -299,7 +299,7 @@
ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</bean>
- <!-- REPORT EXCEL ITEM BEAN -->
+ <!-- EXPORT ITEM BEAN -->
<bean id="org.hisp.dhis.reportexcel.exportitem.action.ListExportItemAction"
class="org.hisp.dhis.reportexcel.exportitem.action.ListExportItemAction"
@@ -378,9 +378,18 @@
<property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
</bean>
- <bean id="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemAction"
- class="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemAction"
- scope="prototype">
+ <bean id="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemToExportReportAction"
+ class="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemToExportReportAction"
+ scope="prototype">
+ <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="statementManager" ref="statementManager" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemToImportReportAction"
+ class="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemToImportReportAction"
+ scope="prototype">
+ <property name="importItemService"
+ ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
<property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
<property name="statementManager" ref="statementManager" />
</bean>
@@ -855,7 +864,7 @@
</bean>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- EXCEL ITEM GROUP -->
+ <!-- IMPORT REPORT -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<bean
@@ -1111,15 +1120,6 @@
ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
- <bean id="org.hisp.dhis.reportexcel.importitem.action.CopyImportItemAction"
- class="org.hisp.dhis.reportexcel.importitem.action.CopyImportItemAction"
- scope="prototype">
- <property name="importItemService"
- ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
- <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
- <property name="statementManager" ref="statementManager" />
- </bean>
-
<!-- IMPORT DATA -->
<!-- GUI - Import param form -->
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml 2011-07-08 07:52:59 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml 2011-07-18 06:50:24 +0000
@@ -301,7 +301,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-excel-reporting/report/exportItems.vm</param>
<param name="menu">/dhis-web-excel-reporting/menu.vm</param>
- <param name="javascripts">javascript/exportItem.js</param>
+ <param name="javascripts">javascript/exportItems.js</param>
<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
</action>
@@ -327,7 +327,7 @@
class="org.hisp.dhis.reportexcel.exportitem.action.SetupExportItemFormAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-excel-reporting/report/addExportItemForm.vm</param>
- <param name="javascripts">javascript/exportItem.js</param>
+ <param name="javascripts">javascript/exportItems.js</param>
<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
</action>
@@ -343,7 +343,7 @@
class="org.hisp.dhis.reportexcel.exportitem.action.SetupExportItemFormAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-excel-reporting/report/updateExportItemForm.vm</param>
- <param name="javascripts">javascript/exportItem.js</param>
+ <param name="javascripts">javascript/exportItems.js</param>
<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
</action>
@@ -393,20 +393,20 @@
/dhis-web-excel-reporting/report/responseExportItems.vm</result>
</action>
- <action name="copyExportItems"
- class="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
- <param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
- </action>
-
- <action name="copyImportItemsToImportReport"
- class="org.hisp.dhis.reportexcel.importitem.action.CopyImportItemToImportReportAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
- <param name="requiredAuthorities">F_COPY_IMPORT_ITEM_ADMINISTRATION</param>
- </action>
-
+ <action name="copyExportItemToExportReport"
+ class="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemToExportReportAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+ </action>
+
+ <action name="copyExportItemToImportReport"
+ class="org.hisp.dhis.reportexcel.exportitem.action.CopyExportItemToImportReportAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+ </action>
+
<action name="getListSheet"
class="org.hisp.dhis.reportexcel.exportitem.action.GetListSheetAction">
<result name="success" type="velocity-xml">
@@ -989,11 +989,12 @@
/dhis-web-excel-reporting/import/responseImportItems.vm
</result>
</action>
-
- <action name="copyImportItems"
- class="org.hisp.dhis.reportexcel.importitem.action.CopyImportItemAction">
- <result name="success" type="velocity-json">
- /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+
+ <action name="copyImportItemToImportReport"
+ class="org.hisp.dhis.reportexcel.importitem.action.CopyImportItemToImportReportAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_COPY_IMPORT_ITEM_ADMINISTRATION</param>
</action>
<!-- IMPORT DATA -->
@@ -1031,7 +1032,7 @@
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,
javascript/export.js,
javascript/preview.js,
- javascript/imports.js</param>
+ javascript/import.js</param>
<param name="stylesheets">
style/style.css,
style/previewStyle.css</param>
=== removed file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItem.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItem.js 2011-07-08 07:52:59 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItem.js 1970-01-01 00:00:00 +0000
@@ -1,759 +0,0 @@
-// ---------------------------------------------------------------------------
-// Dialog
-// ---------------------------------------------------------------------------
-
-function setUpDialog( elementId, title, width, height )
-{
- var dialog = jQuery( '#'+elementId ).dialog({
- title: title,
- modal: true,
- autoOpen: false,
- minWidth: width,
- minHeight: height,
- width: width,
- height: height
- });
-
- return dialog;
-}
-
-function openDialog( _dialog )
-{
- _dialog.dialog( 'open' );
-}
-
-function closeDialog( _dialog )
-{
- _dialog.dialog( 'close' );
-}
-
-// ---------------------------------------------------------------------------------
-// Methods
-// ---------------------------------------------------------------------------------
-
-function changeItemType()
-{
- value = getFieldValue( 'itemType' );
- enable( 'expression-button' );
-
- setFieldValue( 'exportItem input[id=expression]', getFieldValue( 'exportItem input[id=currentExpression]') );
-
- if( value == 'dataelement' ){
- byId('expression-button' ).onclick = deExpressionBuilderForm;
- }else if( value == 'indicator' ){
- byId('expression-button' ).onclick = inExpressionBuilderForm ;
- }else if( value == 'formulaexcel' ){
- byId('expression-button' ).onclick = excelFormulaExpressionBuilderForm ;
- }else if( value == 'organisation' || value == 'serial' || value == 'dataelement_code' || value == 'dataelement_name' ){
- disable( 'expression-button' );
- setFieldValue( 'exportItem input[id=expression]', value );
- removeValidatorRulesById( 'exportItem input[id=expression]' );
- removeValidatorRulesById( 'dataelement textarea[id=formula]' );
- }
-}
-
-function insertOperation( value ) {
- byId('formula').value += value;
-}
-
-function cleanFormula()
-{
- setFieldValue( 'formula','');
- setInnerHTML( 'expression-description', '');
-}
-
-function insertExpression()
-{
- if( category ) var expression = "[*." + getFieldValue("elementSelect")+ "]";
- else var expression = getFieldValue("elementSelect");
- setFieldValue( 'formula', getFieldValue( 'formula') + expression );
-
- getExpression();
-}
-
-function getExpression()
-{
- jQuery.postJSON( '../dhis-web-commons-ajax-json/getExpressionText.action',
- { expression: getFieldValue('formula')}, function( json ){
- if(json.response == 'success'){
- setInnerHTML( 'expression-description', json.message );
- }
- });
-}
-
-function validateAddExportItem( form )
-{
- jQuery.postJSON('validationExportItem.action',
- {
- exportReportId: getFieldValue( 'exportReportId' ),
- name: getFieldValue( 'name' ),
- sheetNo: getFieldValue( 'sheetNo' ),
- row: getFieldValue( 'row' ),
- column: getFieldValue( 'column' )
-
- },function( json ){
- if(json.response == 'success'){
- form.submit();
- }else{
- showErrorMessage( json.message );
- }
- });
-}
-
-function validateUpdateExportItem( form )
-{
- jQuery.postJSON('validationExportItem.action',
- {
- id: getFieldValue( 'id' ),
- exportReportId: getFieldValue( 'exportReportId' ),
- name: getFieldValue( 'name' ),
- sheetNo: getFieldValue( 'sheetNo' ),
- row: getFieldValue( 'row' ),
- column: getFieldValue( 'column' )
-
- },function( json ){
- if(json.response == 'success'){
- form.submit();
- }else{
- showErrorMessage( json.message );
- }
- });
-}
-
-/*
-* Delete multi export item
-*/
-
-function deleteMultiExportItem( confirm )
-{
- if ( window.confirm( confirm ) )
- {
- var listRadio = document.getElementsByName( 'exportItemCheck' );
- var url = "deleteMultiExportItem.action?";
- var j = 0;
-
- for( var i=0; i < listRadio.length; i++ )
- {
- var item = listRadio.item(i);
-
- if( item.checked == true )
- {
- url += "ids=" + item.getAttribute( 'exportItemID' );
- url += (i < listRadio.length-1) ? "&" : "";
- j++;
- }
- }
-
- if( j>0 )
- {
- $.getJSON(
- url, {}, function( json )
- {
- if ( json.response == "success" )
- {
- window.location.reload();
- }
- else if ( json.response == "error" )
- {
- setMessage( json.message );
- }
- }
- );
- }
- }
-}
-
-/**
-* COPY EXPORT_ITEM(s) TO ANOTHER EXPORT_REPORT
-*/
-function copySelectedExportItemToExportReport() {
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( copySelectedExportItemToExportReportReceived );
- request.send( "getAllExportReports.action" );
-}
-
-function copySelectedExportItemToExportReportReceived( xmlObject ) {
-
- var exportReports = xmlObject.getElementsByTagName("exportReport");
- var selectList = document.getElementById("targetExportReport");
- var options = selectList.options;
-
- options.length = 0;
-
- for( var i = 0 ; i < exportReports.length ; i++ ) {
-
- var id = exportReports[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var name = exportReports[i].getElementsByTagName("name")[0].firstChild.nodeValue;
- options.add(new Option(name,id), null);
- }
-
- openDialog( dialog1 );
-}
-
-
-/*
-* Validate Copy Export Items to another Export Report
-*/
-
-sheetId = 0;
-NumberOfItemsChecked = 0;
-ItemsSaved = null;
-itemsCurTarget = null;
-itemsDuplicated = null;
-warningMessages = "";
-
-function validateCopyExportItemsToExportReport() {
-
- sheetId = $( "#targetSheetNo" ).val();
-
- var message = '';
-
- if ( sheetId < 1 ) {
-
- message = i18n_input_sheet_no;
- }
-
- if ( byId("targetExportReport").value == -1 )
- {
- message += "<br/>"+ i18n_choose_export_report;
- }
-
- if ( message.length > 0 )
- {
- setMessage( message );
- return;
- }
-
- itemsCurTarget = null;
- itemsDuplicated = null;
-
- itemsCurTarget = new Array();
- itemsDuplicated = new Array();
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( validateCopyExportItemsToExportReportReceived );
-
- var param = "exportReportId=" + byId("targetExportReport").value;
- param += "&sheetNo=" + sheetId;
-
- request.sendAsPost( param );
- request.send( "getExportItemsBySheet.action" );
-
-}
-
-function validateCopyExportItemsToExportReportReceived( data ) {
-
- var items = data.getElementsByTagName('exportItem');
-
- for (var i = 0 ; i < items.length ; i ++)
- {
- itemsCurTarget.push(items[i].getElementsByTagName('name')[0].firstChild.nodeValue);
- }
-
- splitDuplicatedItems( 'exportItemCheck', 'exportItemID', 'exportItemName' );
- saveCopyExportItemsToExportReport();
-}
-
-function splitDuplicatedItems( itemCheckID, itemIDAttribute, itemNameAttribute ) {
-
- var flag = -1;
- var itemsChecked = new Array();
- var listRadio = document.getElementsByName( itemCheckID );
-
- ItemsSaved = null;
- ItemsSaved = new Array();
-
- for (var i = 0 ; i < listRadio.length ; i++) {
-
- if ( listRadio.item(i).checked ) {
- itemsChecked.push( listRadio.item(i).getAttribute(itemIDAttribute) + "#" + listRadio.item(i).getAttribute(itemNameAttribute));
- }
- }
-
- NumberOfItemsChecked = itemsChecked.length;
-
- for (var i in itemsChecked)
- {
- flag = i;
-
- for (var j in itemsCurTarget)
- {
- if ( itemsChecked[i].split("#")[1] == itemsCurTarget[j] )
- {
- flag = -1;
- itemsDuplicated.push( itemsChecked[i].split("#")[1] );
- break;
- }
- }
- if ( flag >= 0 )
- {
- ItemsSaved.push( itemsChecked[i].split("#")[0] );
- }
- }
-}
-
-function saveCopyExportItemsToExportReport() {
-
- warningMessages = " ======= Sheet [" + sheetId + "] ========";
-
- // If have ExportItem(s) in Duplicating list
- // Preparing the warning message
- if ( itemsDuplicated.length > 0 )
- {
- setUpDuplicatedItemsMessage();
- }
-
- // If have also ExportItem(s) in Copying list
- // Do copy and prepare the message notes
- if ( ItemsSaved.length > 0 )
- {
- var url = "copyExportItems.action";
- url += "?exportReportId=" + $("#targetExportReport").val();
- url += "&sheetNo=" + sheetId;
-
- for (var i in ItemsSaved)
- {
- url += "&exportItems=" + ItemsSaved[i];
- }
-
- executeCopyItems( url );
- }
- // If have no any ExportItem(s) will be copied
- // and also have ExportItem(s) in Duplicating list
- else if ( itemsDuplicated.length > 0 )
- {
- setMessage( warningMessages );
- }
-
- closeDialog( dialog1 );
-}
-
-
-/**
-* COPY SELECTED EXPORT_ITEM(s) TO IMPORT_REPORT
-*/
-
-function copySelectedExportItemToImportReport() {
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( copySelectedExportItemToImportReportReceived );
- request.send( "getAllImportReport.action" );
-}
-
-function copySelectedExportItemToImportReportReceived( xmlObject ) {
-
- var groups = xmlObject.getElementsByTagName("importReport");
- var selectList = document.getElementById("targetImportReport");
- var options = selectList.options;
-
- options.length = 0;
-
- for( var i = 0 ; i < groups.length ; i++ ) {
-
- var id = groups[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var name = groups[i].getElementsByTagName("name")[0].firstChild.nodeValue;
- options.add(new Option(name,id), null);
- }
-
- openDialog( dialog2 );
-}
-
-/*
-* Validate copy Export Items to Import Report
-*/
-
-function validateCopyExportItemsToImportReport() {
-
- sheetId = $("#targetImportReportSheetNo").val();
-
- var message = '';
-
- if ( sheetId < 1 )
- {
- message = i18n_input_sheet_no;
- }
-
- if ( byId("targetImportReport").value == -1 )
- {
- message += "<br/>" + i18n_choose_import_report;
- }
-
- if ( message.length > 0 )
- {
- setMessage( message );
- return;
- }
-
- itemsCurTarget = null;
- itemsDuplicated = null;
-
- itemsCurTarget = new Array();
- itemsDuplicated = new Array();
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( validateCopyExportItemsToImportReportReceived );
- request.send( "getImportItemsByGroup.action?importReportId=" + byId("targetImportReport").value );
-
-}
-
-function validateCopyExportItemsToImportReportReceived( xmlObject ) {
-
- var items = xmlObject.getElementsByTagName('importItem');
-
- for (var i = 0 ; i < items.length ; i ++) {
-
- itemsCurTarget.push(items[i].getElementsByTagName('name')[0].firstChild.nodeValue);
- }
-
- splitDuplicatedItems( 'exportItemCheck', 'exportItemID', 'exportItemName' );
-
- saveCopiedExportItemsToImportReport();
-}
-
-function saveCopiedExportItemsToImportReport() {
-
- warningMessages = " ======= Sheet [" + sheetId + "] ========";
-
- // If have ExportItem(s) in Duplicating list
- // preparing the warning message
- if ( itemsDuplicated.length > 0 )
- {
- setUpDuplicatedItemsMessage();
- }
-
- // If have also ExportItem(s) in Copying list
- // do copy and prepare the message notes
- if ( ItemsSaved.length > 0 )
- {
- var url = "copyImportItems.action";
- url += "?importReportId=" + $("#targetImportReport").val();
- url += "&sheetNo=" + sheetId;
-
- for (var i in ItemsSaved)
- {
- url += "&exportItemIds=" + ItemsSaved[i];
- }
-
- executeCopyItems( url );
- }
- // If have no any ExportItem(s) will be copied
- // and also have ExportItem(s) in Duplicating list
- else if ( itemsDuplicated.length > 0 )
- {
- setMessage( warningMessages );
- }
-
- closeDialog( dialog2 );
-}
-
-function setUpDuplicatedItemsMessage()
-{
- warningMessages +=
- "<br/><b>[" + (itemsDuplicated.length) + "/" + (NumberOfItemsChecked) + "]</b>:: "
- + i18n_copy_items_duplicated
- + "<br/><br/>";
-
- for (var i in itemsDuplicated)
- {
- warningMessages +=
- "<b>(*)</b> "
- + itemsDuplicated[i]
- + "<br/><br/>";
- }
-
- warningMessages += "<br/>";
-}
-
-function executeCopyItems( url )
-{
- $.postJSON(
- url, {}, function ( json )
- {
- if ( json.response == "success" )
- {
- warningMessages +=
- "<br/><b>[" + (ItemsSaved.length) + "/" + (NumberOfItemsChecked) + "]</b>:: "
- + i18n_copy_successful
- + "<br/>======================<br/><br/>";
- }
-
- setMessage( warningMessages );
- }
- );
-}
-
-/**
-* Open dataelement expression
-*/
-function openDataElementExpression() {
-
- byId( "formula" ).value = byId( "expression" ).value;
-
- getALLDataElementGroup();
- getDataElementsByGroup();
- enable("dataElementGroup");
- enable("availableDataElements");
- byId("availableDataElements").onchange = function(e){ getOptionCombos() };
- if(mode=='update'){
- updateFormulaText( 'formula' );
- }
-
- $("#normal").showAtCenter( true );
-}
-
-/**
-* Get All dataelement group
-*/
-
-function getALLDataElementGroup() {
-
- var list = byId('dataElementGroup');
-
- list.options.length = 0;
- list.add( new Option( "ALL", "ALL" ), null );
-
- for ( id in dataElementGroups )
- {
- list.add( new Option( dataElementGroups[id], id ), null );
- }
-}
-
-/**
-* Get DataElements By Group
-*/
-
-function getDataElementsByGroup( )
-{
- var dataElementGroupId = $("#dataElementGroup").val();
- var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + $("#dataElementGroup").val();
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( getDataElementsByGroupCompleted );
- request.send( url );
-}
-
-function getDataElementsByGroupCompleted( xmlObject ){
-
- var dataElementList = byId( "availableDataElements" );
-
- dataElementList.options.length = 0;
-
- var dataelements = xmlObject.getElementsByTagName( "dataElement" );
-
- for ( var i = 0; i < dataelements.length; i++)
- {
- var id = dataelements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
- var elementName = dataelements[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-
- var option = new Option( elementName, id );
- option.onmousemove = function(e){
- showToolTip( e, this.text);
- }
- dataElementList.add( option, null );
- }
-}
-
-
-/**
-* Indicator Export item type
-*/
-function openIndicatorExpression() {
-
- byId("formulaIndicator").value = byId("expression").value;
-
- getIndicatorGroups();
- filterIndicators();
- enable("indicatorGroups");
- enable("availableIndicators");
- setPositionCenter( 'indicatorForm' );
-
- $("#indicatorForm").show();
-}
-
-function getIndicatorGroups() {
-
- var list = byId('indicatorGroups');
-
- list.options.length = 0;
- list.add( new Option( "ALL", "ALL" ), null );
-
- var formula = byId("formulaIndicator").value;
- for ( id in indicatorGroups )
- {
- list.add( new Option( indicatorGroups[id], id ), null );
- }
-}
-
-function filterIndicators() {
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( filterIndicatorsCompleted );
- request.send( "../dhis-web-commons-ajax/getIndicators.action?id=" + $("#indicatorGroups").val());
-}
-
-function filterIndicatorsCompleted( xmlObject ) {
-
- var indiatorList = byId( "availableIndicators" );
- indiatorList.options.length = 0;
-
- var indicators = xmlObject.getElementsByTagName( "indicator" );
-
- for ( var i = 0; i < indicators.length; i++ )
- {
- var id = indicators[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
- var indicatorName = indicators[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
- var option = document.createElement( "option" );
-
- option.value = "[" + id + "]";
- option.text = indicatorName;
- indiatorList.add( option, null );
-
- var formula = byId('formulaIndicator').value;
- if(formula==option.value){
- option.selected = true;
- byId("formulaIndicatorDiv").innerHTML = indicatorName;
- }
- }
-}
-
-/**
-* Open Category Expression
-*/
-function openCategoryExpression() {
-
- byId("categoryFormula").value = byId("expression").value;
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( openCategoryExpressionReceived );
- request.send("getExportReport.action?id=" + exportReportId);
-
-}
-
-function openCategoryExpressionReceived( data ) {
-
- var selectedDataElementGroups = document.getElementById('dataElementGroup_');
- selectedDataElementGroups.options.length = 0;
- var dataElementGroups = data.getElementsByTagName('dataElementGroup');
-
- for( var i = 0 ; i < dataElementGroups.length ; i++ ) {
-
- var id = dataElementGroups.item(i).getElementsByTagName('id')[0].firstChild.nodeValue;
- var name = dataElementGroups.item(i).getElementsByTagName('name')[0].firstChild.nodeValue;
- //selectedDataElementGroups.options.add(new Option(name, id));
-
- var option = new Option( name, id );
- option.onmousemove = function(e){
- showToolTip( e, this.text);
- }
- selectedDataElementGroups.add(option, null);
- }
-
- getDataElementGroupOrder();
- setPositionCenter( 'category' );
- enable( "dataElementGroup_" );
- enable( "availableDataElements_" );
- byId( "availableDataElements_" ).onchange = function(e){ getOptionCombos_() };
-
- $( "#category" ).show();
-}
-
-
-/**
-* Get DataElement Group Order
-*/
-
-function getDataElementGroupOrder() {
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( getDataElementGroupOrderReceived );
- request.send( "getDataElementGroupOrder.action?id=" + $("#dataElementGroup_").val() );
-
-}
-
-function getDataElementGroupOrderReceived( data ) {
-
- var availableDataElements = byId('availableDataElements_');
- availableDataElements.options.length = 0;
- var dataelEments = data.getElementsByTagName( "dataElement" );
-
- for ( var i = 0; i < dataelEments.length; i++ )
- {
- var id = dataelEments[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
- var name = dataelEments[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
- //availableDataElements.options.add(new Option(name, id));
- var option = new Option( name, id );
- option.onmousemove = function(e){
- showToolTip( e, this.text);
- }
- availableDataElements.add(option, null);
- }
-}
-
-function getOptionCombos_() {
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( getOptionCombos_Received );
- request.send( "getOptionCombos.action?dataElementId=" + byId("availableDataElements_").value );
-
-}
-
-function getOptionCombos_Received( xmlObject ) {
-
- xmlObject = xmlObject.getElementsByTagName('categoryOptions')[0];
-
- var optionComboList = byId( "optionCombos_" );
- optionComboList.options.length = 0;
- var optionCombos = xmlObject.getElementsByTagName( "categoryOption" );
-
- for ( var i = 0; i < optionCombos.length; i++ )
- {
- var id = optionCombos[ i ].getAttribute('id');
- var name = optionCombos[ i ].firstChild.nodeValue;
- var option = document.createElement( "option" );
-
- option.value = id ;
- option.text = name;
- optionComboList.add( option, null );
- }
-}
-
-function insertDataElementId_() {
-
- var optionCombo = byId("optionCombos_");
- var dataElementComboId = "[*." + optionCombo.value + "]";
- byId("categoryFormula").value = dataElementComboId;
- byId("categoryFormulaDiv").innerHTML = "*." + optionCombo[optionCombo.selectedIndex].text ;
-}
-
-function clearFormula(formulaFieldName){
- byId(formulaFieldName).value = '';
- byId(formulaFieldName + "Div").innerHTML = ''
-}
-// -------------------------------------------------------------------------------
-// Show textFormula
-// -------------------------------------------------------------------------------
-
-function updateFormulaText( formulaFieldName )
-{
- var formula = htmlEncode( byId( formulaFieldName ).value );
- var url = "getFormulaText.action?formula=" + formula;
-
- var request = new Request();
- request.setCallbackSuccess( updateFormulaTextReceived );
- request.send( url );
-}
-
-function updateFormulaTextReceived( messageElement )
-{
- byId( "formulaDiv").innerHTML = messageElement;
-}
=== added file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItems.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItems.js 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exportItems.js 2011-07-18 06:50:24 +0000
@@ -0,0 +1,759 @@
+// ---------------------------------------------------------------------------
+// Dialog
+// ---------------------------------------------------------------------------
+
+function setUpDialog( elementId, title, width, height )
+{
+ var dialog = jQuery( '#'+elementId ).dialog({
+ title: title,
+ modal: true,
+ autoOpen: false,
+ minWidth: width,
+ minHeight: height,
+ width: width,
+ height: height
+ });
+
+ return dialog;
+}
+
+function openDialog( _dialog )
+{
+ _dialog.dialog( 'open' );
+}
+
+function closeDialog( _dialog )
+{
+ _dialog.dialog( 'close' );
+}
+
+// ---------------------------------------------------------------------------------
+// Methods
+// ---------------------------------------------------------------------------------
+
+function changeItemType()
+{
+ value = getFieldValue( 'itemType' );
+ enable( 'expression-button' );
+
+ setFieldValue( 'exportItem input[id=expression]', getFieldValue( 'exportItem input[id=currentExpression]') );
+
+ if( value == 'dataelement' ){
+ byId('expression-button' ).onclick = deExpressionBuilderForm;
+ }else if( value == 'indicator' ){
+ byId('expression-button' ).onclick = inExpressionBuilderForm ;
+ }else if( value == 'formulaexcel' ){
+ byId('expression-button' ).onclick = excelFormulaExpressionBuilderForm ;
+ }else if( value == 'organisation' || value == 'serial' || value == 'dataelement_code' || value == 'dataelement_name' ){
+ disable( 'expression-button' );
+ setFieldValue( 'exportItem input[id=expression]', value );
+ removeValidatorRulesById( 'exportItem input[id=expression]' );
+ removeValidatorRulesById( 'dataelement textarea[id=formula]' );
+ }
+}
+
+function insertOperation( value ) {
+ byId('formula').value += value;
+}
+
+function cleanFormula()
+{
+ setFieldValue( 'formula','');
+ setInnerHTML( 'expression-description', '');
+}
+
+function insertExpression()
+{
+ if( category ) var expression = "[*." + getFieldValue("elementSelect")+ "]";
+ else var expression = getFieldValue("elementSelect");
+ setFieldValue( 'formula', getFieldValue( 'formula') + expression );
+
+ getExpression();
+}
+
+function getExpression()
+{
+ jQuery.postJSON( '../dhis-web-commons-ajax-json/getExpressionText.action',
+ { expression: getFieldValue('formula')}, function( json ){
+ if(json.response == 'success'){
+ setInnerHTML( 'expression-description', json.message );
+ }
+ });
+}
+
+function validateAddExportItem( form )
+{
+ jQuery.postJSON('validationExportItem.action',
+ {
+ exportReportId: getFieldValue( 'exportReportId' ),
+ name: getFieldValue( 'name' ),
+ sheetNo: getFieldValue( 'sheetNo' ),
+ row: getFieldValue( 'row' ),
+ column: getFieldValue( 'column' )
+
+ },function( json ){
+ if(json.response == 'success'){
+ form.submit();
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+}
+
+function validateUpdateExportItem( form )
+{
+ jQuery.postJSON('validationExportItem.action',
+ {
+ id: getFieldValue( 'id' ),
+ exportReportId: getFieldValue( 'exportReportId' ),
+ name: getFieldValue( 'name' ),
+ sheetNo: getFieldValue( 'sheetNo' ),
+ row: getFieldValue( 'row' ),
+ column: getFieldValue( 'column' )
+
+ },function( json ){
+ if(json.response == 'success'){
+ form.submit();
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+}
+
+/*
+* Delete multi export item
+*/
+
+function deleteMultiExportItem( confirm )
+{
+ if ( window.confirm( confirm ) )
+ {
+ var listRadio = document.getElementsByName( 'exportItemCheck' );
+ var url = "deleteMultiExportItem.action?";
+ var j = 0;
+
+ for( var i=0; i < listRadio.length; i++ )
+ {
+ var item = listRadio.item(i);
+
+ if( item.checked == true )
+ {
+ url += "ids=" + item.getAttribute( 'exportItemID' );
+ url += (i < listRadio.length-1) ? "&" : "";
+ j++;
+ }
+ }
+
+ if( j>0 )
+ {
+ $.getJSON(
+ url, {}, function( json )
+ {
+ if ( json.response == "success" )
+ {
+ window.location.reload();
+ }
+ else if ( json.response == "error" )
+ {
+ setMessage( json.message );
+ }
+ }
+ );
+ }
+ }
+}
+
+/**
+* COPY EXPORT_ITEM(s) TO ANOTHER EXPORT_REPORT
+*/
+function copySelectedExportItemToExportReport() {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( copySelectedExportItemToExportReportReceived );
+ request.send( "getAllExportReports.action" );
+}
+
+function copySelectedExportItemToExportReportReceived( xmlObject ) {
+
+ var exportReports = xmlObject.getElementsByTagName("exportReport");
+ var selectList = document.getElementById("targetExportReport");
+ var options = selectList.options;
+
+ options.length = 0;
+
+ for( var i = 0 ; i < exportReports.length ; i++ ) {
+
+ var id = exportReports[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var name = exportReports[i].getElementsByTagName("name")[0].firstChild.nodeValue;
+ options.add(new Option(name,id), null);
+ }
+
+ openDialog( dialog1 );
+}
+
+
+/*
+* Validate Copy Export Items to another Export Report
+*/
+
+sheetId = 0;
+NumberOfItemsChecked = 0;
+ItemsSaved = null;
+itemsCurTarget = null;
+itemsDuplicated = null;
+warningMessages = "";
+
+function validateCopyExportItemsToExportReport() {
+
+ sheetId = $( "#targetSheetNo" ).val();
+
+ var message = '';
+
+ if ( sheetId < 1 ) {
+
+ message = i18n_input_sheet_no;
+ }
+
+ if ( byId("targetExportReport").value == -1 )
+ {
+ message += "<br/>"+ i18n_choose_export_report;
+ }
+
+ if ( message.length > 0 )
+ {
+ setMessage( message );
+ return;
+ }
+
+ itemsCurTarget = null;
+ itemsDuplicated = null;
+
+ itemsCurTarget = new Array();
+ itemsDuplicated = new Array();
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( validateCopyExportItemsToExportReportReceived );
+
+ var param = "exportReportId=" + byId("targetExportReport").value;
+ param += "&sheetNo=" + sheetId;
+
+ request.sendAsPost( param );
+ request.send( "getExportItemsBySheet.action" );
+
+}
+
+function validateCopyExportItemsToExportReportReceived( data ) {
+
+ var items = data.getElementsByTagName('exportItem');
+
+ for (var i = 0 ; i < items.length ; i ++)
+ {
+ itemsCurTarget.push(items[i].getElementsByTagName('name')[0].firstChild.nodeValue);
+ }
+
+ splitDuplicatedItems( 'exportItemCheck', 'exportItemID', 'exportItemName' );
+ saveCopyExportItemsToExportReport();
+}
+
+function splitDuplicatedItems( itemCheckID, itemIDAttribute, itemNameAttribute ) {
+
+ var flag = -1;
+ var itemsChecked = new Array();
+ var listRadio = document.getElementsByName( itemCheckID );
+
+ ItemsSaved = null;
+ ItemsSaved = new Array();
+
+ for (var i = 0 ; i < listRadio.length ; i++) {
+
+ if ( listRadio.item(i).checked ) {
+ itemsChecked.push( listRadio.item(i).getAttribute(itemIDAttribute) + "#" + listRadio.item(i).getAttribute(itemNameAttribute));
+ }
+ }
+
+ NumberOfItemsChecked = itemsChecked.length;
+
+ for (var i in itemsChecked)
+ {
+ flag = i;
+
+ for (var j in itemsCurTarget)
+ {
+ if ( itemsChecked[i].split("#")[1] == itemsCurTarget[j] )
+ {
+ flag = -1;
+ itemsDuplicated.push( itemsChecked[i].split("#")[1] );
+ break;
+ }
+ }
+ if ( flag >= 0 )
+ {
+ ItemsSaved.push( itemsChecked[i].split("#")[0] );
+ }
+ }
+}
+
+function saveCopyExportItemsToExportReport() {
+
+ warningMessages = " ======= Sheet [" + sheetId + "] ========";
+
+ // If have ExportItem(s) in Duplicating list
+ // Preparing the warning message
+ if ( itemsDuplicated.length > 0 )
+ {
+ setUpDuplicatedItemsMessage();
+ }
+
+ // If have also ExportItem(s) in Copying list
+ // Do copy and prepare the message notes
+ if ( ItemsSaved.length > 0 )
+ {
+ var url = "copyExportItemToExportReport.action";
+ url += "?exportReportId=" + $("#targetExportReport").val();
+ url += "&sheetNo=" + sheetId;
+
+ for (var i in ItemsSaved)
+ {
+ url += "&exportItems=" + ItemsSaved[i];
+ }
+
+ executeCopyItems( url );
+ }
+ // If have no any ExportItem(s) will be copied
+ // and also have ExportItem(s) in Duplicating list
+ else if ( itemsDuplicated.length > 0 )
+ {
+ setMessage( warningMessages );
+ }
+
+ closeDialog( dialog1 );
+}
+
+
+/**
+* COPY SELECTED EXPORT_ITEM(s) TO IMPORT_REPORT
+*/
+
+function copySelectedExportItemToImportReport() {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( copySelectedExportItemToImportReportReceived );
+ request.send( "getAllImportReport.action" );
+}
+
+function copySelectedExportItemToImportReportReceived( xmlObject ) {
+
+ var groups = xmlObject.getElementsByTagName("importReport");
+ var selectList = document.getElementById("targetImportReport");
+ var options = selectList.options;
+
+ options.length = 0;
+
+ for( var i = 0 ; i < groups.length ; i++ ) {
+
+ var id = groups[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var name = groups[i].getElementsByTagName("name")[0].firstChild.nodeValue;
+ options.add(new Option(name,id), null);
+ }
+
+ openDialog( dialog2 );
+}
+
+/*
+* Validate copy Export Items to Import Report
+*/
+
+function validateCopyExportItemsToImportReport() {
+
+ sheetId = $("#targetImportReportSheetNo").val();
+
+ var message = '';
+
+ if ( sheetId < 1 )
+ {
+ message = i18n_input_sheet_no;
+ }
+
+ if ( byId("targetImportReport").value == -1 )
+ {
+ message += "<br/>" + i18n_choose_import_report;
+ }
+
+ if ( message.length > 0 )
+ {
+ setMessage( message );
+ return;
+ }
+
+ itemsCurTarget = null;
+ itemsDuplicated = null;
+
+ itemsCurTarget = new Array();
+ itemsDuplicated = new Array();
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( validateCopyExportItemsToImportReportReceived );
+ request.send( "getImportItemsByGroup.action?importReportId=" + byId("targetImportReport").value );
+
+}
+
+function validateCopyExportItemsToImportReportReceived( xmlObject ) {
+
+ var items = xmlObject.getElementsByTagName('importItem');
+
+ for (var i = 0 ; i < items.length ; i ++) {
+
+ itemsCurTarget.push(items[i].getElementsByTagName('name')[0].firstChild.nodeValue);
+ }
+
+ splitDuplicatedItems( 'exportItemCheck', 'exportItemID', 'exportItemName' );
+
+ saveCopiedExportItemsToImportReport();
+}
+
+function saveCopiedExportItemsToImportReport() {
+
+ warningMessages = " ======= Sheet [" + sheetId + "] ========";
+
+ // If have ExportItem(s) in Duplicating list
+ // preparing the warning message
+ if ( itemsDuplicated.length > 0 )
+ {
+ setUpDuplicatedItemsMessage();
+ }
+
+ // If have also ExportItem(s) in Copying list
+ // do copy and prepare the message notes
+ if ( ItemsSaved.length > 0 )
+ {
+ var url = "copyExportItemToImportReport.action";
+ url += "?importReportId=" + $("#targetImportReport").val();
+ url += "&sheetNo=" + sheetId;
+
+ for (var i in ItemsSaved)
+ {
+ url += "&exportItemIds=" + ItemsSaved[i];
+ }
+
+ executeCopyItems( url );
+ }
+ // If have no any ExportItem(s) will be copied
+ // and also have ExportItem(s) in Duplicating list
+ else if ( itemsDuplicated.length > 0 )
+ {
+ setMessage( warningMessages );
+ }
+
+ closeDialog( dialog2 );
+}
+
+function setUpDuplicatedItemsMessage()
+{
+ warningMessages +=
+ "<br/><b>[" + (itemsDuplicated.length) + "/" + (NumberOfItemsChecked) + "]</b>:: "
+ + i18n_copy_items_duplicated
+ + "<br/><br/>";
+
+ for (var i in itemsDuplicated)
+ {
+ warningMessages +=
+ "<b>(*)</b> "
+ + itemsDuplicated[i]
+ + "<br/><br/>";
+ }
+
+ warningMessages += "<br/>";
+}
+
+function executeCopyItems( url )
+{
+ $.postJSON(
+ url, {}, function ( json )
+ {
+ if ( json.response == "success" )
+ {
+ warningMessages +=
+ "<br/><b>[" + (ItemsSaved.length) + "/" + (NumberOfItemsChecked) + "]</b>:: "
+ + i18n_copy_successful
+ + "<br/>=======================<br/><br/>";
+ }
+
+ setMessage( warningMessages );
+ }
+ );
+}
+
+/**
+* Open dataelement expression
+*/
+function openDataElementExpression() {
+
+ byId( "formula" ).value = byId( "expression" ).value;
+
+ getALLDataElementGroup();
+ getDataElementsByGroup();
+ enable("dataElementGroup");
+ enable("availableDataElements");
+ byId("availableDataElements").onchange = function(e){ getOptionCombos() };
+ if(mode=='update'){
+ updateFormulaText( 'formula' );
+ }
+
+ $("#normal").showAtCenter( true );
+}
+
+/**
+* Get All dataelement group
+*/
+
+function getALLDataElementGroup() {
+
+ var list = byId('dataElementGroup');
+
+ list.options.length = 0;
+ list.add( new Option( "ALL", "ALL" ), null );
+
+ for ( id in dataElementGroups )
+ {
+ list.add( new Option( dataElementGroups[id], id ), null );
+ }
+}
+
+/**
+* Get DataElements By Group
+*/
+
+function getDataElementsByGroup( )
+{
+ var dataElementGroupId = $("#dataElementGroup").val();
+ var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + $("#dataElementGroup").val();
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( getDataElementsByGroupCompleted );
+ request.send( url );
+}
+
+function getDataElementsByGroupCompleted( xmlObject ){
+
+ var dataElementList = byId( "availableDataElements" );
+
+ dataElementList.options.length = 0;
+
+ var dataelements = xmlObject.getElementsByTagName( "dataElement" );
+
+ for ( var i = 0; i < dataelements.length; i++)
+ {
+ var id = dataelements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+ var elementName = dataelements[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
+ var option = new Option( elementName, id );
+ option.onmousemove = function(e){
+ showToolTip( e, this.text);
+ }
+ dataElementList.add( option, null );
+ }
+}
+
+
+/**
+* Indicator Export item type
+*/
+function openIndicatorExpression() {
+
+ byId("formulaIndicator").value = byId("expression").value;
+
+ getIndicatorGroups();
+ filterIndicators();
+ enable("indicatorGroups");
+ enable("availableIndicators");
+ setPositionCenter( 'indicatorForm' );
+
+ $("#indicatorForm").show();
+}
+
+function getIndicatorGroups() {
+
+ var list = byId('indicatorGroups');
+
+ list.options.length = 0;
+ list.add( new Option( "ALL", "ALL" ), null );
+
+ var formula = byId("formulaIndicator").value;
+ for ( id in indicatorGroups )
+ {
+ list.add( new Option( indicatorGroups[id], id ), null );
+ }
+}
+
+function filterIndicators() {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( filterIndicatorsCompleted );
+ request.send( "../dhis-web-commons-ajax/getIndicators.action?id=" + $("#indicatorGroups").val());
+}
+
+function filterIndicatorsCompleted( xmlObject ) {
+
+ var indiatorList = byId( "availableIndicators" );
+ indiatorList.options.length = 0;
+
+ var indicators = xmlObject.getElementsByTagName( "indicator" );
+
+ for ( var i = 0; i < indicators.length; i++ )
+ {
+ var id = indicators[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+ var indicatorName = indicators[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+ var option = document.createElement( "option" );
+
+ option.value = "[" + id + "]";
+ option.text = indicatorName;
+ indiatorList.add( option, null );
+
+ var formula = byId('formulaIndicator').value;
+ if(formula==option.value){
+ option.selected = true;
+ byId("formulaIndicatorDiv").innerHTML = indicatorName;
+ }
+ }
+}
+
+/**
+* Open Category Expression
+*/
+function openCategoryExpression() {
+
+ byId("categoryFormula").value = byId("expression").value;
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( openCategoryExpressionReceived );
+ request.send("getExportReport.action?id=" + exportReportId);
+
+}
+
+function openCategoryExpressionReceived( data ) {
+
+ var selectedDataElementGroups = document.getElementById('dataElementGroup_');
+ selectedDataElementGroups.options.length = 0;
+ var dataElementGroups = data.getElementsByTagName('dataElementGroup');
+
+ for( var i = 0 ; i < dataElementGroups.length ; i++ ) {
+
+ var id = dataElementGroups.item(i).getElementsByTagName('id')[0].firstChild.nodeValue;
+ var name = dataElementGroups.item(i).getElementsByTagName('name')[0].firstChild.nodeValue;
+ //selectedDataElementGroups.options.add(new Option(name, id));
+
+ var option = new Option( name, id );
+ option.onmousemove = function(e){
+ showToolTip( e, this.text);
+ }
+ selectedDataElementGroups.add(option, null);
+ }
+
+ getDataElementGroupOrder();
+ setPositionCenter( 'category' );
+ enable( "dataElementGroup_" );
+ enable( "availableDataElements_" );
+ byId( "availableDataElements_" ).onchange = function(e){ getOptionCombos_() };
+
+ $( "#category" ).show();
+}
+
+
+/**
+* Get DataElement Group Order
+*/
+
+function getDataElementGroupOrder() {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( getDataElementGroupOrderReceived );
+ request.send( "getDataElementGroupOrder.action?id=" + $("#dataElementGroup_").val() );
+
+}
+
+function getDataElementGroupOrderReceived( data ) {
+
+ var availableDataElements = byId('availableDataElements_');
+ availableDataElements.options.length = 0;
+ var dataelEments = data.getElementsByTagName( "dataElement" );
+
+ for ( var i = 0; i < dataelEments.length; i++ )
+ {
+ var id = dataelEments[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+ var name = dataelEments[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+ //availableDataElements.options.add(new Option(name, id));
+ var option = new Option( name, id );
+ option.onmousemove = function(e){
+ showToolTip( e, this.text);
+ }
+ availableDataElements.add(option, null);
+ }
+}
+
+function getOptionCombos_() {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( getOptionCombos_Received );
+ request.send( "getOptionCombos.action?dataElementId=" + byId("availableDataElements_").value );
+
+}
+
+function getOptionCombos_Received( xmlObject ) {
+
+ xmlObject = xmlObject.getElementsByTagName('categoryOptions')[0];
+
+ var optionComboList = byId( "optionCombos_" );
+ optionComboList.options.length = 0;
+ var optionCombos = xmlObject.getElementsByTagName( "categoryOption" );
+
+ for ( var i = 0; i < optionCombos.length; i++ )
+ {
+ var id = optionCombos[ i ].getAttribute('id');
+ var name = optionCombos[ i ].firstChild.nodeValue;
+ var option = document.createElement( "option" );
+
+ option.value = id ;
+ option.text = name;
+ optionComboList.add( option, null );
+ }
+}
+
+function insertDataElementId_() {
+
+ var optionCombo = byId("optionCombos_");
+ var dataElementComboId = "[*." + optionCombo.value + "]";
+ byId("categoryFormula").value = dataElementComboId;
+ byId("categoryFormulaDiv").innerHTML = "*." + optionCombo[optionCombo.selectedIndex].text ;
+}
+
+function clearFormula(formulaFieldName){
+ byId(formulaFieldName).value = '';
+ byId(formulaFieldName + "Div").innerHTML = ''
+}
+// -------------------------------------------------------------------------------
+// Show textFormula
+// -------------------------------------------------------------------------------
+
+function updateFormulaText( formulaFieldName )
+{
+ var formula = htmlEncode( byId( formulaFieldName ).value );
+ var url = "getFormulaText.action?formula=" + formula;
+
+ var request = new Request();
+ request.setCallbackSuccess( updateFormulaTextReceived );
+ request.send( url );
+}
+
+function updateFormulaTextReceived( messageElement )
+{
+ byId( "formulaDiv").innerHTML = messageElement;
+}
=== added file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/import.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/import.js 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/import.js 2011-07-18 06:50:24 +0000
@@ -0,0 +1,154 @@
+function organisationUnitSelected( orgUnits ){
+ window.location = "getImportingParams.action";
+}
+selection.setListenerFunction( organisationUnitSelected );
+
+// -----------------------------------------------------------------------------
+// IMPORT DATA FROM EXCEL FILE INTO DATABASE
+// -----------------------------------------------------------------------------
+
+function importData()
+{
+ if ( importItemIds && importItemIds.length > 0 )
+ {
+ lockScreen();
+ var params = 'importData.action?';
+
+ for ( var i = 0 ; i < importItemIds.length ; i ++ )
+ {
+ params += 'importItemIds=' + importItemIds[i];
+ params += (i < importItemIds.length-1) ? "&" : "";
+ }
+
+ jQuery.postJSON( params,
+ {
+ importReportId: byId('importReportId').value,
+ periodId: byId('period').value
+ }, function( json ) {
+ unLockScreen();
+ showSuccessMessage( json.message );
+ });
+ }
+ else showWarningMessage( i18n_choose_import_item );
+}
+
+// -----------------------------------------------------------------------------
+// PREVIEW DATA FLOW
+// @param isImport This is a global variable which declared in preview.js
+// -----------------------------------------------------------------------------
+
+function getPreviewImportData(){
+
+ lockScreen();
+
+ isImport = true;
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( previewExportReportReceived );
+ request.send( "previewDataFlow.action?importReportId=" + byId("importReportId").value );
+
+}
+
+isToggled = true;
+
+function selectAllData( _this )
+{
+ if ( isToggled )
+ {
+ jQuery( _this ).val( i18n_unselect_all );
+
+ for ( var i = 0 ; i < importlist.length ; i ++ )
+ {
+ importlist[i].className = 'ui-widget-content ui-selected';
+
+ idTemp = jQuery(importlist[i]).attr( 'id' ) + "_" + jQuery(importlist[i]).html();
+
+ if ( jQuery.inArray(idTemp, importItemIds) != -1 )
+ {
+ importItemIds = jQuery.grep( importItemIds, function(value) {
+ return value != idTemp
+ });
+ }
+ else importItemIds.push( idTemp );
+ }
+ }
+ else
+ {
+ jQuery( _this ).val( i18n_select_all );
+
+ for ( var i = 0 ; i < importlist.length ; i ++ )
+ {
+ importlist[i].className = 'ui-widget-content ui-unselected';
+ }
+
+ importItemIds.length = 0;
+ }
+
+ isToggled = !isToggled;
+}
+
+// --------------------------------------------------------------------
+// PERIOD TYPE
+// --------------------------------------------------------------------
+
+function getPeriodsByImportReport( importReportId ) {
+
+ var url = 'getPeriodsByImportReport.action';
+
+ jQuery.postJSON( url, {'importReportId':importReportId}, responseListPeriodReceived );
+}
+
+function validateUploadExcelImportByJSON(){
+
+ jQuery( "#upload" ).upload( 'validateUploadExcelImport.action',
+ { 'draft': true },
+ function ( data )
+ {
+ if ( data.response == 'error' )
+ {
+ setMessage( data.message );
+ }
+ else
+ {
+ uploadExcelImport();
+ }
+ }, 'json'
+ );
+}
+
+function validateUploadExcelImportByXML(){
+
+ jQuery( "#upload" ).upload( 'validateUploadExcelImport.action',
+ { 'draft': true },
+ function ( data )
+ {
+ data = data.getElementsByTagName('message')[0];
+ var type = data.getAttribute("type");
+
+ if ( type == 'error' )
+ {
+ setMessage( data.firstChild.nodeValue );
+ }
+ else
+ {
+ uploadExcelImport();
+ }
+ }, 'xml'
+ );
+}
+
+function uploadExcelImport(){
+
+ jQuery( "#upload" ).upload( 'uploadExcelImport.action',
+ { 'draft': true },
+ function( data, e ) {
+ try {
+ window.location.reload();
+ }
+ catch(e) {
+ alert(e);
+ }
+ }
+ );
+}
\ No newline at end of file
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/importItems.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/importItems.js 2011-07-05 07:08:32 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/importItems.js 2011-07-18 06:50:24 +0000
@@ -284,7 +284,7 @@
}
request.sendAsPost(params);
- request.send( "copyImportItemsToImportReport.action");
+ request.send( "copyImportItemToImportReport.action");
}
// If have no any ImportItem(s) will be copied
// and also have ImportItem(s) in Duplicating list
=== removed file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js 2011-07-18 05:04:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js 1970-01-01 00:00:00 +0000
@@ -1,154 +0,0 @@
-function organisationUnitSelected( orgUnits ){
- window.location = "getImportingParams.action";
-}
-selection.setListenerFunction( organisationUnitSelected );
-
-// -----------------------------------------------------------------------------
-// IMPORT DATA FROM EXCEL FILE INTO DATABASE
-// -----------------------------------------------------------------------------
-
-function importData()
-{
- if ( importItemIds && importItemIds.length > 0 )
- {
- lockScreen();
- var params = 'importData.action?';
-
- for ( var i = 0 ; i < importItemIds.length ; i ++ )
- {
- params += 'importItemIds=' + importItemIds[i];
- params += (i < importItemIds.length-1) ? "&" : "";
- }
-
- jQuery.postJSON( params,
- {
- importReportId: byId('importReportId').value,
- periodId: byId('period').value
- }, function( json ) {
- unLockScreen();
- showSuccessMessage( json.message );
- });
- }
- else showWarningMessage( i18n_choose_import_item );
-}
-
-// -----------------------------------------------------------------------------
-// PREVIEW DATA FLOW
-// @param isImport This is a global variable which declared in preview.js
-// -----------------------------------------------------------------------------
-
-function getPreviewImportData(){
-
- lockScreen();
-
- isImport = true;
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( previewExportReportReceived );
- request.send( "previewDataFlow.action?importReportId=" + byId("importReportId").value );
-
-}
-
-isToggled = true;
-
-function selectAllData( _this )
-{
- if ( isToggled )
- {
- jQuery( _this ).val( i18n_unselect_all );
-
- for ( var i = 0 ; i < importlist.length ; i ++ )
- {
- importlist[i].className = 'ui-widget-content ui-selected';
-
- idTemp = jQuery(importlist[i]).attr( 'id' ) + "_" + jQuery(importlist[i]).html();
-
- if ( jQuery.inArray(idTemp, importItemIds) != -1 )
- {
- importItemIds = jQuery.grep( importItemIds, function(value) {
- return value != idTemp
- });
- }
- else importItemIds.push( idTemp );
- }
- }
- else
- {
- jQuery( _this ).val( i18n_select_all );
-
- for ( var i = 0 ; i < importlist.length ; i ++ )
- {
- importlist[i].className = 'ui-widget-content ui-unselected';
- }
-
- importItemIds.length = 0;
- }
-
- isToggled = !isToggled;
-}
-
-// --------------------------------------------------------------------
-// PERIOD TYPE
-// --------------------------------------------------------------------
-
-function getPeriodsByImportReport( importReportId ) {
-
- var url = 'getPeriodsByImportReport.action';
-
- jQuery.postJSON( url, {'importReportId':importReportId}, responseListPeriodReceived );
-}
-
-function validateUploadExcelImportByJSON(){
-
- jQuery( "#upload" ).upload( 'validateUploadExcelImport.action',
- { 'draft': true },
- function ( data )
- {
- if ( data.response == 'error' )
- {
- setMessage( data.message );
- }
- else
- {
- uploadExcelImport();
- }
- }, 'json'
- );
-}
-
-function validateUploadExcelImportByXML(){
-
- jQuery( "#upload" ).upload( 'validateUploadExcelImport.action',
- { 'draft': true },
- function ( data )
- {
- data = data.getElementsByTagName('message')[0];
- var type = data.getAttribute("type");
-
- if ( type == 'error' )
- {
- setMessage( data.firstChild.nodeValue );
- }
- else
- {
- uploadExcelImport();
- }
- }, 'xml'
- );
-}
-
-function uploadExcelImport(){
-
- jQuery( "#upload" ).upload( 'uploadExcelImport.action',
- { 'draft': true },
- function( data, e ) {
- try {
- window.location.reload();
- }
- catch(e) {
- alert(e);
- }
- }
- );
-}
\ No newline at end of file