Ignore:
Timestamp:
May 27, 2010, 1:13:50 PM (11 years ago)
Author:
tabma
Message:
  • refactored (now using configuration file where entities to be used are configured)
File:
1 edited

Legend:

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

    r415 r485  
    2222class ImporterTagLib {
    2323    static namespace = 'importer'
    24     def standardentities = [[type:-1, name:"Don't import"], [type:0, name:"Study"], [type:1, name:"Subject"], [type:2, name:"Event"],
    25                         [type:3, name:"Protocol"], [type:4, name:"Sample"]]
    2624
    2725    /**
     
    5351
    5452    /**
    55      * @param entities array
     53     * @param entities array containing selected entities
    5654     */
    5755    def properties = { attrs ->
    58         def selectedentities = []
    5956        def header = attrs['header']
     57        def entities = attrs['entities']
    6058
    61         attrs['entities'].index.each { columnindex, entitytype ->
    62             def entity = [type:entitytype,columnindex:columnindex.toInteger()]
    63             selectedentities.add(entity)
    64         }
    65 
    66         out << render (template:"common/properties", model:[selectedentities:selectedentities, standardentities:standardentities, header:header])
     59        out << render ( template:"common/properties",
     60                        model:[selectedentities:entities,
     61                        standardentities:grailsApplication.config.gscf.domain.importableEntities,
     62                        header:header])
    6763    }
    6864
     
    124120        def res = "<select style=\"font-size:10px\" name=\"${name}.index.${custval}\">"
    125121
    126         standardentities.each { e ->
    127             res += "<option value=\"${e.type}\""
    128             res += (e.type == sel) ? " selected" : ""
    129             res += ">${e.name}</option>"
     122        grailsApplication.config.gscf.domain.importableEntities.each { e ->
     123            res += "<option value=\"${e.value.name}\""
     124            res += (e.value.type == sel) ? " selected" : ""
     125            res += ">${e.value.name}</option>"
    130126        }
    131127
Note: See TracChangeset for help on using the changeset viewer.