Changeset 173
- Timestamp:
- Feb 8, 2010, 8:23:33 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r169 r173 26 26 def ImporterService 27 27 28 /** 29 * Default page 30 **/ 28 31 def index = { } 29 32 … … 31 34 * This method will move the uploaded file to a temporary path and send the header 32 35 * and the first n rows to the preview 36 * @param importfile uploaded file to import 33 37 */ 34 38 def upload = { … … 46 50 47 51 } 52 53 def accept = { 54 55 } 48 56 } -
trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy
r169 r173 18 18 class ImporterTagLib { 19 19 static namespace = 'importer' 20 def entities = [[value:0, name:"Study"], [value:1, name:"Subject"], [value:2, name:"Event"], 21 [value:3, name:"Protocol"], [value:4, name:"Sample"]] 22 23 def celltypes = [[value:0, name:"Numeric"], [value:1, name:"String"], [value:2, name:"Formula"], 24 [value:3, name:"Blank"], [value:4, name:"Boolean"], [value:5, name:"Error"]] 20 25 21 26 /** … … 32 37 } 33 38 39 def createSelect(int selected, String name, ArrayList options) { 40 def res = "<select style=\"font-size:10px\" name=\"${name}\">" 41 42 options.each { e -> 43 res += "<option value=\"${e.value}\"" 44 res += (e.value == selected) ? " selected" : "" 45 res += ">${e.name}</option>" 46 } 47 48 res += "</select>" 49 return res 50 } 51 52 /** 53 * @param selected selected entity 54 * @param name name of the HTML select object 55 **/ 56 def entitySelect = { attrs -> 57 def selected = (attrs['selected']==null) ? -1 : attrs['selected'] 58 out << createSelect(selected, attrs['name'], entities) 59 } 60 34 61 /** 35 62 * @param selected selected celltype 36 63 * @param name name of the HTML select object 37 * @param celltypes built-in cell types, based on the cell type 38 * @see org.apache.poi.ss.usermodel.Cell 64 * @see org.apache.poi.ss.usermodel.Cell for the possible cell types 39 65 * @return HTML select object 40 66 */ 41 def celltypeselector = { attrs -> 42 def selected = attrs['selected'] 43 def name = attrs['name'] 44 def celltypes = [[celltype:0, name:"Numeric"], [celltype:1, name:"String"], [celltype:2, name:"Formula"], 45 [celltype:3, name:"Blank"], [celltype:4, name:"Boolean"], [celltype:5, name:"Error"]] 46 47 def res = "<select name=\"${name}\">" 48 49 celltypes.each { c -> 50 res += "<option value=\"${c.celltype}\"" 51 res += (c.celltype == selected) ? " selected" : "" 52 res += ">${c.name}</option>" 53 } 54 55 res += "</select>" 56 57 out << res 67 def celltypeSelect = { attrs -> 68 def selected = (attrs['selected']==null) ? -1 : attrs['selected'] 69 out << createSelect(selected, attrs['name'], celltypes) 58 70 } 59 60 71 } -
trunk/grails-app/views/importer/common/_preview.gsp
r169 r173 15 15 <g:form name="previewform" action="accept"> 16 16 <table> 17 <tr> 18 <g:each var="column" in="${header}"> 19 <td>${column.value}<br /> 20 <importer:celltypeselector selected="${column.celltype}" name="celltype[${column.columnindex}]"/> 21 </td> 22 </g:each> 23 </tr> 17 <tr> 18 <td>Columnname:</td> 19 <g:each var="column" in="${header}"> 20 <td class="header"> 21 <b>${column.value}</b> 22 </td> 23 </g:each> 24 </tr> 25 26 <tr> 27 <td>Datatype:</td> 28 <g:each var="column" in="${header}"> 29 <td class="header"> 30 <importer:celltypeSelect selected="${column.celltype}" name="celltype[${column.columnindex}]"/> 31 </td> 32 </g:each> 33 </tr> 34 35 <tr> 36 <td>Entity:</td> 37 <g:each var="column" in="${header}"> 38 <td class="header"> 39 <importer:entitySelect name="entity[${column.columnindex}]"/> 40 </td> 41 </g:each> 42 </tr> 43 24 44 <g:each var="row" in="${datamatrix}"> 25 45 <tr> 46 <td>Value</td> 26 47 <g:each var="column" in="${row}"> 27 <td >48 <td class="datamatrix"> 28 49 <g:if test="${column.toString()==''}">.</g:if> 29 50 <g:else>${column.toString()}</g:else> … … 32 53 </tr> 33 54 </g:each> 34 35 <td align="right" colspan="${datamatrix.length}"><input type="submit" value="Accept"></td>36 55 <tr> 56 <td align="right" colspan="${datamatrix.length}"><input type="submit" value="Accept"></td> 57 </tr> 37 58 </table> 38 59 </g:form> -
trunk/web-app/css/importer.css
r169 r173 1 .header 2 { 3 border-collapse:collapse; 4 border-width: 1px; 5 border-color: red; 6 background-color: #DDDDDD; 7 } 8 9 .datamatrix 10 { 11 background-color: #CCDDCC; 12 } 13
Note: See TracChangeset
for help on using the changeset viewer.