Ignore:
Timestamp:
Feb 15, 2010, 9:38:24 PM (8 years ago)
Author:
tabma
Message:
  • properties template
File:
1 edited

Legend:

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

    r173 r200  
    3737    }
    3838
    39     def createSelect(int selected, String name, ArrayList options) {
     39    def entity = { attrs ->
     40        out << entities[attrs['index']].name
     41    }
     42
     43    /**
     44     * @param entities array of entity:columnindex values
     45     */
     46    def properties = { attrs ->
     47        def ent = []
     48
     49        attrs['entities'].each { e ->
     50            def temp = e.split(":")         
     51            def entity = [type:temp[0],columnindex:temp[1]]
     52            ent.add(entity)
     53        }
     54
     55        out << render (template:"common/properties", model:[entities:ent])
     56    }
     57
     58    def createSelect(int selected, String name, ArrayList options, String customvalue) {
    4059        def res = "<select style=\"font-size:10px\" name=\"${name}\">"
    4160
    4261        options.each { e ->
    43             res += "<option value=\"${e.value}\""
     62            res += "<option value=\"${e.value}:${customvalue}\""
    4463            res += (e.value == selected) ? " selected" : ""
    4564            res += ">${e.name}</option>"
     
    5069    }
    5170
     71   
     72
    5273    /**
    5374     * @param selected selected entity
     
    5677    def entitySelect = { attrs ->       
    5778        def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    58         out << createSelect(selected, attrs['name'], entities)
     79        def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
     80        out << createSelect(selected, attrs['name'], entities, customvalue)
    5981    }
    6082
     
    6789    def celltypeSelect = { attrs ->
    6890        def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    69         out << createSelect(selected, attrs['name'], celltypes)
     91        def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
     92        out << createSelect(selected, attrs['name'], celltypes, customvalue)
    7093    }
    7194}
Note: See TracChangeset for help on using the changeset viewer.