Changeset 256
- Timestamp:
- Mar 11, 2010, 11:48:16 AM (13 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r255 r256 62 62 63 63 /** 64 * User has assigned all entities and celltypes to the columns and continues to the next step (assigning properties to columns)64 * User has assigned all entities and templatefieldtypes to the columns and continues to the next step (assigning properties to columns) 65 65 * All information of the columns is stored in a session as MappingColumn object 66 66 * 67 67 * @param entity list of entities and columns it has been assigned to (columnindex:entitytype format) 68 * @param celltype list of celltypes and columns it has been assigned to (columnindex:celltype format)68 * @param templatefieldtype list of celltypes and columns it has been assigned to (columnindex:templatefieldtype format) 69 69 * @return properties page 70 70 * 71 71 * @see celltype: http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html 72 72 */ 73 def savepreview = { 73 def savepreview = { 74 def tft = null 74 75 def entities = request.getParameterValues("entity") 75 def celltypes = request.getParameterValues("celltype")76 def templatefieldtypes = request.getParameterValues("templatefieldtype") 76 77 77 celltypes.each { c -> 78 def temp = c.split(":") 79 def celltype = temp[1].toInteger() 80 def templatefieldtype = TemplateFieldType.STRING 78 templatefieldtypes.each { t -> 79 def temp = t.split(":") 80 def templatefieldtype = temp[1] 81 81 82 session.header[temp[0].toInteger()].celltype = celltype 83 84 switch (celltype) { 85 case 0 : templatefieldtype = TemplateFieldType.INTEGER 86 break 87 case 1 : templatefieldtype = TemplateFieldType.STRING 88 break 89 case 2 : // formula cell type, cannot handle this 90 break 91 case 3 : templatefieldtype = TemplateFieldType.STRING 92 break 93 case 4 : templatefieldtype = TemplateFieldType.STRING 94 break 82 switch (templatefieldtype) { 83 case "STRING" : tft = TemplateFieldType.STRING 84 break 85 case "TEXT" : tft = TemplateFieldType.TEXT 86 break 87 case "INTEGER" : tft = TemplateFieldType.INTEGER 88 break 89 case "FLOAT" : tft = TemplateFieldType.FLOAT 90 break 91 case "DOUBLE" : tft = TemplateFieldType.DOUBLE 92 break 93 case "STRINGLIST" : tft = TemplateFieldType.STRINGLIST 94 break 95 case "ONTOLOGYTERM" : tft = TemplateFieldType.ONTOLOGYTERM 96 break 97 case "DATE" : tft = TemplateFieldType.DATE 98 break 95 99 default: break 96 100 } 101 session.header[temp[0].toInteger()].templatefieldtype = tft 97 102 } 98 103 99 104 entities.each { e -> 100 105 def temp = e.split(":") 101 Class clazz 106 Class clazz 102 107 103 108 switch (temp[1].toInteger()) { … … 113 118 break 114 119 default: clazz = Object 120 break 115 121 } 116 122 … … 132 138 */ 133 139 def saveproperties = { 140 def columnproperties = request.getParameterValues("columnproperty") 134 141 135 def columnproperties = request.getParameterValues("columnproperty")136 142 columnproperties.each { cp -> 137 143 def temp = cp.split(":") -
trunk/grails-app/domain/dbnp/importer/MappingColumn.groovy
r255 r256 15 15 dbnp.studycapturing.TemplateFieldType templatefieldtype 16 16 Class entity 17 String property 18 Integer celltype 17 String property 19 18 Integer index 20 19 String value … … 25 24 26 25 String toString() { 27 return "Name:" + name + "/TemplateFieldType:" + templatefieldtype + "/Entity:" + entity + "/Property:" + property + "/ Celltype:" + celltype + "/Index:" + index + "/Value:" + value26 return "Name:" + name + "/TemplateFieldType:" + templatefieldtype + "/Entity:" + entity + "/Property:" + property + "/Index:" + index + "/Value:" + value 28 27 } 29 28 } -
trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy
r255 r256 22 22 def standardentities = [[type:-1, name:"Don't import"], [type:0, name:"Study"], [type:1, name:"Subject"], [type:2, name:"Event"], 23 23 [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 ]*/30 24 31 25 /** … … 62 56 } 63 57 64 def createSelect( intselected, String name, options, String customvalue) {58 def createSelect(selected, String name, options, String customvalue) { 65 59 def res = "<select style=\"font-size:10px\" name=\"${name}\">" 66 60 67 61 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>" 71 65 } 72 66 … … 118 112 } 119 113 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 128 129 } 129 130 … … 134 135 * @return HTML select object 135 136 */ 136 def celltypeSelect = { attrs ->137 def templatefieldtypeSelect = { attrs -> 137 138 def selected = (attrs['selected']==null) ? -1 : attrs['selected'] 138 139 def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue'] 140 def name = (attrs['name']==null) ? "" : attrs['name'] 139 141 //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 141 154 } 142 155 } -
trunk/grails-app/views/importer/common/_preview.gsp
r255 r256 28 28 <g:each var="column" in="${header}"> 29 29 <td class="header"> 30 <importer: celltypeSelect selected="${column.value.templatefieldtype}" name="celltype" customvalue="${column.key.toString()}"/>30 <importer:templatefieldtypeSelect selected="${column.value.templatefieldtype}" name="templatefieldtype" customvalue="${column.key.toString()}"/> 31 31 </td> 32 32 </g:each>
Note: See TracChangeset
for help on using the changeset viewer.