Changeset 833 for trunk/grails-app
- Timestamp:
- Mar 3, 2011, 12:24:01 PM (14 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/EntryDetailedController.groovy
r826 r833 31 31 if(entryInstance) { 32 32 if(entryInstance.enteredBy.loginName == authService.currentUser.loginName) { 33 def taskI D= entryInstance.task.id33 def taskId = entryInstance.task.id 34 34 entryInstance.delete(flush:true) 35 35 flash.message = "Entry ${params.id} deleted" 36 redirect(controller: 'taskDetailed', action: 'show', id: taskI D)36 redirect(controller: 'taskDetailed', action: 'show', id: taskId) 37 37 } 38 38 else { … … 94 94 def ajaxCreate = { 95 95 if(!params.taskId || !params.entryTypeId) { 96 flash.message = g.message(code:"entry.create.no.params") 97 redirect(controller:"taskDetailed", action:"search") 96 response.status = 403 97 params.errorMessage = g.message(code: "entry.create.no.params.ajax") 98 render(template: "/shared/messages") 98 99 return 99 100 } … … 102 103 103 104 if(!taskInstance) { 104 flash.message = g.message(code:"task.notFound") 105 redirect(controller:"taskDetailed", action:"search") 105 response.status = 403 106 params.errorMessage = g.message(code:"default.not.found", args:['Task',params.taskId]) 107 render(template: "/shared/messages") 106 108 return 107 109 } … … 109 111 // Check for Complete task. 110 112 if(taskInstance.taskStatus.id == 3) { 111 flash.errorMessage = g.message(code:"task.operationNotPermittedOnCompleteTask") 112 redirect(controller:"taskDetailed", action:"show", id: taskInstance.id) 113 response.status = 403 114 params.errorMessage = g.message(code:"task.operationNotPermittedOnCompleteTask") 115 render(template: "/shared/messages") 113 116 return 114 117 } 115 118 119 // Success. 116 120 def entryInstance = new Entry() 117 121 entryInstance.task = taskInstance … … 119 123 render(template: "create", model: ['entryInstance': entryInstance]) 120 124 } 125 126 def ajaxSave = { 127 def result = taskService.saveEntry(params) 128 129 // Success. 130 if(!result.error) { 131 def entryList = Entry.withCriteria { 132 eq("entryType", result.entryInstance.entryType) 133 task { 134 idEq(result.taskId) 135 } 136 } 137 render(template: "list", model: ['entryList': entryList]) 138 return 139 } 140 141 if(result.error.code != "default.create.failure") { 142 response.status = 403 143 params.errorMessage = g.message(code: result.error.code) 144 render(template: "/shared/messages") 145 return 146 } 147 148 response.status = 403 149 render(template: "create", model: ['entryInstance': result.entryInstance]) 150 } // ajaxSave 121 151 122 152 def create = { -
trunk/grails-app/controllers/TaskDetailedController.groovy
r809 r833 424 424 } 425 425 426 def entryPMList = Entry.withCriteria { 427 eq("entryType", EntryType.get(6)) 428 eq("task", taskInstance) 429 } 430 426 431 def subTaskInstanceList = Task.findAllByParentTaskAndTrash(taskInstance, false, params) 427 432 def subTaskInstanceTotal = Task.countByParentTaskAndTrash(taskInstance, false) … … 450 455 entryCauseList: entryCauseList, 451 456 entryWorkDoneList: entryWorkDoneList, 457 entryPMList: entryPMList, 452 458 taskProcedureRevision: taskProcedureRevision, 453 459 taskProcedureExits: taskProcedureExits, -
trunk/grails-app/i18n/messages.properties
r830 r833 176 176 177 177 entry.create.no.params=Please select a task, then add an entry. 178 entry.create.no.params.ajax=Incorrect params supplied. 178 179 179 180 taskRecurringSchedule.notFound=Could not complete operation, recurring schedule not found. -
trunk/grails-app/views/entryDetailed/_create.gsp
r830 r833 1 1 2 <g:form action="save" method="post" > 2 3 <g:render template="/shared/messages" /> 4 <g:hasErrors bean="${entryInstance}"> 5 <div class="errors"> 6 <g:renderErrors bean="${entryInstance}" as="list" /> 7 </div> 8 </g:hasErrors> 9 <div class="pane_close"> 10 <img src="${resource(dir:'images/skin',file:'cross.png')}" alt="Close" title="Close"/> 11 </div> 12 <g:form action="ajaxSave" method="post" name="createEntryForm"> 3 13 <g:hiddenField name="task.id" value="${entryInstance.task.id}" /> 4 14 <g:hiddenField name="entryType.id" value="${entryInstance.entryType.id}" /> -
trunk/grails-app/views/taskDetailed/_showProcedureTab.gsp
r831 r833 25 25 <br /> 26 26 27 <div id="pmEntryContainer"></div> 27 <div id="pmEntryContainer"> 28 <g:if test="${entryPMList.isEmpty()}"> 29 <h1>No PM Entries</h1> 30 <br /> 31 </g:if> 32 <g:else> 33 <g:render template="/entryDetailed/list" 34 model="['entryList':entryPMList]" /> 35 </g:else> 36 </div> 37 38 <br /> 39 40 <div id="createPMEntryContainer" style="display:none;"></div> 28 41 29 42 <div style="text-align:right;" id="pmEntryButton"> … … 32 45 class="add" 33 46 value="Add PM Entry" 34 onclick="loadEntryForm(jQuery('#pmEntryContainer'), 35 jQuery('#pmEntryButton'), 36 {taskId: ${taskInstance?.id}, entryTypeId: 6})" /> 47 onclick="getCreateEntryForm(jQuery('#pmEntryContainer'), 48 jQuery('#createPMEntryContainer'), 49 jQuery('#pmEntryButton'), 50 {taskId: ${taskInstance?.id}, entryTypeId: 6})" /> 37 51 </span> 38 52 </div> 53 39 54 </g:else> -
trunk/grails-app/views/taskDetailed/_showTaskTab.gsp
r823 r833 230 230 <tbody> 231 231 <g:each in="${entryFaultList}" status="i" var="entry"> 232 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}" />232 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"> 233 233 234 234 <td style="width:65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> … … 300 300 <tbody> 301 301 <g:each in="${entryCauseList}" status="i" var="entry"> 302 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}" />302 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"> 303 303 304 304 <td style="width:65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> … … 339 339 <br /> 340 340 341 <g:if test="${entryWorkDoneList.isEmpty()}"> 342 <h1>No Work Done</h1> 343 <br /> 344 </g:if> 345 <g:else> 346 <div class="list"> 347 <h1>Work Done</h1> 348 <table> 349 <thead> 350 <tr> 351 <th>Comment</th> 352 <th>Date Done</th> 353 <th>Duration</th> 354 <th>Entered By</th> 355 <th></th> 356 </tr> 357 </thead> 358 <tbody> 359 <g:each in="${entryWorkDoneList}" status="i" var="entry"> 360 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"/> 361 362 <td width="65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> 363 ${entry.comment.encodeAsHTML()} 364 </td> 365 366 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> 367 <g:formatDate date="${entry.dateDone}" format="EEE, dd-MMM-yyyy"/> 368 </td> 369 370 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> 371 ${entry.durationHour}:${entry.durationMinute} 372 </td> 373 374 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> 375 ${entry.enteredBy.encodeAsHTML()} 376 </td> 377 378 <td class="notClickable"> 379 <g:link controller="entryDetailed" action="edit" id="${entry.id}"> 380 <img src="${resource(dir:'images/skin',file:'database_edit.png')}" alt="Edit" title="Edit" /> 381 </g:link> 382 </td> 383 384 </tr> 385 </g:each> 386 </tbody> 387 </table> 388 </div> 389 </g:else> 390 391 <div class="buttons"> 392 <g:form controller="entryDetailed"> 393 <g:hiddenField name="taskInstance.id" value="${taskInstance?.id}" /> 394 <g:hiddenField name="entryType.id" value="3" /> 395 <span class="button"> 396 <g:actionSubmit value="Add Work Done" action="create" class="add"/> 397 </span> 398 </g:form> 399 </div> 341 <div id="workDoneContainer"> 342 <g:if test="${entryWorkDoneList.isEmpty()}"> 343 <h1>No Work Done</h1> 344 <br /> 345 </g:if> 346 <g:else> 347 <g:render template="/entryDetailed/list" 348 model="['entryList':entryWorkDoneList]" /> 349 </g:else> 350 </div> 351 352 <br /> 353 354 <div id="createWorkDoneContainer" style="display:none;"></div> 355 356 <div style="text-align:right;" id="workDoneButton"> 357 <span class="buttons"> 358 <input type="button" 359 class="add" 360 value="Add Work Done" 361 onclick="getCreateEntryForm(jQuery('#workDoneContainer'), 362 jQuery('#createWorkDoneContainer'), 363 jQuery('#workDoneButton'), 364 {taskId: ${taskInstance?.id}, entryTypeId: 3})" /> 365 </span> 366 </div>
Note: See TracChangeset
for help on using the changeset viewer.