Take a look at the example script here:
http://about.scriblio.net/wiki/scrib_availability
That script is what we use at Plymouth to connect the record in our
Scriblio instance to our III ILS. The main purpose is to show the
current location and availability of the items, but it also adds a few
links, including one to view the record and another to request it.
It's an ugly and sloppy bit of code, but near the bottom you'll see
this:
'<p><a href="'. $WPopac_ilsbase .'record='. $id .'"
rel="nofollow">View record in LOLA catalog</a> · <a href="'.
$WPopac_ilssso . urlencode($WPopac_ilsbase.'search/.b'.$id .'/.b'.
$id .'/1%2C432%2C432%2CB/request') .'" rel="nofollow">Request item</
a></p>'
That bit inserts both the links you're asking about, but I should
explain the variables:
$id is the III bib record ID
$WPopac_ilsbase is the base URL to the III web OPAC (mine is 'http://lola.plymouth.edu/')
$WPopac_ilssso is the URL to the single sign-on hack I wrote (not part
of Scriblio). You should probably ignore that and rewrite the code
like this:
'<p><a href="'. $WPopac_ilsbase .'record='. $id .'"
rel="nofollow">View record in LOLA catalog</a> · <a href="'.
$WPopac_ilsbase.'search/.b'.$id .'/.b'.$id .'/1%2C432%2C432%2CB/
request' .'" rel="nofollow">Request item</a></p>'
Please write back to tell us how it works,
--Casey
The scrib_availability function isn't supposed to get declared if
there's another one already declared, but it seems like your plugin is
getting loaded after Scriblio, causing the problem. I have another
solution to fix that and prevent it from causing difficulty later, but
at least you've worked around it for now.
I took a look at your catalog and found that the bibnumber for your
example record is:
1354026
But the bib number in Scriblio is:
354026
The number looks almost right, just missing the leading digit. What
_should_ be happening is that the record's full sourceid gets sent to
scrib_availability(), where this line of code trims the source ID
prefix off the front:
$id = substr($id, 2);
The prefix is supposed to be two characters. It hasn't yet mattered to
any production instance that I'm aware of, but you _can_ assign
different source id prefixes to different ILSs and build a union
catalog that way. The example code, however, ignores the prefix and
assumes all the records are from a single ILS. And that works if the
source id prefix is always exactly two characters long, but, well, is
your prefix two characters long?
If not, you've found a bug in Scriblio's UI and documentation that I
need to fix, but you can work around it in the short term in one of
two ways:
The preferred way is to reimport content using a two-character prefix
The quick way is to change the substring to only trim one char.
This prefix issue can be confusing for us III users, since all our bib
numbers are prefixed with "b", but this is a different prefix. You've
probably seen it, but I'm going to toss this screenshot out as a point
of reference:
http://flickr.com/photos/scriblio/1934135957/
Finally, I think there's a linebreak in your code that's turning into
a full <br> tag. That explains why the rel="nofollow" stuff is showing.
--Casey
I think you've got a line break in the "request this item" link too,
but it's being URL encoded and is hard to see. But that won't fix the
problem causing it to fail. We don't use that feature now and I can't
guarantee that my code works as it should, so I took a deeper look.
Starting with this record in your ILS:
http://webcat.lcls.org/record=1354076
We get this URL to request the item:
http://webcat.lcls.org/search/.b1354076/.b1354076/1%2C1%2C1%2CB/
request~b1354076
In that URL, we discover that the bibnumber actually appears three
times. Here it is broken down:
http://{ILS hostname}/search/.b{bibnumber}/.b{bibnumber}/1%2C1%2C1%2CB/
request~b{bibnumber}
I think my example code worked on my ILS when I wrote it, but it's
clear that your ILS is expecting something slightly different.
Something like this should work for you:
$WPopac_ilsbase.'search/.b'.$id .'/.b'.$id .'/1%2C432%2C432%2CB/
request'. $id
--Casey
I'm still struggling with the item request. I added the code you
suggested, but I can't figure out what else is needed. Here's my
plugin:
<a href="'. $WPopac_ilssso .
urlencode($WPopac_ilsbase.'search/.b'.$id .'/.b'.$id .'/
1%2C432%2C432%2CB/request'. $id) .'" rel="nofollow">Request item</a></
p>');
This is great. Glad to hear it's working.
Can you send the plugin to me off list as an attachment? The mail list
software tortures code too much to rely on.
Also, don't hesitate to put your own name and URL in the plugin header.
--Casey