From: Thomas Berezansky Date: Fri, 23 Oct 2015 15:20:02 +0000 (-0400) Subject: Allow multiple icon styles X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e604f1944fffee8d092c2687c8f308ec8a909428;p=working%2FEvergreen.git Allow multiple icon styles Comma-delimited list, First one with icons wins. icon_format,item_type would be "new style, then old style". Signed-off-by: Thomas Berezansky --- diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 6c2cb47910..8166685546 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -593,30 +593,33 @@ END; # "mattype" == "custom marc format specifier" - icon_style = ctx.get_cgf('opac.icon_attr').value || 'item_type'; - 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; - ccvm = ctx.get_ccvm(node.getAttribute('cvmid')); - NEXT IF ccvm.opac_visible == 'f'; - - format = {}; - type = ccvm.code.remove('-'); # blu-ray to bluray - format.label = ccvm.search_label || ccvm.value; - format.icon = PROCESS get_ccvm_icon ccvm=ccvm; - format.itemtype = schema_typemap.$type || 'CreativeWork'; - - args.all_formats.push(format); # metarecords want all formats - - IF !args.format_label; - # use the first format as the default - args.format_label = format.label; - args.schema.itemtype = format.itemtype; - args.format_icon = format.icon; + icon_styles = ctx.get_cgf('opac.icon_attr').value || 'item_type'; + FOREACH icon_style IN icon_styles.split(','); + 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; + ccvm = ctx.get_ccvm(node.getAttribute('cvmid')); + NEXT IF ccvm.opac_visible == 'f'; + + format = {}; + type = ccvm.code.remove('-'); # blu-ray to bluray + format.label = ccvm.search_label || ccvm.value; + format.icon = PROCESS get_ccvm_icon ccvm=ccvm; + format.itemtype = schema_typemap.$type || 'CreativeWork'; + + args.all_formats.push(format); # metarecords want all formats + + IF !args.format_label; + # use the first format as the default + args.format_label = format.label; + args.schema.itemtype = format.itemtype; + args.format_icon = format.icon; + END; END; END; + LAST IF args.all_formats.size > 0; END; args.bibid = [];