From 9ddbec68d147fc031218d35a36843209ae099add Mon Sep 17 00:00:00 2001 From: berick Date: Thu, 31 Mar 2011 17:48:47 -0400 Subject: [PATCH] Fleshed out View MARC / Subjects Tabs Record detail page has support for showing the 'extras' tabs. Currently supported tabs are View MARC (html) and extended subject info. For consistency w/ seed skin, subjects are now only shown in expanded subjects area. --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 3 +- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 14 ++- .../templates/default/opac/parts/record/body.tt2 | 72 ------------- .../templates/default/opac/parts/record/extras.tt2 | 116 ++++----------------- .../default/opac/parts/record/subjects.tt2 | 92 ++++++++++++++++ .../default/opac/parts/record/summary.tt2 | 39 ------- 6 files changed, 127 insertions(+), 209 deletions(-) create mode 100644 Open-ILS/web/templates/default/opac/parts/record/subjects.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index fac8a2dea6..e232b725a2 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->{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'); @@ -252,7 +253,7 @@ sub load_login { # login succeeded, redirect as necessary my $acct = $self->apache->unparsed_uri; - $acct =~ s#/login#/myopac/main#; + $acct =~ s|/login|/myopac/main|; return $self->generic_redirect( $cgi->param('redirect_to') || $acct, diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index c3716d52b0..c2da1921d5 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -33,6 +33,14 @@ sub load_record { $self->ctx->{copy_limit} = $copy_limit; $self->ctx->{copy_offset} = $copy_offset; + for my $expand ($self->cgi->param('expand')) { + if($expand eq 'marchtml') { + $self->ctx->{marchtml} = $self->mk_marc_html($rec_id); + } elsif($expand eq 'subject') { + $self->ctx->{expand_subject} = 1; + } + } + return Apache2::Const::OK; } @@ -121,8 +129,10 @@ sub mk_copy_query { sub mk_marc_html { my($self, $rec_id) = @_; - $self->ctx->{marc_html} = $U->simplereq( - 'open-ils.search', 'open-ils.search.biblio.record.html', $rec_id); + # could be optimized considerably by performing the xslt on the already fetched record + return $U->simplereq( + 'open-ils.search', + 'open-ils.search.biblio.record.html', $rec_id); } 1; diff --git a/Open-ILS/web/templates/default/opac/parts/record/body.tt2 b/Open-ILS/web/templates/default/opac/parts/record/body.tt2 index f36182a4ad..9de517dd0b 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/body.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/body.tt2 @@ -38,84 +38,12 @@
- - - - - - -
- « Back - -
- - - - - - - - -
- [% l("Record Summary") %] - - - [% l("Export to RefWorks") %] - - - - -
-
[% l("This record has been deleted from the database. We recommend that you remove this title from any bookbags it may have been added to.") %]
- [% INCLUDE "default/opac/parts/record/summary.tt2" %]
-
-
- -
-
- -
-
[% INCLUDE "default/opac/parts/record/extras.tt2" %] - -
- [% l("(none)") %] -
-
- [% l("Item successfully added to bookbag") %] -
-
- [% l("Enter the name of the new bookbag") %] -
-
- [% l("Bookbag successfully created") %] -
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 6db9b6e478..292ed79a74 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 @@ -1,5 +1,14 @@ +[% + # Augments/alters the current URL to set expand=$tab + # for displaying expanded detail content. + BLOCK rdetail_extras_tab_link; + SET foo = CGI.param('expand', tab); + ctx.unparsed_uri.replace('\?.*', '?' _ CGI.query_string); + END; +%] +
- +
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Subject: - -
-
- Genre: - -
-
- Topic Heading: - -
-
- Geographic Setting: - -
-
- Biographical Subject: - -
-
- Character Attributes: - -
-
- Setting: - -
-
- Time Period: - -
-
-
+ [% INCLUDE "default/opac/parts/record/subjects.tt2" %] + +
@@ -297,18 +223,18 @@ [% INCLUDE "default/opac/parts/record/copyinfo.tt2" %] -
[% l("Full text") %]
[% l("See the full text of this book.") %]
diff --git a/Open-ILS/web/templates/default/opac/parts/record/subjects.tt2 b/Open-ILS/web/templates/default/opac/parts/record/subjects.tt2 new file mode 100644 index 0000000000..50a83f6039 --- /dev/null +++ b/Open-ILS/web/templates/default/opac/parts/record/subjects.tt2 @@ -0,0 +1,92 @@ + + +[% IF ctx.expand_subject %] + +
+ + + + + + + [% + subjects = [ + { + label => l('Genre: '), + xpath => '//*[@tag="655"]|//*[@tag="659"]' + }, { + label => l('Topic Heading: '), + xpath => '//*[@tag="690"]' + }, { + label => l('Geographic Setting: '), + xpath => '//*[@tag="691"]' + }, { + label => l('Biographical Subject: '), + xpath => '//*[@tag="692"]' + }, { + label => l('Character Attributes: '), + xpath => '//*[@tag="693"]' + }, { + label => l('Setting: '), + xpath => '//*[@tag="698"]' + }, { + label => l('Time Period: '), + xpath => '//*[@tag="699"]' + } + ]; + + FOREACH subj IN subjects; + ''; + content = PROCESS render_subject(xpath=subj.xpath); + IF content.match('\S') %] + + + + + [% END; END; %] +
+ [% l('Subject:') %] + + [% BLOCK render_subject; + loc = CGI.param('loc') | uri; + xpath = xpath || '//*[starts-with(@tag,"6")]'; + FOR node IN ctx.marc_xml.findnodes(xpath); + all_terms = []; + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = 0; + FOR a IN subfield.attributes; + IF a.nodeName == "code"; + code = a.nodeValue; + END; + END; + NEXT UNLESS code.match('[a-z]'); + + IF code.match('[vxyz]'); + " — "; + END; + # at this point, we actually have a partial term to use. + single_term = subfield.textContent | html; + all_terms.push(subfield.textContent); + total_term = all_terms.join(" ").replace('\s+$', '') ; # XXX need to take care of any &'s, right? + '' _ single_term _ ''; + END; + "
"; + END %] + [% END %] + [% s = PROCESS render_subject; IF s.match('\S'); s; END; %] +
+ [% subj.label %] +
[% content %]
+
+ +[% END %] + diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index a62508d4d5..eaa77a4ec1 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -96,45 +96,6 @@ [% attrs.pubdate %] - - - [% BLOCK render_subject; - loc = CGI.param('loc') | uri; - FOR node IN ctx.marc_xml.findnodes('//*[starts-with(@tag,"6")]'); - all_terms = []; - FOR subfield IN node.childNodes; - NEXT UNLESS subfield.nodeName == "subfield"; - code = 0; - FOR a IN subfield.attributes; - IF a.nodeName == "code"; - code = a.nodeValue; - END; - END; - NEXT UNLESS code.match('[a-z]'); - - IF code.match('[vxyz]'); - " — "; - END; - # at this point, we actually have a partial - # term to use. - single_term = subfield.textContent | html; - all_terms.push(subfield.textContent); - total_term = all_terms.join(" ").replace('\s+$', '') ; # XXX need to take care of any &'s, right? - '' _ single_term _ ''; - END; - "
"; - END %] - [% END %] - [% s = PROCESS render_subject; IF s.match('\S') %] - - [% l("Subjects") %] - - [% s %] - [% END %] -
-- 2.11.0