</script>
[% END; # use_autosuggest %]
+
+[% IF ctx.page == 'record' %]
<script type="text/javascript">
- [% ac_types = ['toc', 'anotes', 'excerpt', 'summary', 'reviews'] %]
/* Checks to see if a given type of added content has data to show.
* The first arg to callback() is boolean indicating the presence of data.
load : function(result) { callback(true, ident, type); }
});
}
-
- [%
- IF ctx.page == 'record';
- # XXX revisit when ident=ctx.bre_id
- ident = ctx.record_attrs.isbn_clean || ctx.record_attrs.upc;
- IF ident;
- FOR type IN ac_types;
- IF ctx.added_content.$type.status == '3' # status unknown %]
- dojo.addOnLoad(function() {
- var ident = '[% ident %]';
- var type = '[% type %]';
- acIsAvailable(ident, type, function(avail, ident, type) {
- // if the content is available, un-hide the tab
- if (avail) dojo.removeClass(dojo.byId('ac:' + type), 'hidden');
- });
+ [%- # XXX revisit when ident=ctx.bre_id
+ ident = ctx.record_attrs.isbn_clean || ctx.record_attrs.upc;
+ IF ident;
+ FOR type IN ctx.added_content.keys;
+ IF ctx.added_content.$type.status == '3' # status unknown %]
+ dojo.addOnLoad(function() {
+ var ident = '[% ident %]';
+ var type = '[% type %]';
+ acIsAvailable(ident, type, function(avail, ident, type) {
+ // if the content is available, un-hide the tab
+ if (avail) dojo.removeClass(dojo.byId('ac:' + type), 'hidden');
});
- [% END; # IF status unknown
- END;
- END; # IF ident
- END;
+ });
+ [% END; # IF status unknown
+ END;
+ END; # IF ident
%]
</script>
+[% END; # page=record -%]
[%- END; # want_dojo -%]
%]
<div id='ac_tab_wrapper'>
- [% FOR type IN ac_types.keys;
+ [%
+ all_hidden = 1;
+ FOR type IN ac_types.keys;
tab_class = 'ac_tab';
+ SET tab_class = tab_class _ ' ac_tab_selected' IF type == selected_type;
IF ctx.added_content.$type.status != '2'; # no content
+ all_hidden = 0;
IF ctx.added_content.$type.status == '3' AND want_dojo; # status unknown
tab_class = tab_class _ ' hidden';
END %]
<a href="[% mkurl('', {ac => type}) _ '#addedcontent' %]">[% ac_types.$type %]</a>
</div>
[% END;
- END %]
+ END;
+ %]
</div>
<div id='ac_content'>
ELSE;
l('No Content Available');
END;
+ ELSIF all_hidden;
+ l('No Content Available');
END;
%]
</div>
[% # Hidden extras are not yet implemented. Some may require JS
+ MACRO tab_is_active(tab) BLOCK;
+ exp_name = 'expand_' _ tab;
+ IF ctx.$exp_name OR ctx.expand_all; 1; END;
+ END;
+
# Let's see if we should hide the content cafe / simple summary content
hide_summary = 1;
IF attrs.summary.0; hide_summary = 0; ELSE;
END;
END;
+ # if no added content is available, hide the main tab
+ IF !tab_is_active('addedcontent');
+ hide_ac = 1;
+ FOR type IN ctx.added_content.keys;
+ SET hide_ac = 0 IF
+ ctx.added_content.$type.status != '2'; # not available
+ END;
+ END;
+
extras = [
{name => 'summaryplus', label => l('Summaries & More'), hide => hide_summary},
{name => 'contents', label => l('Contents'), hide => !attrs.contents},
{name => 'excerpt', label => l('Excerpt'), hide => 1},
{name => 'issues', label => l('Issues Held'), hide => !(ctx.have_holdings_to_show || ctx.have_mfhd_to_show)},
{name => 'preview', label => l('Preview'), hide => 1},
- {name => 'addedcontent', label => l('Additional Content')}, # hide if all content is known to not exist
+ {name => 'addedcontent', label => l('Additional Content'), hide => hide_ac}, # hide if all content is known to not exist
{name => 'cnbrowse', label => l('Shelf Browser')},
{name => 'marchtml', label => l('MARC Record')}
];
- MACRO tab_is_active(tab) BLOCK;
- exp_name = 'expand_' _ tab;
- IF ctx.$exp_name OR ctx.expand_all; 1; END;
- END;
-
FOREACH extra IN extras;
IF extra.hide; NEXT; END;
name = extra.name;
}
#ac_tab_wrapper { width : 100%; }
-.ac_tab { float: left; padding-right: 10px; font-size: 110%; }
+.ac_tab { float: left; padding-right: 10px; font-size: 110%; padding: 5px; border: 1px solid #417860; }
+.ac_tab_selected { background-color: #417860; }
+.ac_tab_selected a { color: #FFF; }
#ac_content { clear: both; width: 100%; margin-top: 10px; }