- Timestamp:
- Mar 23, 2010, 1:57:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy
r299 r305 19 19 import org.apache.poi.hssf.usermodel.HSSFCell 20 20 import org.apache.poi.ss.usermodel.DataFormatter 21 import dbnp.studycapturing.Study 22 import dbnp.studycapturing.Subject 23 import dbnp.studycapturing.Event 24 import dbnp.studycapturing.Protocol 25 import dbnp.studycapturing.Sample 21 26 22 27 class ImporterTagLib { … … 72 77 * 73 78 * @param importtemplate_id template identifier where fields are retrieved from 74 * @param columnindex column in the header we're talking about79 * @param MappingColumn object containing all required information 75 80 * @return chooser object 76 81 * */ 77 82 def propertyChooser = { attrs -> 78 // TODO: this should be changed to retrieving fields per entity 79 def t = Template.get(session.importtemplate_id) 80 def columnindex = attrs['columnindex'] 83 // TODO: this should be changed to retrieving fields per entity instead of from one template 84 // and session variables should not be used inside the service, migrate to controller 81 85 82 switch (attrs['entitytype']) { 83 case 0 : createPropertySelect(attrs['name'], t.fields, columnindex) 84 break 85 case 1 : break 86 case 2 : break 87 case 3 : break 88 default : out << createPropertySelect(attrs['name'], t.fields, columnindex) 89 break 90 } 86 def t = Template.get(session.importtemplate_id) 87 def mc = attrs['mappingcolumn'] 88 89 out << createPropertySelect(attrs['name'], t.fields.findAll { it.type == mc.templatefieldtype }, mc.index) 91 90 } 92 91 93 92 /** 94 93 * @param name name of the HTML select object 95 * @param options list of options to be used94 * @param options list of options (fields) to be used 96 95 * @param columnIndex column identifier (corresponding to position in header of the Excel sheet) 97 96 * @return HTML select object 98 97 */ 99 def createPropertySelect(String name, options, StringcolumnIndex)100 { 98 def createPropertySelect(String name, options, Integer columnIndex) 99 { 101 100 def res = "<select style=\"font-size:10px\" name=\"${name}\">" 102 101 103 options.each { f -> 102 options.each { f -> 104 103 res += "<option value=\"${columnIndex}:${f.id}\"" 105 104 //res += (e.type.toInteger() == selected) ? " selected" : ""
Note: See TracChangeset
for help on using the changeset viewer.