Changeset 231 for trunk


Ignore:
Timestamp:
Mar 3, 2010, 3:50:32 PM (13 years ago)
Author:
tabma
Message:
  • property page contains columns and field identifiers combined in the select dropdown
Location:
trunk/grails-app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r203 r231  
    125125            return System.currentTimeMillis() + Runtime.runtime.freeMemory()
    126126        }
     127
     128    def importdata = {
     129       
     130    }
    127131}
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r215 r231  
    1515
    1616package dbnp.importer
     17import dbnp.studycapturing.Template
    1718
    1819class ImporterTagLib {
     
    7071    }
    7172
    72    
     73    /**
     74     * Possibly this will later on return an AJAX-like autocompletion chooser for the fields?
     75     *
     76     * @param importtemplate_id template identifier where fields are retrieved from
     77     * @param columnindex column in the header we're talking about
     78     * @return chooser object
     79     * */
     80    def propertyChooser = { attrs ->
     81        // TODO: this should be changed to retrieving fields per entity
     82        def t = Template.get(session.importtemplate_id)
     83        def columnindex = attrs['columnindex']
     84
     85        switch (attrs['entitytype']) {
     86            case 0  : createSelect(-1, "property", t.fields, "1")
     87                     break
     88            case 1  : break
     89            case 2  : break
     90            case 3  : break
     91            default : out << createPropertySelect("property", t.fields, columnindex)
     92                     break
     93        }
     94    }
     95
     96    /**
     97     * @param name name of the HTML select object
     98     * @param options list of options to be used
     99     * @param columnIndex column identifier (corresponding to position in header of the Excel sheet)
     100     * @return HTML select object
     101     */
     102    def createPropertySelect(String name, options, String columnIndex)
     103    {
     104        def res = "<select style=\"font-size:10px\" name=\"${name}\">"
     105
     106        options.each { f ->
     107            res += "<option value=\"${columnIndex}:${f.id}\""
     108            //res += (e.type.toInteger() == selected) ? " selected" : ""
     109            res += ">${f}</option>"
     110        }
     111
     112        res += "</select>"
     113        return res
     114    }   
    73115
    74116    /**
     
    93135        out << createSelect(selected, attrs['name'], standardcelltypes, customvalue)
    94136    }
    95    
    96 
    97137}
  • trunk/grails-app/views/importer/common/_properties.gsp

    r215 r231  
    2626                                <b>${header[selentity.columnindex.toInteger()].value}</b>
    2727                            </td>
    28                             <td>
    29                                
    30                                 <g:each var="template" in="${templates}">
    31                                     ${template.studyFields()}
    32                                 </g:each>
     28                            <td>                               
     29                                <!-- <g:select name="template" from="${templates.fields}"/> -->
     30                                <importer:propertyChooser entity="${selentity.type.toLong()}" columnindex="${selentity.columnindex}"/>
    3331                            </td>
     32                        </tr>
    3433                    </g:if>
    3534                </g:each>
     
    4039              </tr>
    4140          </g:each>
     41        <tr>
     42            <td>
     43                <input type="submit" name="savebutton" value="Next"/>
     44            </td>
     45        </tr>
     46
    4247    </table>
    4348</g:form>
Note: See TracChangeset for help on using the changeset viewer.