Ignore:
Timestamp:
Mar 22, 2011, 4:33:49 PM (11 years ago)
Author:
t.w.abma@…
Message:
  • importer wizard webtest working
  • native file input HTML element didn't work inside AjaxFlow, so used hidden importfile variable
  • added check for development or test environment in configuration file
  • added webtestfiles folder to web-apps containing Excel files to test
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r1656 r1658  
    66import org.codehaus.groovy.grails.plugins.web.taglib.ValidationTagLib
    77import grails.plugins.springsecurity.Secured
     8import org.codehaus.groovy.grails.commons.ConfigurationHolder
     9import grails.util.GrailsUtil
     10
    811
    912/**
     
    123126                                // that string
    124127                                flash.importer_params.importfile = params.importfile.replace('existing*', '')
    125                 flash.importer_params.importfile = new XmlSlurper().parseText(flash.importer_params.importfile[flash.importer_params.importfile.indexOf('<pre')..-1]).toString()
     128                //flash.importer_params.importfile = new XmlSlurper().parseText(flash.importer_params.importfile[flash.importer_params.importfile.indexOf('<pre')..-1]).toString()
    126129
    127130                                success()
     
    130133                        on("next") {
    131134                                flash.wizardErrors = [:]
     135
    132136                                flash.importer_params = params
    133                                 flash.importer_params.importfile = params.importfile.replace('existing*', '')
    134                 flash.importer_params.importfile = new XmlSlurper().parseText(flash.importer_params.importfile[flash.importer_params.importfile.indexOf('<pre')..-1]).toString()
     137                                flash.importer_params.importfile = params.importfile.replace('existing*', '')               
     138                //flash.importer_params.importfile = new XmlSlurper().parseText(flash.importer_params.importfile[flash.importer_params.importfile.indexOf('<pre')..-1]).toString()
    135139
    136140                                if (params.entity) {
     
    266270
    267271                                // Always delete the uploaded file in the save step to be sure it doesn't reside there anymore
    268                                 fileService.delete(flow.importer_importedfile)
     272                                if (GrailsUtil.environment != "test") fileService.delete(flow.importer_importedfile)
    269273
    270274                                // Save all entities
     
    340344         * @returns boolean true if correctly validated, otherwise false
    341345         */
    342         boolean fileImportPage(flow, flash, params) {
     346        boolean fileImportPage(flow, flash, params) {       
    343347                def importedfile = fileService.get(params['importfile'])
    344348                flow.importer_importedfile = params['importfile']
    345 
    346                 if (importedfile.exists()) {
     349       
     350        if (importedfile.exists()) {
    347351                        try {
    348352                                session.importer_workbook = importerService.getWorkbook(new FileInputStream(importedfile))
Note: See TracChangeset for help on using the changeset viewer.