Add support for TPAC in SFX Target Parser feature/sfx_parser
authorDan Scott <dscott@laurentian.ca>
Wed, 15 Aug 2012 15:47:29 +0000 (11:47 -0400)
committerDan Scott <dscott@laurentian.ca>
Wed, 15 Aug 2012 15:47:29 +0000 (11:47 -0400)
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/examples/sfx_target_parser/JSPAC.hlp
Open-ILS/examples/sfx_target_parser/README
Open-ILS/examples/sfx_target_parser/TPAC.hlp [new file with mode: 0644]
Open-ILS/examples/sfx_target_parser/TPAC.pm [new file with mode: 0644]

index d1d7107..c631e6e 100644 (file)
@@ -88,6 +88,7 @@ font-weight: bold; font-variant: normal; text-transform: none; color: #333399}
 In the PARSE_PARAM field, replace the following information: 
 <br>
 <span class="code">eg_host = $$LOCAL_CATALOGUE_SERVER<br>
+ 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
index df6edc1..c8a7f85 100644 (file)
@@ -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/<instance>/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/<instance>/lib/Parsers/TargetParser/Evergreen
+cp *.hlp /exlibris/sfx_ver/sfx4_1/<instance>/lib/Parsers/TargetParser/Evergreen
+cp *.pm /exlibris/sfx_ver/sfx4_1/<instance>/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 (file)
index 0000000..36aed2c
--- /dev/null
@@ -0,0 +1,99 @@
+<html>
+<head>
+<!--
+#
+# SFXCTRL              GUI for sfxctrl
+#
+# Version:             $Id: Evergreen.hlp,v 1.1 2012/01/16 19:08:51 am_3 Exp $
+#
+# Authors:             Patrick Hochstenbach, <Patrick.Hochstenbach@rug.ac.be>
+# Authors:             Dan Scott, <dscott@laurentian.ca>
+#
+# Copyright:           (c) 2000, SFX by Ex Libris (USA) Inc.
+#
+-->
+<title>sfxctrl</title>
+
+</head>
+<body 
+       bgcolor="#E6E6CE" 
+       background="/sfxctrl/pix.1.0/sfx_admin_dbManager_bg2.gif" 
+>
+
+<html>
+<head>
+<title>sfxctrl</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<!--
+#
+# SFXCTRL              GUI for sfxctrl
+#
+# Version:             $Id: Evergreen.hlp,v 1.1 2012/01/16 19:08:51 am_3 Exp $
+#
+# Authors:             Patrick Hochstenbach, <Patrick.Hochstenbach@rug.ac.be>
+# Authors:             Dan Scott, <dscott@laurentian.ca>
+#
+# Copyright:           (c) 2000, SFX by Ex Libris (USA) Inc.
+#
+--> 
+</head>
+
+<body bgcolor="#E6E6CE" background="/sfxctrl/pix.1.0/sfx_admin_dbManager_bg2.gif"><head> 
+<style type="text/css">
+<!--
+.regular {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; 
+
+line-height: normal; font-weight: normal; font-variant: normal; text-transform: none; color: 
+
+#333399}
+.title {  font-family: Arial, Helvetica, sans-serif; font-size: 12pt; font-style: bold; 
+
+line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: 
+
+#333399}
+.bold {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; 
+
+line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: 
+
+#333399}
+.code {  font-family: Courier; font-size: 9pt; font-style: normal; line-height: normal; 
+
+font-weight: bold; font-variant: normal; text-transform: none; color: #333399}
+-->
+</style></HEAD>
+<span class="title"> 
+<p>PARSE_PARAM help for Evergreen Template Toolkit OPAC</p>
+</span>
+<p><span class="regular"><i>This help file describes Target Parser information 
+  for the Evergreen Template Toolkit OPAC. You will need this information only when
+  editing this Target Service.<br>
+  <br>
+  </i><span class="bold">About PARSE_PARAM fields</span><i><br>
+  </i>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: <br>
+  1. in the Target Service table : parameters that apply to the whole Target Service 
+  (eg. base URL) <br>
+  2. in the Object Portfolio table : parameters that apply to one particular Object 
+  Portfolio. (eg. jkey)<br>
+  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.</span></p>
+<span class="regular"> 
+<p><span class="bold"> General Information</span><br>
+  Target - LOCAL_CATALOGUE_EVERGREEN_TPAC<br>
+  Service - getHolding<br>
+  Parser - Evergreen::TPAC</p>
+</span> 
+<p><span class="regular"><span class="bold">Information needed in the Target Service:</span><br>
+In the PARSE_PARAM field, replace the following information: 
+<br>
+<span class="code">eg_host = $$LOCAL_CATALOGUE_SERVER<br>
+ eg_host = catalog.example.com
+ eg_org_unit = 103, 1, etc
+</span><br> 
+<p>
+</p>
+</body>
+</html>
+
diff --git a/Open-ILS/examples/sfx_target_parser/TPAC.pm b/Open-ILS/examples/sfx_target_parser/TPAC.pm
new file mode 100644 (file)
index 0000000..dc6ad41
--- /dev/null
@@ -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;