=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/ValidateReportAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/ValidateReportAction.java 2013-02-12 06:55:14 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/ValidateReportAction.java 1970-01-01 00:00:00 +0000 @@ -1,127 +0,0 @@ -package org.hisp.dhis.reporting.reportviewer.action; - -/* - * Copyright (c) 2004-2012, 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 com.opensymphony.xwork2.Action; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.report.Report; -import org.hisp.dhis.report.ReportService; - -/** - * @author Lars Helge Overland - */ -public class ValidateReportAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - public ReportService reportService; - - public void setReportService( ReportService reportService ) - { - this.reportService = reportService; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private Integer id; - - public void setId( Integer id ) - { - this.id = id; - } - - private String name; - - public void setName( String name ) - { - this.name = name; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String message; - - public String getMessage() - { - return message; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - if ( name == null ) - { - message = i18n.getString( "specify_name" ); - - return INPUT; - } - else - { - name = name.trim(); - - if ( name.length() == 0 ) - { - message = i18n.getString( "specify_name" ); - - return INPUT; - } - - /* - Report match = reportService.getReportByName( name ).get( 0 ); - - if ( match != null && (id == null || match.getId() != id) ) - { - message = i18n.getString( "name_in_use" ); - - return INPUT; - } - */ - } - - message = i18n.getString( "ok" ); - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ValidateTableAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ValidateTableAction.java 2013-02-08 07:18:39 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ValidateTableAction.java 1970-01-01 00:00:00 +0000 @@ -1,128 +0,0 @@ -package org.hisp.dhis.reporting.tablecreator.action; - -/* - * Copyright (c) 2004-2012, 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 com.opensymphony.xwork2.Action; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.reporttable.ReportTable; -import org.hisp.dhis.reporttable.ReportTableService; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class ValidateTableAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private ReportTableService reportTableService; - - public void setReportTableService( ReportTableService reportTableService ) - { - this.reportTableService = reportTableService; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private Integer id; - - public void setId( Integer id ) - { - this.id = id; - } - - private String name; - - public void setName( String name ) - { - this.name = name; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String message; - - public String getMessage() - { - return message; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - if ( name == null ) - { - message = i18n.getString( "specify_name" ); - - return INPUT; - } - else - { - name = name.trim(); - - if ( name.length() == 0 ) - { - message = i18n.getString( "specify_name" ); - - return INPUT; - } - - /* - ReportTable match = reportTableService.getReportTableByName( name ).get( 0 ); - - if ( match != null && (id == null || match.getId() != id) ) - { - message = i18n.getString( "name_in_use" ); - - return INPUT; - } - */ - } - - message = i18n.getString( "ok" ); - - return SUCCESS; - } -} === 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 2013-03-05 19:00:51 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-03-14 10:27:27 +0000 @@ -103,11 +103,6 @@ - - - - @@ -169,11 +164,6 @@ - - - - === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-03-14 04:50:21 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-03-14 10:27:27 +0000 @@ -113,12 +113,6 @@ - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - /dhis-web-commons/ajax/jsonResponseInput.vm - plainTextError - - @@ -151,6 +145,7 @@ displayManageTableForm.action + F_REPORTTABLE_PUBLIC_ADD,F_REPORTTABLE_PRIVATE_ADD @@ -165,6 +160,7 @@ /dhis-web-reporting/addTableForm.vm /dhis-web-reporting/menu.vm ../dhis-web-commons/oust/oust.js,javascript/table.js,javascript/lists.js + F_REPORTTABLE_PUBLIC_ADD,F_REPORTTABLE_PRIVATE_ADD @@ -172,12 +168,6 @@ plainTextError - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - /dhis-web-commons/ajax/jsonResponseInput.vm - plainTextError - - /dhis-web-commons/ajax/jsonResponseSuccess.vm plainTextError === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm 2013-01-25 15:24:37 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm 2013-03-14 10:27:27 +0000 @@ -1,5 +1,7 @@

$i18n.getString( "create_report_table" )

=== 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 2013-01-25 15:24:37 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js 2013-03-14 10:27:27 +0000 @@ -1,23 +1,18 @@ function addReport() { - if ( $( "#id" ).val().length == 0 && !hasText( "upload" ) ) - { - setMessage( i18n_please_specify_file ); - return false; - } - - $.postJSON( "validateReport.action", { id:$( "#id" ).val(), "name":$( "#name" ).val() }, function( json ) - { - if ( json.response == "input" ) - { - setMessage( json.message ); - return false; - } - else if ( json.response == "success" ) - { - $( "#reportForm" ).submit(); - } - } ); + if ( $( "#reportForm #name" ).val().trim().length == 0 ) + { + setMessage( i18n_specify_name ); + return false; + } + + if ( $( "#reportForm #id" ).val().trim().length == 0 && !hasText( "upload" ) ) + { + setMessage( i18n_please_specify_file ); + return false; + } + + $( "#reportForm" ).submit(); } function removeReport( id ) === 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 2013-02-08 07:18:39 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2013-03-14 10:27:27 +0000 @@ -4,21 +4,16 @@ function saveTable() { + if ( $( "#tableForm #tableName" ).val().trim().length == 0 ) + { + setHeaderDelayMessage( i18n_specify_name ); + return false; + } + if ( validateCollections() ) { - $.postJSON( "validateTable.action", { id:getFieldValue( "tableId" ), "name":getFieldValue( "tableName" ) }, function( json ) - { - if ( json.response == "input" ) - { - setHeaderDelayMessage( json.message ); - return false; - } - else if ( json.response == "success" ) - { - selectTableForm(); - $( "#tableForm" ).submit(); - } - } ); + selectTableForm(); + $( "#tableForm" ).submit(); } }