<field reporter:label="Is OPAC Visible?" name="opac_visible" reporter:datatype="bool"/>
<field reporter:label="Owning Org Unit" name="owner" reporter:datatype="org_unit"/>
<field reporter:label="Position" name="pos" reporter:datatype="int"/>
+ <field reporter:label="Display Above Orgs" name="top" reporter:datatype="bool"/>
<field reporter:label="Copy Location Mappings" name="location_maps" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
name TEXT NOT NULL, -- i18n
owner INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
pos INT NOT NULL DEFAULT 0,
+ top BOOL NOT NULL DEFAULT FALSE,
opac_visible BOOL NOT NULL DEFAULT TRUE,
CONSTRAINT lgroup_once_per_owner UNIQUE (owner,name)
);
name TEXT NOT NULL, -- i18n
owner INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
pos INT NOT NULL DEFAULT 0,
+ top BOOL NOT NULL DEFAULT FALSE,
opac_visible BOOL NOT NULL DEFAULT TRUE,
CONSTRAINT lgroup_once_per_owner UNIQUE (owner,name)
);
NEXT UNLESS ctx.is_staff || org_unit.opac_visible == 't';
- IF !loc_grp;
+ IF !loc_grp; # processing an org unit
+
+ top_loc_groups = [];
IF show_loc_groups;
+ # add the location groups that sort below the child org units
FOR grp IN ctx.copy_location_groups.$ou_id.reverse;
- node_stack.push({org => org_unit, loc_grp => grp});
+ IF grp.top == 't';
+ top_loc_groups.push(grp);
+ ELSE;
+ node_stack.push({org => org_unit, loc_grp => grp});
+ END;
END;
END;
+
+ # add the child org units
FOR child IN org_unit.children.reverse;
node_stack.push({org => child});
END;
+
+ # add the location groups that sort to the top
+ # above the child org units
+ FOR grp IN top_loc_groups;
+ node_stack.push({org => org_unit, loc_grp => grp});
+ END;
END;
node_value = ou_id;