TPac: first try audience_group SVF for audience maps
authorBill Erickson <berick@esilibrary.com>
Tue, 6 Sep 2011 16:12:36 +0000 (12:12 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 6 Sep 2011 16:22:14 +0000 (12:22 -0400)
Allow for configuration of an "audience_group"
config.record_attr_definition for collecting MARC audience codes into more
human-friendly groups.  This allows the TPac to behave more like the
current OPAC, which groups audience values into simpler collections. As
with "mattype", if no "audience_group" configuration exists, fall back to
the traditional, long-form "audience" attribute.

For future referene, here's an example setup using an "audience_group"
attribute.

-- Can be done in MARC Record Attributes admin UI
INSERT INTO config.record_attr_definition
    (name, label, description, fixed_field, filter)
VALUES
    ('audience_group', 'Audience Group', 'Audience Group', 'Audn', TRUE);

-- Can be done in MARC Coded Value Maps admin UI
INSERT INTO config.coded_value_map
    (ctype, code, value, description)
VALUES
    ('audience_group', 'A', 'Adult', 'Adult Audience'),
    ('audience_group', 'T', 'Teen', 'Teen Audience'),
    ('audience_group', 'C', 'Children', 'Children Audience');

-- No UI currently
INSERT INTO config.record_attr_index_norm_map
    (attr, norm, params)
VALUES
    ('audience_group', (
        SELECT id FROM
            config.index_normalizer WHERE func =
            'generic_map_normalizer'
        ),
        '["=>A g,e,f=>A a,c,j,b=>C d=>T"]'
);

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/advanced/search.tt2

index f856ce8..7e300ed 100644 (file)
@@ -42,7 +42,7 @@
             <td valign='top'>
                 <strong>[% l("Audience") %]</strong><br />
                     [% INCLUDE "opac/parts/coded_value_selector.tt2"
-                        attr="audience" multiple="multiple" size="4" %]
+                        attr=["audience_group", "audience"] multiple="multiple" size="4" %]
                 </select>
             </td>
             <td valign='top'>