ticket_group_pick_widget

one of the documented procedures in this installation of the ACS
Usage:
ticket_group_pick_widget { -return_url {/ticket/admin} } db GS.group_search GS.group_type_restrict target
What it does:
generate the group pick widget
Defined in: /web/philip/tcl/ticket-defs.tcl

Source code:

arg_parser_for_ticket_group_pick_widget $args
 
    set out {}

    if {![empty_string_p ${GS.group_search}]} { 

        set match "%[string tolower [string trim ${GS.group_search}]]%"
        
        util_dbq {GS.group_type_restrict match}
        set query "select user_groups.group_name as group_name,
 nvl(user_group_parent.group_name, user_groups.group_type) as group_type,
 user_groups.group_id
 from user_groups, user_groups user_group_parent
 where user_groups.parent_group_id = user_group_parent.group_id (+)
 and user_groups.approved_p = 't' and lower(user_groups.group_name) like $DBQmatch"

        if {![empty_string_p ${GS.group_type_restrict}]} { 
            append query " and user_groups.group_type = ${DBQGS.group_type_restrict}"
        }

        append query " order by lower(nvl(user_group_parent.group_name, user_groups.group_type)), lower(group_name)"
        
        set selection [ns_db select $db $query]
        
        while {[ns_db getrow $db $selection]} {

            set_variables_after_query 
            
            if {[empty_string_p $out]} { 
                append out "<strong>$group_type</strong><ul>"
            } elseif {[string compare $last_group_type $group_type] != 0} { 
                append out "</ul>\n<strong>$group_type</strong>\n<ul>"
            }
            
            append out "<li> <a href=\"$target$group_id\">$group_name</a>"
            set last_group_type $group_type
        }
        
        if {![empty_string_p $out]} { 
            append out "</ul>"
        } else { 
            set out "<em>no matching groups</em>"
        }

    }

    append out "<form method=post>
 Group name matching: <input type=text maxwidth=60 name=GS.group_search [export_form_value GS.group_search]> Group type:
 [ad_db_select_widget -default ${GS.group_type_restrict} -option_list {{{} {-- All Groups --}}} $db "select pretty_plural, group_type from user_group_types order by pretty_plural" GS.group_type_restrict]
   [export_ns_set_vars form [ticket_exclude_regexp {^GS.}]]
 </form>"
    
    return $out


philg@mit.edu