Changeset 139 for trunk/grails-app/controllers
- Timestamp:
- Sep 28, 2009, 10:01:43 AM (15 years ago)
- Location:
- trunk/grails-app/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/AppCoreController.groovy
r134 r139 5 5 def authenticateService 6 6 7 def index = { redirect(action: home,params:params) }7 def index = { redirect(action:start,params:params) } 8 8 9 9 // the delete, save and update actions only accept POST requests 10 10 //def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 11 11 12 /** 13 * This is where we arrive after login. 14 * Attach the welcome flash message and redirect to where ever we want the user to start. 15 * e.g. redirect(controller:"taskDetailed", action:"search") 16 */ 12 17 def welcome = { 13 18 def personInstance = Person.get(authenticateService.userDomain().id) … … 16 21 def sess = getSession() 17 22 sess.setMaxInactiveInterval(personInstance.sessionTimeout) 18 redirect(action: home)23 redirect(action:start) 19 24 } 20 25 21 def home = { 22 } 23 24 def options = { 25 } 26 27 def acknowledgements = { 26 def start = { 28 27 } 29 28 … … 35 34 if (request.method == 'POST') { 36 35 def personInstance = Person.get(authenticateService.userDomain().id) 37 // personInstance.sessionTimeout = params.sessionTimeout.toInteger()38 36 personInstance.properties = params 39 37 if (!personInstance.hasErrors() && personInstance.save()) { … … 41 39 sess.setMaxInactiveInterval(personInstance.sessionTimeout) 42 40 flash.message = "Session timeout changed." 43 redirect(action: options)41 redirect(action:start) 44 42 } 45 43 else { … … 68 66 //userCache.removeUserFromCache(personInstance.loginName) 69 67 flash.message = "Password changed successfully." 70 redirect(action: options)68 redirect(action:start) 71 69 } 72 70 else { -
trunk/grails-app/controllers/AssetDetailedController.groovy
r124 r139 3 3 class AssetDetailedController extends BaseController { 4 4 5 def index = { redirect(action: list,params:params) }5 def index = { redirect(action:search,params:params) } 6 6 7 7 // the delete, save and update actions only accept POST requests … … 13 13 } 14 14 15 def search = { 16 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 17 [ assetInstanceList: Asset.list( params ), assetInstanceTotal: Asset.count() ] 18 } 19 15 20 def show = { 21 22 // In the case of an actionSubmit button, rewrite action name from 'index'. 23 if(params._action_Show) 24 { params.action='show' } 25 16 26 def assetInstance = Asset.get( params.id ) 17 27 18 28 if(!assetInstance) { 19 29 flash.message = "Asset not found with id ${params.id}" 20 redirect(action: list)30 redirect(action:search) 21 31 } 22 32 else { return [ assetInstance : assetInstance ] } … … 29 39 assetInstance.delete() 30 40 flash.message = "Asset ${params.id} deleted" 31 redirect(action: list)41 redirect(action:search) 32 42 } 33 43 catch(org.springframework.dao.DataIntegrityViolationException e) { … … 38 48 else { 39 49 flash.message = "Asset not found with id ${params.id}" 40 redirect(action: list)50 redirect(action:search) 41 51 } 42 52 } 43 53 44 54 def edit = { 55 56 // In the case of an actionSubmit button, rewrite action name from 'index'. 57 if(params._action_Edit) 58 { params.action='edit' } 59 45 60 def assetInstance = Asset.get( params.id ) 46 61 47 62 if(!assetInstance) { 48 63 flash.message = "Asset not found with id ${params.id}" 49 redirect(action: list)64 redirect(action:search) 50 65 } 51 66 else { -
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r116 r139 3 3 class InventoryItemDetailedController extends BaseController { 4 4 5 def index = { redirect(action: list,params:params) }5 def index = { redirect(action:search, params:params) } 6 6 7 7 // the delete, save and update actions only accept POST requests … … 13 13 } 14 14 15 def search = { 16 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 17 [ inventoryItemInstanceList: InventoryItem.list( params ), inventoryItemInstanceTotal: InventoryItem.count() ] 18 } 19 15 20 def show = { 21 22 // In the case of an actionSubmit button, rewrite action name from 'index'. 23 if(params._action_Show) 24 { params.action='show' } 25 16 26 def inventoryItemInstance = InventoryItem.get( params.id ) 17 27 18 28 if(!inventoryItemInstance) { 19 29 flash.message = "InventoryItem not found with id ${params.id}" 20 redirect(action: list)30 redirect(action:search) 21 31 } 22 32 else { return [ inventoryItemInstance : inventoryItemInstance ] } … … 29 39 inventoryItemInstance.delete() 30 40 flash.message = "InventoryItem ${params.id} deleted" 31 redirect(action: list)41 redirect(action:search) 32 42 } 33 43 catch(org.springframework.dao.DataIntegrityViolationException e) { … … 38 48 else { 39 49 flash.message = "InventoryItem not found with id ${params.id}" 40 redirect(action: list)50 redirect(action:search) 41 51 } 42 52 } 43 53 44 54 def edit = { 55 56 // In the case of an actionSubmit button, rewrite action name from 'index'. 57 if(params._action_Edit) 58 { params.action='edit' } 59 45 60 def inventoryItemInstance = InventoryItem.get( params.id ) 46 61 47 62 if(!inventoryItemInstance) { 48 63 flash.message = "InventoryItem not found with id ${params.id}" 49 redirect(action: list)64 redirect(action:search) 50 65 } 51 66 else { -
trunk/grails-app/controllers/TaskDetailedController.groovy
r137 r139 2 2 3 3 class TaskDetailedController extends BaseController { 4 5 def index = { redirect(action:list,params:params) } 4 5 def index = { 6 println "index called" 7 redirect(action:search,params:params) 8 } 6 9 7 10 // the delete, save and update actions only accept POST requests 8 11 static allowedMethods = [delete:'POST', save:'POST', update:'POST'] 9 10 // def list = {11 // params.max = Math.min( params.max ? params.max.toInteger() : 10, 100)12 // def taskInstanceActives = Task.findAllByIsActive( true ).list( params )13 // // def taskInstanceList = taskInstanceActives.list( params )14 // return [ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceActives.count() ]15 // }16 12 17 13 def list = { … … 20 16 } 21 17 18 def search = { 19 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 20 21 if(!params.order) { 22 params.sort = "id" 23 params.order = "desc" 24 } 25 26 if(params.search == "ShowAll") 27 { 28 def taskInstanceActivesList = Task.findAllByIsActive(true, params) 29 def taskInstanceActivesTotal = Task.countByIsActive(true) 30 return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 31 } 32 if(params.search == "ShowDeleted") 33 { 34 def taskInstanceActivesList = Task.findAllByIsActive(false, params) 35 def taskInstanceActivesTotal = Task.countByIsActive(false) 36 return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 37 } 38 // Default: 39 def taskInstanceActivesList = Task.findAllByIsActive(true, params) 40 def taskInstanceActivesTotal = Task.countByIsActive(true) 41 [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 42 } 43 44 def searchShowAll = { 45 redirect(action:'search', params:[search:"ShowAll"]) 46 } 47 48 def searchShowDeleted = { 49 redirect(action:'search', params:[search:"ShowDeleted"]) 50 } 51 22 52 def show = { 53 54 // In the case of an actionSubmit button, rewrite action name from 'index'. 55 if(params._action_Show) 56 { params.action='show' } 57 23 58 def taskInstance = Task.get( params.id ) 24 59 25 60 if(!taskInstance) { 26 61 flash.message = "Task not found with id ${params.id}" 27 redirect(action: list)62 redirect(action:search) 28 63 } 29 64 else { … … 86 121 taskInstance.isActive = false 87 122 flash.message = "Task ${params.id} has been set to inactive." 88 redirect(action: list)123 redirect(action:search) 89 124 } 90 125 catch(org.springframework.dao.DataIntegrityViolationException e) { … … 95 130 else { 96 131 flash.message = "Task not found with id ${params.id}" 97 redirect(action: list)132 redirect(action:search) 98 133 } 99 134 } 100 135 101 136 def edit = { 137 138 // In the case of an actionSubmit button, rewrite action name from 'index'. 139 if(params._action_Edit) 140 { params.action='edit' } 141 102 142 def taskInstance = Task.get( params.id ) 103 143 104 144 if(!taskInstance) { 105 145 flash.message = "Task not found with id ${params.id}" 106 redirect(action: list)146 redirect(action:search) 107 147 } 108 148 else { … … 166 206 if(!parentTaskInstance) { 167 207 flash.message = "Task not found with id ${params.id}" 168 redirect(action: list)208 redirect(action:search) 169 209 } 170 210 else {
Note: See TracChangeset
for help on using the changeset viewer.