Re: [IUG] SMS script question


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
At 01:07 PM 1/15/2010, Emily Clasper wrote:
Thanks to the excellent discussions on this ListServ and the fantastic
contributions to the IUG Clearinghouse, the Suffolk County Libraries have
been able to put an SMS call number feature on our catalogs. Most of the
time, it works well, both on our public and staff servers. However, we have
been getting complaints that this feature does not always work nicely within
our libraries' scoped catalogs. Sometimes, it's fine. Other times, we just
get the "There was a problem. Message Not sent!" Error.

Here is an example from our public Catalog:

This one works: http://alpha2.suffolk.lib.ny.us/record=b4029617~S83 (Our
full County Scope)

This one doesn't: http://alpha2.suffolk.lib.ny.us/record=b4029617~S34 (From
an individual library's scope)


The PHP script has a security measure in place -- before it'll send the email, it checks to make sure the location and call number that it's sending actually appear on the page from which the script call originated. It does this by searching your catalog for the bib number that the Javascript sent to the PHP script and checking the text of the record for the existence of the location and call number strings that the Javascript sent. Problem is that the Javascript is sending just the bib number and not the scope number, and absent the scope number for the individual library, the search defaults to the full county scope. And in the record for the full county scope, the location for this particular individual library doesn't appear until after the "View additional copies..." button is clicked, i.e., the string "JJ-Non-fiction" does not appear in the body text that the script retrieves when it grabs plain old http://alpha2.suffolk.lib.ny.us/record=b4029617 -- no match on the location, so no message gets sent.

Possible fixes:
(1) Don't use the security piece at all.
(2) Don't use the location part of the security piece and just rely on the check for the call number, but there's no assurance that the individual library call number will always appear on the full county screen.
(3) Change the Javascript so that it retrieves the record from the scope where the sms function is invoked.

#3 would be preferable, but I'm not sure if the mechanism whereby the PHP script grabs the code of a page specified by a URL will get the scoped page merely by including the scope in the URL (Bob don't do scopes). But you could try pretty easily by altering this line in sms.js:

var bibNum = bodyText.match(/b[\d]{7}/m);

Change it to:

var bibNum = bodyText.match(/b[\d]{7}~[\d]{1,2}/m);

...I think. That should match on and retrieve the record number with scope, but I'm not sure if the tilde will mess things up.


Bob Duncan


~!~!~!~!~!~!~!~!~!~!~!~!~
Robert E. Duncan
Systems Librarian
Editor of IT Communications
Lafayette College
Easton, PA 18042
duncanr at lafayette dot edu
http://library.lafayette.edu/

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.