[% PROCESS inputs; root = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' WHERE parent_ou IS NULL ORDER BY name;'; q = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' WHERE parent_ou = ? ORDER BY name;'; org_unit_type = DBI.tie('actor.org_unit_type', 'id') %] [% WRAPPER select name=input_prefix multi="multi" onchange='change_multihier_' _ table_alias _ '(this);'; depth = 0; FOR f = DBI.query(root); INCLUDE option value=f.id content=f.name; INCLUDE next_level parent_ou = f.id depth; END; END; BLOCK next_level; depth = depth + 1; x = depth; s = DBI.prepare(q); FOR f = s.execute(parent_ou); ou_t = f.ou_type; logme(["can_have_vols for ou_t", ,org_unit_type.$ou_t.can_have_vols]); IF org_unit_type.$ou_t.can_have_vols == 1; %] [% END; x = depth; val = ''; WHILE x > 0; val = val _ '  '; x = x - 1; END; INCLUDE option value=f.id content=f.name content=val _ f.name id='mh_' _ f.id; INCLUDE next_level parent_ou = f.id; END; END; %]