im_project_select db select_name { default " " } { status " " } { type " " } { exclude_status " " }What it does:
Returns an html select box named $select_name and defaulted to $default with a list of all the projects in the system. If status is specified, we limit the select box to projects matching that status. If type is specified, we limit the select box to project matching that type. If exclude_status is provided as a list, we limit to states that do not match any states in exclude_status.Defined in: /web/philip/tcl/intranet-defs.tcl
Source code:
set sql "select ug.group_name, ug.group_id from user_groups ug, im_projects p where ug.parent_group_id=[im_project_group_id $db] and ug.group_id = p.group_id(+)" if { ![empty_string_p $status] } { append sql " and project_status_id=(select project_status_id from im_project_status where project_status='[DoubleApos $status]')" } if { ![empty_string_p $exclude_status] } { set exclude_string "" foreach type $exclude_status { if { ![empty_string_p $exclude_string] } { append exclude_string ", " } append exclude_string "'[DoubleApos $type]'" } append sql " and project_status_id in (select project_status_id from im_project_status where project_status not in ($exclude_string)) " } if { ![empty_string_p $type] } { append sql " and project_type_id=(select project_type_id from im_project_types where project_type='[DoubleApos $type]')" } append sql " order by lower(group_name)" return [im_selection_to_select_box $db $sql $select_name $default]