Ignore:
Timestamp:
Jun 4, 2010, 12:15:24 PM (11 years ago)
Author:
roberth
Message:

Adding of contacts is made possible in the study creation wizard.

File:
1 edited

Legend:

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

    r496 r527  
    4848    static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
    4949
     50    /**
     51     * Fires after every action and determines the layout of the page
     52     */
     53    def afterInterceptor = { model, modelAndView ->
     54      println( params );
     55
     56      if ( params['dialog'] ) {
     57        model.layout = 'dialog';
     58        model.extraparams = [ 'dialog': 'true' ] ;
     59      } else {
     60        model.layout = 'main';
     61        model.extraparams = [] ;
     62      }
     63    }
     64
    5065    def index = {
    5166        redirect(action: "list", params: params)
     
    6580    def save = {
    6681        def personRoleInstance = new PersonRole(params)
     82        def extraparams = new LinkedHashMap();
     83
     84        if( params[ 'dialog' ] ) {
     85          extraparams[ 'dialog' ] = params[ 'dialog' ]
     86        }
     87
    6788        if (personRoleInstance.save(flush: true)) {
    6889            flash.message = "${message(code: 'default.created.message', args: [message(code: 'personRole.label', default: 'Role'), personRoleInstance.name])}"
    6990            //redirect(action: "show", id: personRoleInstance.id)
    70             redirect(action: "list")
     91            redirect(action: "list", params: extraparams)
    7192        }
    7293        else {
     
    99120    def update = {
    100121        def personRoleInstance = PersonRole.get(params.id)
     122        def extraparams = new LinkedHashMap();
     123
     124        if( params[ 'dialog' ] ) {
     125          extraparams[ 'dialog' ] = params[ 'dialog' ]
     126        }
     127
    101128        if (personRoleInstance) {
    102129            if (params.version) {
     
    113140                flash.message = "${message(code: 'default.updated.message', args: [message(code: 'personRole.label', default: 'Role'), personRoleInstance.name])}"
    114141                //redirect(action: "show", id: personRoleInstance.id)
    115                 redirect(action: "list")
     142                redirect(action: "list", params: extraparams)
    116143
    117144            }
     
    122149        else {
    123150            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'personRole.label', default: 'Role'), params.id])}"
    124             redirect(action: "list")
     151            redirect(action: "list", params: extraparams)
    125152        }
    126153    }
     
    128155    def delete = {
    129156        def personRoleInstance = PersonRole.get(params.id)
     157        def extraparams = new LinkedHashMap();
     158
     159        if( params[ 'dialog' ] ) {
     160          extraparams[ 'dialog' ] = params[ 'dialog' ]
     161        }
     162
    130163
    131164        if (personRoleInstance) {
     
    134167                personRoleInstance.delete(flush: true)
    135168                flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'personRole.label', default: 'Role'), roleName])}"
    136                 redirect(action: "list")
     169                redirect(action: "list", params: extraparams)
    137170            }
    138171            catch (org.springframework.dao.DataIntegrityViolationException e) {
    139172                flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'personRole.label', default: 'Role'), roleName])}"
    140173                // redirect(action: "show", id: params.id)
    141                 redirect(action: "list")
     174                redirect(action: "list", params: extraparams)
    142175            }
    143176        }
    144177        else {
    145178            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'personRole.label', default: 'Role'), params.id])}"
    146             redirect(action: "list")
     179            redirect(action: "list", params: extraparams)
    147180        }
    148181    }
Note: See TracChangeset for help on using the changeset viewer.