Changeset 1035


Ignore:
Timestamp:
Nov 1, 2010, 4:38:36 PM (6 years ago)
Author:
adem.bilican@…
Message:

SimpleTox? exporter with file downloading system

Location:
trunk/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/exporter/ExporterController.groovy

    r1000 r1035  
    8888
    8989        HSSFWorkbook wb = new HSSFWorkbook()
    90         FileOutputStream fileOut = new FileOutputStream(studyInstance.title+"_SimpleTox.xls")
     90        //FileOutputStream fileOut = new FileOutputStream(studyInstance.title+"_SimpleTox.xls")
    9191//        HSSFCellStyle style = wb.createCellStyle()
    9292//        style.setFillForegroundColor((short) HSSFColor.RED.index)
     
    126126            sub.createCell((short)8).setCellValue(studyInstance.samples.getAt(s-1).parentSubject.species.name)
    127127
     128            // adding the subject domain + template properties
    128129            for (u in 0..studyInstance.samples.getAt(s-1).parentSubject.giveFields().unique().size()-1){
    129                 row.createCell((short)9+u).setCellValue(studyInstance.samples.getAt(s-1).parentSubject.giveFields().getAt(u).toString())
    130 //                println "VALUE "+studyInstance.samples.getAt(s-1).parentSubject.getFieldValue(u.name)
    131130                TemplateField tf = studyInstance.samples.getAt(s-1).parentSubject.giveFields().getAt(u)
    132 //                println tf.name
    133 //                println studyInstance.samples.getAt(s-1).parentSubject.giveFields().getAt(u)
    134131                row.createCell((short)9+u).setCellValue(tf.name)
    135132                studyInstance.samples.getAt(s-1).parentSubject.getFieldValue(tf.name) ? sub.createCell((short)9+u).setCellValue(studyInstance.samples.getAt(s-1).parentSubject.getFieldValue(tf.name).toString()) : "not define"
    136133            }
    137134
     135            // adding the samplingEvent domain + template properties
     136            for (t in 0..studyInstance.samples.getAt(s-1).parentEvent.giveFields().unique().size()-1){
     137                TemplateField tf = studyInstance.samples.getAt(s-1).parentEvent.giveFields().getAt(t)
     138                row.createCell((short)9+studyInstance.samples.getAt(s-1).parentSubject.giveFields().unique().size()+t).setCellValue(tf.name)
     139                studyInstance.samples.getAt(s-1).parentEvent.getFieldValue(tf.name) ? sub.createCell((short)9+studyInstance.samples.getAt(s-1).parentSubject.giveFields().unique().size()+t).setCellValue(studyInstance.samples.getAt(s-1).parentEvent.getFieldValue(tf.name).toString()) : "not define"
     140            }
     141
     142            // adding samples domain + template properties
     143            TemplateField sf = studyInstance.samples.getAt(s-1).giveFields().getAt(s)
     144            //println studyInstance.samples.getAt(s-1).getFieldValue(sf.name)
     145
     146            // adding Event domaine + template properties
     147
     148
    138149        }
     150        //println "DOMAINS " +studyInstance.samples.getAt(s-1).parentSubject.giveFields()
    139151
    140         //println "DOMAINS " +studyInstance.samples.getAt(s-1).parentSubject.giveFields()
     152        //wb.write(fileOut)
     153        //fileOut.close()
     154
     155        response.setHeader("Content-disposition", "attachment;filename=\"${studyInstance.title}_SimpleTox.xls\"")
     156        response.setContentType("application/octet-stream")
     157        wb.write(response.outputStream)
     158        response.outputStream.close()
     159
    141160       
    142        
    143         wb.write(fileOut)
    144         fileOut.close()
    145161    }
    146162
     163 
    147164}
  • trunk/grails-app/views/exporter/index.gsp

    r1000 r1035  
    7878    </div>
    7979
    80     <div class="paginateButtons">
    81         <g:paginate total="${studyInstanceTotal}" prev="&laquo; Previous" next="&raquo; Next" />
    82         <br>
    83         <INPUT TYPE=submit name=submit Value="Export">
     80
     81    <div class="paginateButtons" id="button">
    8482    </div>
     83
     84<!--    <g:submitToRemote action="test" update="result" />-->
     85
     86<!--    <g:submitToRemote action="export" update="[success:'message',failure:'error']" />-->
     87
     88    <INPUT TYPE=submit name=submit Value="Export">
     89
    8590  </div>
     91
     92    <div id="result">  </div>
     93
    8694</g:form>
     95
    8796</body>
    8897</html>
Note: See TracChangeset for help on using the changeset viewer.