Changeset 144
- Timestamp:
- Oct 3, 2009, 4:05:02 PM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/TaskDetailedController.groovy
r143 r144 19 19 20 20 def search = { 21 // println params 21 22 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100 ) 22 23 24 // Search urls: 23 25 if(!params.filter) 24 26 { 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" } 27 def taskInstanceList = [] 28 def personInstance = Person.get(authenticateService.userDomain().id) 29 30 if(params.searchMyTodays) { 31 taskInstanceList = taskSearchService.getMyTodays(params) 32 if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks for ${personInstance.firstName} ${personInstance.lastName}." } 33 else { params.message = "No tasks found for today." } 34 } 35 else if(params.searchInTheLastWeek) { 36 taskInstanceList = taskSearchService.getInTheLastWeek(params) 37 if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week." } 38 else { params.message = "No tasks found for today." } 39 } 40 else if(params.searchMyInTheLastWeek) { 41 taskInstanceList = taskSearchService.getMyInTheLastWeek(params) 42 if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week for ${personInstance.firstName} ${personInstance.lastName}." } 43 else { params.message = "No tasks found for today." } 44 } 45 else { 46 //Default: 47 taskInstanceList = taskSearchService.getTodays(params) 48 if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks." } 49 else { params.message = "No tasks found for today." } 50 } 51 32 52 return[ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount] 33 53 } -
trunk/grails-app/services/TaskSearchService.groovy
r143 r144 41 41 } 42 42 } 43 44 def getInTheLastWeek(params) { 45 params.max = Math.min(params?.max?.toInteger() ?: 10, 100) 46 params.offset = params?.offset?.toInteger() ?: 0 47 params.sort = params?.sort ?: "id" 48 params.order = params?.order ?: "desc" 49 50 def taskInstanceList = Task.createCriteria().list( 51 max: params.max, 52 offset: params.offset, 53 sort: params.sort, 54 order: params.order) { 55 ge("targetStartDate", dateUtilService.getToday()-7) 56 lt("targetStartDate", dateUtilService.getTomorrow()) 57 eq("isActive", true) 58 } 59 } 60 61 def getMyInTheLastWeek(params) { 62 params.max = Math.min(params?.max?.toInteger() ?: 10, 100) 63 params.offset = params?.offset?.toInteger() ?: 0 64 params.sort = params?.sort ?: "id" 65 params.order = params?.order ?: "desc" 66 67 def taskInstanceList = Task.createCriteria().list( 68 max: params.max, 69 offset: params.offset, 70 sort: params.sort, 71 order: params.order) { 72 eq("leadPerson", Person.get(authenticateService.userDomain().id)) 73 ge("targetStartDate", dateUtilService.getToday()-7) 74 lt("targetStartDate", dateUtilService.getTomorrow()) 75 eq("isActive", true) 76 } 77 } 43 78 } -
trunk/grails-app/views/appCore/start.gsp
r143 r144 47 47 <g:link controller="taskDetailed" 48 48 action="search" 49 params="[searchMyTodays ]">49 params="[searchMyTodays:'true']"> 50 50 Today's 51 51 </g:link> 52 52 <br /> 53 53 <g:link controller="taskDetailed" 54 action="searchMyInTheLastWeek"> 54 action="search" 55 params="[searchMyInTheLastWeek:'true']"> 55 56 In the last week 56 57 </g:link> … … 69 70 <br /> 70 71 <g:link controller="taskDetailed" 71 action="searchInTheLastWeek"> 72 action="search" 73 params="[searchInTheLastWeek:'true']"> 72 74 In the last week 73 75 </g:link>
Note: See TracChangeset
for help on using the changeset viewer.