Ignore:
Timestamp:
May 13, 2009, 12:51:15 PM (16 years ago)
Author:
gav
Message:

Add icons from famfamfam silk icons, add acknowledgement page to suite.
Adjust AssignedPerson? controller so that a task.id is required to create.
Move Add AssignedPerson? link up to TaskDetailed? show page.
Further improvements to taskDetailed show tabs.
Adjust TaskProcedureDetailed? controller to allow linking a Procedure to a task during creation.
Adjust TaskRecurringSchedule? to a one-to-one cascading relationship.
Modify CSS class duration to time and added icons.
Regenerate some pages.

Location:
trunk/grails-app/controllers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/AppCoreController.groovy

    r127 r134  
    2323
    2424    def options = {
     25    }
     26
     27    def acknowledgements = {
    2528    }
    2629
  • trunk/grails-app/controllers/AssignedPersonDetailedController.groovy

    r97 r134  
    8282
    8383    def create = {
     84                if(!params.task?.id) {
     85                        flash.message = "Please select a task and then 'Add Assigned Person'"
     86                        redirect(controller: "taskDetailed", action: list)
     87                }
     88                else {
    8489        def assignedPersonInstance = new AssignedPerson()
    8590        assignedPersonInstance.properties = params
    8691        return ['assignedPersonInstance':assignedPersonInstance]
     92                }
    8793    }
    8894
  • trunk/grails-app/controllers/TaskDetailedController.groovy

    r133 r134  
    2020    }
    2121
    22 //     def show = {
    23 //         def taskInstance = Task.get( params.id )
    24 //
    25 //         if(!taskInstance) {
    26 //             flash.message = "Task not found with id ${params.id}"
    27 //             redirect(action:list)
    28 //         }
    29 //         else {
    30 //             def taskProcedureInstance = TaskProcedure.get(taskInstance?.taskProcedure?.id)
    31 //             return [ taskInstance : taskInstance,  taskProcedureInstance: taskProcedureInstance]
    32 //
    33 //         }
    34 //     }
    35 
    3622    def show = {
    3723        def taskInstance = Task.get( params.id )
     
    4228        }
    4329        else {
     30                        params.max = 10
     31                        params.order = "desc"
     32                        params.sort = "id"
     33
     34                        def subTaskInstanceList = Task.findAllByParentTask(taskInstance, params)
     35                        def subTaskInstanceTotal = Task.countByParentTask(taskInstance)                                 
     36            def showTaskTab = new String("true")
     37
    4438            def taskProcedureInstance = TaskProcedure.get(taskInstance.taskProcedure?.id)
    4539            def taskProcedureExits = new Boolean("true")
    46             def showTaskTab = new String("true")
    47 
    4840            if(!taskProcedureInstance) {
    4941                taskProcedureExits = false
    5042            }
     43//                      else {
     44                                params.order = "asc"
     45                                params.sort = "procedureStepNumber"
     46                                def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params)
     47//                      }
     48                                               
     49            def taskRecurringScheduleInstance = TaskRecurringSchedule.get(taskInstance.taskRecurringSchedule?.id)
     50            def taskRecurringScheduleExits= new Boolean("true")
     51                        if(!taskRecurringScheduleInstance) {
     52                taskRecurringScheduleExits = false
     53            }
     54                       
    5155            return [ taskInstance : taskInstance,
    5256                            taskProcedureInstance: taskProcedureInstance,
    5357                            taskProcedureExits: taskProcedureExits,
    54                             showTaskTab: showTaskTab]
     58                            showTaskTab: showTaskTab,
     59                                                        subTaskInstanceList: subTaskInstanceList,
     60                                                        subTaskInstanceTotal: subTaskInstanceTotal,
     61                                                        subTaskInstanceMax: params.max,
     62                                                        maintenanceActionList: maintenanceActionList,
     63                                                        taskRecurringScheduleInstance: taskRecurringScheduleInstance,
     64                                                        taskRecurringScheduleExits: taskRecurringScheduleExits]
    5565        }
    5666    }
     
    136146        }
    137147    }
    138 
    139     //Generate a new TaskProcedure for a taskInstance.
    140     def generateProcedure = {
    141         def taskProcedureInstance = new TaskProcedure()
    142         taskProcedureInstance.properties = params
    143 
    144         def taskInstance = Task.get(params.taskInstance.id)
    145         def taskProcedureExits = new Boolean("true")
    146         def showProcedureTab = new String("true")
    147 
    148         if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save()) {
    149             taskProcedureInstance.addToTasks(taskInstance)
    150             flash.message = "Procedure created, you can now add steps to the procedure"
    151 //             redirect(action:show, id:params.taskInstance.id)
     148       
     149        def listSubTasks = {
     150                def parentTaskInstance = Task.get(params.id)
     151                               
     152        if(!parentTaskInstance) {
     153            flash.message = "Task not found with id ${params.id}"
     154            redirect(action:list)
    152155        }
    153156        else {
    154             taskProcedureExits = false
    155         }
    156 
    157         render(view:'show',model:[ taskInstance : taskInstance, 
    158                                                         taskProcedureInstance: taskProcedureInstance,
    159                                                         taskProcedureExits: taskProcedureExits,
    160                                                         showProcedureTab: showProcedureTab])
    161     }
    162 
    163     def findProcedure = {
    164         redirect(controller:"taskProcedureDetailed", action:"list", id:params.taskInstance.id)
    165     }
     157                params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     158                def subTaskInstanceList = Task.findAllByParentTask(parentTaskInstance, params)
     159                def subTaskInstanceTotal = Task.countByParentTask(parentTaskInstance)
     160                               
     161        [ taskInstanceList: subTaskInstanceList,
     162                        taskInstanceTotal:  subTaskInstanceTotal,
     163                        parentTaskInstance: parentTaskInstance]
     164                }
     165        }
    166166       
    167167}
  • trunk/grails-app/controllers/TaskProcedureDetailedController.groovy

    r133 r134  
    1111        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    1212        [ taskProcedureInstanceList: TaskProcedure.list( params ), taskProcedureInstanceTotal: TaskProcedure.count() ]
     13    }
     14       
     15    def search = {
     16        redirect(action:list)
    1317    }
    1418
     
    8286
    8387    def create = {
     88                def taskInstance = Task.get(params.taskInstance?.id)
     89               
    8490        def taskProcedureInstance = new TaskProcedure()
    8591        taskProcedureInstance.properties = params
    86         return ['taskProcedureInstance':taskProcedureInstance]
     92        return ['taskProcedureInstance':taskProcedureInstance,
     93                                                taskInstance: taskInstance]
    8794    }
    8895
    8996    def save = {
    9097        def taskProcedureInstance = new TaskProcedure(params)
     98                def taskInstance = Task.get(params.taskInstance.id)
     99                               
    91100        if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save()) {
     101                        taskProcedureInstance.addToTasks(taskInstance)
    92102            flash.message = "TaskProcedure ${taskProcedureInstance.id} created"
    93103            redirect(action:show,id:taskProcedureInstance.id)
  • trunk/grails-app/controllers/TaskRecurringScheduleDetailedController.groovy

    r131 r134  
    8080        }
    8181    }
    82 
     82       
    8383    def create = {
    84         def taskRecurringScheduleInstance = new TaskRecurringSchedule()
    85         taskRecurringScheduleInstance.properties = params
    86         return ['taskRecurringScheduleInstance':taskRecurringScheduleInstance]
     84        try {
     85            def taskInstance = Task.get(params.taskInstance.id)
     86                        def taskRecurringScheduleInstance = new TaskRecurringSchedule()
     87            taskRecurringScheduleInstance.task = taskInstance
     88            return [taskRecurringScheduleInstance: taskRecurringScheduleInstance]
     89        }
     90        catch(Exception e) {
     91            flash.message = "Please select a task, then Create a Recurring Schedule for it.'"
     92            redirect(controller:"taskDetailed", action:"list")
     93        }
    8794    }
    8895
    8996    def save = {
    9097        def taskRecurringScheduleInstance = new TaskRecurringSchedule(params)
    91         if(!taskRecurringScheduleInstance.hasErrors() && taskRecurringScheduleInstance.save()) {
    92             flash.message = "TaskRecurringSchedule ${taskRecurringScheduleInstance.id} created"
    93             redirect(action:show,id:taskRecurringScheduleInstance.id)
    94         }
    95         else {
    96             render(view:'create',model:[taskRecurringScheduleInstance:taskRecurringScheduleInstance])
    97         }
     98                def taskInstance = Task.get(params.task.id)
     99               
     100                if(!taskRecurringScheduleInstance.hasErrors() && taskRecurringScheduleInstance.save()) {
     101                       
     102                        taskInstance.taskRecurringSchedule = taskRecurringScheduleInstance
     103                                       
     104                        if(taskInstance.save()) {
     105                                flash.message = "TaskRecurringSchedule ${taskRecurringScheduleInstance.id} created"
     106                                redirect(action:show,id:taskRecurringScheduleInstance.id)
     107                        }
     108                        else {
     109                                flash.message = "Task could not be saved and therefore the Recurring Schedule has been disgarded, cause unknown."                               
     110                                render(view:'create',model:[taskRecurringScheduleInstance:taskRecurringScheduleInstance])
     111                        }
     112                }
     113                else {
     114                        render(view:'create',model:[taskRecurringScheduleInstance:taskRecurringScheduleInstance])
     115                }
     116
    98117    }
     118       
    99119}
Note: See TracChangeset for help on using the changeset viewer.