Changeset 143 for trunk/grails-app/controllers
- Timestamp:
- Oct 3, 2009, 2:51:02 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/TaskDetailedController.groovy
r140 r143 5 5 def authenticateService 6 6 def dateUtilService 7 def taskSearchService 7 8 def filterService 8 9 … … 13 14 14 15 def list = { 15 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 )16 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 ) 16 17 [ taskInstanceList: Task.list( params ), taskInstanceTotal: Task.count() ] 17 18 } 18 19 19 20 def search = { 20 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 )21 22 if(!params. _action_search)21 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 ) 22 23 if(!params.filter) 23 24 { 24 // Default: 25 def taskInstanceActivesList = Task.findAllByIsActive(true, params) 26 def taskInstanceActivesTotal = Task.countByIsActive(true) 27 return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal] 28 } 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 25 // if(params.searchMyTodays) { def taskInstanceList = taskSearchService.getMyTodays(params) } 26 // else { def taskInstanceList = taskSearchService.getTodays(params) } 27 28 def taskInstanceList = taskSearchService.getTodays(params) 29 30 if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks" } 31 else { params.message = "No tasks found for today" } 32 return[ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount] 33 } 34 // filterPane: 35 return[ taskInstanceList: filterService.filter( params, Task ), 36 taskInstanceTotal: filterService.count( params, Task ), 37 filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params), 38 params:params ] 39 } 40 36 41 def advancedSearch = { 37 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 )42 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 ) 38 43 39 44 if(!params._action_advancedSearch) … … 51 56 } 52 57 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 } 58 // def searchTodays = { 59 // def taskInstanceList = taskSearchService.getTodays(params) 60 // 61 // if(taskInstanceList.totalCount > 0) 62 // { 63 // flash.message = "Today's tasks" 64 // } 65 // else { flash.message = "No tasks found for today" } 66 // 67 // render( view:'search', 68 // model:[ taskInstanceList: taskInstanceList, 69 // taskInstanceTotal: taskInstanceList.totalCount]) 70 // } 71 72 // def searchMyTodays = { 73 // params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 74 // 75 // def taskInstanceList = Task.createCriteria().list() { 76 // eq("leadPerson", Person.get(authenticateService.userDomain().id)) 77 // ge("targetStartDate", dateUtilService.getToday()) 78 // eq("isActive", true) 79 // } 80 // 81 // def taskInstanceTotal = Task.createCriteria().count() { 82 // eq("leadPerson", Person.get(authenticateService.userDomain().id)) 83 // ge("targetStartDate", dateUtilService.getToday()) 84 // eq("isActive", true) 85 // } 86 // 87 // if(taskInstanceTotal > 0) 88 // { 89 // flash.message = "Today's tasks" 90 // } 91 // else { flash.message = "No tasks found for today" } 92 // 93 // render( view:'search', 94 // model:[ taskInstanceList: taskInstanceList, 95 // taskInstanceTotal: taskInstanceTotal]) 96 // } 102 97 103 98 def searchInTheLastWeek = { … … 284 279 else { 285 280 def criteria = taskInstance.createCriteria() 286 def result s= criteria {281 def result = criteria { 287 282 and { 288 283 notEqual('id', taskInstance.id) 289 284 } 290 285 } 291 return [ taskInstance : taskInstance, possibleParentList: result s]286 return [ taskInstance : taskInstance, possibleParentList: result ] 292 287 } 293 288 }
Note: See TracChangeset
for help on using the changeset viewer.