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