</permacrud>
</class>
+ <class id="cusppet" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::ui_staff_portal_page_entry_type" oils_persist:tablename="config.ui_staff_portal_page_entry_type" reporter:label="Portal Page Entry Type">
+ <fields oils_persist:primary="code">
+ <field name="code" reporter:label="Entry Type Code" reporter:datatype="text" reporter:selector="label" oils_obj:required="true"/>
+ <field name="label" reporter:label="Entry Type Label" reporter:datatype="text" oils_obj:required="true"/>
+ </fields>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <retrieve/>
+ </actions>
+ </permacrud>
+ </class>
+
<class id="cusppe" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::ui_staff_portal_page_entry" oils_persist:tablename="config.ui_staff_portal_page_entry" reporter:label="Portal Page Entry">
<fields oils_persist:primary="id" oils_persist:sequence="config.ui_staff_portal_page_entry_id_seq">
<field name="id" reporter:label="ID" reporter:datatype="id" reporter:selector="label"/>
<field name="page_col" reporter:label="Page Column" reporter:datatype="int" oils_obj:required="true"/>
<field name="col_pos" reporter:label="Column Position" reporter:datatype="int" oils_obj:required="true"/>
- <field name="entry_type" reporter:label="Entry Type" reporter:datatype="text" oils_obj:required="true"/>
+ <field name="entry_type" reporter:label="Entry Type" reporter:datatype="link" oils_obj:required="true"/>
<field name="label" reporter:label="Entry Label" reporter:datatype="text"/>
<field name="image_url" reporter:label="Entry Image URL" reporter:datatype="text"/>
<field name="target_url" reporter:label="Entry Target URL" reporter:datatype="text"/>
<field name="owner" reporter:label="Owner" reporter:datatype="link" oils_obj:required="true"/>
</fields>
<links>
+ <link field="entry_type" reltype="has_a" key="code" map="" class="cusppet"/>
<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
BEGIN;
-CREATE TYPE config.ui_staff_portal_page_entry_type AS ENUM ('link', 'menuitem', 'text', 'header', 'catalogsearch');
+CREATE TABLE config.ui_staff_portal_page_entry_type(
+ code TEXT PRIMARY KEY,
+ label TEXT NOT NULL
+);
+
+INSERT INTO config.ui_staff_portal_page_entry_type (code, label)
+VALUES
+ ('link', oils_i18n_gettext('link', 'Link', 'cusppet', 'label')),
+ ('menuitem', oils_i18n_gettext('menuitem', 'Menu Item', 'cusppet', 'label')),
+ ('text', oils_i18n_gettext('text', 'Text and/or HTML', 'cusppet', 'label')),
+ ('header', oils_i18n_gettext('header', 'Header', 'cusppet', 'label')),
+ ('catalogsearch', oils_i18n_gettext('catalogsearch', 'Catalog Search Box', 'cusppet', 'label'));
+
CREATE TABLE config.ui_staff_portal_page_entry (
- id SERIAL PRIMARY Key,
+ id SERIAL PRIMARY KEY,
page_col INTEGER NOT NULL,
col_pos INTEGER NOT NULL,
- entry_type config.ui_staff_portal_page_entry_type NOT NULL,
+ entry_type TEXT NOT NULL,
label TEXT,
image_url TEXT,
target_url TEXT,
owner INT NOT NULL -- REFERENCES actor.org_unit (id)
);
+ALTER TABLE config.ui_staff_portal_page_entry ADD CONSTRAINT cusppe_entry_type_fkey
+ FOREIGN KEY (entry_type) REFERENCES config.ui_staff_portal_page_entry_type(code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE config.ui_staff_portal_page_entry ADD CONSTRAINT cusppe_owner_fkey
FOREIGN KEY (owner) REFERENCES actor.org_unit(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;