DMD-rwt

advertisement

Enhancements, Customizations, and Workarounds

Bob Trotter

University System of Georgia

Developer Meets Developer

February 1 – 2, 2010

Discovery

Tool Enhancements

• Redesigned Holdings / Status extraction

• Added 85x/86x translation

• Implemented Journal Title search

• Renew Web Service

Holdings / Status Extraction select md.mfhd_id, md.seqnum, l.location_display_name, md.record_segment, mm.display_call_no, mm.suppress_in_opac

from mfhd_data md, bib_mfhd bm, mfhd_master mm, location l where bm.bib_id = $id and md.mfhd_id = bm.mfhd_id and mm.mfhd_id = bm.mfhd_id and mm.suppress_in_opac <> 'Y' and l.location_id = mm.location_id

order by l.location_display_name, md.mfhd_id, md.seqnum

} while ($md = $stM->fetch(PDO::FETCH_ASSOC)) { if ($md['SUPPRESS_IN_OPAC'] <> 'Y') { if ($first) {

$omid = $md['MFHD_ID'];

$first = 0;

}

$mid = $md['MFHD_ID']; if ($omid != $mid) {

$holdings[$i]['items'] = procItems($old_mid);

$holdings[$i]['hold] = procHold($omid,$mdata);

$holdings[$i]['loc'] = htmlentities($locn);

$holdings[$i]['callno'] = $callno;

$old_mid = $mid;

$mdata = '';

$i++;

}

$locn = $md['LOCATION_DISPLAY_NAME'];

$mdata .= $md['RECORD_SEGMENT'];

$callno = $md['DISPLAY_CALL_NO'];

}

Holdings Data

• We try to get everything Webvoyage displays

– Notes from 852

– Summary – 866

– Supplement Summary 867

– Indexes Summary 868

– Marc Holdings data 85x/86x pairs

Code for 85x/86x pairs

//****************************************

// Get MARC Holdings data

// Get 85x/86x pairs - rwt

//****************************************

$sfs = array('a', 'b', 'c', 'i', 'j', 'k', 'u', 'v', 'w', 'x', 'z');

$mon = array('01'=>'Jan.','02'=>'Feb.','03'=>'Mar.','04'=>'Apr.','05'=>'May','06'=>'Jun.','07'=>'Jul.','08'=>'Aug.','0

9'=>'Sep.','10'=>'Oct.','11'=>'Nov.','12'=>'Dec.');

$tag_arr = array('853'=>'863','854'=>'864','855'=>'865'); while (list($pat,$dat) = each($tag_arr)) {

$f = 0;

$hd = array();

$fields = $record->getFields($pat); foreach ($fields as $field) {

} if ($subfield = $field->getSubfield('8')) {

$d8 = explode('.', $subfield->getData());

$d853['link'] = $d8[0]; foreach ($sfs as $sf) { if ($subfield = $field->getSubfield($sf)) {

}

$d853[$sf] = $subfield->getData(); if ($sf == '8') {

$d853['link'] = explode('.', $d853[$sf]);

}

}

Code for 85x/86x pairs

$fields_86x = $record->getFields($dat); foreach ($fields_86x as $field_86x) {

$d863 = array(); if ($subfield = $field_86x->getSubfield('8')) {

$d = explode('.', $subfield->getData());

$d863['link'] = $d[0]; if ($d863['link'] == $d853['link']) {

$d863['seq'] = $d[1]; reset($sfs); foreach ($sfs as $sf) { if ($subfield = $field_86x->getSubfield($sf)) {

$d863[$sf] = $subfield->getData();

}

}

}

$hd[$f] = ''; if (isset($d863['a'])) { if (preg_match("/-/", $d863['a'])) {

$th = explode('-', $d863['a']);

$hd[$f] = $d853['a'].' '.$th[0].' - '.$d853['a'].' '.$th[1].' ';

}

} else {

$hd[$f] = $d853['a'].' '.$d863['a'].' '; else {

$hd[$f] = $d853['a'].' '.$d863['a'].' ';

Code for 85x/86x pairs if (isset($d863['b'])) $hd[$f] .= ', '.$d853['b'].' '.$d863['b'].' '; if (isset($d863['c'])) $hd[$f] .= ', '.$d853['c'].' '.$d863['c'].' '; if (isset($d863['i'])) { if (preg_match("/^\(/", $d853['i'])) {

$hd[$f] .= '('.$d863['i'];

} if (isset($d863['j'])) {

$th = explode('-', $d863['j']);

$m1 = $mon[$th[0]];

$m2 = $mon[$th[1]]; if (isset($d853['k']) && isset($d863['k'])) {

$dh = explode('-', $d863['k']);

$m1 .= ':'.$dh[0];

$m2 .= ':'.$dh[1];

}

$hd[$f] .= ':'.$m1; if ($m2 != '') $hd[$f] .= ' - '.$m2;

}

$hd[$f] .= ')';

}

}

}

$f++;

}

}

} if ($f > 0) $holding[$dat] = $hd;

Holdings display

Renew Web Service

• On Checked Out list, we include all

Local and UB charges

• Had to be able to

Renew item from any UB institution

<input type=checkbox name=rida[0] value="2776166,local,54100">

<input type=checkbox name=rida[1] value="42943,BAINDB20010316224456,32917">

<input type=checkbox name=rida[2] value="312886,GASOUTHDB20010803230231,139002">

Renew Web Service

• Library.ini

[BAINDB20010316224456] host=gil1.uga.edu

db= pw= nm=Bainbridge College port=1521 gfurl= wsport=7114

[GASOUTHDB20010803230231] host=gil2.uga.edu

db= pw= nm=Georgia Southern University port=1521 gfurl=http://gilfind.georgiasouthern.edu

wsport=10014

[UGADB20010316230258] host=gil4.uga.edu

db= pw= nm=University of Georgia 20 port=1521 gfurl=http://gilfind.uga.edu

wsport=7014

Renew Web Service

• Renew Code

$dbArray = parse_ini_file('/vufind/library.ini',true);

… foreach($_POST['rida'] as $item) { list($iId[$i],$iInst[$i],$patid[$i]) = explode(',',$item); if ($iInst[$i] == 'local') {

$iInst[$i] = $patronHomeUbId;

}

$wsport[$i] = $dbArray[$iInst[$i]]['wsport'];

$wshost[$i] = $dbArray[$iInst[$i]]['host'];

}

… for ($j=0;$j<$i;$j++) {

$hst = $wshost[$j];

$prt = $wsport[$j];

$url = "http://$hst:$prt/$app/$svc";

$nst = '1@' . $iInst[$j];

$client->setUrl($url);

$message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>

Renew Web Service

• Renew Code cont.

$client->clearPostData(); header('Content-type: text/xml');

$client->setBody($message);

$res = $client->sendRequest();

$response = $client->getResponseBody(); if ((substr(trim($response), 0, 5) == '<?xml') ||

(substr(trim($response), 0, 2) == ‘<r’)) {

$unxml = new XML_Unserializer();

$response = $unxml->unserialize($response);

$data = $unxml->getUnserializedData();

}

$itemid = $iId[$j];

$inst = $iInst[$j]; if ($inst == $patronHomeUbId) $inst = 'local'; if (isset($data['ser:serviceData']['myac:messages']['myac:message'])) {

$emsg = $data['ser:serviceData']['myac:messages']['myac:message'];

$ren_stat[$inst][$itemid]['message'] = $emsg;

$ren_stat[$inst][$itemid]['status'] = 'Not Renewed';

} else {

$ren_stat[$inst][$itemid]['message'] = '';

$ren_stat[$inst][$itemid]['status'] = 'Renewed';

}

$unxml = '';

Renew Web Service

• Results

Implementing Patron PINs

• Populated Patron tables (33) with 5 digit randomly generated numbers.

• Modified Logon page of Classic Webvoyage to link to ‘Get My PIN’ function.

Implementing Patron PINs

Implementing Patron PINs

• Opac.ini

[Logon_Page]

ResetButton=Reset"><span id="inx"></span><script>addText4();</script><p id="xx

• Header.htm

function addText4() { var txt = document.createElement('text'); txt.innerHTML = '<center><div style="padding-top: 5px;"><b><a href="" onClick="getPIN(logonpage);return false;">Get My PIN</a></b></div></center>';

} var rnode = document.getElementById('inx'); rnode.parentNode.appendChild(txt); function getPIN(f) { f.action = '/getPIN.php';

} f.submit();

• Due to Bug in UC, it will accept any valid PIN.

Implementing Patron PINs

• Opac.ini

[Logon_Page]

SubmitButton=Logon to My Account" ONCLICK="checkPIN(this.form)"><b id="yy

• Header.htm

function checkPIN(f) {

Syntax checking from Webvoyage script copied here….

var xhttp=new XMLHttpRequest(); var dbk = f.HLIB.value; var ntyp = f.LGNT.value; var bc = f.BC.value; var ln = f.LN.value; var pin = f.PIN.value; var url = "https://giluc.usg.edu/validatePIN.php?dbk=" + escape(dbk) + "&ntyp=" + ntyp + "& bc=" + bc + "&ln=" + ln + "&pin=" + pin; xhttp.open("GET",url,false); xhttp.send(""); var xmltxt=xhttp.responseText; if (xmltxt == 'failed') { alert("The PIN entered does not match your current PIN."); f.elements[4].value = ""; f.elements[3].select(); f.elements[3].focus(); return;

}

// All is well. Submit form.

f.submit();

}

Implementing Patron PINs

• Codes (0,1,2) for Number Type dropdown changed with order displayed.

Implementing Patron PINs

• In both getPIN.php and validatePIN.php, had to read opac.ini to check [Login Types] stanza for order of number types.

[Login Types]

BC=Enter Your Patron Barcode/Library ID from Home Library

#SSN=Enter Your Social Security Number

IID=Enter Your Institution ID from Home Institution

• Typical [Logon_Page] stanza

[Logon_Page]

Background=/images/blank.gif

Text=000000

BGCOLOR=FFFFFF

LINK=

VLINK=

ALINK=

SubmitButton=Logon

ResetButton=Reset"><span id="inx"></span><script>addText4();</script><p id="xx

HomeLibrary=<script>addText2();</script>

LastName=</span><b>Last Name:

PIN=<script>addText();</script>

DefaultCluster=CLUSTER1

Questions?

• gil.usg.edu – GIL Project Homepage

• giluc.usg.edu – GIL Universal Catalog

• rwt@mail.libs.uga.edu - My email

Download