28
Developer Developer Chicago ExLibris 9-10 Mar 2011 Ken Herold Hamilton College [ALL IP MARKS IMPLIED]

Developer Developer

  • Upload
    zalman

  • View
    154

  • Download
    1

Embed Size (px)

DESCRIPTION

Developer Developer. Chicago ExLibris 9-10 Mar 2011 Ken Herold Hamilton College. [ALL IP MARKS IMPLIED]. ILL requests - integration. Combine VoyagerILL , Ariel, and RapidILL data Voyager 7+ Tomcat Web Voyage; Perl; PHP ../cl_myAccount.xsl (Patron logged in) - PowerPoint PPT Presentation

Citation preview

Page 1: Developer                Developer

Developer Developer

Chicago ExLibris 9-10 Mar 2011

Ken HeroldHamilton College

[ALL IP MARKS IMPLIED]

Page 2: Developer                Developer

ILL requests - integrationo Combine VoyagerILL, Ariel, and RapidILL datao Voyager 7+ Tomcat Web Voyage; Perl; PHP o ../cl_myAccount.xsl (Patron logged in)o New “ILL Items – Summary” links and tableo Replace Requests Pending table/suppress templateo Renew/View 90-day history link (VoyagerILL)o Manage Document Delivery link (Ariel/RAPID)o Table displays title, ILL number, status, date

requested, date received, and date dueo Automate retrieval/live PDF link when available

2

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer - Developer

Page 3: Developer                Developer

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer3

CLIODATA.MDB FILESYSTEM SOAPBORROWING REQ PDF DELIVERY

PERL SQL/PHP PHP/PERL XML INPUT

keys: FULL NAME PATRON_ID EMAIL ADDRESS MATCHING ACHIEVED VIA PATRON EXTRACT TO XML FILE

VOYAGER ILL

RAPID ILLARIEL

MY ACCOUNTS PAGE REQUESTS

PATRON EMAIL, FORMS, OPENURL

Page 4: Developer                Developer

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer4

VOYAGER ILL

RAPID ILLARIEL

PATRON EMAIL, FORMS, OPENURL

Patrons initiate ILL requests via email, online forms, and using OpelURL Resolved links in databases and web resources.

Staff input these into OCLC and ingest into ILL Management via ILL Request, the Voyager CLIO modules.

Data is managed and responded to in various ways. Books shipped,articles transmitted, Ariel images received, RapidILL documentsdelivered as pdfs.

Page 5: Developer                Developer

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer

VOYAGER ILL

RAPID ILLARIEL

CLIODATA.MDB FILESYSTEM SOAP API BORROWING REQ PDF DELIVERY PERL SQL/PHP PHP/PERL

GENERATE HTML/XML FROM 3 SOURCES

PATRON_ID EMAIL ADDRESS REQUEST # Alex2clio.phpIll2alex.php

DocList.plarielDocs.php

Rapid2.cgi

cl_myAccount.xsl

Page 6: Developer                Developer

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer6

MY ACCOUNTS PAGE REQUESTS

DESIGN OBJECTIVE IS A ONE-STOP LOCATION FOR ALL INTERLIBRARY LOAN AND DOCUMENT DELIVERY REQUESTSFOR A LOGGED-IN PATRON IN TOMCAT WEB VOYAGE.

XML STREAMS FILL THIS TABLE WITH CITATION DATA, ILL NUMBER, STATUS WITHIN THE LAST HOUR, AND DATES FOR REQUEST, RECEIPT, AND DATE DUE FOR LOANS.

LINKS TAKE PATRON TO PRE-AUTHENTICATED PERSONALHISTORY AND MANAGEMENT

Page 7: Developer                Developer

7Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

GENERATED BY

ALEX2CLIO.PHP

USING INTERNALPATRON_ID POST

Page 8: Developer                Developer

VoyagerILL Data

• Hosted on Windows 2003 R2 server• MS Access 2003 database Cliodata.mdb • System DSN Data Source: cliodata_copy.mdb• BorrowingRequests table updated hourly • Mdb includes patron table refreshed monthly • Requests archived monthly/latest 90 days • Project leverages existing PHP reporting

8Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

VOYAGER ILL

Page 9: Developer                Developer

ILL2Alex.php – output xml

9Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

VOYAGER ILL

<doc>  <illNo>73014956</illNo>   <reqDate>2011-01-18</reqDate>   <recDate>2011-01-22</recDate>   <dueDate />   <bookTitle>Atti del terzo Congresso di studi arabi e islamici. Ravello, 1-6 settembre 1966.; pp: ??</bookTitle>   <artTitle>"le nom supreme de dieu"</artTitle>   <status>RecCopy</status> </doc><doc>  <illNo>72524358</illNo>   <reqDate>2011-01-04</reqDate>   <recDate>2011-01-14</recDate>   <dueDate>2011-02-19</dueDate>   <bookTitle>Los nombres del diablo : ensayo sobre la magia, Granada : Universidad de Granada, 2005</bookTitle>   <artTitle />   <status>RecLoan</status></doc>

Page 10: Developer                Developer

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer10

Document Delivery

ARIEL_{PIN}_... .PDF

ARIEL_{PIN}_... .CTRLEmail [email protected] {0|1|2} 0=availableID --ID:-NNNNNNN [-RAPID]Postdate MM/DD/YYYYViews {0-5}Total views 5

Ariel then sends patron notification email with this pre-formed link:

http://{server}/cgi-bin/DocList.pl?PN=$$PIN$$&EM=$$PATRONEMAIL$$

$$PIN$$ is randomly generated. We do not want patron to have to remember this and do extra login.

It and $$PATRONEMAIL$$ is at Ariel PC in antiquated and securedSQL database. Staff enter singly into Ariel DB per patron.

ARIEL

Page 11: Developer                Developer

Automate: PHP reads docs folderhttp://{server}/[email protected]

<?xml version="1.0" ?> <result> <doc> <field2>2</field2> <field3>nnnnnnnnn</field3> <field4>02/01/2010</field4> <field5>3</field5> <field6>5</field6> <file>ARIEL_{PIN}_{Ariel_PC}_20100201152952.PDF</file> </doc> <login>http://{server}/cgi-bin/DocList.pl?

PN={PIN}&[email protected]</login> </result>

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer11

• PARSES .CTRL FILES• MATCHES EMAIL AT FIELD1• CLEANS UP ILL ID NUMBER• GETS DATE POSTED• RE-CREATES PDF FILENAME• CREATES AUTO-LOGIN LINK• BUILDS XML OUTPUT

ARIEL

Page 12: Developer                Developer

RAPID API DOCUMENTATION - CSU LIBRARIES – RAPID EXPANSION PROJECT LAST MODIFIED: MARCH 9, 2010 - REV. 1.55

METHOD: RetrieveHistory (Returns the status history of the request in Rapid. )SOAP Request (Input)

<UserName>string</UserName> <Password>string</Password> <RequestingRapidCode>string</RequestingRapidCode> <RequestingBranchName>string</RequestingBranchName> <RequestId>int</RequestId>

SOAP Request (Output) <IsSuccessful>boolean</IsSuccessful> <HistoryTransactions /> <JournalYear> string </JournalYear> <JournalTitle> string</JournalTitle> <ArticleTitle> string </ ArticleTitle > <JournalVol> string </JournalVol> <JournalIssue> string </JournalIssue> <JournalPages string </JournalPages> <Issn> string </Issn> <OclcNumber> string </OclcNumber> Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

12

SOAP web service via PerlRAPID ILL

We send RequestId, which is our negative ILL number, and receive citation data.

RAPID added the optional output values following HistoryTransactions at our request.

Page 13: Developer                Developer

http://{serverIP}/rapid2.cgi?3705838

<result>The international journal of transitional justice [electronic resource].. Vol 3 (2009); pp: 445- Musila G. M. "Options for Transitional Justice in Kenya: Autonomy and the Challenge of External Prescriptions</result>

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer13

SOAP web service exampleRAPID ILL

Page 14: Developer                Developer

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer14

SUPPRESS “BORROWS” IN CHARGED AND PENDING ITEMS TABLES

Page 15: Developer                Developer

VoyagerILL with RapidILL

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer15

Page 16: Developer                Developer

16Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

cl_myAccount.xsl

<xsl:variable name="patFN" select="page:page//page:element[@nameId='page.header.logout.link']/page:preText[1]"/>

….<xsl:key name="patrons" match="patron" use="@patName" /> <xsl:template name="displayILLLink"><xsl:for-each select="document('/m1/…/users.xml')"> <xsl:variable name="patronID"><xsl:value-of select="key('patrons', $patFN)/@patID"

/></xsl:variable> <form style="display:inline;float:left" action="http://{serverIP}/alex2clio.php" method="post"

target="_blank"> <input type="hidden" name="glomf" value="{$patronID}" /> <span class="yellowBtnLeft">&#160;</span>

<input class="yellowBtn" type="submit" name="sendit" value="Renew / View History" /> <span class="yellowBtnRight">&#160;</span>&#160;&#160;

</form> </xsl:for-each> </xsl:template>

Page 17: Developer                Developer

call link, build table <xsl:key name="patrons" match="patron" use="@patName" />

<xsl:template name="displayILLItems">

<div style="clear:both;margin-left:3px"><p class="subTitle"><a name="illItems"></a>ILL Items - Summary</p></div>

<!-- Ken added to show CLIO link--><p><xsl:call-template name="displayILLLink"/></p>

<div id="hctableDisplay"> <table id="hctableILLItems" cellspacing="0" > <tr id="hctableHeadingILLItems">

<th id="hccellILLItem">Title</th> <th id="hccellILLNo">ILL No</th> <th id="hccellILLStatus">Status</th> <th id="hccellILLReqDate">Requested</th> <th id="hccellILLRecDate">Received</th> <th id="hccellILLDueDate">Date Due</th> </tr>

17Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

MY ACCOUNTS PAGE REQUESTS

Page 18: Developer                Developer

get CLIO data<xsl:for-each select="document('/m1/…/users.xml')">

<xsl:variable name="patronEM"><xsl:value-of select="key('patrons', $patFN)/@patEmail" /></xsl:variable> <xsl:variable name="patronILL">

http://{serverIP}/ill2Alex.php?email=<xsl:value-of select="$patronEM“> </xsl:value-of></xsl:variable>

<xsl:for-each select="document($patronILL)/result/doc"> <tr class="{$rowClass}">

<xsl:variable name="hcillNo" select="illNo"/> <!-- store ill# from VoyagerILL--> <xsl:variable name="hcartTitle" select="artTitle"/> <!-- store artTitle --> <xsl:variable name="hcrequestType" select="status"/> <!-- store requestType -->

<div style="margin-left:20px;margin-bottom:10px;font-size:.8em"> <td class="tableCell" headers="cellILLItem"> <xsl:value-of select="bookTitle" /> <xsl:if test="string-length($hcartTitle)!=0"> &#160;&#160;<xsl:value-of select="artTitle" /> </xsl:if>

18Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

MY ACCOUNTS PAGE REQUESTS

Page 19: Developer                Developer

test PDF delivery<xsl:variable name="arielDocs“>http://{serverIP}/arielDocs.php?EMAIL= <xsl:value-of select="$patronEM“></xsl:value-of></xsl:variable>

<xsl:for-each select="document($arielDocs)/result/doc"><xsl:variable name="hcStatus" select="field2"/> <!-- store status from Ariel --><xsl:variable name="hcillNum" select="field3"/> <!-- store ill# from Ariel --><xsl:variable name="hcLink" select="file"/> <!-- store filename from Ariel --> <xsl:if test="$hcillNo = $hcillNum">

<!-- Match means display link to PDF if status =0 (available) --> <xsl:if test="$hcStatus = '0'"> <br /> <a style="margin-left:5px;padding:0 3px 0 3px;border:1px solid #990000;text-decoration:none" href="http://{server}/ariel/docs/{$hcLink}" target="_blank"><img border="none" src="/vwebv/ui/en_US/images/pdf.gif">

</img></a> </xsl:if> </xsl:if> </xsl:for-each>

</td>

19Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

MY ACCOUNTS PAGE REQUESTS

Page 20: Developer                Developer

more CLIO data

<td class="tableCell" headers="cellILLNo“><xsl:value-of select="illNo" /></td><td class="tableCell" headers="cellILLStatus">

<xsl:choose> <xsl:when test="$hcrequestType='RecLoan'">Charged&#160; </xsl:when> <xsl:when test="$hcrequestType='RecCopy'">Delivered&#160;</xsl:when> <xsl:when test="$hcrequestType='SHIPPED'">Shipped&#160;</xsl:when> <xsl:when test="$hcrequestType='CONDITIONAL'">Pending&#160;</xsl:when> <xsl:otherwise><xsl:value-of select="status" /></xsl:otherwise> </xsl:choose></td>

<td class="tableCell" headers="cellILLReqDate“><xsl:value-of select="reqDate" /> </td><td class="tableCell" headers="cellILLRecDate“><xsl:value-of select="recDate" /> </td><td class="tableCell" headers="cellILLDueDate“><xsl:value-of select="dueDate" />

</td> </div></tr></xsl:for-each>

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer20

MY ACCOUNTS PAGE REQUESTS

Page 21: Developer                Developer

get RAPID data<div style="margin-bottom:10px;font-size:.8em">

<xsl:variable name="arielDocs2">http://{SERVER}/arielDocs.php?EMAIL= <xsl:value-of select="$patronEM“> </xsl:value-of></xsl:variable>

<xsl:for-each select="document($arielDocs2)/result/doc"> <tr class="{$rowClass}">

<xsl:variable name="hcStatus2" select="field2"/> <!-- store status from Ariel --> <xsl:variable name="hcillNum2" select="field3"/> <!-- store ill# from Ariel --> <xsl:variable name="hcPostDate" select="field4"/> <!-- store postdate from Ariel --> <xsl:variable name="hcillFile" select="file"/> <!-- store filename from Ariel --> <xsl:variable name="hcillViews" select="field5"/> <!– store times viewed Ariel --> <!-- RAPID ILL requests start with negative sign -->

<xsl:if test="starts-with($hcillNum2,'-')" >

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer21

MY ACCOUNTS PAGE REQUESTS

Page 22: Developer                Developer

more RAPID data<!-- Match means display link to PDF if status =0 (available) -->

<xsl:if test="$hcStatus2 = '0'"> <xsl:variable name="rapidData">http://{serverIP}/rapid2.cgi?

<xsl:value-of select="field3“> </xsl:value-of></xsl:variable><td class="tableCell" headers="cellILLItem"> <xsl:value-of select="document($rapidData)"/>

<!– Fill with citation data from RAPID SOAP service plus PDF icon --> <a style="margin-left:5px;padding:0 3px 0 3px;border:1px solid #990000;text-decoration:none" href="http://{SERVER}/ariel/docs/{$hcillFile}" target="_blank"><img border="none" src="/vwebv/ui/en_US/images/pdf.gif"/>

</a> </td> <td class="tableCell" headers="cellILLNo"><xsl:value-of select="field3" /></td> <td class="tableCell" headers="cellILLStatus">Available</td> <td class="tableCell" headers="cellReqDate"></td> <td class="tableCell" headers="cellRecDate"><xsl:value-of select="field4" /></td> <td class="tableCell" headers="cellDueDate"></td> </xsl:if></xsl:if> </tr> </xsl:for-each>

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer22

MY ACCOUNTS PAGE REQUESTS

Page 23: Developer                Developer

…finish with ARIEL data for second link

<xsl:for-each select="document($arielDocs2)/result"> <xsl:variable name="loginLink"><xsl:value-of select="login" /></xsl:variable> <form style="display:inline;float:left" action="{$loginLink}" method="post" target="_blank"><span class="yellowBtnLeft">&#160;</span><input class="yellowBtn" type="submit" name="sendit"

value="Manage Document Delivery" /> <span class="yellowBtnRight">&#160;</span>&#160;&#160; </form>

<p style="clear:both"/> </xsl:for-each> </div> </xsl:for-each> </table>

CREDIT: Peter MacDonald for all style elements, css, and page /table behaviors

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer23

Page 24: Developer                Developer

<?php// arielDocs.php

$baseDir = 'd:\\...\\ariel\\docs\\';$email =$_GET['EMAIL'];

// Build the xml output$xml_output = "<?xml version=\"1.0\"?>\n";$xml_output .= "<result>\n";

$d = opendir($baseDir) or die($php_errormsg);while (false !== ($f = readdir($d))) { if (preg_match('/^ARIEL_.*CTRL/',$f)) { $fh = fopen($baseDir.$f,r) or die($php_errormsg); $s = rtrim(fgets($fh,256)); if ($s == $email) { $xml_output .= "<doc>\n"; for ($i=2; $i<=6; $i++) { $s = rtrim(fgets($fh,256)); $s = preg_replace("|--ID:il|","",$s); $s = preg_replace("|--ID:|","",$s);

$s = preg_replace("|ILL:|","",$s); $xml_output .= "<field".$i.">".$s."</field".$i.">\n"; } fclose($fh) or die($php_errormsg); $f = preg_replace("|CTRL|","PDF",$f); $xml_output .= "<file>".$f."</file>\n"; $xml_output .= "</doc>\n"; $pin = preg_split("/_/",$f); } }}closedir($d); $xml_output .= "<login>http://{server}/cgi-bin/DocList.pl?

PN=".$pin[1]."&amp;EM=".$email."</login>";$xml_output .= "</result>";

echo $xml_output; ?>

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer24

ARIEL

Page 25: Developer                Developer

rapid2.cgi – SOAP service use strict;

use SOAP::Lite ;

my $reqNum = $ENV{QUERY_STRING};# reqNum comes in as negative number$reqNum =~ s/-//;

my $soap = SOAP::Lite->new( proxy => ("http://rapid2.library.colostate.edu/rapidapi/apiservice.asmx"), uri => ("http://rapid2.library.colostate.edu/rapidapi"), on_action => (sub{join '', '', @_ }), default_ns => ("http://rapid2.library.colostate.edu/rapidapi/"), autotype => 0); Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

25

RAPID ILL

Page 26: Developer                Developer

next RetrieveHistorymy $method = SOAP::Data->name('RetrieveHistory')

->attr({xmlns => 'http://rapid2.library.colostate.edu/rapidapi/'}); my @params = (SOAP::Data->name("input" => \SOAP::Data->value( SOAP::Data->name("UserName" => 'yhm'), SOAP::Data->name("Password" => ‘{password}'), SOAP::Data->name("RequestingRapidCode" => 'yhm'), SOAP::Data->name("RequestingBranchName" => 'Main Library'), SOAP::Data->name("RequestId" => SOAP::Data->value($reqNum) )) )); Ken Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

26

RAPID ILL

Page 27: Developer                Developer

then parse/format resultmy $result = $soap->call($method => @params);

my $data = $result->valueof('//RetrieveHistoryResponse/RetrieveHistoryResult/JournalTitle');

$data .= ". Vol ";$data .= $result->valueof('//RetrieveHistoryResponse/RetrieveHistoryResult/JournalVol');$data .= " (";$data .= $result->valueof('//RetrieveHistoryResponse/RetrieveHistoryResult/JournalYear');$data .= "); pp: ";$data .= $result->valueof('//RetrieveHistoryResponse/RetrieveHistoryResult/JournalPages');$data .= " ";$data .= $result->valueof('//RetrieveHistoryResponse/RetrieveHistoryResult/ArticleTitle');$data =~ s/-eoa/- /g;$data =~ s/-EOA/- /g;$data =~ s/\<|\>//g;print "Content-type: text/xml\n\n<result>".$data."</result>";exit(0);

NOTE: oXygen XML Editor contains an invaluable WSDL SOAP Analyzer toolKen Herold Hamilton College 9-10 Mar

2011 ExLibris Chicago Developer - Developer

27

RAPID ILL

Page 28: Developer                Developer

…exit;

// Thank You!

// [email protected]

Ken Herold Hamilton College 9-10 Mar 2011 ExLibris Chicago Developer -

Developer28