]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/authors.tt2
Going for the Jungle skin feel (like Amazon)
[Evergreen.git] / Open-ILS / src / templates / opac / parts / record / authors.tt2
1 [%  
2
3 authors = [
4     {
5         type => 'author', 
6         label => l('Author'),
7         xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]'
8     }, {
9         type => 'added', 
10         label => l('Added Author'),
11         xpath => '//*[@tag="700"]|//*[@tag="710"]|//*[@tag="711"]'
12     }, {
13         type => 'credits', 
14         label => l('Credited'),
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         term = '';
30         qterm = '';
31         FOR subfield IN node.childNodes;
32             NEXT UNLESS subfield.nodeName == "subfield";
33             code = subfield.getAttribute('code');
34             NEXT UNLESS code.match('[a-z]');
35             sf_raw = subfield.textContent;
36             sf = subfield.textContent | html;
37             term = term _ ' ' _ sf;
38             qterm = qterm _ ' ' _ sf_raw;
39         END;
40         url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, ['page', 'expand']);
41         author_type = label | html;
42         '<a href="' _ url _ '">' _ term _ '</a> (' _ author_type _ '). ';
43     END;
44 END;
45 %]
46
47 <div class='rdetail_extras_div'>
48 [% FOREACH author IN authors;
49     NEXT UNLESS author.xpath; 
50     links = PROCESS build_author_links(xpath=author.xpath, label=author.label);
51     IF links.match('\S') %]
52     <span class='rdetail-author-div'>[% links %]</span>
53     [% END %]
54 [% END %]
55 </div>
56
57