# value=org_id show_loc_groups=1/0 can_have_vols_only=1/0
BLOCK build_org_selector;
- root_node = org_unit || ctx.aou_tree;
- node_stack = [{org => root_node}] %]
+ node_stack = [{org => org_unit || ctx.aou_tree}] %]
<select [% IF id %] id='[% id %]' [% END %] name='[% name %]'>
[%
disabled = '';
selected = '';
- IF ctx.is_staff || org_unit.opac_visible == 't';
+ NEXT UNLESS ctx.is_staff || org_unit.opac_visible == 't';
- IF !loc_grp;
- IF show_loc_groups;
- FOR grp IN ctx.copy_location_groups.$ou_id.sort('pos').reverse;
- node_stack.push({org => org_unit, loc_grp => grp});
- END;
- END;
- FOR child IN org_unit.children.reverse;
- node_stack.push({org => child});
+ IF !loc_grp;
+ IF show_loc_groups;
+ FOR grp IN ctx.copy_location_groups.$ou_id.sort('pos').reverse;
+ node_stack.push({org => org_unit, loc_grp => grp});
END;
END;
+ FOR child IN org_unit.children.reverse;
+ node_stack.push({org => child});
+ END;
+ END;
- IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
- disabled = 'disabled="disabled"';
- ELSIF ou_id == value; # TODO: test for copy_loc value
- selected = 'selected="selected"';
- END %]
+ IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
+ disabled = 'disabled="disabled"';
+ ELSIF ou_id == value; # TODO: test for copy_loc value
+ selected = 'selected="selected"';
+ END %]
- <option value='[% org_unit.id | uri %]' [% selected %] [% disabled %]>
- [%
- depth = org_unit.ou_type.depth;
- IF loc_grp; depth = depth + 1; END;
- pad = depth * 2;
- FOR idx IN [0..pad]; ' '; END;
- loc_grp ? loc_grp.name : org_unit.name | html ;
- %]
- </option>
+ <option value='[% org_unit.id | uri %]' [% selected %] [% disabled %]>
+ [%
+ # loc_grp's are displayed as children of the current org
+ depth = org_unit.ou_type.depth;
+ IF loc_grp; depth = depth + 1; END;
+ pad = depth * 2;
+ FOR idx IN [0..pad]; ' '; END;
+ loc_grp ? loc_grp.name : org_unit.name | html ;
+ %]
+ </option>
- [%
- END;
+ [%
END;
%]
</select>