- Timestamp:
- Jun 2, 2010, 4:22:42 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/DataSource.groovy
r488 r509 64 64 url = "jdbc:postgresql://localhost:5432/gscf" 65 65 dialect = org.hibernate.dialect.PostgreSQLDialect 66 logSql = true // enable logging while not yet final66 //logSql = true // enable logging while not yet final 67 67 68 68 /* Apparently Hibernate performs two queries on inserting, one before -
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r503 r509 62 62 [title: 'Done'] // finish page 63 63 ] 64 success() 64 65 } 65 66 … … 72 73 onRender { 73 74 flow.page = 1 75 success() 74 76 } 75 77 on("next").to "start" … … 81 83 onRender { 82 84 flow.page = 1 85 success() 83 86 } 84 87 on("next").to "study" … … 92 95 flow.page = 1 93 96 flash.cancel = true 97 success() 94 98 } 95 99 on("cancel") { 96 100 flow.study = null 101 102 success() 97 103 }.to "start" 98 104 on("next") { … … 105 111 flash.errors 106 112 ) 113 114 error() 107 115 }.to "modify" 108 116 } … … 115 123 onRender { 116 124 flow.page = 2 125 success() 117 126 } 118 127 on("refresh") { … … 123 132 124 133 // remove errors as we don't want any warnings now 125 flash.errors = [:] 134 flash.errors = [:] 135 136 success() 126 137 }.to "study" 127 138 on("switchTemplate") { … … 133 144 // remove errors as we don't want any warnings now 134 145 flash.errors = [:] 146 147 success() 135 148 }.to "study" 136 149 on("previous") { … … 166 179 flow.subjectTemplates = [:] 167 180 } 181 success() 168 182 } 169 183 on("refresh") { 170 184 flash.values = params 185 success() 171 186 }.to "subjects" 172 187 on("add") { … … 205 220 flow.subjectTemplates[ subjectTemplateName ].subjects[ subjectsSize ] = increment 206 221 } 222 223 success() 207 224 }.to "subjects" 208 225 on("next") { … … 268 285 flash.values.templateType = (flow.event instanceof Event) ? 'event' : 'sample' 269 286 } 287 success() 270 288 } 271 289 on("switchTemplate") { … … 330 348 flow.events.remove(delete) 331 349 } 350 351 success() 332 352 }.to "events" 333 353 on("addEventGroup") { 334 354 flash.values = params 335 355 356 // handle study data 357 this.handleEvents(flow, flash, params) 358 336 359 // handle event groupings 337 360 this.handleEventGrouping(flow, flash, params) … … 361 384 362 385 flow.eventGroups[increment] = new EventGroup( name: groupName ) 386 387 success() 363 388 }.to "events" 364 389 on("deleteEventGroup") { 365 390 flash.values = params 366 367 391 def delete = params.get('do') as int; 368 392 … … 375 399 flow.eventGroups.remove(delete) 376 400 } 401 402 success() 377 403 }.to "events" 378 404 on("previous") { … … 402 428 onRender { 403 429 flow.page = 5 430 success() 404 431 } 405 432 on("previous") { 406 433 this.handleSubjectGrouping(flow, flash, params) 434 success() 407 435 }.to "events" 408 436 on("next") { 409 437 this.handleSubjectGrouping(flow, flash, params) 438 success() 410 439 }.to "samples" 411 440 } … … 416 445 onRender { 417 446 flow.page = 6 447 flow.bla = "samples" 448 449 // iterate through subjects 450 flow.subjects.each() { subject -> 451 println subject.value.name 452 453 // iterate through events 454 flow.events.each() { event -> 455 println "bla" 456 if (event instanceof SamplingEvent) { 457 //println event.getFieldValue('name') 458 println event.startTime 459 println event.endTime 460 } 461 462 } 463 } 464 465 success() 418 466 } 419 467 on("previous") { 468 success() 420 469 }.to "groups" 421 470 on("next") { 422 }.to "samples" 471 success() 472 }.to "confirm" 423 473 } 424 474 … … 433 483 on("toEvents").to "events" 434 484 on("toGroups").to "groups" 435 on("previous").to " groups"485 on("previous").to "samples" 436 486 on("next").to "save" 437 487 } … … 443 493 flash.errors = [:] 444 494 445 // start transaction446 def transaction = sessionFactory.getCurrentSession().beginTransaction()447 448 495 // persist data to the database 449 496 try { 450 // save EventDescriptions 451 flow.eventDescriptions.each() { 452 if (!it.save(flush:true)) { 453 this.appendErrors(it, flash.errors) 454 throw new Exception('error saving eventDescription') 455 } 456 println "saved eventdescription "+it 457 } 458 459 // TODO: eventDescriptions that are not linked to an event are currently 460 // stored but end up in a black hole. We should either decide to 461 // NOT store these eventDescriptions, or add "hasmany eventDescriptions" 462 // to Study domain class 497 println ".saving wizard data..." 463 498 464 499 // save events 465 flow.events.each() { 466 if (!it.save(flush:true)) { 467 this.appendErrors(it, flash.errors) 500 println ".saving events" 501 flow.events.each() { event -> 502 if (!event.save(flush:true)) { 503 this.appendErrors(event, flash.errors) 468 504 throw new Exception('error saving event') 469 505 } 470 println "saved event "+it471 506 472 507 // add to study 473 if ( it instanceof SamplingEvent) {474 flow.study.addToSamplingEvents( it)508 if (event instanceof SamplingEvent) { 509 flow.study.addToSamplingEvents(event) 475 510 } else { 476 flow.study.addToEvents( it)511 flow.study.addToEvents(event) 477 512 } 513 514 println ".saved event ["+event+"] of type ["+event.getClass()+"] (id: "+event.id+")" 478 515 } 479 516 517 // save subjects 518 println ".saving subjects" 519 flow.subjects.each() { subjectId, subject -> 520 if (!subject.save(flush:true)) { 521 this.appendErrors(subject.value, flash.errors) 522 throw new Exception('error saving subject') 523 } 524 525 // add this subject to the study 526 flow.study.addToSubjects(subject) 527 528 println ".saved subject "+subject+" (id: "+subject.id+")" 529 } 530 480 531 // save eventGroups 481 flow.eventGroups.each() { 482 if (!it.save(flush:true)) { 483 this.appendErrors(it, flash.errors) 532 println ".saving eventGroups" 533 flow.eventGroups.each() { eventGroup -> 534 if (!eventGroup.save(flush:true)) { 535 this.appendErrors(eventGroup, flash.errors) 484 536 throw new Exception('error saving eventGroup') 485 537 } 486 println "saved eventGroup "+it487 538 488 539 // add to study 489 flow.study.addToEventGroups(it) 540 flow.study.addToEventGroups(eventGroup) 541 542 println ".saved eventGroup ["+eventGroup+"] (id: "+eventGroup.id+")" 490 543 } 491 492 // save subjects493 flow.subjects.each() {494 if (!it.save(flush:true)) {495 this.appendErrors(it, flash.errors)496 throw new Exception('error saving subject')497 }498 println "saved subject "+it499 500 // add this subject to the study501 flow.study.addToSubjects(it)502 }503 544 504 545 // save study 546 println ".saving study" 505 547 if (!flow.study.save(flush:true)) { 506 548 this.appendErrors(flow.study, flash.errors) 507 549 throw new Exception('error saving study') 508 550 } 509 println "saved study "+flow.study+" (id: "+flow.study.id+")" 510 511 // commit transaction 512 println "commit" 513 transaction.commit() 551 println ".saved study "+flow.study+" (id: "+flow.study.id+")" 552 514 553 success() 515 554 } catch (Exception e) { … … 520 559 flash.debug = e.getStackTrace() 521 560 522 println "rollback"523 transaction.rollback()524 561 error() 525 562 } … … 653 690 } 654 691 655 // got an event in the flow scope?656 //if (!flow.event) flow.event = new Event()657 658 692 // if a template is selected, get template instance 659 693 if (template instanceof String && template.size() > 0) { … … 731 765 */ 732 766 def handleSubjectGrouping(flow, flash, params) { 733 println params734 735 767 // iterate through event groups 736 768 def g = 0 … … 746 778 } 747 779 } 748 749 println g+" : "+eventGroup.subjects750 780 751 781 g++ -
trunk/grails-app/views/wizard/pages/_confirmation.gsp
r359 r509 29 29 <p> 30 30 You are about to create a study containing ${subjects.size()} subjects, 31 ${eventDescriptions.size()} event descriptions and ${events.size()} events grouped into 32 ${eventGroups.size()} event groups. 31 ${events.size()} events grouped into ${eventGroups.size()} event groups. 33 32 </p> 34 33 </div> … … 37 36 <p> 38 37 <ul> 39 <li>title: ${study?.title}</li> 40 <li>description: ${study?.description}</li> 41 <li>research question: ${study?.researchQuestion}</li> 42 <li>code: ${study?.code}</li> 43 <li>EC code: ${study?.ecCode}</li> 44 <g:each var="field" in="${study.template.fields}"> 38 <g:each var="field" in="${study.giveFields()}"> 45 39 <li>${field.name} - ${study.getFieldValue(field.name)}</li> 46 40 </g:each> -
trunk/grails-app/views/wizard/pages/_samples.gsp
r503 r509 18 18 19 19 <span class="info"> 20 <span class="title">Samples bla bla</span>21 bla bla bla samples blah di bla blah...20 <span class="title">Samples</span> 21 blah blah blaaa.... 22 22 </span> 23 23 24 todo... 24 25 25 26 </wizard:pageContent> -
trunk/web-app/css
- Property svn:ignore
-
old new 1 1 main.css
-
- Property svn:ignore
Note: See TracChangeset
for help on using the changeset viewer.