Changeset 21 for trunk/src/grails-app/controllers
- Timestamp:
- Jan 19, 2009, 8:31:46 PM (16 years ago)
- Location:
- trunk/src/grails-app/controllers
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/grails-app/controllers/EntryController.groovy
r16 r21 1 1 class EntryController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Entry 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ entryInstanceList: Entry.list( params ) ] 11 } 12 13 def show = { 14 def entryInstance = Entry.get( params.id ) 15 16 if(!entryInstance) { 17 flash.message = "Entry not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ entryInstance : entryInstance ] } 21 } 22 23 def delete = { 24 def entryInstance = Entry.get( params.id ) 25 if(entryInstance) { 26 entryInstance.delete() 27 flash.message = "Entry ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Entry not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def entryInstance = Entry.get( params.id ) 38 39 if(!entryInstance) { 40 flash.message = "Entry not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ entryInstance : entryInstance ] 45 } 46 } 47 48 def update = { 49 def entryInstance = Entry.get( params.id ) 50 if(entryInstance) { 51 entryInstance.properties = params 52 if(!entryInstance.hasErrors() && entryInstance.save()) { 53 flash.message = "Entry ${params.id} updated" 54 redirect(action:show,id:entryInstance.id) 55 } 56 else { 57 render(view:'edit',model:[entryInstance:entryInstance]) 58 } 59 } 60 else { 61 flash.message = "Entry not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def entryInstance = new Entry() 68 entryInstance.properties = params 69 return ['entryInstance':entryInstance] 70 } 71 72 def save = { 73 def entryInstance = new Entry(params) 74 if(!entryInstance.hasErrors() && entryInstance.save()) { 75 flash.message = "Entry ${entryInstance.id} created" 76 redirect(action:show,id:entryInstance.id) 77 } 78 else { 79 render(view:'create',model:[entryInstance:entryInstance]) 80 } 81 } 4 82 } -
trunk/src/grails-app/controllers/ModificationController.groovy
r16 r21 1 1 class ModificationController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Modification 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ modificationInstanceList: Modification.list( params ) ] 11 } 12 13 def show = { 14 def modificationInstance = Modification.get( params.id ) 15 16 if(!modificationInstance) { 17 flash.message = "Modification not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ modificationInstance : modificationInstance ] } 21 } 22 23 def delete = { 24 def modificationInstance = Modification.get( params.id ) 25 if(modificationInstance) { 26 modificationInstance.delete() 27 flash.message = "Modification ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Modification not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def modificationInstance = Modification.get( params.id ) 38 39 if(!modificationInstance) { 40 flash.message = "Modification not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ modificationInstance : modificationInstance ] 45 } 46 } 47 48 def update = { 49 def modificationInstance = Modification.get( params.id ) 50 if(modificationInstance) { 51 modificationInstance.properties = params 52 if(!modificationInstance.hasErrors() && modificationInstance.save()) { 53 flash.message = "Modification ${params.id} updated" 54 redirect(action:show,id:modificationInstance.id) 55 } 56 else { 57 render(view:'edit',model:[modificationInstance:modificationInstance]) 58 } 59 } 60 else { 61 flash.message = "Modification not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def modificationInstance = new Modification() 68 modificationInstance.properties = params 69 return ['modificationInstance':modificationInstance] 70 } 71 72 def save = { 73 def modificationInstance = new Modification(params) 74 if(!modificationInstance.hasErrors() && modificationInstance.save()) { 75 flash.message = "Modification ${modificationInstance.id} created" 76 redirect(action:show,id:modificationInstance.id) 77 } 78 else { 79 render(view:'create',model:[modificationInstance:modificationInstance]) 80 } 81 } 4 82 } -
trunk/src/grails-app/controllers/PersonController.groovy
r16 r21 1 1 class PersonController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Person 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ personInstanceList: Person.list( params ) ] 11 } 12 13 def show = { 14 def personInstance = Person.get( params.id ) 15 16 if(!personInstance) { 17 flash.message = "Person not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ personInstance : personInstance ] } 21 } 22 23 def delete = { 24 def personInstance = Person.get( params.id ) 25 if(personInstance) { 26 personInstance.delete() 27 flash.message = "Person ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Person not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def personInstance = Person.get( params.id ) 38 39 if(!personInstance) { 40 flash.message = "Person not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ personInstance : personInstance ] 45 } 46 } 47 48 def update = { 49 def personInstance = Person.get( params.id ) 50 if(personInstance) { 51 personInstance.properties = params 52 if(!personInstance.hasErrors() && personInstance.save()) { 53 flash.message = "Person ${params.id} updated" 54 redirect(action:show,id:personInstance.id) 55 } 56 else { 57 render(view:'edit',model:[personInstance:personInstance]) 58 } 59 } 60 else { 61 flash.message = "Person not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def personInstance = new Person() 68 personInstance.properties = params 69 return ['personInstance':personInstance] 70 } 71 72 def save = { 73 def personInstance = new Person(params) 74 if(!personInstance.hasErrors() && personInstance.save()) { 75 flash.message = "Person ${personInstance.id} created" 76 redirect(action:show,id:personInstance.id) 77 } 78 else { 79 render(view:'create',model:[personInstance:personInstance]) 80 } 81 } 4 82 } -
trunk/src/grails-app/controllers/TaskController.groovy
r16 r21 1 1 class TaskController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Task 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ taskInstanceList: Task.list( params ) ] 11 } 12 13 def show = { 14 def taskInstance = Task.get( params.id ) 15 16 if(!taskInstance) { 17 flash.message = "Task not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ taskInstance : taskInstance ] } 21 } 22 23 def delete = { 24 def taskInstance = Task.get( params.id ) 25 if(taskInstance) { 26 taskInstance.delete() 27 flash.message = "Task ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Task not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def taskInstance = Task.get( params.id ) 38 39 if(!taskInstance) { 40 flash.message = "Task not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ taskInstance : taskInstance ] 45 } 46 } 47 48 def update = { 49 def taskInstance = Task.get( params.id ) 50 if(taskInstance) { 51 taskInstance.properties = params 52 if(!taskInstance.hasErrors() && taskInstance.save()) { 53 flash.message = "Task ${params.id} updated" 54 redirect(action:show,id:taskInstance.id) 55 } 56 else { 57 render(view:'edit',model:[taskInstance:taskInstance]) 58 } 59 } 60 else { 61 flash.message = "Task not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def taskInstance = new Task() 68 taskInstance.properties = params 69 return ['taskInstance':taskInstance] 70 } 71 72 def save = { 73 def taskInstance = new Task(params) 74 if(!taskInstance.hasErrors() && taskInstance.save()) { 75 flash.message = "Task ${taskInstance.id} created" 76 redirect(action:show,id:taskInstance.id) 77 } 78 else { 79 render(view:'create',model:[taskInstance:taskInstance]) 80 } 81 } 4 82 } -
trunk/src/grails-app/controllers/TaskGroupController.groovy
r16 r21 1 1 class TaskGroupController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = TaskGroup 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ taskGroupInstanceList: TaskGroup.list( params ) ] 11 } 12 13 def show = { 14 def taskGroupInstance = TaskGroup.get( params.id ) 15 16 if(!taskGroupInstance) { 17 flash.message = "TaskGroup not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ taskGroupInstance : taskGroupInstance ] } 21 } 22 23 def delete = { 24 def taskGroupInstance = TaskGroup.get( params.id ) 25 if(taskGroupInstance) { 26 taskGroupInstance.delete() 27 flash.message = "TaskGroup ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "TaskGroup not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def taskGroupInstance = TaskGroup.get( params.id ) 38 39 if(!taskGroupInstance) { 40 flash.message = "TaskGroup not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ taskGroupInstance : taskGroupInstance ] 45 } 46 } 47 48 def update = { 49 def taskGroupInstance = TaskGroup.get( params.id ) 50 if(taskGroupInstance) { 51 taskGroupInstance.properties = params 52 if(!taskGroupInstance.hasErrors() && taskGroupInstance.save()) { 53 flash.message = "TaskGroup ${params.id} updated" 54 redirect(action:show,id:taskGroupInstance.id) 55 } 56 else { 57 render(view:'edit',model:[taskGroupInstance:taskGroupInstance]) 58 } 59 } 60 else { 61 flash.message = "TaskGroup not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def taskGroupInstance = new TaskGroup() 68 taskGroupInstance.properties = params 69 return ['taskGroupInstance':taskGroupInstance] 70 } 71 72 def save = { 73 def taskGroupInstance = new TaskGroup(params) 74 if(!taskGroupInstance.hasErrors() && taskGroupInstance.save()) { 75 flash.message = "TaskGroup ${taskGroupInstance.id} created" 76 redirect(action:show,id:taskGroupInstance.id) 77 } 78 else { 79 render(view:'create',model:[taskGroupInstance:taskGroupInstance]) 80 } 81 } 4 82 }
Note: See TracChangeset
for help on using the changeset viewer.