im_prune_org_chart treeWhat it does:
deletes all leaves where currently_employed_p is set to vacant positionDefined in: /web/philip/tcl/intranet-defs.tcl
Source code:
set result [list [head $tree]]
# First, recursively process the sub-trees.
foreach subtree [tail $tree] {
set new_subtree [im_prune_org_chart $subtree]
if { ![null_p $new_subtree] } {
lappend result $new_subtree
}
}
# Now, delete vacant leaves.
# We also delete vacant inner nodes that have only one child.
# 1. if the tree only consists of one vacant node
# -> return an empty tree
# 2. if the tree has a vacant root and only one child
# -> return the child
# 3. otherwise
# -> return the tree
if { [thd [head $result]] == "f" } {
switch [llength $result] {
1 { return [list] }
2 { return [snd $result] }
default { return $result }
}
} else {
return $result
}