Ignore:
Timestamp:
Apr 7, 2010, 11:24:56 AM (11 years ago)
Author:
tabma
Message:
  • study can be selected, imported data fancier postview, lazy loading bug fixed (hopefully)
File:
1 edited

Legend:

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

    r321 r328  
    5656        def datamatrix= ImporterService.getDatamatrix(wb, 0, 5)
    5757
    58         session.header = header
    59         session.importtemplate_id = params.template_id
    60         session.workbook = wb
     58        session.importer_header = header
     59        session.importer_template_id = params.template_id
     60        session.importer_workbook = wb
    6161
    6262        render (view:"step1", model:[header:header, datamatrix:datamatrix])
     
    7777        def entities  = request.getParameterValues("entity")
    7878        def templatefieldtypes = request.getParameterValues("templatefieldtype")
    79         def identifiercolumnindex = params.identifier.toInteger()
     79        def identifiercolumnindex = (params.identifier!=null) ? params.identifier.toInteger() : -1
    8080
    8181        templatefieldtypes.each { t ->     
     
    102102                default: break
    103103            }
    104             session.header[columnindex].templatefieldtype = tft
     104            session.importer_header[columnindex].templatefieldtype = tft
    105105        }
    106106
     
    125125            }
    126126
    127             session.header[columnindex].identifier = (columnindex == identifiercolumnindex) ? true : false
    128             session.header[columnindex].index = columnindex
    129             session.header[columnindex].entity = clazz
     127            session.importer_header[columnindex].identifier = (columnindex == identifiercolumnindex) ? true : false
     128            session.importer_header[columnindex].index = columnindex
     129            session.importer_header[columnindex].entity = clazz
    130130        }
    131131
     
    133133        // TODO: show template fields per entity
    134134       
    135         def templates = Template.get(session.importtemplate_id)
     135        def templates = Template.get(session.importer_template_id)
    136136
    137         render(view:"step2", model:[entities:entities, header:session.header, templates:templates])
     137        render(view:"step2", model:[entities:entities, header:session.importer_header, templates:templates])
    138138    }
    139139
     
    143143    */
    144144    def saveproperties = {
    145         def columnproperties  = request.getParameterValues("columnproperty")
     145        def columnproperties  = request.getParameterValues("columnproperty")   
     146        session.importer_study = Study.get(params.study.id.toInteger())
    146147
    147148        columnproperties.each { cp ->           
    148149                def columnindex = cp.split(":")[0].toInteger()
    149150                def property_id = cp.split(":")[1].toInteger()
    150                 session.header[columnindex].property = TemplateField.get(property_id)           
     151                session.importer_header[columnindex].property = TemplateField.get(property_id)
    151152        }
    152153
    153154        //import workbook
    154         session.importeddata = ImporterService.importdata(session.importtemplate_id, session.workbook, 0, 1, session.header)   
     155        session.importer_importeddata = ImporterService.importdata(session.importer_template_id, session.importer_workbook, 0, 1, session.importer_header)
    155156
    156         render(view:"step3", model:[datamatrix:session.importeddata])
     157        render(view:"step3", model:[datamatrix:session.importer_importeddata])
    157158    }
    158159
    159160    def savepostview = {
    160         ImporterService.savedata(session.importeddata) 
     161        ImporterService.savedata(session.importer_study, session.importer_importeddata)
    161162        render(view:"step4")
    162163    }
Note: See TracChangeset for help on using the changeset viewer.