END;
END;
- # Get CCVM labels
BLOCK get_ccvm_label;
- IF !ctx.ccvm_cache.$id;
- fetch_ccvm = ctx.search_ccvm('id', id);
- IF fetch_ccvm;
- ctx.ccvm_cache.$id = fetch_ccvm.0;
- END;
- END;
- IF search_label and ctx.ccvm_cache.$id.search_label;
- ctx.ccvm_cache.$id.search_label;
+ ccvm = ctx.get_ccvm(id); # caches internally
+ IF search_label and ccvm.search_label;
+ ccvm.search_label;
ELSE;
- ctx.ccvm_cache.$id.value;
+ ccvm.$id.value;
END;
END;
# "mattype" == "custom marc format specifier"
icon_style = ctx.get_cgf('opac.icon_attr').value || 'item_type';
- node = xml.findnodes(
- '//*[local-name()="attributes"]/*[local-name()="field"][@name="' _ icon_style _ '"]');
- IF node AND node.textContent;
- type = node.textContent;
- args.format_label = PROCESS get_ccvm_label id=node.getAttribute('cvmid') search_label=1;
- IF !args.format_label;
- args.format_label = node.getAttribute('coded-value');
+ formats_xpath = '//*[local-name()="attributes"]/*[local-name()="field"][@name="' _ icon_style _ '"]';
+
+ args.all_formats = [];
+ FOR node IN xml.findnodes(formats_xpath);
+ IF node AND node.textContent;
+ type = node.textContent;
+ label = PROCESS get_ccvm_label id=node.getAttribute('cvmid') search_label=1;
+ itemtype = schema_typemap.$type || 'CreativeWork';
+ icon = ctx.media_prefix _ '/images/format_icons/' _ icon_style _ '/' _ type _ '.png';
+ # collect all formats for metarecord support
+ args.all_formats.push({label => label, icon => icon, itemtype => itemtype});
+ IF !args.format_label;
+ # use the first format as the default
+ args.format_label = label;
+ args.schema.itemtype = itemtype;
+ args.format_icon = icon;
+ END;
END;
- args.schema.itemtype = schema_typemap.$type || 'CreativeWork';
- args.format_icon = ctx.media_prefix _ '/images/format_icons/' _ icon_style _ '/' _ type _ '.png';
- LAST;
END;
args.bibid = [];
</div>
<div id='bib_format' class='result_table_title_cell'>
[%- IF attrs.format_label; %]
- <img title="[% attrs.format_label | html %]" alt="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" /> [% attrs.format_label; %]
+ [% FOR format IN attrs.all_formats %]
+ <img title="[% format.label | html %]"
+ alt="[% format.label | html %]"
+ src="[% format.icon %]" />
+ [% format.label | html %]
+ [% END %]
[%- END %]
[%- UNLESS CGI.param('detail_record_view')
OR (show_more_details.default == 'true'