3 UPDATE action_trigger.event_definition SET template = $$
5 <style> li { padding: 8px; margin 5px; }</style>
7 [% FOR cbreb IN target %]
8 [% FOR item IN cbreb.items;
9 bre_id = item.target_biblio_record_entry;
11 bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
12 FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
13 title = title _ part.textContent;
16 author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
17 item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
18 publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
19 pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
20 isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
21 issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
22 upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
26 Bib ID# [% bre_id %]<br/>
27 [% IF isbn %]ISBN: [% isbn %]<br/>[% END %]
28 [% IF issn %]ISSN: [% issn %]<br/>[% END %]
29 [% IF upc %]UPC: [% upc %]<br/>[% END %]
30 Title: [% title %]<br />
31 Author: [% author %]<br />
32 Publication Info: [% publisher %] [% pubdate %]<br/>
33 Item Type: [% item_type %]
40 WHERE hook = 'biblio.format.record_entry.print' AND id < 100; -- sample data
43 UPDATE action_trigger.event_definition SET delay = '00:00:00', template = $$
44 [%- SET user = target.0.owner -%]
45 To: [%- params.recipient_email || user.email %]
46 From: [%- params.sender_email || default_sender %]
47 Subject: Bibliographic Records
49 [% FOR cbreb IN target %]
50 [% FOR item IN cbreb.items;
51 bre_id = item.target_biblio_record_entry;
53 bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
54 FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
55 title = title _ part.textContent;
58 author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
59 item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
60 publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
61 pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
62 isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
63 issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
64 upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
67 [% loop.count %]/[% loop.size %]. Bib ID# [% bre_id %]
68 [% IF isbn %]ISBN: [% isbn _ "\n" %][% END -%]
69 [% IF issn %]ISSN: [% issn _ "\n" %][% END -%]
70 [% IF upc %]UPC: [% upc _ "\n" %] [% END -%]
73 Publication Info: [% publisher %] [% pubdate %]
74 Item Type: [% item_type %]
79 WHERE hook = 'biblio.format.record_entry.email' AND id < 100; -- sample data
81 -- remove a swath of unused environment entries
83 DELETE FROM action_trigger.environment env
84 USING action_trigger.event_definition def
85 WHERE env.event_def = def.id AND
86 env.path != 'items' AND
87 def.hook = 'biblio.format.record_entry.print' AND
88 def.id < 100; -- sample data
90 DELETE FROM action_trigger.environment env
91 USING action_trigger.event_definition def
92 WHERE env.event_def = def.id AND
93 env.path != 'items' AND
94 env.path != 'owner' AND
95 def.hook = 'biblio.format.record_entry.email' AND
96 def.id < 100; -- sample data