Ignore:
Timestamp:
Feb 18, 2010, 8:10:35 AM (14 years ago)
Author:
tabma
Message:
  • rewrote to HashMap? based columns (columns are always unique, storing in array tricky/redundancy)
  • entities can be chosen in the preview
  • properties page shows columns grouped per entity
  • properties page allows mapping of column to property (TODO: get all fields per entity)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r200 r203  
    1818class ImporterTagLib {
    1919    static namespace = 'importer'
    20     def entities = [[value:0, name:"Study"], [value:1, name:"Subject"], [value:2, name:"Event"],
    21                         [value:3, name:"Protocol"], [value:4, name:"Sample"]]
     20    def standardentities = [[type:0, name:"Study"], [type:1, name:"Subject"], [type:2, name:"Event"],
     21                        [type:3, name:"Protocol"], [type:4, name:"Sample"]]
    2222
    23     def celltypes = [[value:0, name:"Numeric"], [value:1, name:"String"], [value:2, name:"Formula"],
    24                          [value:3, name:"Blank"], [value:4, name:"Boolean"], [value:5, name:"Error"]]
     23    def standardcelltypes = [[type:0, name:"Numeric"], [type:1, name:"String"], [type:2, name:"Formula"],
     24                         [type:3, name:"Blank"], [type:4, name:"Boolean"], [type:5, name:"Error"]]
    2525
    2626    /**
     
    4545     */
    4646    def properties = { attrs ->
    47         def ent = []
     47        def selectedentities = []
     48        def header = attrs['header']
    4849
    49         attrs['entities'].each { e ->
    50             def temp = e.split(":")         
     50        attrs['entities'].each { se ->
     51            def temp = se.split(":")
    5152            def entity = [type:temp[0],columnindex:temp[1]]
    52             ent.add(entity)
     53            selectedentities.add(entity)
    5354        }
    5455
    55         out << render (template:"common/properties", model:[entities:ent])
     56        out << render (template:"common/properties", model:[selectedentities:selectedentities, standardentities:standardentities, header:header])
    5657    }
    5758
     
    6061
    6162        options.each { e ->
    62             res += "<option value=\"${e.value}:${customvalue}\""
    63             res += (e.value == selected) ? " selected" : ""
     63            res += "<option value=\"${e.type}:${customvalue}\""
     64            res += (e.type.toInteger() == selected) ? " selected" : ""
    6465            res += ">${e.name}</option>"
    6566        }
     
    7879        def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    7980        def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
    80         out << createSelect(selected, attrs['name'], entities, customvalue)
     81        out << createSelect(selected, attrs['name'], standardentities, customvalue)
    8182    }
    8283
     
    9091        def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    9192        def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
    92         out << createSelect(selected, attrs['name'], celltypes, customvalue)
     93        out << createSelect(selected, attrs['name'], standardcelltypes, customvalue)
    9394    }
    9495}
Note: See TracChangeset for help on using the changeset viewer.