Ignore:
Timestamp:
May 12, 2010, 1:23:35 PM (11 years ago)
Author:
tabma
Message:
  • refactored code and templates of the Importer Wizard, now makes use of indexed formparameters
File:
1 edited

Legend:

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

    r359 r415  
    5353
    5454    /**
    55      * @param entities array in the format of columnindex:entitytype format
     55     * @param entities array
    5656     */
    5757    def properties = { attrs ->
     
    5959        def header = attrs['header']
    6060
    61         attrs['entities'].each { se ->
    62             def temp = se.split(":")
    63             def entity = [type:temp[1],columnindex:temp[0]]
     61        attrs['entities'].index.each { columnindex, entitytype ->
     62            def entity = [type:entitytype,columnindex:columnindex.toInteger()]
    6463            selectedentities.add(entity)
    6564        }
     
    7069    /**
    7170     * Possibly this will later on return an AJAX-like autocompletion chooser for the fields?
    72      *
     71     *
     72     * @param name name for the property chooser element
    7373     * @param importtemplate_id template identifier where fields are retrieved from
    7474     * @param MappingColumn object containing all required information
     
    8787
    8888    /**
     89     * Create the property chooser select element
     90     *
    8991     * @param name name of the HTML select object
    9092     * @param options list of options (fields) to be used
     
    9496    def createPropertySelect(String name, options, Integer columnIndex)
    9597    {   
    96         def res = "<select style=\"font-size:10px\" name=\"${name}\">"
     98        def res = "<select style=\"font-size:10px\" name=\"${name}.index.${columnIndex}\">"
    9799
    98100        options.each { f ->         
    99             res += "<option value=\"${columnIndex}:${f.id}\""
     101            res += "<option value=\"${f.id}\""
    100102            //res += (e.type.toInteger() == selected) ? " selected" : ""
    101103            res += ">${f}</option>"
     
    120122        def name = (attrs['name']==null) ? -1 : attrs['name']
    121123
    122         def res = "<select style=\"font-size:10px\" name=\"${name}\">"
     124        def res = "<select style=\"font-size:10px\" name=\"${name}.index.${custval}\">"
    123125
    124126        standardentities.each { e ->
    125             res += "<option value=\"${custval}:${e.type}\""
     127            res += "<option value=\"${e.type}\""
    126128            res += (e.type == sel) ? " selected" : ""
    127129            res += ">${e.name}</option>"
     
    133135
    134136    /**
     137     * Create a templatefieldtype selector
     138     *
    135139    * @param selected selected TemplateFieldType
    136140    * @param customvalue custom value to be combined in the option(s) of the selector
     
    142146    def templatefieldtypeSelect = { attrs ->
    143147        def selected = (attrs['selected']==null) ? -1 : attrs['selected']
    144         def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue']
     148        def custval = (attrs['customvalue']==null) ? "" : attrs['customvalue']
    145149        def name = (attrs['name']==null) ? "" : attrs['name']   
    146150
    147         def res = "<select style=\"font-size:10px\" name=\"${name}\">"
     151        def res = "<select style=\"font-size:10px\" name=\"${name}.index.${custval}\">"
    148152
    149153        TemplateFieldType.list().each { e ->
    150             res += "<option value=\"${customvalue}:${e}\""
     154            res += "<option value=\"${e}\""
    151155            res += (e == selected) ? " selected" : ""
    152156            res += ">${e}</option>"
Note: See TracChangeset for help on using the changeset viewer.