Changeset 219
- Timestamp:
- Mar 1, 2010, 5:47:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/EventDescriptionController.groovy
r162 r219 47 47 48 48 def showMyProtocol = { 49 50 def protocol = ( params.protocolid) ? Protocol.get(params.protocolid) : Protocol.find("for Protocol id") 51 def event = Event.get(params.id) 52 def protocolInstance = event.eventDescription.protocol 53 54 if( protocolInstance && protocolInstance && protocol.id==protocolInstance.id ) { 55 def parameterStringValues = event.parameterStringValues 56 render( view:"showMyProtocolFilled", model:["protocolInstance":protocolInstance,"event":event,"parameterStringValues":parameterStringValues] ) 49 def description = EventDescription.get(params.id) 50 if( description.protocol==null ) { 51 protocol = new Protocol() 52 render( view:"showMyProtocolEmpty", model:[protocol:protocol,description:description] ) 57 53 } 58 54 else { 59 if(protocol!=null) render( view: "showMyProtocolEmpty", model:["protocolInstance":protocol] ) 60 else render( "NULL" ) 55 render( view: "showMyProtocolFilled", model:[protocol:description.protocol,description:description] ) 61 56 } 62 } 57 } 58 59 60 def showMyProtocolEmpty = { 61 println "in showMyProtocolEmpty" 62 } 63 64 65 def showMyProtocolFilled = { 66 println "in showMyProtocolFilled" 67 } 68 69 70 63 71 64 72 … … 121 129 122 130 123 def test = { println "test" 124 render("test") } 131 def test = { render(params) } 132 133 def test2 = { 134 def eventDescriptionInstance = EventDescription.get(params.id) 135 if (!eventDescriptionInstance) { 136 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'eventDescription.label', default: 'EventDescription'), params.id])}" 137 redirect(action: "list") 138 } 139 else { 140 return [eventDescriptionInstance: eventDescriptionInstance] 141 } 142 } 143 144 145 def addProtocolParameter = { 146 render( action:"showProtocolParameters", model:['addNew':true] ) 147 } 148 149 150 def showProtocolParameters = { 151 println params 152 153 def description = EventDescription.get(params.id) 154 def protocol = description.protocol==null ? new Protocol() : description.protocol 155 156 if( params['addOneParameter']=='true') { // add a new parameter 157 println "adding" 158 def parameter = new ProtocolParameter() 159 protocol.addToParameters(parameter) 160 } 161 162 def list = [] 163 protocol.parameters.each { 164 list.add(it) 165 list.sort{ a,b -> a.name <=> b.name } 166 } 167 168 render( view:"showProtocolParameters", model:[protocol:protocol,description:description,list:list] ) 169 } 170 125 171 }
Note: See TracChangeset
for help on using the changeset viewer.