Sending SMS from an III catalog

This method uses a mixture of DOM scripting, and a small ammount of perl (or any other backend language) to send SMS from the catalog.

When testing this, try it on your 'test' server first

Step 1: Prepare your wwwoptions file

In order for this method to work, we need to put some 'landmarks' or 'ids' in your wwwoptions file. We'll use javascript later to access these.

  1. open your wwwoptions file
  2. find the TABLEPARAM_BIB_DETAIL entry and add to it: id='bib_detail' our's looks like this:
    TABLEPARAM_BIB_DETAIL=id='bib_detail' width="100%" border="0" cellspacing="1"
  3. repeat for the TABLEPARAM_BIB_ITEMS:

    TABLEPARAM_BIB_ITEMS=id='bib_items'  width="100%" border="3" cellspacing="1"

Step 2: modify your stylesheet:

add the following lines to your stylesheet:

#info, #sms {
border:1px solid #36647b; position:absolute; top:250; left:50; z-index:1000; background:#fff; padding:10px; margin:10px; background:#efefcf; }
#sms .eg { font-style:italic; font-size:80%; }
#info {top:500}
#sms {font-size:70%}

Step 3: Modify your toplogo.html (to add the javascript)

add the following line to your TOPLOGO.html

<script type="text/javascript" src='/screens/sms.js'> </script>

Step 4: Modify your HTML

Add the following to your bib_display.html. If you don't have WEBPAC PRO, it should be possible to do this using some fancy DOM scripting. (note: this is all in the zip file)

<!-- this div starts hidden and is just a note -->
<div style='visibility:hidden' id='info'>You could get out a piece of paper, find a pencil, and write down this call number so that you can find it in the stacks. Or you could text it to your phone! The text message will contain the location, call number, and title of the item on this page. Be careful if you don't have a text messaging plan for your phone - carrier charges may apply.<br><a href="#here" onClick="document.getElementById('info').style.visibility='hidden';return false" style='text-align:center'>close</a></div> <!-- this is the button set we'll hide it if the BIB has no items --> <div id=smsfeatures>
<a href="#here" name=smsbutton id=smsbutton onClick="showsms();return false;"><img src="/screens/smsbutton.gif" border=0></a>&nbsp;&nbsp;
   <a href="#here" onClick="findPos(document.getElementById('smsbutton'),document.getElementById('info'),-350,-100);document.getElementById('info').style.visibility='visible';return false;"><img src='/screens/smsq.gif' border=0></a><br>
</div> <!-- a quick script to hide the SMS menu if there are no items. same as the javascript in the SMS form, but it's really just to see if the items exist. If they don't, we hide the buttons --> <script> var f = document.getElementById('bib_detail'); try { var itms = document.getElementById('bib_items'); var tr = itms.getElementsByTagName('TR'); for(i = 1; i < tr.length; i++) { var x=tr[i].getElementsByTagName('TD'); if (x.length == 3) { var loc = x[0].innerHTML.replace(/(<([^>]+)>|&nbsp;)/ig,""); var call = x[1].innerHTML.replace(/(<([^>]+)>|&nbsp;)/ig,""); var status = x[2].innerHTML.replace(/(<([^>]+)>|&nbsp;)/ig,""); } } } catch (e) { document.getElementById('smsfeatures').style.visibility='hidden'; }

<!-- just a placeholder for the sms form -->
<div id='sms' style="visibility:hidden;display:none">

Step 5: Download the files

Download the following ZIP file and add the images / javascript file / perl.

Step 6: Customize the Perl script

  1. Modify the script to change the 'from' address

    note: make sure you set it as executable (on a unix system (chmod 755)
    note: this requires Mail::Sendmail (which is a module that emulates Sendmail without actually using the commandline version of sendmail. it should be 'safe')
  2. put it on a server that runs perl scripts (note the URL)
  3. there is no reason you can't translate this into PHP or another language. It basically is going to validate the phone # and turn the data into an email, and send it.

Step 7: add your buttons and your javascript

  1. modify the first line of the javascript to point to your perl script (you could easily change this to PHP or another language)
  2. upload them to your III Server

Step 8: Test

load a record in your catalog