Changeset 140 for trunk/grails-app/controllers
- Timestamp:
- Oct 1, 2009, 5:11:48 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/TaskDetailedController.groovy
r139 r140 3 3 class TaskDetailedController extends BaseController { 4 4 5 def index = { 6 println "index called" 7 redirect(action:search,params:params) 8 } 5 def authenticateService 6 def dateUtilService 7 def filterService 9 8 10 9 // the delete, save and update actions only accept POST requests 11 10 static allowedMethods = [delete:'POST', save:'POST', update:'POST'] 12 11 12 def index = { redirect(action:search,params:params) } 13 13 14 def list = { 14 15 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 15 16 [ taskInstanceList: Task.list( params ), taskInstanceTotal: Task.count() ] 16 17 } 17 18 18 19 def search = { 19 20 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 20 21 21 if(!params.order) { 22 params.sort = "id" 23 params.order = "desc" 24 } 25 26 if(params.search == "ShowAll") 27 { 22 if(!params._action_search) 23 { 24 // Default: 28 25 def taskInstanceActivesList = Task.findAllByIsActive(true, params) 29 26 def taskInstanceActivesTotal = Task.countByIsActive(true) 30 27 return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 31 28 } 32 if(params.search == "ShowDeleted") 33 { 34 def taskInstanceActivesList = Task.findAllByIsActive(false, params) 35 def taskInstanceActivesTotal = Task.countByIsActive(false) 29 render( view:'search', 30 model:[ taskInstanceList: filterService.filter( params, Task ), 31 taskInstanceTotal: filterService.count( params, Task ), 32 filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params), 33 params:params ] ) 34 } 35 36 def advancedSearch = { 37 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 38 39 if(!params._action_advancedSearch) 40 { 41 // Default: 42 def taskInstanceActivesList = Task.findAllByIsActive(true, params) 43 def taskInstanceActivesTotal = Task.countByIsActive(true) 36 44 return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 37 45 } 38 // Default: 39 def taskInstanceActivesList = Task.findAllByIsActive(true, params) 40 def taskInstanceActivesTotal = Task.countByIsActive(true) 41 [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 42 } 46 render( view:'advancedSearch', 47 model:[ taskInstanceList: filterService.filter( params, Task ), 48 taskInstanceTotal: filterService.count( params, Task ), 49 filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params), 50 params:params ] ) 51 } 52 53 def searchTodays = { 54 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 55 56 def taskInstanceList = Task.createCriteria().list() { 57 eq("targetStartDate", dateUtilService.getToday()) 58 eq("isActive", true) 59 } 60 61 def taskInstanceTotal = Task.createCriteria().count() { 62 eq("targetStartDate", dateUtilService.getToday()) 63 eq("isActive", true) 64 } 65 66 if(taskInstanceTotal > 0) 67 { 68 flash.message = "Today's tasks" 69 } 70 else { flash.message = "No tasks found for today" } 71 72 render( view:'search', 73 model:[ taskInstanceList: taskInstanceList, 74 taskInstanceTotal: taskInstanceTotal]) 75 } 76 77 def searchMyTodays = { 78 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 79 80 def taskInstanceList = Task.createCriteria().list() { 81 eq("leadPerson", Person.get(authenticateService.userDomain().id)) 82 ge("targetStartDate", dateUtilService.getToday()) 83 eq("isActive", true) 84 } 85 86 def taskInstanceTotal = Task.createCriteria().count() { 87 eq("leadPerson", Person.get(authenticateService.userDomain().id)) 88 ge("targetStartDate", dateUtilService.getToday()) 89 eq("isActive", true) 90 } 91 92 if(taskInstanceTotal > 0) 93 { 94 flash.message = "Today's tasks" 95 } 96 else { flash.message = "No tasks found for today" } 97 98 render( view:'search', 99 model:[ taskInstanceList: taskInstanceList, 100 taskInstanceTotal: taskInstanceTotal]) 101 } 102 103 def searchInTheLastWeek = { 104 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 105 106 def taskInstanceList = Task.createCriteria().list() { 107 ge("targetStartDate", dateUtilService.getToday()-7) 108 eq("isActive", true) 109 } 110 111 def taskInstanceTotal = Task.createCriteria().count() { 112 ge("targetStartDate", dateUtilService.getToday()-7) 113 eq("isActive", true) 114 } 115 116 if(taskInstanceTotal > 0) 117 { 118 flash.message = "Tasks with target start date in the last week." 119 } 120 121 else {flash.message = "No tasks found with target start date in the last week." } 122 123 render( view:'search', 124 model:[ taskInstanceList: taskInstanceList, 125 taskInstanceTotal: taskInstanceTotal]) 126 } 127 128 def searchMyInTheLastWeek = { 129 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 130 131 def taskInstanceList = Task.createCriteria().list() { 132 eq("leadPerson", Person.get(authenticateService.userDomain().id)) 133 ge("targetStartDate", dateUtilService.getToday()-7) 134 eq("isActive", true) 135 } 136 137 def taskInstanceTotal = Task.createCriteria().count() { 138 eq("leadPerson", Person.get(authenticateService.userDomain().id)) 139 ge("targetStartDate", dateUtilService.getToday()-7) 140 eq("isActive", true) 141 } 142 143 if(taskInstanceTotal > 0) 144 { 145 flash.message = "Tasks with target start date in the last week." 146 } 147 else { flash.message = "No tasks found with target start date in the last week." } 148 149 render( view:'search', 150 model:[ taskInstanceList: taskInstanceList, 151 taskInstanceTotal: taskInstanceTotal]) 152 } 153 154 // def search = { 155 // params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 156 // 157 // if(!params.order) { 158 // params.sort = "id" 159 // params.order = "desc" 160 // } 161 // 162 // if(params.search == "ShowAll") 163 // { 164 // def taskInstanceActivesList = Task.findAllByIsActive(true, params) 165 // def taskInstanceActivesTotal = Task.countByIsActive(true) 166 // return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 167 // } 168 // if(params.search == "ShowDeleted") 169 // { 170 // def taskInstanceActivesList = Task.findAllByIsActive(false, params) 171 // def taskInstanceActivesTotal = Task.countByIsActive(false) 172 // return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 173 // } 174 // // Default: 175 // def taskInstanceActivesList = Task.findAllByIsActive(true, params) 176 // def taskInstanceActivesTotal = Task.countByIsActive(true) 177 // [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 178 // } 43 179 44 180 def searchShowAll = {
Note: See TracChangeset
for help on using the changeset viewer.