------------------------------------------------------------ revno: 108 committer: Lars Helge Oeverland larshe...@gmail.com branch nick: trunk timestamp: Tue 2009-03-24 11:31:31 +0100 message: dhis-web-reporting: 1. Fixed bug that lead to exception 'illegal attempt at association a collection with two sessions' 2. Removed the option for creating a report table directly in the 'add' form, this would lead to an exception when selecting report parameters and no 'static' selections renamed: dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java => dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ReCreateTableAction.java => dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/DefaultReportTableCreator.java dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/ReportTableUpgrader.java dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-03-24 10:31:31 +0000 @@ -233,6 +233,7 @@ * * @param name the name. * @param mode the mode. + * @param regression include regression columns. * @param dataElements the data elements. * @param indicators the indicators. * @param dataSets the datasets. @@ -287,8 +288,6 @@ this.reportParams = reportParams; this.i18nFormat = i18nFormat; this.reportingMonthName = reportingMonthName; - - init(); } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2009-03-24 10:31:31 +0000 @@ -47,7 +47,7 @@ int saveReportTable( ReportTable reportTable ); - void saveOrUpdateReportTable( ReportTable reportTable ); + void updateReportTable( ReportTable reportTable ); void deleteReportTable( ReportTable reportTable ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java 2009-03-24 10:31:31 +0000 @@ -39,7 +39,7 @@ int saveReportTable( ReportTable reportTable ); - void saveOrUpdateReportTable( ReportTable reportTable ); + void updateReportTable( ReportTable reportTable ); void deleteReportTable( ReportTable reportTable ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/DefaultReportTableCreator.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/DefaultReportTableCreator.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/DefaultReportTableCreator.java 2009-03-24 10:31:31 +0000 @@ -114,8 +114,6 @@ setMessage( "aggregating_data" ); - reportTableService.saveOrUpdateReportTable( reportTable ); - // --------------------------------------------------------------------- // Exporting relevant data to data mart // --------------------------------------------------------------------- @@ -154,7 +152,7 @@ reportTable.updateExistingTableName(); - reportTableService.saveOrUpdateReportTable( reportTable ); + reportTableService.updateReportTable( reportTable ); log.info( "Created report table" ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java 2009-03-24 10:31:31 +0000 @@ -63,9 +63,9 @@ return (Integer) sessionManager.getCurrentSession().save( reportTable ); } - public void saveOrUpdateReportTable( ReportTable reportTable ) + public void updateReportTable( ReportTable reportTable ) { - sessionManager.getCurrentSession().saveOrUpdate( reportTable ); + sessionManager.getCurrentSession().update( reportTable ); } public void deleteReportTable( ReportTable reportTable ) === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2009-03-09 12:11:46 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2009-03-24 10:31:31 +0000 @@ -238,9 +238,9 @@ return reportTableStore.saveReportTable( reportTable ); } - public void saveOrUpdateReportTable( ReportTable reportTable ) + public void updateReportTable( ReportTable reportTable ) { - reportTableStore.saveOrUpdateReportTable( reportTable ); + reportTableStore.updateReportTable( reportTable ); } public void deleteReportTable( ReportTable reportTable ) === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/ReportTableUpgrader.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/ReportTableUpgrader.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/ReportTableUpgrader.java 2009-03-24 10:31:31 +0000 @@ -70,7 +70,7 @@ { table.setExistingTableName( table.getTableName() ); - reportTableService.saveOrUpdateReportTable( table ); + reportTableService.updateReportTable( table ); } } === renamed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ReCreateTableAction.java' => 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ReCreateTableAction.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java 2009-03-24 10:31:31 +0000 @@ -56,10 +56,10 @@ * @author Lars Helge Overland * @version $Id$ */ -public class ReCreateTableAction +public class CreateTableAction implements Action { - private static final Log log = LogFactory.getLog( ReCreateTableAction.class ); + private static final Log log = LogFactory.getLog( CreateTableAction.class ); private static final String MODE_REPORT = "report"; === renamed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java' => 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/CreateTableAction.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java 2009-03-24 10:31:31 +0000 @@ -28,15 +28,10 @@ */ import static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection; -import static org.hisp.dhis.util.InternalProcessUtil.*; -import static org.hisp.dhis.reporttable.ReportTableInternalProcess.PROCESS_TYPE; import java.util.ArrayList; -import java.util.Date; import java.util.List; -import org.amplecode.cave.process.ProcessCoordinator; -import org.amplecode.cave.process.ProcessExecutor; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryComboService; @@ -44,21 +39,17 @@ import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.period.MonthlyPeriodType; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.reporttable.RelativePeriods; import org.hisp.dhis.reporttable.ReportParams; import org.hisp.dhis.reporttable.ReportTable; -import org.hisp.dhis.reporttable.ReportTableInternalProcess; import org.hisp.dhis.reporttable.ReportTableService; import org.hisp.dhis.system.util.CollectionConversionUtils; -import org.hisp.dhis.user.CurrentUserService; import com.opensymphony.xwork.Action; @@ -66,27 +57,13 @@ * @author Lars Helge Overland * @version $Id$ */ -public class CreateTableAction +public class SaveTableAction implements Action { // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- - private ProcessCoordinator processCoordinator; - - public void setProcessCoordinator( ProcessCoordinator processCoordinator ) - { - this.processCoordinator = processCoordinator; - } - - private CurrentUserService currentUserService; - - public void setCurrentUserService( CurrentUserService currentUserService ) - { - this.currentUserService = currentUserService; - } - private ReportTableService reportTableService; public void setReportTableService( ReportTableService reportTableService ) @@ -94,13 +71,6 @@ this.reportTableService = reportTableService; } - private I18nFormat format; - - public void setFormat( I18nFormat format ) - { - this.format = format; - } - private DataElementService dataElementService; public void setDataElementService( DataElementService dataElementService ) @@ -161,13 +131,6 @@ this.tableName = tableName; } - private boolean skipDataMart; - - public void setSkipDataMart( boolean skipDataMart ) - { - this.skipDataMart = skipDataMart; - } - private String mode; public void setMode( String mode ) @@ -252,13 +215,6 @@ this.selectedOrganisationUnits = selectedOrganisationUnits; } - private Integer reportingPeriod; - - public void setReportingPeriod( Integer reportingPeriod ) - { - this.reportingPeriod = reportingPeriod; - } - private boolean reportingMonth; public void setReportingMonth( boolean reportingMonth ) @@ -380,27 +336,6 @@ { ReportTable reportTable = getReportTable(); - String owner = currentUserService.getCurrentUsername(); - - ProcessExecutor executor = processCoordinator.newProcess( PROCESS_TYPE, owner ); - - ReportTableInternalProcess reportTableProcess = (ReportTableInternalProcess) executor.getProcess(); - - reportTableProcess.addReportTable( reportTable ); - reportTableProcess.setDoDataMart( !skipDataMart ); - - processCoordinator.requestProcessExecution( executor ); - - setCurrentRunningProcess( PROCESS_KEY_REPORT, executor.getId() ); - - return SUCCESS; - } - - public String save() - throws Exception - { - ReportTable reportTable = getReportTable(); - reportTableService.saveReportTable( reportTable ); return SUCCESS; @@ -450,30 +385,20 @@ relatives.setIndividualMonthsThisYear( individualMonthsThisYear ); relatives.setIndividualQuartersThisYear( individualQuartersThisYear ); - List<Period> relativePeriods = reportTableService.getRelativePeriods( relatives, reportingPeriod ); - ReportParams reportParams = new ReportParams(); reportParams.setParamReportingMonth( paramReportingMonth ); reportParams.setParamParentOrganisationUnit( paramParentOrganisationUnit ); reportParams.setParamOrganisationUnit( paramOrganisationUnit ); - Date date = reportTableService.getDateFromPreviousMonth( reportingPeriod ); - - MonthlyPeriodType periodType = new MonthlyPeriodType(); - - Period period = periodType.createPeriod( date ); - - String reportingMonthName = format.formatPeriod( period ); - ReportTable reportTable = null; if ( tableId == null ) { reportTable = new ReportTable( tableName, mode, regression, - dataElements, indicators, dataSets, categoryOptionCombos, periods, relativePeriods, organisationUnits, + dataElements, indicators, dataSets, categoryOptionCombos, periods, null, organisationUnits, doIndicators, doCategoryOptionCombos, doPeriods, doOrganisationUnits, relatives, reportParams, - format, reportingMonthName ); + null, null ); } else { @@ -486,7 +411,6 @@ reportTable.setDataSets( dataSets ); reportTable.setCategoryOptionCombos( categoryOptionCombos ); reportTable.setPeriods( periods ); - reportTable.setRelativePeriods( relativePeriods ); reportTable.setUnits( organisationUnits ); reportTable.setDoIndicators( doIndicators ); reportTable.setDoCategoryOptionCombos( doCategoryOptionCombos ); @@ -494,10 +418,6 @@ reportTable.setDoUnits( doOrganisationUnits ); reportTable.setRelatives( relatives ); reportTable.setReportParams( reportParams ); - reportTable.setI18nFormat( format ); - reportTable.setReportingMonthName( reportingMonthName ); - - reportTable.init(); } return reportTable; === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-03-07 13:10:38 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-03-24 10:31:31 +0000 @@ -176,32 +176,28 @@ ref="org.hisp.dhis.dataset.DataSetService"/> </bean> + <bean id="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction" + class="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction" + scope="prototype"> + <property name="reportTableService" + ref="org.hisp.dhis.reporttable.ReportTableService"/> + <property name="dataElementService" + ref="org.hisp.dhis.dataelement.DataElementService"/> + <property name="categoryComboService" + ref="org.hisp.dhis.dataelement.DataElementCategoryComboService"/> + <property name="indicatorService" + ref="org.hisp.dhis.indicator.IndicatorService"/> + <property name="periodService" + ref="org.hisp.dhis.period.PeriodService"/> + <property name="organisationUnitService" + ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/> + <property name="dataSetService" + ref="org.hisp.dhis.dataset.DataSetService"/> + </bean> + <bean id="org.hisp.dhis.reporting.tablecreator.action.CreateTableAction" class="org.hisp.dhis.reporting.tablecreator.action.CreateTableAction" scope="prototype"> - <property name="processCoordinator" - ref="processCoordinator"/> - <property name="currentUserService" - ref="org.hisp.dhis.user.CurrentUserService"/> - <property name="reportTableService" - ref="org.hisp.dhis.reporttable.ReportTableService"/> - <property name="dataElementService" - ref="org.hisp.dhis.dataelement.DataElementService"/> - <property name="categoryComboService" - ref="org.hisp.dhis.dataelement.DataElementCategoryComboService"/> - <property name="indicatorService" - ref="org.hisp.dhis.indicator.IndicatorService"/> - <property name="periodService" - ref="org.hisp.dhis.period.PeriodService"/> - <property name="organisationUnitService" - ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/> - <property name="dataSetService" - ref="org.hisp.dhis.dataset.DataSetService"/> - </bean> - - <bean id="org.hisp.dhis.reporting.tablecreator.action.ReCreateTableAction" - class="org.hisp.dhis.reporting.tablecreator.action.ReCreateTableAction" - scope="prototype"> <property name="processCoordinator" ref="processCoordinator"/> <property name="currentUserService" === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml 2009-03-07 13:10:38 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml 2009-03-24 10:31:31 +0000 @@ -129,7 +129,7 @@ <param name="requiredAuthorities">F_REPORT_DELETE</param> </action> - <action name="createReportTable" class="org.hisp.dhis.reporting.tablecreator.action.ReCreateTableAction"> + <action name="createReportTable" class="org.hisp.dhis.reporting.tablecreator.action.CreateTableAction"> <result name="success" type="redirect">displayViewReportForm.action</result> <param name="requiredAuthorities">F_REPORT_VIEW</param> </action> @@ -182,12 +182,12 @@ <param name="requiredAuthorities">F_REPORTTABLE_DELETE</param> </action> + <action name="saveTable" class="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction"> + <result name="success" type="redirect">displayManageTableForm.action</result> + <param name="requiredAuthorities">F_REPORTTABLE_ADD</param> + </action> + <action name="createTable" class="org.hisp.dhis.reporting.tablecreator.action.CreateTableAction"> - <result name="success" type="redirect">getReportParams.action?mode=status</result> - <param name="requiredAuthorities">F_REPORTTABLE_ADD</param> - </action> - - <action name="reCreateTable" class="org.hisp.dhis.reporting.tablecreator.action.ReCreateTableAction"> <result name="success" type="velocity-xml">/dhis-web-reporting/responseSuccess.vm</result> <param name="onExceptionReturn">plainTextError</param> <param name="requiredAuthorities">F_REPORTTABLE_ADD</param> === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2009-03-24 10:31:31 +0000 @@ -1,7 +1,7 @@ <h3>$i18n.getString( "create_report_table" )</h3> -<form id="tableForm" name="tableForm" method="post"> +<form id="tableForm" name="tableForm" method="post" action="saveTable.action"> <input type="hidden" id="tableId" name="tableId" value="$!reportTable.id"> <input type="hidden" id="mode" name="mode" value="$!mode"> @@ -26,14 +26,14 @@ <td><input type="checkbox" id="doIndicators" name="doIndicators" value="true"#if( $reportTable.doIndicators ) checked#end></td> </tr> <tr> - <td><label for="skipDataMart">$i18n.getString( "skip_data_mart" )</label></td> - <td><input type="checkbox" id="skipDataMart" name="skipDataMart" value="true"></td> - <td><label for="doOrganisationUnits">$i18n.getString( "organisation_units" )</label></td> + <td><label for="regression">$i18n.getString( "include_regression" )</label></td> + <td><input type="checkbox" onclick="toggleRegression()" id="regression" name="regression" value="true"#if( $reportTable.isRegression() ) checked#end></td> + <td><label for="doOrganisationUnits">$i18n.getString( "organisation_units" )</label></td> <td><input type="checkbox" id="doOrganisationUnits" name="doOrganisationUnits" value="true"#if( $reportTable.doUnits ) checked#end></td> </tr> <tr> - <td><label for="regression">$i18n.getString( "include_regression" )</label></td> - <td><input type="checkbox" onclick="toggleRegression()" id="regression" name="regression" value="true"#if( $reportTable.isRegression() ) checked#end></td> + <td></td> + <td></td> <td><label for="doPeriods">$i18n.getString( "periods" )</label></td> <td><input type="checkbox" id="doPeriods" name="doPeriods" value="true"#if( $reportTable.doPeriods ) checked#end></td> </tr> @@ -319,24 +319,6 @@ <td style="height:15px"></td> </tr> - <!-- Reporting month --> - - <tr> - <th>$i18n.getString( "reporting_month" )</th> - </tr> - <tr> - <td> - <select id="reportingPeriod" name="reportingPeriod" style="min-width:640px"> - #foreach ( $key in $reportingPeriods.keySet() ) - <option value="$key">$reportingPeriods.get( $key )</option> - #end - </select> - </td> - </tr> - <tr> - <td style="height:15px"></td> - </tr> - </table> <!-- Relative Periods --> @@ -420,8 +402,7 @@ <tr> <td> - <input type="button" value="$i18n.getString( 'create_and_save' )" onclick="createAndSaveTable()" style="width:120px"><input - type="button" value="$i18n.getString( 'save' )" onclick="saveTable()" style="width:120px"><input + <input type="button" value="$i18n.getString( 'save' )" onclick="saveTable()" style="width:120px"><input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayManageTableForm.action'" style="width:120px"> </td> </tr> === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm 2009-03-24 10:31:31 +0000 @@ -24,7 +24,7 @@ #if ( $mode == "table" && $!reportParams.isSet() == false ) <script type="text/javascript"> - reCreateTable( "$id" ); + createTable( "$id" ); </script> #end @@ -123,7 +123,7 @@ <tr> <td> #if ( $mode == "table" && $!reportParams.isSet() ) - <input type="button" value="$i18n.getString( 'ok' )" onclick="reCreateTable( '$id' )" style="width:120px"> + <input type="button" value="$i18n.getString( 'ok' )" onclick="createTable( '$id' )" style="width:120px"> #end #if ( $mode == "table" || $mode == "status" ) <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayManageTableForm.action'" style="width:120px"> === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js 2009-03-24 10:31:31 +0000 @@ -3,7 +3,7 @@ function runAndViewReport( reportId, reportUrl ) { - var url = "reCreateTable.action?id=" + reportId + "&mode=report"; + var url = "createTable.action?id=" + reportId + "&mode=report"; if ( document.getElementById( "reportingPeriod" ) != null ) { === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2009-03-24 10:31:31 +0000 @@ -1,11 +1,11 @@ // ----------------------------------------------------------------------------- -// Recreate ReportTable +// Create ReportTable // ----------------------------------------------------------------------------- -function reCreateTable( tableId ) +function createTable( tableId ) { - var url = "reCreateTable.action?id=" + tableId + "&mode=table"; + var url = "createTable.action?id=" + tableId + "&mode=table"; if ( document.getElementById( "reportingPeriod" ) != null ) { @@ -23,11 +23,11 @@ } var request = new Request(); - request.setCallbackSuccess( reCreateTableReceived ); + request.setCallbackSuccess( createTableReceived ); request.send( url ); } -function reCreateTableReceived( messageElement ) +function createTableReceived( messageElement ) { getTableStatus(); } @@ -69,49 +69,6 @@ } // ----------------------------------------------------------------------------- -// Create and save ReportTable -// ----------------------------------------------------------------------------- - -function createAndSaveTable() -{ - if ( validateCollections() ) - { - var tableId = document.getElementById( "tableId" ).value; - var tableName = document.getElementById( "tableName" ).value; - - var url = "validateTable.action?id=" + tableId + "&name=" + tableName; - - var request = new Request(); - request.setResponseTypeXML( 'message' ); - request.setCallbackSuccess( createAndSaveTableReceived ); - request.send( url ); - } -} - -function createAndSaveTableReceived( messageElement ) -{ - var type = messageElement.getAttribute( 'type' ); - var message = messageElement.firstChild.nodeValue; - - if ( type == "input" ) - { - setMessage( message ); - - return false; - } - else if ( type == "success" ) - { - selectTableForm(); - - var form = document.getElementById( "tableForm" ); - - form.action = "createTable.action"; - - form.submit(); - } -} - -// ----------------------------------------------------------------------------- // Save ReportTable // ----------------------------------------------------------------------------- @@ -146,21 +103,7 @@ { selectTableForm(); - var form = document.getElementById( "tableForm" ); - - form.action = "createTable!save.action"; - - form.submit(); - } -} - -function removeTable( tableId, tableName ) -{ - var result = window.confirm( i18n_confirm_delete + '\n\n' + tableName ); - - if ( result ) - { - window.location.href = "removeTable.action?id=" + tableId; + document.getElementById( "tableForm" ).submit(); } } @@ -186,6 +129,20 @@ } // ----------------------------------------------------------------------------- +// Remove +// ----------------------------------------------------------------------------- + +function removeTable( tableId, tableName ) +{ + var result = window.confirm( i18n_confirm_delete + '\n\n' + tableName ); + + if ( result ) + { + window.location.href = "removeTable.action?id=" + tableId; + } +} + +// ----------------------------------------------------------------------------- // Validation // ----------------------------------------------------------------------------- -- Trunk 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. _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp