Changeset 953 for trunk


Ignore:
Timestamp:
Oct 20, 2010, 6:16:20 PM (13 years ago)
Author:
j.a.m.wesbeek@…
Message:
Location:
trunk/grails-app
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy

    r952 r953  
    448448                                // handle form data
    449449                                eventPage(flow, flash, params) ? success() : error()
    450                         }.to "groups"
     450                        }.to "eventsNext"
    451451                        on("quickSave") {
    452452                                // handle form data
    453453                                eventPage(flow, flash, params) ? success() : error()
    454454                        }.to "waitForSave"
     455                }
     456
     457                // decide to show a warning page or not
     458                eventsNext {
     459                        action {
     460                                def assigned = false
     461
     462                                // check if all sampling events are in an eventGroup
     463                                flow.study.samplingEvents.each() { samplingEvent ->
     464                                        // iterate through eventGroups
     465                                        flow.study.eventGroups.each() { eventGroup ->
     466                                                if ( eventGroup.samplingEvents.find { it.equals(samplingEvent) } ) {
     467                                                        assigned = true
     468                                                }
     469                                        }
     470                                }
     471
     472                                if (assigned) {
     473                                        toGroupsPage()
     474                                } else {
     475                                        toWarningPage()
     476                                }
     477                        }
     478                        on("toWarningPage").to "unassignedSamplingEventWarning"
     479                        on("toGroupsPage").to "groups"
     480                }
     481
     482                // warning page for unassigned samplingEvent
     483                unassignedSamplingEventWarning {
     484                        render(view: "_unassigned_samplingEvent_warning")
     485                        onRender {
     486                                flow.page = 4
     487                                success()
     488                        }
     489                        on("next").to "groups"
     490                        on("previous").to "events"
    455491                }
    456492
     
    475511                        }.to "waitForSave"
    476512                }
    477 
    478                 // decide to show a warning page or not
    479 
    480513
    481514                // sample 'previous' page with warning
Note: See TracChangeset for help on using the changeset viewer.