Ignore:
Timestamp:
Sep 28, 2009, 10:01:43 AM (15 years ago)
Author:
gav
Message:

Install Navigation plugin, work on navigation and hopefully fixed a few more IE vs Firefox CSS issues.
New skin for class-diagram plugin.
Adjust security config to suite.
Replace home.gsp with start.gsp, remove options.gsp and acknowledgements.gsp as they are now on start.gsp tabs.
Create search pages for Tasks, Assets and Inventory.
Change suggested login to manager.
Change all date formats to format="EEE, dd-MMM-yyyy".

File:
1 edited

Legend:

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

    r137 r139  
    22
    33class TaskDetailedController extends BaseController {
    4    
    5     def index = { redirect(action:list,params:params) }
     4
     5    def index = {
     6        println "index called"
     7        redirect(action:search,params:params)
     8    }
    69
    710    // the delete, save and update actions only accept POST requests
    811    static allowedMethods = [delete:'POST', save:'POST', update:'POST']
    9 
    10 //     def list = {
    11 //         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    12 //         def taskInstanceActives = Task.findAllByIsActive( true ).list( params )
    13 // //         def taskInstanceList = taskInstanceActives.list( params )
    14 //         return [ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceActives.count() ]
    15 //     }
    1612
    1713    def list = {
     
    2016    }
    2117
     18    def search = {
     19        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     20       
     21        if(!params.order) {
     22            params.sort = "id"
     23            params.order = "desc"
     24        }
     25       
     26        if(params.search == "ShowAll")
     27        {
     28            def taskInstanceActivesList = Task.findAllByIsActive(true, params)
     29            def taskInstanceActivesTotal = Task.countByIsActive(true)
     30            return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
     31        }
     32        if(params.search == "ShowDeleted")
     33        {
     34            def taskInstanceActivesList = Task.findAllByIsActive(false, params)
     35            def taskInstanceActivesTotal = Task.countByIsActive(false)
     36            return [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
     37        }
     38        // Default:
     39        def taskInstanceActivesList = Task.findAllByIsActive(true, params)
     40        def taskInstanceActivesTotal = Task.countByIsActive(true)
     41        [taskInstanceList: taskInstanceActivesList, taskInstanceTotal: taskInstanceActivesTotal]
     42    }
     43   
     44    def searchShowAll = {
     45        redirect(action:'search', params:[search:"ShowAll"])
     46    }
     47   
     48    def searchShowDeleted = {
     49        redirect(action:'search', params:[search:"ShowDeleted"])
     50    }
     51
    2252    def show = {
     53       
     54        // In the case of an actionSubmit button, rewrite action name from 'index'.
     55        if(params._action_Show)
     56        { params.action='show' }
     57
    2358        def taskInstance = Task.get( params.id )
    2459
    2560        if(!taskInstance) {
    2661            flash.message = "Task not found with id ${params.id}"
    27             redirect(action:list)
     62            redirect(action:search)
    2863        }
    2964        else {
     
    86121                taskInstance.isActive = false
    87122                flash.message = "Task ${params.id} has been set to inactive."
    88                 redirect(action:list)
     123                redirect(action:search)
    89124            }
    90125            catch(org.springframework.dao.DataIntegrityViolationException e) {
     
    95130        else {
    96131            flash.message = "Task not found with id ${params.id}"
    97             redirect(action:list)
     132            redirect(action:search)
    98133        }
    99134    }
    100135
    101136    def edit = {
     137       
     138        // In the case of an actionSubmit button, rewrite action name from 'index'.
     139        if(params._action_Edit)
     140        { params.action='edit' }
     141       
    102142        def taskInstance = Task.get( params.id )
    103143
    104144        if(!taskInstance) {
    105145            flash.message = "Task not found with id ${params.id}"
    106             redirect(action:list)
     146            redirect(action:search)
    107147        }
    108148        else {
     
    166206        if(!parentTaskInstance) {
    167207            flash.message = "Task not found with id ${params.id}"
    168             redirect(action:list)
     208            redirect(action:search)
    169209        }
    170210        else {
Note: See TracChangeset for help on using the changeset viewer.