- Timestamp:
- Feb 15, 2010, 9:38:24 PM (10 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r182 r200 38 38 def upload = { 39 39 def downloadedfile = request.getFile('importfile'); 40 def tempfile = new File(System.getProperty('java.io.tmpdir') + File. pathSeparator + System.currentTimeMillis() + ".nmcdsp")40 def tempfile = new File(System.getProperty('java.io.tmpdir') + File.separatorChar + System.currentTimeMillis() + ".nmcdsp") 41 41 downloadedfile.transferTo(tempfile) 42 42 … … 50 50 } 51 51 52 def accept = { 53 52 def savepreview = { 53 def entities = request.getParameterValues("entity") 54 55 render(view:"step2", model:[entities:entities]) 54 56 } 55 57 } -
trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy
r173 r200 37 37 } 38 38 39 def createSelect(int selected, String name, ArrayList options) { 39 def entity = { attrs -> 40 out << entities[attrs['index']].name 41 } 42 43 /** 44 * @param entities array of entity:columnindex values 45 */ 46 def properties = { attrs -> 47 def ent = [] 48 49 attrs['entities'].each { e -> 50 def temp = e.split(":") 51 def entity = [type:temp[0],columnindex:temp[1]] 52 ent.add(entity) 53 } 54 55 out << render (template:"common/properties", model:[entities:ent]) 56 } 57 58 def createSelect(int selected, String name, ArrayList options, String customvalue) { 40 59 def res = "<select style=\"font-size:10px\" name=\"${name}\">" 41 60 42 61 options.each { e -> 43 res += "<option value=\"${e.value} \""62 res += "<option value=\"${e.value}:${customvalue}\"" 44 63 res += (e.value == selected) ? " selected" : "" 45 64 res += ">${e.name}</option>" … … 50 69 } 51 70 71 72 52 73 /** 53 74 * @param selected selected entity … … 56 77 def entitySelect = { attrs -> 57 78 def selected = (attrs['selected']==null) ? -1 : attrs['selected'] 58 out << createSelect(selected, attrs['name'], entities) 79 def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue'] 80 out << createSelect(selected, attrs['name'], entities, customvalue) 59 81 } 60 82 … … 67 89 def celltypeSelect = { attrs -> 68 90 def selected = (attrs['selected']==null) ? -1 : attrs['selected'] 69 out << createSelect(selected, attrs['name'], celltypes) 91 def customvalue = (attrs['customvalue']==null) ? "" : attrs['customvalue'] 92 out << createSelect(selected, attrs['name'], celltypes, customvalue) 70 93 } 71 94 } -
trunk/grails-app/views/importer/common/_preview.gsp
r173 r200 13 13 */ 14 14 %> 15 <g:form name="previewform" action=" accept">15 <g:form name="previewform" action="savepreview"> 16 16 <table> 17 17 <tr> … … 28 28 <g:each var="column" in="${header}"> 29 29 <td class="header"> 30 <importer:celltypeSelect selected="${column.celltype}" name="celltype [${column.columnindex}]"/>30 <importer:celltypeSelect selected="${column.celltype}" name="celltype" customvalue="${column.columnindex.toString()}"/> 31 31 </td> 32 32 </g:each> … … 37 37 <g:each var="column" in="${header}"> 38 38 <td class="header"> 39 <importer:entitySelect name="entity [${column.columnindex}]"/>39 <importer:entitySelect name="entity" customvalue="${column.columnindex.toString()}"/> 40 40 </td> 41 41 </g:each>
Note: See TracChangeset
for help on using the changeset viewer.