]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/authors.tt2
Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac...
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / authors.tt2
1 [%  
2
3 authors = [
4     {
5         type => 'author', 
6         label => l('Authors: '),
7         xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]'
8     }, {
9         type => 'added', 
10         label => l('Added Authors: '),
11         xpath => '//*[@tag="700"]|//*[@tag="710"]|//*[@tag="711"]'
12     }, {
13         type => 'credits', 
14         label => l('Credits: '),
15         xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]'
16     }, {
17         type => 'cast', 
18         label => l('Cast: '),
19         xpath => '//*[@tag="508"]'
20     }, {
21         type => 'notes', 
22         label => l('Author Notes: '),
23         xpath => '' # Comes from added content...
24     }
25 ];
26
27 BLOCK build_author_links;
28     FOR node IN ctx.marc_xml.findnodes(xpath);
29         FOR subfield IN node.childNodes;
30             NEXT UNLESS subfield.nodeName == "subfield";
31             code = subfield.getAttribute('code');
32             NEXT UNLESS code.match('[a-z]');
33             term = subfield.textContent | html;
34             '<br/><a href="' _ ctx.opac_root _ '/results?qtype=author&amp;query=' _ term _ '&amp;loc=' _ loc _ '">' _ term _ '</a>';
35         END;
36     END;
37 END;
38 %]
39
40 <div class='rdetail_extras_div'>
41 [% FOREACH author IN authors;
42     NEXT UNLESS author.xpath; 
43     links = PROCESS build_author_links(xpath=author.xpath);
44     IF links.match('\S') %]
45     <strong>[% author.label | html %]</strong>
46     <div class='rdetail-author-div'>[% links %]</div>
47     [% END %]
48 [% END %]
49 </div>
50
51