Changeset 1261 for trunk/grails-app
- Timestamp:
- Dec 13, 2010, 11:50:28 AM (10 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BuildConfig.groovy
r1232 r1261 47 47 //grails.plugin.location.'grom' = '../grom' 48 48 //grails.plugin.location.'ajax-flow' = '../AjaxFlow' 49 //grails.plugin.location.'jumpbar' = '../jumpbar' -
trunk/grails-app/conf/Config.groovy
r1199 r1261 93 93 metabolomics { 94 94 url = "http://test.metabolomics.dbnp.org" 95 95 96 } 96 97 } -
trunk/grails-app/controllers/dbnp/studycapturing/AssayController.groovy
- Property svn:keywords changed from Author Date Rev to Date Author Rev
r959 r1261 3 3 class AssayController { 4 4 5 def assayService 6 def authenticationService 7 5 8 static allowedMethods = [save: "POST", update: "POST", delete: "POST"] 6 9 … … 115 118 } 116 119 } 120 121 /** 122 * Shows a page where an assay from a study can be selected 123 * 124 * @param none 125 */ 126 def selectAssay = { 127 def user = authenticationService.getLoggedInUser() 128 def studies = Study.findAllByOwner(user) 129 def assays = Assay.findAllByParent(studies[0]) 130 131 [userStudies: studies, assays: assays] 132 } 133 134 /** 135 * Exports all assay information as an Excel file. 136 * 137 * @param params.id Assay id 138 */ 139 def exportAssayAsExcel = { 140 Assay assay = Assay.get(params.id) 141 142 if (!assay) { 143 flash.errorMessage = "No assay found with id: $params.id." 144 redirect action: 'selectAssay' 145 return 146 } 147 148 // TODO: refactor into service 149 150 // Gather sample meta data from GSCF 151 def samples = assay.samples 152 153 def collectUsedTemplateFields = { templateEntityList -> 154 155 def templateFields = templateEntityList*.giveFields().flatten().unique().findAll{it} 156 def usedTemplateFields = templateFields.findAll{ tf -> 157 158 templateEntityList.any { it.fieldExists(tf.name) && it.getFieldValue(tf.name) } 159 } 160 161 def m = [:] 162 usedTemplateFields.each { tf -> 163 m["${tf.name}"] = templateEntityList.collect{ it.fieldExists(tf.name) ? it.getFieldValue(tf.name) : '' } 164 } 165 m 166 } 167 168 // get all sample related subjects 169 def assayData = [ 170 'Subject Data': collectUsedTemplateFields(samples*.parentSubject.unique()), 171 'Sampling Event Data': collectUsedTemplateFields(samples*.parentEvent.unique()), 172 'Event Data': collectUsedTemplateFields(samples*.parentEventGroup.events.flatten().unique()), 173 'Sample Data': collectUsedTemplateFields(samples)] 174 175 // Gather sample meta data from the module 176 177 // - sample metadata 178 179 // Gather measurement data from the module 180 181 // - measurements 182 183 // Write to excel 184 185 println assayData 186 187 try { 188 assayService.exportAssayDataAsExcelFile(assayData) 189 } catch (Exception e) { 190 flash.errorMessage = e.message 191 redirect action: 'selectAssay' 192 } 193 } 117 194 } -
trunk/grails-app/controllers/dbnp/studycapturing/StudyController.groovy
- Property svn:keywords changed from Author Date Rev to Date Author Rev
r1245 r1261 367 367 } 368 368 369 /*def edit = { 370 def studyInstance = Study.get(params.id) 371 if (!studyInstance) { 372 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 373 redirect(action: "list") 374 } 375 else { 376 return [studyInstance: studyInstance] 377 } 378 } 379 380 def update = { 381 def studyInstance = Study.get(params.id) 382 if (studyInstance) { 383 if (params.version) { 384 def version = params.version.toLong() 385 if (studyInstance.version > version) { 386 387 studyInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'study.label', default: 'Study')] as Object[], "Another user has updated this Study while you were editing") 388 render(view: "edit", model: [studyInstance: studyInstance]) 389 return 390 } 391 } 392 studyInstance.properties = params 393 if (!studyInstance.hasErrors() && studyInstance.save(flush: true)) { 394 flash.message = "${message(code: 'default.updated.message', args: [message(code: 'study.label', default: 'Study'), studyInstance.id])}" 395 redirect(action: "show", id: studyInstance.id) 396 } 397 else { 398 render(view: "edit", model: [studyInstance: studyInstance]) 399 } 400 } 401 else { 402 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 403 redirect(action: "list") 404 } 405 } 406 */ 369 /** 370 * Renders assay names and id's as JSON 371 */ 372 def ajaxGetAssays = { 373 374 def study = Study.read(params.id) 375 render study?.assays?.collect{[name: it.name, id: it.id]} as JSON 376 } 377 378 407 379 } -
trunk/grails-app/views/study/show_assays.gsp
- Property svn:keywords set to Date Author Rev
r1213 r1261 31 31 <td>${assay.module.name}</td> 32 32 <td>${assay.module.platform}</td> 33 %{--<td><a href="${assay.module.url}/assay/${assay.externalAssayID}">view</a></td>--}% 34 <td><jumpbar:link 35 linkDest="${createLink(action:'show', id:studyInstance.id)}/#Assays" 36 linkText='Go back to GSCF' 37 frameSource="${assay.module.url}/assay/showByToken/${assay.externalAssayID}" 38 pageTitle="Assay View in Module"> 33 <td> 34 <jumpbar:link frameSource="${assay.module.url}/assay/showByToken/${assay.externalAssayID}" pageTitle="Metabolomics Module"> 39 35 view 40 36 </jumpbar:link></td>
Note: See TracChangeset
for help on using the changeset viewer.