]> 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             url = mkurl(ctx.opac_root _ '/results', {query => subfield.textContent, qtype => 'author'}, ['page', 'expand']);
35             '<br/><a href="' _ url _ '">' _ term _ '</a>';
36         END;
37     END;
38 END;
39 %]
40
41 <div class='rdetail_extras_div'>
42 [% FOREACH author IN authors;
43     NEXT UNLESS author.xpath; 
44     links = PROCESS build_author_links(xpath=author.xpath);
45     IF links.match('\S') %]
46     <strong>[% author.label | html %]</strong>
47     <div class='rdetail-author-div'>[% links %]</div>
48     [% END %]
49 [% END %]
50 </div>
51
52