im_project_parent_select db select_name { default " " } { current_group_id " " } { status " " } { exclude_status " " }What it does:
Returns an html select box named $select_name and defaulted to $default with a list of all the eligible projects for parentsDefined in: /web/philip/tcl/intranet-defs.tcl
Source code:
if { [empty_string_p $current_group_id] } {
set limit_group_sql ""
} else {
set limit_group_sql " and p.group_id != $current_group_id"
}
set status_sql ""
if { ![empty_string_p $status] } {
set status_sql "and p.project_status_id=(select project_status_id from im_project_status where project_status='[DoubleApos $status]')"
} elseif { ![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]'"
}
set status_sql " and p.project_status_id in (select project_status_id
from im_project_status
where project_status not in ($exclude_string)) "
}
set sql "select group_name, g.group_id
from user_groups g, im_projects p
where p.parent_id is null
and g.group_id=p.group_id(+) $limit_group_sql $status_sql
order by lower(g.group_name)"
return [im_selection_to_select_box $db $sql $select_name $default]