Ignore:
Timestamp:
Mar 11, 2010, 11:48:16 AM (9 years ago)
Author:
tabma
Message:
  • Template enums now used instead of POI Celltypes
File:
1 edited

Legend:

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

    r255 r256  
    2222    def standardentities = [[type:-1, name:"Don't import"], [type:0, name:"Study"], [type:1, name:"Subject"], [type:2, name:"Event"],
    2323                        [type:3, name:"Protocol"], [type:4, name:"Sample"]]
    24 
    25     /*def standardcelltypes = [
    26                          [type:0, name:"Numeric"], [type:1, name:"String"], [type:2, name:"Formula"],
    27                          [type:3, name:"Blank"], [type:4, name:"Boolean"], [type:5, name:"Error"], [type:6, name:"Date"],
    28                          [type:7, name:"Float"], [type:8, name:"Double"], [type:9, name:"List of items"], [type:10, name:"Ontologyterm"]
    29                      ]*/
    3024
    3125    /**
     
    6256    }
    6357
    64     def createSelect(int selected, String name, options, String customvalue) {
     58    def createSelect(selected, String name, options, String customvalue) {
    6559        def res = "<select style=\"font-size:10px\" name=\"${name}\">"
    6660
    6761        options.each { e ->
    68             res += "<option value=\"${customvalue}:${e.type}\""
    69             res += (e.type.toInteger() == selected) ? " selected" : ""
    70             res += ">${e.name}</option>"
     62            res += "<option value=\"${customvalue}:${e}\""
     63            res += (e == selected) ? " selected" : ""
     64            res += ">${e}</option>"
    7165        }
    7266
     
    118112    }   
    119113
    120     /**
    121      * @param selected selected entity
    122      * @param name name of the HTML select object
    123      **/
    124     def entitySelect = { attrs ->       
    125         def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    126         def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
    127         out << createSelect(selected, attrs['name'], standardentities, customvalue)
     114     def entitySelect = { attrs ->
     115        def sel = (attrs['selected']==null) ? -1 : attrs['selected']
     116        def custval = (attrs['customvalue']==null) ? "" : attrs['customvalue']
     117        def name = (attrs['name']==null) ? -1 : attrs['name']
     118
     119        def res = "<select style=\"font-size:10px\" name=\"${name}\">"
     120
     121        standardentities.each { e ->
     122            res += "<option value=\"${custval}:${e.type}\""
     123            res += (e.type == sel) ? " selected" : ""
     124            res += ">${e.name}</option>"
     125        }
     126
     127        res += "</select>"
     128        out << res
    128129    }
    129130
     
    134135    * @return HTML select object
    135136    */
    136     def celltypeSelect = { attrs ->
     137    def templatefieldtypeSelect = { attrs ->
    137138        def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    138139        def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
     140        def name = (attrs['name']==null) ? "" : attrs['name']
    139141        //out << createSelect(selected, attrs['name'], standardcelltypes, customvalue)
    140         out << createSelect(selected, attrs['name'], TemplateFieldType.list(), customvalue)
     142
     143        def res = "<select style=\"font-size:10px\" name=\"${name}\">"
     144
     145        TemplateFieldType.list().each { e ->
     146            res += "<option value=\"${customvalue}:${e}\""
     147            res += (e == selected) ? " selected" : ""
     148            res += ">${e}</option>"
     149        }
     150
     151        res += "</select>"
     152
     153        out << res
    141154    }
    142155}
Note: See TracChangeset for help on using the changeset viewer.