24
TEXT ME, MAYBE Implementing texting functionality in the Aleph OPAC Alevtina (Allie) Verbovetskaya Web & Mobile Systems Librarian City University of New York IGeLU 2014 | Oxford, UK| September 16, 2014

Text me, maybe

  • Upload
    olina

  • View
    52

  • Download
    2

Embed Size (px)

DESCRIPTION

Text me, maybe. Implementing texting functionality in the Aleph OPAC. Alevtina (Allie) Verbovetskaya Web & Mobile Systems Librarian City University of New York IGeLU 2014 | Oxford, UK| September 16, 2014. Texting item location info from the OPAC. Web OPAC. Received SMS. Outline. - PowerPoint PPT Presentation

Citation preview

Page 1: Text me, maybe

TEXT ME, MAYBEImplementing texting functionality in the Aleph OPAC

Alevtina (Allie) VerbovetskayaWeb & Mobile Systems LibrarianCity University of New YorkIGeLU 2014 | Oxford, UK| September 16, 2014

Page 2: Text me, maybe

Texting item location info from the OPAC

Web OPAC Received SMS

Page 3: Text me, maybe

Outline• How To• Gotchas• Response & Usage• Enhancements

Page 4: Text me, maybe

HOW TOStep-by-step instructions

Page 5: Text me, maybe

Add new CSS class (“sms”)$ vi exlibris-xxx01.css...#sms {

width: 250px;font-family: arial, helvetica, sans-serif;border: 1px solid #36647B;position: absolute;left: 50%;top: 50%;z-index: 1000;padding: 10px;margin: 10px;background: #EFEFCF;

}...

Page 6: Text me, maybe

Add ID (“bib-items”) to table with holding info$ vi item-global-body-head...<table border="0" cellspacing="2" id="bib-items"><tr class="tr1"> <th class="text3">&nbsp;</th> <th class="text3">Library</th> <th class="text3">Location</th> <th class="text3">Call number</th> <th class="text3">Description</th> <th class="text3">Item Status</th> <th class="text3">Due date</th> <th class="text3">Due hour</th></tr>...

Page 7: Text me, maybe

Add ID (“bib-detail”) to table with item info$ vi item-global-head-1...<table width="100%" id="bib-detail">...

Page 8: Text me, maybe

Add “Text this!” link (span ID “smslink”)$ vi item-global-dropdown-menus-a...<span id="smslink">

<a href="#" onClick="showSMS();return false;">Text this!</a></span>...

Page 9: Text me, maybe

Add JS to hide “Text this!” link if no data$ vi item-global-body-tail...<script>var itms = document.getElementById('bib-items');var tr = itms.getElementsByTagName('tr');for( var i = 1; i < tr.length; i++ ) {

var td = tr[i].getElementsByTagName('td');// our items table has 8 columns (if item exists)...// yours may be different! change accordingly!if( td.length !== 8 ) {

document.getElementById('smslink').style.visibility='hidden';}

}</script>...

Page 10: Text me, maybe

Create new span tag (ID “sms”) to display form

$ vi item-global-dropdown-menus-a...<span id="sms" style="visibility:hidden;display:none;"></span>...

Page 11: Text me, maybe

Write sms-js & include in headervar phone = frm.phone.value;phone = phone.replace( /[^\d]/ig, "" );var prvdr = frm.provider.options[frm.provider.selectedIndex].value;if( ( phone.length == 10 ) && ( prvdr !== "" ) ) {

var url = smsurl;if( frm.title.value.length > 75 ){

url += "title=" + encodeURIComponent( frm.title.value ).substring( 0, 74 ) + " (...)";} else{

url += "title=" + encodeURIComponent( frm.title.value );}url += "&number=" + encodeURIComponent( frm.phone.value );url += "&provider=" + encodeURIComponent( frm.provider.options[frm.provider.selectedIndex].value );for( i = 0; i < frm.lib.length; i++ ){

if( frm.lib[i].checked == true ){

url += "&item=" + encodeURIComponent( frm.lib[i].value );}

}if( frm.lib.length == undefined ){

url += "&item=" + encodeURIComponent( frm.lib.value );}var head = document.getElementsByTagName( "head" )[0];var script = document.createElement( 'script' );script.setAttribute( 'type', 'text/javascript' );

(...or just download it from http://db.tt/JO638ug7)

Page 12: Text me, maybe

In cgi-bin, write sms.pl & chmod 0755 'Nextel' => '@messaging.nextel.com', 'Sprint' => '@messaging.sprintpcs.com', 'T-Mobile' => '@tmomail.net', 'Verizon' => '@vtext.com', 'Virgin' => '@vmobl.com');# return address need not be an actual email address# (but should be easily identifiable to your users)my $from = "refdesk\@your.lib";my $q = new CGI;my $num = $q->param( 'number' );# remove all non-digit characters from number:$num =~ s/[^\d]//ig;# concatenate number with SMTP domain from %providers:my $to = $num . $providers{ $q->param( 'provider' ) };# remove all parentheses and dashes:$to =~ s/[\(\)\-\s]//ig;my $title = $q->param( 'title' );# remove extraneous whitespaces at beginning & end of line:$title =~ s/^\s+|\s+$//g;my $hold = $q->param( 'item' );my $body = "'$title'\n$hold\n--DO NOT RESPOND";# replace [mail-server] with your SMTP domainmy $smtp = Net::SMTP->new( "[mail-server]", Debug => 1 );$smtp->mail( $from );$smtp->to( $to );$smtp->data();$smtp->datasend( $body );$smtp->dataend();

(...or just download it from http://db.tt/8BJcUTQF)

Page 13: Text me, maybe

GOTCHASUnexpected bumps in the road (and how we overcame them)

Page 14: Text me, maybe

Lack of dedicated SMS server• Messages sent from ILS server erroneously flagged as spam• Rule added for spam filter

• Text messages sent as emails• Force user to know & select cellular carrier

Page 15: Text me, maybe

Location of item title inconsistent on holding page• Added trailing slash to titles so JS can identify them:

$ vi ./xxx01/edit_paragraph.eng!* Author-Title for Bib Inf013 1#### D ^:^013 245## 9 ## ^/^013 250## D ## .013 260## W ##^ .013 300## D ##^ .

• Included JavaScript in footer to remove slash(after SMS script has had a chance to run):

Page 16: Text me, maybe

Script to remove extra slash in title$ vi item-global-tail-1<script>// some titles end with two slashes (//) and, because this is not a// desired behavior, we are replacing the two slashes with just one slashvar bib = document.getElementById( "bib-detail" );var x = bib.rows;for( var i = 0; i < x.length; i++ ) { var y = x[i].cells; for( var j = 0; j < y.length; j++ ) { var txt = y[j].innerHTML; y[j].innerHTML = txt.replace( /\/\//g, "/" ); }}</script>

Page 17: Text me, maybe

RESPONSE & USAGEFeedback from the campuses & review of the server logs

Page 18: Text me, maybe

Response from librarians & staff• Slew of positive emails in response to announcement:• “I’m really glad to see this OPAC feature at last.”• “…it’s so great to have something to help the students! YAY”• “I just wanted to thank you for yet another awesome OPAC improvement!!!! I

am really going to make use of this feature.”• “…I am promoting it when I teach my library instruction classes. What a great

tool for our students!”

• There were suggestions, too:• “…could the text include a link back to the item in the catalog? For example,

since I tried texting info to myself about an ebook, I imagine if I was texting that info I’d want to log back in later to access that title? But this is just a suggestion—I think the texting feature on its own is great.”

• “Allie, I am not sure why or if this would be useful on the mobile catalog, but just wondering if you are planning on adding it to that.”

Page 19: Text me, maybe

Usage statistics• Stats being gathered from Apache error log• One year after implementation (04/04/13 - 04/26/14)...• 11,008 text messages were sent from the OPAC:

• AT&T, Verizon, and T-Mobile were the most frequently used cellular providers:

alephap1-18(1) CUN01-ALEPH>>grep -c 'Recipient ok' error_log11008

Provider Frequency

AT&T 3109

Boost Mobile 221

Metro PCS 365

Nextel 8

Sprint 1596

T-Mobile 2679

Verizon 2794

Virgin 238

Page 20: Text me, maybe

Sample log entry

Page 21: Text me, maybe

ENHANCEMENTSOpportunities to improve functionality

Page 22: Text me, maybe

Ideas• Making API calls rather than screen scraping• Adding link back to OPAC (esp. for e-resources)• Using URL shortener, perhaps?

• Using dedicated SMS server for improved performance• Adding feature to Primo (using custom tiles)

Page 23: Text me, maybe

THANK YOU!Any questions?

Page 24: Text me, maybe

Allie VerbovetskayaWeb & Mobile Systems LibrarianOffice of Library ServicesCity University of New [email protected]@alevtina