Changeset 135
- Timestamp:
- May 13, 2009, 7:36:01 PM (16 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/TaskRecurringScheduleDetailedController.groovy
r134 r135 89 89 } 90 90 catch(Exception e) { 91 flash.message = "Please select a task, then Create a Recurring Schedule for it .'"91 flash.message = "Please select a task, then Create a Recurring Schedule for it" 92 92 redirect(controller:"taskDetailed", action:"list") 93 93 } … … 97 97 def taskRecurringScheduleInstance = new TaskRecurringSchedule(params) 98 98 def taskInstance = Task.get(params.task.id) 99 100 if(!taskRecurringScheduleInstance.hasErrors() && taskRecurringScheduleInstance.save()) { 99 100 if(taskInstance.taskRecurringSchedule) { 101 flash.message = "This task already has a recurring schedule" 102 redirect(controller:"taskDetailed", action:"show", id: params.task.id) 103 } 104 else { 101 105 102 taskInstance.taskRecurringSchedule = taskRecurringScheduleInstance 103 104 if(taskInstance.save()) { 105 flash.message = "TaskRecurringSchedule ${taskRecurringScheduleInstance.id} created" 106 redirect(action:show,id:taskRecurringScheduleInstance.id) 106 taskRecurringScheduleInstance.nextDueDate = new Date() 107 108 // taskRecurringScheduleInstance.nextDueDate = calculateNextDueDate(new Date()) 109 110 if(!taskRecurringScheduleInstance.hasErrors() && taskRecurringScheduleInstance.save()) { 111 112 taskInstance.taskRecurringSchedule = taskRecurringScheduleInstance 113 114 if(taskInstance.save()) { 115 flash.message = "TaskRecurringSchedule ${taskRecurringScheduleInstance.id} created" 116 redirect(action:show,id:taskRecurringScheduleInstance.id) 117 } 118 else { 119 flash.message = "Task could not be saved and therefore the Recurring Schedule has been disgarded, cause unknown." 120 render(view:'create',model:[taskRecurringScheduleInstance:taskRecurringScheduleInstance]) 121 } 107 122 } 108 123 else { 109 flash.message = "Task could not be saved and therefore the Recurring Schedule has been disgarded, cause unknown."110 124 render(view:'create',model:[taskRecurringScheduleInstance:taskRecurringScheduleInstance]) 111 125 } 112 }113 else {114 render(view:'create',model:[taskRecurringScheduleInstance:taskRecurringScheduleInstance])115 126 } 116 127 117 128 } 118 129 130 // private Date calculateNextDueDate(nextDue) { 131 // // def now = new Date() 132 // // def calculatedDays = new Integer() 133 // // def nextDue = new Date() 134 // 135 // // switch (period) { 136 // // case "Day(s)": 137 // // calculatedDays = period 138 // // nextDue = now + calculatedDays 139 // // case "Week(s)": 140 // // calculatedDays = period * 7 141 // // nextDue = now + calculatedDays 142 // // // default: 143 // // } 144 // nextDue = nextDue + 1 145 // return nextDue 146 // } 147 119 148 } -
trunk/grails-app/domain/TaskRecurringSchedule.groovy
r134 r135 4 4 Period period 5 5 6 Integer recurEvery 6 Integer recurEvery = 1 7 7 Date startDate = new Date() 8 8 Date lastGeneratedDate -
trunk/grails-app/views/login/auth.gsp
r133 r135 56 56 <p> 57 57 <label for='j_username'>Login ID</label> 58 <input type='text' class='text_' name='j_username' id='j_username' value=' admin' />58 <input type='text' class='text_' name='j_username' id='j_username' value='user' /> 59 59 </p> 60 60 <p> -
trunk/grails-app/views/taskDetailed/show.gsp
r134 r135 395 395 <td valign="top" class="name">Start Date:</td> 396 396 397 <td valign="top" class="value">${taskRecurringScheduleInstance.startDate}</td> 398 397 <td valign="top" class="value"> 398 <g:formatDate date="${taskRecurringScheduleInstance.startDate}" format="EEE, dd MMM yyyy"/> 399 </td> 400 401 </tr> 402 403 <tr class="prop"> 404 <td valign="top" class="name">Is Enabled:</td> 405 406 <td valign="top" class="value">${fieldValue(bean:taskRecurringScheduleInstance, field:'isEnabled')}</td> 407 408 </tr> 409 410 <tr class="prop"> 411 <td></td> 412 </tr> 413 414 <tr class="prop"> 415 <td></td> 399 416 </tr> 400 417 401 418 <tr class="prop"> 402 <td valign="top" class="name">Next Due Date:</td> 403 404 <td valign="top" class="value">${taskRecurringScheduleInstance.nextDueDate}</td> 419 <td valign="top" class="name">Next Due Date:</td> 420 421 <td valign="top" class="value"> 422 <g:formatDate date="${taskRecurringScheduleInstance.nextDueDate}" format="EEE, dd MMM yyyy"/> 423 </td> 405 424 406 425 </tr> … … 408 427 <tr class="prop"> 409 428 <td valign="top" class="name">Last Generated Date:</td> 410 411 <td valign="top" class="value">${taskRecurringScheduleInstance.lastGeneratedDate}</td> 429 430 <td valign="top" class="value"> 431 <g:formatDate date="${taskRecurringScheduleInstance.lastGeneratedDate}" format="EEE, dd MMM yyyy"/> 432 </td> 412 433 413 434 </tr> … … 415 436 <tr class="prop"> 416 437 <td valign="top" class="name">Last Generated Sub Task:</td> 417 418 <td valign="top" class="value">${taskRecurringScheduleInstance.lastGeneratedSubTask}</td> 419 438 439 <td valign="top" class="value"> 440 <g:link controller="taskDetailed" action="show" id="${taskRecurringScheduleInstance?.lastGeneratedSubTask?.id}"> 441 ${taskRecurringScheduleInstance?.lastGeneratedSubTask?.encodeAsHTML()} 442 </g:link> 443 </td> 420 444 </tr> 421 445 </tbody> … … 424 448 <div class="buttons"> 425 449 <g:form controller="taskRecurringScheduleDetailed"> 426 <input type="hidden" name="id" value="${task Instance?.id}" />450 <input type="hidden" name="id" value="${taskRecurringScheduleInstance?.id}" /> 427 451 <span class="button"><g:actionSubmit class="edit" value="Edit" /></span> 428 452 </g:form> -
trunk/grails-app/views/taskRecurringScheduleDetailed/create.gsp
r134 r135 32 32 <label for="recForTask">Recurring Schedule for Task:</label> 33 33 </td> 34 <td valign="top" name="recForTask" class="value"> 35 ${taskRecurringScheduleInstance.task} 34 <td valign="top" name="recForTask" class="value"> 35 <g:link controller="taskDetailed" action="show" id="${taskRecurringScheduleInstance?.task?.id}">${taskRecurringScheduleInstance?.task?.encodeAsHTML()}</g:link> 36 </td> 37 </tr> 38 39 <tr class="prop"> 40 <td valign="top" class="name"> 41 <label for="startDate">Start Date:</label> 42 </td> 43 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'startDate','errors')}"> 44 <g:datePicker name="startDate" value="${taskRecurringScheduleInstance?.startDate}" precision="day"></g:datePicker> 36 45 </td> 37 46 </tr> … … 39 48 <tr class="prop"> 40 49 <td valign="top" class="name"> 41 <label for=" lastGeneratedDate">Last Generated Date:</label>50 <label for="recurEvery">Recur Every:</label> 42 51 </td> 43 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'lastGeneratedDate','errors')}"> 44 <g:datePicker name="lastGeneratedDate" value="${taskRecurringScheduleInstance?.lastGeneratedDate}" noSelection="['':'']"></g:datePicker> 52 <td valign="top" class="value" > 53 <input type="text" class="time ${hasErrors(bean:taskRecurringScheduleInstance,field:'recurEvery','errors')}" 54 id="recurEvery" name="recurEvery" value="${fieldValue(bean:taskRecurringScheduleInstance,field:'recurEvery')}" /> 55 <g:select optionKey="id" from="${Period.list()}" name="period.id" value="${taskRecurringScheduleInstance?.period?.id}" ></g:select> 45 56 </td> 46 </tr> 47 48 <tr class="prop"> 49 <td valign="top" class="name"> 50 <label for="lastGeneratedSubTask">Last Generated Sub Task:</label> 51 </td> 52 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'lastGeneratedSubTask','errors')}"> 53 <g:select optionKey="id" from="${Task.list()}" name="lastGeneratedSubTask.id" value="${taskRecurringScheduleInstance?.lastGeneratedSubTask?.id}" noSelection="['null':'']"></g:select> 54 </td> 55 </tr> 57 </tr> 56 58 57 59 <tr class="prop"> … … 61 63 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'isEnabled','errors')}"> 62 64 <g:checkBox name="isEnabled" value="${taskRecurringScheduleInstance?.isEnabled}" ></g:checkBox> 63 </td>64 </tr>65 66 <tr class="prop">67 <td valign="top" class="name">68 <label for="nextDueDate">Next Due Date:</label>69 </td>70 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'nextDueDate','errors')}">71 <g:datePicker name="nextDueDate" value="${taskRecurringScheduleInstance?.nextDueDate}" ></g:datePicker>72 </td>73 </tr>74 75 <tr class="prop">76 <td valign="top" class="name">77 <label for="period">Period:</label>78 </td>79 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'period','errors')}">80 <g:select optionKey="id" from="${Period.list()}" name="period.id" value="${taskRecurringScheduleInstance?.period?.id}" ></g:select>81 </td>82 </tr>83 84 <tr class="prop">85 <td valign="top" class="name">86 <label for="recurEvery">Recur Every:</label>87 </td>88 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'recurEvery','errors')}">89 <input type="text" id="recurEvery" name="recurEvery" value="${fieldValue(bean:taskRecurringScheduleInstance,field:'recurEvery')}" />90 </td>91 </tr>92 93 <tr class="prop">94 <td valign="top" class="name">95 <label for="startDate">Start Date:</label>96 </td>97 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'startDate','errors')}">98 <g:datePicker name="startDate" value="${taskRecurringScheduleInstance?.startDate}" ></g:datePicker>99 65 </td> 100 66 </tr> -
trunk/grails-app/views/taskRecurringScheduleDetailed/edit.gsp
r134 r135 29 29 <table> 30 30 <tbody> 31 31 32 <tr class="prop"> 33 <td valign="top" class="name"> 34 <label for="recForTask">Recurring Schedule for Task:</label> 35 </td> 36 <td valign="top" name="recForTask" class="value"> 37 <g:link controller="taskDetailed" action="show" id="${taskRecurringScheduleInstance?.task?.id}">${taskRecurringScheduleInstance?.task?.encodeAsHTML()}</g:link> 38 </td> 39 </tr> 40 32 41 <tr class="prop"> 33 42 <td valign="top" class="name"> 34 <label for=" lastGeneratedDate">Last GeneratedDate:</label>43 <label for="startDate">Start Date:</label> 35 44 </td> 36 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:' lastGeneratedDate','errors')}">37 <g:datePicker name=" lastGeneratedDate" value="${taskRecurringScheduleInstance?.lastGeneratedDate}" noSelection="['':'']"></g:datePicker>45 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'startDate','errors')}"> 46 <g:datePicker name="startDate" value="${taskRecurringScheduleInstance?.startDate}" precision="day"></g:datePicker> 38 47 </td> 39 </tr> 40 48 </tr> 49 41 50 <tr class="prop"> 42 51 <td valign="top" class="name"> 43 <label for=" lastGeneratedSubTask">Last Generated Sub Task:</label>52 <label for="recurEvery">Recur Every:</label> 44 53 </td> 45 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'lastGeneratedSubTask','errors')}"> 46 <g:select optionKey="id" from="${Task.list()}" name="lastGeneratedSubTask.id" value="${taskRecurringScheduleInstance?.lastGeneratedSubTask?.id}" noSelection="['null':'']"></g:select> 54 <td valign="top" class="value" > 55 <input type="text" class="time ${hasErrors(bean:taskRecurringScheduleInstance,field:'recurEvery','errors')}" 56 id="recurEvery" name="recurEvery" value="${fieldValue(bean:taskRecurringScheduleInstance,field:'recurEvery')}" /> 57 <g:select optionKey="id" from="${Period.list()}" name="period.id" value="${taskRecurringScheduleInstance?.period?.id}" ></g:select> 47 58 </td> 48 59 </tr> … … 55 66 <g:checkBox name="isEnabled" value="${taskRecurringScheduleInstance?.isEnabled}" ></g:checkBox> 56 67 </td> 57 </tr> 58 59 <tr class="prop"> 60 <td valign="top" class="name"> 61 <label for="nextDueDate">Next Due Date:</label> 62 </td> 63 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'nextDueDate','errors')}"> 64 <g:datePicker name="nextDueDate" value="${taskRecurringScheduleInstance?.nextDueDate}" ></g:datePicker> 65 </td> 66 </tr> 67 68 <tr class="prop"> 69 <td valign="top" class="name"> 70 <label for="period">Period:</label> 71 </td> 72 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'period','errors')}"> 73 <g:select optionKey="id" from="${Period.list()}" name="period.id" value="${taskRecurringScheduleInstance?.period?.id}" ></g:select> 74 </td> 75 </tr> 76 77 <tr class="prop"> 78 <td valign="top" class="name"> 79 <label for="recurEvery">Recur Every:</label> 80 </td> 81 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'recurEvery','errors')}"> 82 <input type="text" id="recurEvery" name="recurEvery" value="${fieldValue(bean:taskRecurringScheduleInstance,field:'recurEvery')}" /> 83 </td> 84 </tr> 85 86 <tr class="prop"> 87 <td valign="top" class="name"> 88 <label for="startDate">Start Date:</label> 89 </td> 90 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'startDate','errors')}"> 91 <g:datePicker name="startDate" value="${taskRecurringScheduleInstance?.startDate}" ></g:datePicker> 92 </td> 93 </tr> 94 95 <tr class="prop"> 96 <td valign="top" class="name"> 97 <label for="task">Task:</label> 98 </td> 99 <td valign="top" class="value ${hasErrors(bean:taskRecurringScheduleInstance,field:'task','errors')}"> 100 <g:select optionKey="id" from="${Task.list()}" name="task.id" value="${taskRecurringScheduleInstance?.task?.id}" ></g:select> 101 </td> 102 </tr> 68 </tr> 103 69 104 70 </tbody> -
trunk/grails-app/views/taskRecurringScheduleDetailed/list.gsp
r134 r135 24 24 <g:sortableColumn property="id" title="Id" /> 25 25 26 <g:sortableColumn property=" lastGeneratedDate" title="Last Generated Date" />26 <g:sortableColumn property="taskId" title="Recurring Schedule for Task" /> 27 27 28 <th>Last Generated Sub Task</th> 29 28 <g:sortableColumn property="recurEvery" title="Recur Every" /> 29 30 <g:sortableColumn property="period" title="Period" /> 31 30 32 <g:sortableColumn property="isEnabled" title="Is Enabled" /> 31 32 <g:sortableColumn property="nextDueDate" title="Next Due Date" /> 33 34 <th>Period</th> 33 34 <th></th> 35 35 36 36 </tr> … … 38 38 <tbody> 39 39 <g:each in="${taskRecurringScheduleInstanceList}" status="i" var="taskRecurringScheduleInstance"> 40 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 40 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}" onclick='window.location = "${request.getContextPath()}/taskRecurringScheduleDetailed/show/${taskRecurringScheduleInstance.id}"'/> 41 41 42 42 43 <td><g:link action="show" id="${taskRecurringScheduleInstance.id}">${fieldValue(bean:taskRecurringScheduleInstance, field:'id')}</g:link></td> 43 44 44 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:' lastGeneratedDate')}</td>45 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'task')}</td> 45 46 46 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'lastGeneratedSubTask')}</td> 47 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'recurEvery')}</td> 48 49 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'period')}</td> 47 50 48 51 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'isEnabled')}</td> 49 50 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'nextDueDate')}</td> 51 52 <td>${fieldValue(bean:taskRecurringScheduleInstance, field:'period')}</td> 52 53 <td> 54 <g:link action="show" id="${taskRecurringScheduleInstance.id}"> 55 <img src="${createLinkTo(dir:'images/skin',file:'database_go.png')}" alt="Show" /> 56 </g:link> 57 </td> 53 58 54 59 </tr> -
trunk/grails-app/views/taskRecurringScheduleDetailed/show.gsp
r134 r135 20 20 <div class="dialog"> 21 21 <table> 22 <tbody> 23 24 22 <tbody> 23 25 24 <tr class="prop"> 26 25 <td valign="top" class="name">Id:</td> … … 29 28 30 29 </tr> 30 31 <tr class="prop"> 32 <td valign="top" class="name"> 33 <label for="recForTask">Recurring Schedule for Task:</label> 34 </td> 35 <td valign="top" name="recForTask" class="value"> 36 <g:link controller="taskDetailed" action="show" id="${taskRecurringScheduleInstance?.task?.id}">${taskRecurringScheduleInstance?.task?.encodeAsHTML()}</g:link> 37 </td> 38 </tr> 31 39 32 40 <tr class="prop"> 33 <td valign="top" class="name"> Last Generated Date:</td>41 <td valign="top" class="name">Recur Every:</td> 34 42 35 <td valign="top" class="value">${fieldValue(bean:taskRecurringScheduleInstance, field:'lastGeneratedDate')}</td> 43 <td valign="top" class="value"> 44 ${taskRecurringScheduleInstance?.recurEvery} ${taskRecurringScheduleInstance?.period} 45 </td> 36 46 37 47 </tr> 38 48 39 49 <tr class="prop"> 40 <td valign="top" class="name"> Last Generated Sub Task:</td>50 <td valign="top" class="name">Start Date:</td> 41 51 42 <td valign="top" class="value"><g:link controller="task" action="show" id="${taskRecurringScheduleInstance?.lastGeneratedSubTask?.id}">${taskRecurringScheduleInstance?.lastGeneratedSubTask?.encodeAsHTML()}</g:link></td> 43 52 <td valign="top" class="value"> 53 <g:formatDate date="${taskRecurringScheduleInstance.startDate}" format="EEE, dd MMM yyyy"/> 54 </td> 44 55 </tr> 45 56 … … 50 61 51 62 </tr> 63 64 <tr class="prop"> 65 <td></td> 66 </tr> 67 68 <tr class="prop"> 69 <td></td> 70 </tr> 52 71 53 72 <tr class="prop"> 54 73 <td valign="top" class="name">Next Due Date:</td> 55 74 56 <td valign="top" class="value">${fieldValue(bean:taskRecurringScheduleInstance, field:'nextDueDate')}</td> 75 <td valign="top" class="value"> 76 <g:formatDate date="${taskRecurringScheduleInstance.nextDueDate}" format="EEE, dd MMM yyyy"/> 77 </td> 57 78 79 </tr> 80 81 <tr class="prop"> 82 <td valign="top" class="name">Last Generated Date:</td> 83 84 <td valign="top" class="value"> 85 <g:formatDate date="${taskRecurringScheduleInstance.lastGeneratedDate}" format="EEE, dd MMM yyyy"/> 86 </td> 58 87 </tr> 59 88 60 89 <tr class="prop"> 61 <td valign="top" class="name"> Period:</td>90 <td valign="top" class="name">Last Generated Sub Task:</td> 62 91 63 <td valign="top" class="value"><g:link controller="period" action="show" id="${taskRecurringScheduleInstance?.period?.id}">${taskRecurringScheduleInstance?.period?.encodeAsHTML()}</g:link></td> 64 65 </tr> 66 67 <tr class="prop"> 68 <td valign="top" class="name">Recur Every:</td> 69 70 <td valign="top" class="value">${fieldValue(bean:taskRecurringScheduleInstance, field:'recurEvery')}</td> 71 72 </tr> 73 74 <tr class="prop"> 75 <td valign="top" class="name">Start Date:</td> 76 77 <td valign="top" class="value">${fieldValue(bean:taskRecurringScheduleInstance, field:'startDate')}</td> 78 79 </tr> 80 81 <tr class="prop"> 82 <td valign="top" class="name">Task:</td> 83 84 <td valign="top" class="value"><g:link controller="task" action="show" id="${taskRecurringScheduleInstance?.task?.id}">${taskRecurringScheduleInstance?.task?.encodeAsHTML()}</g:link></td> 92 <td valign="top" class="value"> 93 <g:link controller="taskDetailed" action="show" id="${taskRecurringScheduleInstance?.lastGeneratedSubTask?.id}"> 94 ${taskRecurringScheduleInstance?.lastGeneratedSubTask?.encodeAsHTML()} 95 </g:link> 96 </td> 85 97 86 98 </tr>
Note: See TracChangeset
for help on using the changeset viewer.