ticket_actions

one of the documented procedures in this installation of the ACS
Usage:
ticket_actions   msg_id   status_class   status_subclass   responsibility   user_id   ticket_user_id   assigned_user_id   return_url   where   { type "line" }
What it does:
generate the ticket actions as seen in the index.tcl table and at the bottom of issue-view.
Defined in: /web/philip/tcl/ticket-defs.tcl

Source code:


    set out {}
    set join {}
    set comment(list) {Add a comment}
    set view(list) {View the ticket}
    set edit(list) {Edit the ticket}
    set clarify(list) {Clarify the ticket}
    set makecopy(list) {Make a duplicate of the ticket}
    set move(list) {Move the ticket to another project}
    set close(list) {Close the ticket}
    set cancel(list) {Cancel the ticket}
    set reopen(list) {Reopen the ticket}
    set approve(list) {Approve the fix}
    set changes(list) {View the ticket change history}
    set fixed(list) {Mark the ticket as fixed}
    set needdef(list) {Need more information to resolve}
    set defer(list) {Defer the ticket}



    set comment(line) {comment} 
    set view(line) {view}
    set edit(line) {edit}
    set makecopy(line) {copy}
    set move(line) {move}
    set clarify(line) {clarify}
    set close(line) {close}
    set cancel(line) {cancel}
    set reopen(line) {reopen}
    set approve(line) {approve}
    set changes(line) {view changes}
    set fixed(line) {fixed}
    set needdef(line) {need info}
    set defer(line) {defer}

    if {$where != "index" } {
        lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=closed&action=comment&return_url=[ns_urlencode "[ns_conn url]?[export_ns_set_vars url]"]\">$comment($type)</a>"
    } 
    if {$where != "view" } {
        lappend out "<a href=\"/ticket/issue-view?msg_id=$msg_id&$return_url\">$view($type)</a>"
    }

    if {$where != "edit" } { 
        lappend out "<a href=\"/ticket/issue-new?msg_id=$msg_id&mode=full&$return_url\">$edit($type)</a>"
    } 
    if {$type == "list"} { 
        lappend out "<a href=\"ticket-move?msg_id=$msg_id&$return_url\">$move($type)</a>"
        #lappend out "<a href=\"issue-new?ascopy=1&msg_id=$msg_id&project_id=&$return_url\">$makecopy($type)</a>"
        lappend out "<a href=\"issue-audit?msg_id=$msg_id&$return_url\">$changes($type)</a>"
        lappend out "<a href=\"ticket-watch?msg_id=$msg_id&return_url=[ns_urlencode "[ns_conn url]?[export_ns_set_vars url]"]\">Watch this ticket (get email on all activity)</a><p>"
        
    } 

    # this is a huge mess.  fix later.  should just be data driven.
    if { $user_id == $ticket_user_id 
         && $user_id != $assigned_user_id } {
        if {$status_subclass == "approve"
            && $responsibility == "user" } {
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=closed&action=approve&$return_url\">$approve($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$approve($type)</em>"
        }
        
        if {$status_subclass == "clarify"
            && $responsibility == "user" } { 
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=open&action=clarify&$return_url\">$clarify($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$clarify($type)</em>"
        }
        if {$status_class == "active" 
            && $status_subclass != "approve"} { 
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=closed&action=cancel&$return_url\">$cancel($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$cancel($type)</em>"
        }        
    }

    if {$user_id == $ticket_user_id || $user_id == $assigned_user_id} { 
        if { ($status_class == "closed" && $user_id == $ticket_user_id)
             || ($status_class == "defer" && $user_id == $assigned_user_id) } {
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=open&action=reopen&$return_url\">$reopen($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$reopen($type)</em>"
        }
    }

    # assigned user actions
    if { $user_id == $assigned_user_id } {
        if {$status_class == "active" 
            && $status_subclass != "approve" } { 
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=need%20def&action=needdef&$return_url\">$needdef($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$needdef($type)</em>"
        }

        if {$status_class == "active" 
            && $status_subclass != "approve" } { 
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=defer&action=defer&$return_url\">$defer($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$defer($type)</em>"
        }

        if {$status_class == "active" 
            && $status_subclass != "approve" } { 
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=Fix/AA&action=fixed&$return_url\">$fixed($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$fixed($type)</em>"
        }
    } 
    
    if {$user_id == $ticket_user_id || $user_id == $assigned_user_id} { 
        if {$status_class == "active" } { 
            lappend out "<a href=\"ticket-code-set?msg_id=$msg_id&what=status&value=closed&action=close&$return_url\">$close($type)</a>"
        } elseif { $type == "list" } { 
            lappend out "<em>$close($type)</em>"
        }
    }

    switch $type { 
        line { 
            return [join $out " | "]
        }
        
    }
    return "<UL><LI>[join $out {<LI>}]</UL>"


philg@mit.edu