Changeset 84 for branches/TaskRewrite/src/grails-app
- Timestamp:
- Mar 24, 2009, 3:30:12 AM (16 years ago)
- Location:
- branches/TaskRewrite/src/grails-app
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TaskRewrite/src/grails-app/conf/BootStrap.groovy
r73 r84 227 227 subTaskInstance.parentTask = Task.get(1) 228 228 229 subTaskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), 230 taskStatus:TaskStatus.findByName("Not Started"), 231 taskPriority:TaskPriority.get(2), 232 taskType:TaskType.get(1), 233 leadPerson:Person.get(3), 234 description:"Replace sensor at next opportunity.", 235 comment:"Nothing else has worked.") 236 BootStrapSaveAndTest(subTaskInstance) 237 subTaskInstance.addToAssignedPersons(Person.get(1)) 238 239 //Add task 3 as a subTask of task 1. 240 taskInstance.addToSubTasks(Task.get(3)) 241 subTaskInstance.parentTask = Task.get(1) 242 229 243 taskInstance = new Task(taskGroup:TaskGroup.findByName("Production Activites"), 230 244 taskStatus:TaskStatus.findByName("Not Started"), … … 259 273 entryTypeInstance = new EntryType(name:"Work Request") 260 274 BootStrapSaveAndTest(entryTypeInstance) 275 276 //Entry 277 def entryInstance 278 279 entryInstance = new Entry(enteredBy: Person.get(6), 280 task: Task.get(1), 281 entryType: EntryType.findByName("Fault"), 282 comment: "This level sensor is causing us trouble.", 283 durationMinute: 20) 284 BootStrapSaveAndTest(entryInstance) 285 286 entryInstance = new Entry(enteredBy: Person.get(4), 287 task: Task.get(1), 288 entryType: EntryType.findByName("WorkDone"), 289 comment: "Cleaned sensor, see how it goes.", 290 durationMinute: 30) 291 BootStrapSaveAndTest(entryInstance) 292 293 entryInstance = new Entry(enteredBy: Person.get(4), 294 task: Task.get(1), 295 entryType: EntryType.findByName("WorkDone"), 296 comment: "Checked up on it later and sensor is dropping out intermittently, created subTask to replace sensor.", 297 durationMinute: 20) 298 BootStrapSaveAndTest(entryInstance) 261 299 262 300 //ModificationType -
branches/TaskRewrite/src/grails-app/controllers/TaskController.groovy
r74 r84 6 6 7 7 // the delete, save and update actions only accept POST requests 8 static allowedMethods = [delete:'POST', save:'POST', update:'POST']8 static allowedMethods = [delete:'POST', deleteDetailed:'POST', save:'POST', saveDetailed:'POST', updateDetailed:'POST'] 9 9 10 @Secured(['ROLE_AppAdmin']) 10 11 def list = { 11 12 if(!params.max) params.max = 10 … … 13 14 } 14 15 16 def listDetailed = { 17 if(!params.max) params.max = 10 18 [ taskInstanceList: Task.list( params ) ] 19 } 20 21 @Secured(['ROLE_AppAdmin']) 15 22 def show = { 16 23 def taskInstance = Task.get( params.id ) … … 23 30 } 24 31 32 def showDetailed = { 33 def taskInstance = Task.get( params.id ) 34 35 if(!taskInstance) { 36 flash.message = "Task not found with id ${params.id}" 37 redirect(action:list) 38 } 39 else { return [ taskInstance : taskInstance ] } 40 } 41 42 @Secured(['ROLE_AppAdmin']) 25 43 def delete = { 26 44 def taskInstance = Task.get( params.id ) … … 36 54 } 37 55 56 def deleteDetailed = { 57 def taskInstance = Task.get( params.id ) 58 if(taskInstance) { 59 taskInstance.delete() 60 flash.message = "Task ${params.id} deleted" 61 redirect(action:list) 62 } 63 else { 64 flash.message = "Task not found with id ${params.id}" 65 redirect(action:list) 66 } 67 } 68 69 @Secured(['ROLE_AppAdmin']) 38 70 def edit = { 39 71 def taskInstance = Task.get( params.id ) … … 48 80 } 49 81 82 def editDetailed = { 83 def taskInstance = Task.get( params.id ) 84 85 if(!taskInstance) { 86 flash.message = "Task not found with id ${params.id}" 87 redirect(action:list) 88 } 89 else { 90 def criteria = taskInstance.createCriteria() 91 def results = criteria { 92 and { 93 notEqual('id', taskInstance.id) 94 } 95 } 96 return [ taskInstance : taskInstance, possibleParentList: results ] 97 } 98 } 99 100 @Secured(['ROLE_AppAdmin']) 50 101 def update = { 51 102 def taskInstance = Task.get( params.id ) … … 66 117 } 67 118 119 def updateDetailed = { 120 def taskInstance = Task.get( params.id ) 121 if(taskInstance) { 122 taskInstance.properties = params 123 if(!taskInstance.hasErrors() && taskInstance.save()) { 124 flash.message = "Task ${params.id} updated" 125 redirect(action:show,id:taskInstance.id) 126 } 127 else { 128 render(view:'edit',model:[taskInstance:taskInstance]) 129 } 130 } 131 else { 132 flash.message = "Task not found with id ${params.id}" 133 redirect(action:edit,id:params.id) 134 } 135 } 136 137 @Secured(['ROLE_AppAdmin']) 68 138 def create = { 69 139 def taskInstance = new Task() … … 72 142 } 73 143 144 def createDetailed = { 145 def taskInstance = new Task() 146 taskInstance.properties = params 147 return ['taskInstance':taskInstance] 148 } 149 150 @Secured(['ROLE_AppAdmin']) 74 151 def save = { 75 152 def taskInstance = new Task(params) … … 82 159 } 83 160 } 161 162 def saveDetailed = { 163 def taskInstance = new Task(params) 164 if(!taskInstance.hasErrors() && taskInstance.save()) { 165 flash.message = "Task ${taskInstance.id} created" 166 redirect(action:showDetailed,id:taskInstance.id) 167 } 168 else { 169 render(view:'createDetailed',model:[taskInstance:taskInstance]) 170 } 171 } 84 172 } -
branches/TaskRewrite/src/grails-app/views/appCore/admin.gsp
r71 r84 12 12 <div class="body"> 13 13 <h1>Welcome to Admin</h1> 14 <div class="errors"> 15 "Warning these pages are for use by the application admin only and not for daily use." <br /> 16 "They allow direct administration of the back-end data, cascade deletion and updates may occur." 17 </div> 14 18 <br/> 15 19 <div class="dialog"> -
branches/TaskRewrite/src/grails-app/views/appCore/home.gsp
r73 r84 8 8 <body> 9 9 <div class="nav"> 10 <span class="menuButton"><g:link class="list" controller="task" action="list ">Tasks</g:link></span>10 <span class="menuButton"><g:link class="list" controller="task" action="listDetailed">Tasks</g:link></span> 11 11 12 12 </div>
Note: See TracChangeset
for help on using the changeset viewer.