Changeset 1685
- Timestamp:
- Apr 1, 2011, 10:31:36 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/SimpleWizardController.groovy
r1684 r1685 127 127 success() 128 128 }.to "existingSamples" 129 130 129 on("previous").to "study" 130 on("refresh") { 131 if( !handleExistingSamples( flow.study, params, flow ) ) 132 return error() 133 134 // Refresh the templates, since the template editor has been opened. 135 flow.templates = [ 136 'Subject': Template.findAllByEntity( Subject.class ).collect { it.refresh(); return it }, 137 'Event': Template.findAllByEntity( Event.class ).collect { it.refresh(); return it }, 138 'SamplingEvent': Template.findAllByEntity( SamplingEvent.class ).collect { it.refresh(); return it }, 139 'Sample': Template.findAllByEntity( Sample.class ).collect { it.refresh(); return it } 140 ]; 141 }.to "existingSamples" 131 142 on("update") { 132 143 handleExistingSamples( flow.study, params, flow ) ? success() : error() … … 173 184 flow.sampleForm.importFile = filename 174 185 175 // Refresh the templates, since the template editor has been opened. To make this happen 176 // the hibernate session has to be cleared first 177 sessionFactory.getCurrentSession().clear(); 178 186 // Refresh the templates, since the template editor has been opened. 179 187 flow.templates = [ 180 'Subject': Template.findAllByEntity( Subject.class ) ,181 'Event': Template.findAllByEntity( Event.class ) ,182 'SamplingEvent': Template.findAllByEntity( SamplingEvent.class ) ,183 'Sample': Template.findAllByEntity( Sample.class ) 188 'Subject': Template.findAllByEntity( Subject.class ).collect { it.refresh(); return it }, 189 'Event': Template.findAllByEntity( Event.class ).collect { it.refresh(); return it }, 190 'SamplingEvent': Template.findAllByEntity( SamplingEvent.class ).collect { it.refresh(); return it }, 191 'Sample': Template.findAllByEntity( Sample.class ).collect { it.refresh(); return it } 184 192 ]; 185 186 193 }.to "samples" 187 194 on("previous").to "returnFromSamples" … … 295 302 }.to "overview" 296 303 on( "previous" ).to "returnFromAssays" 304 on( "save" ) { 305 handleAssays( flow.assay, params, flow ); 306 if( flow.assay.template && !validateObject( flow.assay ) ) 307 error(); 308 309 if( saveStudyToDatabase( flow ) ) { 310 flash.message = "Your study is succesfully saved."; 311 } else { 312 flash.error = "An error occurred while saving your study: <br />" 313 flow.study.getErrors().each { flash.error += it.toString() + "<br />"} 314 return error(); 315 } 316 }.to "assays" 297 317 on("refresh") { 298 // Refresh the templates, since the template editor has been opened. To make this happen299 // the hibernate session has to be cleared first300 //sessionFactory.getCurrentSession().clear();301 302 318 handleAssays( flow.assay, params, flow ); 303 319 … … 319 335 on( "previous" ).to "startAssays" 320 336 } 321 322 337 saveStudy { 323 338 action { 324 if( flow.assay && flow.assay.template && !flow.study.assays?.contains( flow.assay ) ) { 325 flow.study.addToAssays( flow.assay ); 326 } 327 328 if( flow.study.save( flush: true ) ) { 329 // Make sure all samples are attached to all assays 330 flow.study.assays.each { assay -> 331 def l = []+ assay.samples; 332 l.each { sample -> 333 if( sample ) 334 assay.removeFromSamples( sample ); 335 } 336 assay.samples?.clear(); 337 338 flow.study.samples.each { sample -> 339 assay.addToSamples( sample ) 340 } 341 } 342 339 if( saveStudyToDatabase( flow ) ) { 343 340 flash.message = "Your study is succesfully saved."; 344 345 341 finish(); 346 342 } else { 347 343 flash.error = "An error occurred while saving your study: <br />" 348 344 flow.study.getErrors().each { flash.error += it.toString() + "<br />"} 349 350 // Remove the assay from the study again, since it is still available351 // in the session352 if( flow.assay ) {353 flow.study.removeFromAssays( flow.assay );354 flow.assay.parent = flow.study;355 }356 357 345 overview(); 358 346 } … … 366 354 handleError{ 367 355 redirect action: "errorPage" 356 } 357 } 358 359 /** 360 * Saves the study with assay 361 * 362 * @param flow 363 * @return true on success, false otherwise 364 */ 365 protected boolean saveStudyToDatabase( def flow ) { 366 // Save the assay to the study 367 if( flow.assay && flow.assay.template && !flow.study.assays?.contains( flow.assay ) ) { 368 flow.study.addToAssays( flow.assay ); 369 } 370 371 if( flow.study.save( flush: true ) ) { 372 // Make sure all samples are attached to all assays 373 flow.study.assays.each { assay -> 374 def l = []+ assay.samples; 375 l.each { sample -> 376 if( sample ) 377 assay.removeFromSamples( sample ); 378 } 379 assay.samples?.clear(); 380 381 flow.study.samples.each { sample -> 382 assay.addToSamples( sample ) 383 } 384 } 385 386 return true; 387 388 } else { 389 // Remove the assay from the study again, since it is still available 390 // in the session 391 if( flow.assay ) { 392 flow.study.removeFromAssays( flow.assay ); 393 flow.assay.parent = flow.study; 394 } 395 396 return false; 368 397 } 369 398 } -
trunk/grails-app/views/simpleWizard/simpleWizard/assays.gsp
r1678 r1685 9 9 <body> 10 10 <div class="simpleWizard assayspage"> 11 <h1>Assay</h1> 11 <h1> 12 Assay 13 <span class="stepNumber">(step 3 of 4)</span> 14 </h1> 12 15 13 16 <g:if test="${error}"> … … 61 64 <a class="previous" href="#" onClick="submitForm( 'assays', 'previous' ); return false;">Previous</a> 62 65 <a class="next" href="#" onClick="submitForm( 'assays', 'next' ); return false;">Next</a> 66 <a class="save separator" href="#" onClick="submitForm( 'assays', 'save' ); return false;">Save</a> 63 67 <a class="skip" href="#" onClick="submitForm( 'assays', 'skip' ); return false;">Skip</a> 64 68 </p> -
trunk/grails-app/views/simpleWizard/simpleWizard/columns.gsp
r1684 r1685 9 9 <body> 10 10 <div class="simpleWizard"> 11 <h1>Imported file</h1> 11 <h1> 12 Imported file 13 <span class="stepNumber">(step 2 of 4)</span> 14 </h1> 12 15 13 16 <g:if test="${error}"> -
trunk/grails-app/views/simpleWizard/simpleWizard/complexStudy.gsp
r1608 r1685 11 11 <body> 12 12 <div class="simpleWizard"> 13 <h1>Complex study</h1> 13 <h1> 14 Complex study 15 <span class="stepNumber">(step 2 of 4)</span> 16 </h1> 14 17 15 18 <span class="info"> … … 32 35 <p class="options"> 33 36 <a href="#" onClick="submitForm( 'existingSamples', 'previous' ); return false;" class="previous">Previous</a> 34 <a href="#" onClick="submitForm( 'existingSamples', 'save' ); return false;" class="save ">Save</a>37 <a href="#" onClick="submitForm( 'existingSamples', 'save' ); return false;" class="save separator">Save</a> 35 38 </p> 36 39 </div> -
trunk/grails-app/views/simpleWizard/simpleWizard/existingSamples.gsp
r1684 r1685 86 86 <p class="options"> 87 87 <a href="#" onClick="submitForm( 'existingSamples', 'previous' ); return false;" class="previous">Previous</a> 88 <a href="#" onClick="submitForm( 'existingSamples', 'save' ); return false;" class="save">Save</a>89 88 <a href="#" onClick="submitForm( 'existingSamples', 'next' ); return false;" class="next">Next</a> 89 90 <a href="#" onClick="submitForm( 'existingSamples', 'save' ); return false;" class="save update">Save</a> 90 91 <a href="#" onClick="submitForm( 'existingSamples', 'update' ); return false;" class="excel">Update using excel</a> 91 92 <a href="#" onClick="submitForm( 'existingSamples', 'skip' ); return false;" class="skip">Skip</a> -
trunk/grails-app/views/simpleWizard/simpleWizard/finish.gsp
r1611 r1685 23 23 24 24 <p class="options"> 25 <g:link class="view" controller="study" action="show" id="${study.id}">View study</g:link>26 <g:link class="edit" controller="simpleWizard" action="index" id="${study.id}">Edit study</g:link>25 <g:link class="view" controller="study" action="show" id="${study.id}">View this study</g:link> 26 <g:link class="edit" controller="simpleWizard" action="index" id="${study.id}">Edit this study</g:link> 27 27 <g:link class="restart" controller="simpleWizard" action="index">Add another study</g:link> 28 28 </p> -
trunk/grails-app/views/simpleWizard/simpleWizard/missingFields.gsp
r1678 r1685 9 9 <body> 10 10 <div class="simpleWizard"> 11 <h1>Edit properties</h1> 11 <h1> 12 Edit imported data 13 <span class="stepNumber">(step 2 of 4)</span> 14 </h1> 12 15 13 16 <g:if test="${error}"> -
trunk/grails-app/views/simpleWizard/simpleWizard/overview.gsp
r1622 r1685 9 9 <body> 10 10 <div class="simpleWizard"> 11 <h1>Study overview</h1> 11 <h1> 12 Study overview 13 <span class="stepNumber">(step 4 of 4)</span> 14 </h1> 12 15 13 16 <g:if test="${error}"> … … 133 136 <p class="options"> 134 137 <a class="previous" href="#" onClick="submitForm( 'overview', 'previous' ); return false;">Previous</a> 135 <a class="save " href="#" onClick="submitForm( 'overview', 'save' ); return false;">Save</a>138 <a class="save separator" href="#" onClick="submitForm( 'overview', 'save' ); return false;">Save</a> 136 139 </p> 137 140 -
trunk/grails-app/views/simpleWizard/simpleWizard/samples.gsp
r1684 r1685 11 11 <body> 12 12 <div class="simpleWizard samplespage"> 13 <h1>Study data</h1> 13 <h1> 14 Study data 15 <span class="stepNumber">(step 2 of 4)</span> 16 </h1> 14 17 15 18 <span class="info"> … … 154 157 <p class="options"> 155 158 <a href="#" onClick="submitForm( 'samples', 'previous' ); return false;" class="previous">Previous</a> 156 <a href="#" onClick="submitForm( 'samples', 'next' ); return false;" class="next">Next</a> 157 <a class="skip" href="#" onClick="submitForm( 'samples', 'skip' ); return false;">Skip</a> 159 <a href="#" onClick="submitForm( 'samples', 'next' ); return false;" class="next default">Next</a> 160 161 <a class="skip separator" href="#" onClick="submitForm( 'samples', 'skip' ); return false;">Skip</a> 158 162 </p> 159 163 </div> -
trunk/grails-app/views/simpleWizard/simpleWizard/study.gsp
r1684 r1685 16 16 Study 17 17 </g:else> 18 <span class="stepNumber">(step 1 of 4)</span> 18 19 </h1> 19 20 <g:if test="${error}"> … … 101 102 102 103 <p class="options"> 103 <a class="save" href="#" onClick="submitForm( 'study', 'save' ); return false;">Save</a>104 104 <a href="#" onClick="submitForm( 'study', 'next' ); return false;" class="next">Next</a> 105 <a class="save separator" href="#" onClick="submitForm( 'study', 'save' ); return false;">Save</a> 105 106 </p> 106 107 -
trunk/web-app/css/buttons.css
r1553 r1685 5 5 .options a { 6 6 font-size: 10px; 7 margin-right: 10px; 7 8 font-weight: bold; 8 margin-right: 10px;9 9 padding-top: 2px; 10 10 padding-bottom: 2px; … … 14 14 background-repeat: no-repeat; 15 15 } 16 17 .options a.default {} 18 .options .separator { margin-left: 25px; } 16 19 17 20 #content .options a.disabled { color: #aaa; cursor: default; } -
trunk/web-app/css/simplewizard.css
r1684 r1685 1 1 /** GENERAL **/ 2 2 .simpleWizard .options { border-top: 1px solid #ccc; } 3 .simpleWizard { font-size: 11px; } 3 .simpleWizard { font-size: 11px; } 4 .simpleWizard .stepNumber { padding-left: 20px; color: #39A3ED; } 4 5 5 6 /** STUDY PAGE **/
Note: See TracChangeset
for help on using the changeset viewer.