From 7427377e3ff26891c03bf0ea88f1854d1e594919 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 15 Aug 2012 11:47:29 -0400 Subject: [PATCH] Add support for TPAC in SFX Target Parser Signed-off-by: Dan Scott --- Open-ILS/examples/sfx_target_parser/JSPAC.hlp | 1 + Open-ILS/examples/sfx_target_parser/README | 13 ++-- Open-ILS/examples/sfx_target_parser/TPAC.hlp | 99 +++++++++++++++++++++++++++ Open-ILS/examples/sfx_target_parser/TPAC.pm | 82 ++++++++++++++++++++++ 4 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/examples/sfx_target_parser/TPAC.hlp create mode 100644 Open-ILS/examples/sfx_target_parser/TPAC.pm diff --git a/Open-ILS/examples/sfx_target_parser/JSPAC.hlp b/Open-ILS/examples/sfx_target_parser/JSPAC.hlp index d1d71076c8..c631e6e9ff 100644 --- a/Open-ILS/examples/sfx_target_parser/JSPAC.hlp +++ b/Open-ILS/examples/sfx_target_parser/JSPAC.hlp @@ -88,6 +88,7 @@ font-weight: bold; font-variant: normal; text-transform: none; color: #333399} In the PARSE_PARAM field, replace the following information:
eg_host = $$LOCAL_CATALOGUE_SERVER
+ eg_host = catalog.example.com eg_locale = Locale (en-US, en-CA, fr-CA, etc) eg_skin = algoma, default, lul, nohin, uwin eg_org_unit = 103, 1, etc diff --git a/Open-ILS/examples/sfx_target_parser/README b/Open-ILS/examples/sfx_target_parser/README index df6edc100c..c8a7f858ff 100644 --- a/Open-ILS/examples/sfx_target_parser/README +++ b/Open-ILS/examples/sfx_target_parser/README @@ -7,8 +7,10 @@ the JavaScript-based OPAC (JSPAC) as its target. It assumes the existence of identifier|issn and identifier|isbn indexes (available by default as of Evergreen 2.0). The code was based on my work as documented at http://coffeecode.net/archives/194-SFX-target-parser-for-Evergreen-and-some-thoughts-about-searching-identifiers.html -but updated for Evergreen 2.0, made more generic for an Evergreen audience, -and targeted at the JSPAC in the knowledge that TPAC is coming. +but updated for Evergreen 2.2 and made more generic for an Evergreen audience. + +It supports both the JSPAC (deprecated as of Evergreen 2.2) and TPAC +catalogues. 1. Create a SFX target parser Evergreen directory, adjusting the SFX path and instance name according to your needs: @@ -18,12 +20,13 @@ and targeted at the JSPAC in the knowledge that TPAC is coming. mkdir /exlibris/sfx_ver/sfx4_1//lib/Parsers/TargetParser/Evergreen ------------------------------------------------------------------------------ + -2. Copy the JSPAC.hlp and JSPAC.pm files into your SFX target parser Evergreen - directory: +2. Copy the JSPAC.hlp, JSPAC.pm, TPAC.hlp, and TPAC.pm files into your SFX + target parser Evergreen directory: + [source,bash] ------------------------------------------------------------------------------ -cp JSPAC* /exlibris/sfx_ver/sfx4_1//lib/Parsers/TargetParser/Evergreen +cp *.hlp /exlibris/sfx_ver/sfx4_1//lib/Parsers/TargetParser/Evergreen +cp *.pm /exlibris/sfx_ver/sfx4_1//lib/Parsers/TargetParser/Evergreen ------------------------------------------------------------------------------ + 3. Restart SFX to enable it to recognize the new target parser. diff --git a/Open-ILS/examples/sfx_target_parser/TPAC.hlp b/Open-ILS/examples/sfx_target_parser/TPAC.hlp new file mode 100644 index 0000000000..36aed2ca30 --- /dev/null +++ b/Open-ILS/examples/sfx_target_parser/TPAC.hlp @@ -0,0 +1,99 @@ + + + +sfxctrl + + + + + + +sfxctrl + + + + + + + +

PARSE_PARAM help for Evergreen Template Toolkit OPAC

+
+

This help file describes Target Parser information + for the Evergreen Template Toolkit OPAC. You will need this information only when + editing this Target Service.
+
+
About PARSE_PARAM fields
+
PARSE_PARAM fields contain Target Parser information that is specific to + a particular Target Service or Object Portfolio. Two PARSE_PARAM fields exist + in the database:
+ 1. in the Target Service table : parameters that apply to the whole Target Service + (eg. base URL)
+ 2. in the Object Portfolio table : parameters that apply to one particular Object + Portfolio. (eg. jkey)
+ This file will show you which PARSE_PARAM fields to fill in for both the Target + Service level and the Object Portfolio level. More information on Target Parsers + can be found in the SFX User Guide.

+ +

General Information
+ Target - LOCAL_CATALOGUE_EVERGREEN_TPAC
+ Service - getHolding
+ Parser - Evergreen::TPAC

+
+

Information needed in the Target Service:
+In the PARSE_PARAM field, replace the following information: +
+eg_host = $$LOCAL_CATALOGUE_SERVER
+ eg_host = catalog.example.com + eg_org_unit = 103, 1, etc +

+

+

+ + + diff --git a/Open-ILS/examples/sfx_target_parser/TPAC.pm b/Open-ILS/examples/sfx_target_parser/TPAC.pm new file mode 100644 index 0000000000..dc6ad41aea --- /dev/null +++ b/Open-ILS/examples/sfx_target_parser/TPAC.pm @@ -0,0 +1,82 @@ +package Parsers::TargetParser::Evergreen::TPAC; +use Parsers::TargetParser; +use base qw(Parsers::TargetParser); +use strict; + +sub getHolding { + my ($this,$genRequestObj) = @_; + + my $objectType = $genRequestObj->{'objectType'}; + my $ISBN = $genRequestObj->{'ISBN'}; + my $eISBN = $genRequestObj->{'eISBN'}; + my $ISSN = $genRequestObj->{'ISSN'}; + my $eISSN = $genRequestObj->{'eISSN'}; + + my $CODEN = $genRequestObj->{'CODEN'}; + my $bookTitle = $genRequestObj->{'bookTitle'}; + my $journalTitle = $genRequestObj->{'journalTitle'}; + my $articleTitle = $genRequestObj->{'articleTitle'}; + my $confTitle = $genRequestObj->{'confTitle'}; + + my $abbrevTitle = $genRequestObj->{'@abbrevTitle'}; + my $volume = $genRequestObj->{'volume'}; + my $issue = $genRequestObj->{'issue'}; + my $startPage = $genRequestObj->{'startPage'}; + my $endPage = $genRequestObj->{'endPage'}; + + my $year = $genRequestObj->{'year'}; + my $month = $genRequestObj->{'month'}; + my $day = $genRequestObj->{'day'}; + my $SICI = $genRequestObj->{'SICI'}; + my $BICI = $genRequestObj->{'BICI'}; + + my $doi = $genRequestObj->{'doi'}; + my $archive = $genRequestObj->{'archive'}; + my $archiveId = $genRequestObj->{'archiveId'}; + my $authLast = $genRequestObj->{'@authLast'}; + my $authFirst = $genRequestObj->{'@authFirst'}; + + my $authInit = $genRequestObj->{'@authInit'}; + my $medUID = $genRequestObj->{'medUID'}; + my $tickUID = $genRequestObj->{'tickUID'}; + my $subject = $genRequestObj->{'subject'}; + my $attribute = $genRequestObj->{'@attribute'}; + + my $user = $genRequestObj->{'user'}; + my $quarter = $genRequestObj->{'quarter'}; + my $part = $genRequestObj->{'part'}; + my $patent = $genRequestObj->{'patent'}; + my $ssn = $genRequestObj->{'ssn'}; + + + # Canonical search results URL for simple searches: + # http://hostname/eg/opac/results?loc=###&qtype=identifier|issn&query=0895-2779 + + my $svc = $this->{svc}; + my $egHost = $svc->parse_param('eg_host'); + my $egOrgUnit = $svc->parse_param('eg_org_unit'); + + my $path = "http://${egHost}/eg/opac/results?loc=${egOrgUnit}"; + + my $searchString = '&rt=keyword&tp=keyword&t='; + + if (defined($ISSN)) { + $searchString .= "&qtype=identifier|issn&query=$ISSN"; + } + elsif (defined($ISBN)) { + # Strip hyphens + $ISBN =~ s/-//g; + $searchString .= "&qtype=identifier|isbn&query=$ISBN"; + } + elsif (defined($journalTitle)) { + $searchString .= "&qtype=title&query=${journalTitle} bib_level:s"; + } + elsif (defined($bookTitle)) { + $searchString .= "&qtype=title&query=${bookTitle} bib_level:m"; + } + + return ($path . $searchString); + +} + +1; -- 2.11.0