Changeset 1617
- Timestamp:
- Mar 10, 2011, 1:06:54 PM (11 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/exporter/ExporterController.groovy
r1588 r1617 50 50 51 51 def export = { 52 52 def ids = params.list( 'ids' ); 53 53 def studies = [] 54 for ( j in dbnp.studycapturing.Study.list() ){ 55 if (params.containsKey(j.code)){ 56 studies.add(j) 57 } 58 } 54 55 ids.each { 56 if( it.toString().isLong() ) { 57 def study = Study.get( Long.valueOf( it ) ); 58 if( study ) 59 studies << study 60 } 61 } 59 62 60 63 if(studies.size()>1){ … … 63 66 for (studyInstance in studies){ 64 67 downloadFile(studyInstance,false) 65 files.add(new File("web-app/fileuploads/"+studyInstance. code+"_SimpleTox.xls"))68 files.add(new File("web-app/fileuploads/"+studyInstance.id+"_SimpleTox.xls")) 66 69 } 67 70 … … 166 169 if(dl) { 167 170 println "Creation for downloading the file "+studyInstance.title+"_SimpleTox.xls" 168 response.setHeader("Content-disposition", "attachment;filename=\"${studyInstance. code}_SimpleTox.xls\"")171 response.setHeader("Content-disposition", "attachment;filename=\"${studyInstance.title}_SimpleTox.xls\"") 169 172 response.setContentType("application/octet-stream") 170 173 wb.write(response.outputStream) … … 174 177 // Create the file and save into ZIP 175 178 if(!dl){ 176 FileOutputStream fileOut = new FileOutputStream("web-app/fileuploads/"+studyInstance. code+"_SimpleTox.xls", true)179 FileOutputStream fileOut = new FileOutputStream("web-app/fileuploads/"+studyInstance.id+"_SimpleTox.xls", true) 177 180 wb.write(fileOut) 178 181 fileOut.close() -
trunk/grails-app/controllers/dbnp/query/AdvancedQueryController.groovy
r1596 r1617 579 579 switch(s.entity) { 580 580 case "Study": 581 def exportParams = [:]581 def ids = [] 582 582 s.filterResults(selectedIds).each { 583 exportParams[ it.code ] = it.id;583 ids << it.id 584 584 } 585 585 586 return [[ 586 587 module: "gscf", 587 588 name:"simpletox", 588 589 description: "Export as SimpleTox", 589 url: createLink( controller: "exporter", action: "export", params: exportParams)590 url: createLink( controller: "exporter", action: "export", params: [ 'ids' : ids ] ) 590 591 ]] 591 592 case "Sample": -
trunk/grails-app/views/exporter/index.gsp
r1430 r1617 7 7 <g:set var="entityName" value="${message(code: 'study.label', default: 'Study')}" /> 8 8 <title>SimpleTox Exporter</title> 9 10 11 12 9 13 10 </head> … … 41 38 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 42 39 43 <td><input type="checkbox" name=" ${studyInstance.code}" id="checked_studies"></td>40 <td><input type="checkbox" name="ids" value="${studyInstance.id}" id="${studyInstance.title}"</td> 44 41 45 42 <td><g:link controller="study" action="show" id="${studyInstance.id}">${fieldValue(bean: studyInstance, field: "code")}</g:link></td>
Note: See TracChangeset
for help on using the changeset viewer.