From 5c1cd414a367d25174db7a4c33ab5b8ba8ec5db2 Mon Sep 17 00:00:00 2001 From: berick Date: Fri, 1 Apr 2011 16:26:12 -0400 Subject: [PATCH] more rdetail extras cleanup; added support for authors display --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 1 + Open-ILS/web/css/skin/default/opac/style.css | 1 + .../default/opac/parts/record/authors.tt2 | 51 ++++++++++++ .../templates/default/opac/parts/record/extras.tt2 | 91 +++++++--------------- 4 files changed, 82 insertions(+), 62 deletions(-) create mode 100644 Open-ILS/web/templates/default/opac/parts/record/authors.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index c58e2cf29c..a95b8be109 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -173,6 +173,7 @@ sub load_common { $ctx->{referer} = $self->cgi->referer; $ctx->{path_info} = $self->cgi->path_info; + $ctx->{full_path} = $ctx->{base_path} . $self->cgi->path_info; $ctx->{unparsed_uri} = $self->apache->unparsed_uri; $ctx->{opac_root} = $ctx->{base_path} . "/opac"; # absolute base url $ctx->{is_staff} = ($self->apache->headers_in->get('User-Agent') =~ 'oils_xulrunner'); diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index 27f36a7c52..ff9153b6fe 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -979,3 +979,4 @@ a.dash-link:hover { text-decoration: underline !important; } .hold-editor-controls a { padding-left: 2em; } #rdetail_cn_browse_div { text-align: center; } +.rdetail-author-div { padding-bottom: 10px; } diff --git a/Open-ILS/web/templates/default/opac/parts/record/authors.tt2 b/Open-ILS/web/templates/default/opac/parts/record/authors.tt2 new file mode 100644 index 0000000000..5d9db772d1 --- /dev/null +++ b/Open-ILS/web/templates/default/opac/parts/record/authors.tt2 @@ -0,0 +1,51 @@ +[% + +authors = [ + { + type => 'author', + label => l('Authors: '), + xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]' + }, { + type => 'added', + label => l('Added Authors: '), + xpath => '//*[@tag="700"]|//*[@tag="710"]|//*[@tag="711"]' + }, { + type => 'credits', + label => l('Credits: '), + xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]' + }, { + type => 'cast', + label => l('Cast: '), + xpath => '//*[@tag="508"]' + }, { + type => 'notes', + label => l('Author Notes: '), + xpath => '' # Comes from added content... + } +]; + +BLOCK build_author_links; + FOR node IN ctx.marc_xml.findnodes(xpath); + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = subfield.getAttribute('code'); + NEXT UNLESS code.match('[a-z]'); + term = subfield.textContent | html; + '
' _ term _ ''; + END; + END; +END; +%] + +
+[% FOREACH author IN authors; + NEXT UNLESS author.xpath; + links = PROCESS build_author_links(xpath=author.xpath); + IF links.match('\S') %] + [% author.label %] +
[% links %]
+ [% END %] +[% END %] +
+ + diff --git a/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 b/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 index f66b77b706..a87248b779 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 @@ -1,34 +1,5 @@ -[% - # Builds a link like so: $orig_link&expand=$tab#$tab - # use of 'SET foo =' prevents unintended inline rendering of values - BLOCK rdetail_extras_tab_link; - cgi = CGI(); - SET foo = cgi.param('expand', tab); - url = ctx.unparsed_uri.replace('\?.*', '?' _ cgi.query_string); - SET foo = url.replace('#.*', ''); # clear any existing anchor - url _ '#' _ tab; # anchor on the tab name - END; -%] -
-
- - - - [% - # Hidden extras are not yet implemented. Some may require JS - extras = [ - {name => 'summary', label => l('Summary & More'), hide => 1}, # Content Cafe - {name => 'content', label => l('Contents'), hide => 1}, # ToC - {name => 'authors', label => l('Authors'), hide => 1}, - {name => 'series', label => l('Series'), hide => 1}, - {name => 'awards', label => l('Series'), hide => 1}, - {name => 'subject', label => l('Subject')}, - {name => 'annotation', label => l('Annotation'), hide => 1}, - {name => 'reviews', label => l('Reviews'), hide => 1}, - {name => 'excerpt', label => l('Excerpt'), hide => 1}, - {name => 'preview', label => l('Preview'), hide => 1}, - {name => 'novelist', label => l('Suggestions by NoveList'), hide => 1}, - {name => 'cnbrowse', label => l('Shelf Browser'), hide => 1}, - {name => 'copyinfo', label => l('Copy Summary'), hide => 1}, - {name => 'marchtml', label => l('MARC Record')} - ]; + [% # Hidden extras are not yet implemented. Some may require JS + + extras = [ + {name => 'summary', label => l('Summary & More'), hide => 1}, # Content Cafe + {name => 'content', label => l('Contents'), hide => 1}, # ToC + {name => 'authors', label => l('Authors')}, + {name => 'series', label => l('Series'), hide => 1}, + {name => 'awards', label => l('Series'), hide => 1}, + {name => 'subjects', label => l('Subject')}, + {name => 'annotation', label => l('Annotation'), hide => 1}, + {name => 'reviews', label => l('Reviews'), hide => 1}, + {name => 'excerpt', label => l('Excerpt'), hide => 1}, + {name => 'preview', label => l('Preview'), hide => 1}, + {name => 'novelist', label => l('Suggestions by NoveList'), hide => 1}, + {name => 'cnbrowse', label => l('Shelf Browser'), hide => 1}, + {name => 'copyinfo', label => l('Copy Summary'), hide => 1}, + {name => 'marchtml', label => l('MARC Record')} + ]; + + FOREACH extra IN extras; + IF extra.hide; NEXT; END; + name = extra.name; %] - [% FOREACH extra IN extras %] - [% IF extra.hide; NEXT; END; %]
- [% name = extra.name; - exp_name = 'expand_' _ name; + [% exp_name = 'expand_' _ name; IF ctx.$exp_name; - IF name == 'subject'; - INCLUDE "default/opac/parts/record/subjects.tt2"; - ELSIF name == 'reviews'; - ELSIF name == 'excerpt'; - ELSIF name == 'preview'; - ELSIF name == 'novelist'; - ELSIF name == 'cnbrowse'; - ELSIF name == 'copyinfo'; - ELSIF name == 'marchtml'; + IF name == 'marchtml'; ctx.marchtml; + ELSE; + # Load the template for the selected extra + INCLUDE "default/opac/parts/record/${name}.tt2"; END; END; %] -- 2.11.0