]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/extras.tt2
a6100f14f2e92256370e0e0a42337d1626df393d
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / extras.tt2
1 [%
2     arrow_img = ctx.media_prefix _ '/images/rdetail_arrow.png';
3     arrow_down_img = ctx.media_prefix _ '/images/rdetail_arrow_down.png';
4 %]
5 <div>
6     <div id='rdetail_extras_div' style='width: 100%;'> 
7         [%
8             IF ctx.google_books_preview;
9                 label = l('Google Preview');
10                 name = 'google_preview';
11                 href = 'javascript:GBDisplayPreview();';
12         %]
13         <div id="gbp_extra" class="rdetail_extras hide_me">
14             <div class="rdetail_extras_hr"></div>
15             <div id="gbp_extra_links" class="rdetail_extras_link">
16                 <a id='gbp_arrow_link' name='[% name %]' href='[% href %]'><img alt='[% label %]' src='[% arrow_img %]'/></a>
17                 <a id='gbp_arrow_down_link' name='[% name %]' href='[% href %]' class='hide_me'><img alt='[% label %]' src='[% arrow_down_img %]'/></a>
18                 <a name='[% name %]_lbl' href='[% href %]' class="rdetail_extras_lbl">[% label %]</a></div>
19         </div>
20         <div id="gbp_extra_container" class='rdetail_extras_div'></div>
21         [%  END %]
22
23         [%  # Hidden extras are not yet implemented.  Some may require JS
24
25         MACRO tab_is_active(tab) BLOCK;
26             exp_name = 'expand_' _ tab;
27             IF ctx.$exp_name OR ctx.expand_all; 1; END;
28         END;
29
30         # Let's see if we should hide the content cafe / simple summary content
31         hide_summary = 1;
32         IF attrs.summaries.0; hide_summary = 0; ELSE;
33             # Expose content cafe if it's reasonable to do so.
34             # This approach only works when using embedded content cafe.
35             IF ENV.OILS_CONTENT_CAFE_USER; 
36                 ident = attrs.isbn_clean || attrs.upc; 
37                 IF ident; hide_summary = 0; END;
38             END;
39         END;
40
41         # if no added content is available, hide the main tab.
42         # if any content is available, use the first tab as the default display tab.
43         default_ac = '';
44         IF !tab_is_active('addedcontent');
45             hide_ac = 1;
46             FOR type IN ctx.added_content.keys;
47                 IF ctx.added_content.$type.status != '2'; # not available
48                     hide_ac = 0;
49                 END;
50                 IF ctx.added_content.$type.status == '1';
51                     SET default_ac = type UNLESS default_ac;
52                 END;
53             END;
54         END;
55
56         extras = [
57             {name => 'summaryplus',  label => l('Summaries &amp; More'), hide => hide_summary}, 
58             {name => 'annotation', label => l('Annotation'), hide => 1}, 
59             {name => 'awards',  label => l('Awards, Reviews, & Suggested Reads')}, 
60             {name => 'excerpt',  label => l('Excerpt'), hide => 1},
61             {name => 'issues',   label => l('Issues Held'), hide => !(ctx.have_holdings_to_show || ctx.have_mfhd_to_show)},
62             {name => 'preview',  label => l('Preview'), hide => 1}, 
63             {name => 'addedcontent',  label => l('Additional Content'), hide => hide_ac},  # hide if all content is known to not exist
64             {name => 'cnbrowse', label => l('Shelf Browser')},
65             {name => 'marchtml', label => l('MARC Record')}
66         ];
67
68         FOREACH extra IN extras;
69             IF extra.hide; NEXT; END; 
70             name = extra.name;
71         %]
72         <div class="rdetail_extras">
73             <div class="rdetail_extras_hr"></div>
74             <div class="rdetail_extras_link">
75                 [%  
76                     IF tab_is_active(name);
77                         href = mkurl('', {}, ['expand', 'ac']);
78                         img_url = arrow_down_img;
79                     ELSE;
80                         IF name == 'addedcontent' AND default_ac;
81                             href = mkurl('', {expand => name, ac => default_ac}) _ '#' _ name; 
82                         ELSE;
83                             href = mkurl('', {expand => name}) _ '#' _ name; 
84                         END;
85                         img_url = arrow_img;
86                     END;
87                 %]
88                 <a name='[% name %]' href='[% href %]'><img alt='[% extra.label %]' src='[% img_url %]'/></a>
89                 <a name='[% name %]_lbl' href='[% href %]' class="rdetail_extras_lbl">[% extra.label %]</a>
90             </div>
91         </div>
92         <div class='rdetail_extras_div'>
93             [%  IF tab_is_active(name);
94                     IF name == 'marchtml';
95                         ctx.marchtml;
96                     ELSE;
97                         # Load the template for the selected extra
98                         INCLUDE "opac/parts/record/${name}.tt2";
99                     END;
100                 END; 
101             %]
102         </div>
103         [% END %]
104     </div>
105 </div>