Access Keys:
Skip to content (Access Key - 0)
My Area (Access Key - 2)


Toggle Sidebar
Your Rating: Results: PatheticBadOKGoodOutstanding! 0 rates
Labels:
aleph aleph Delete
opac opac Delete
customization customization Delete
translation translation Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

OPAC Enhancer for Aleph

Tags: , , ,
Last Updated: Apr 29, 2011 11:34


  • Description

    OPAC Enhancer is a daemon written in Perl that sits between Aleph www server and Apache. It can be used to modify requests before they reach the www server and responses before they reach the client (browser).

    By default it is possible to do "translations" (either language-specific or global) of the results, but it is also possible to add custom processing to enable customized functions or server-side amending of the response with results from an external source eliminating the need to use client-side JavaScript.

OPAC Enhancer will also fix HTTP headers Aleph sends in case they contain only LF as the end-of-line marker. Resulting headers will contain CR LF markers to make the responses conform to RFC 2616 (this problem should be fixed in Aleph v19 rep_ver #14191).


  • Author: Ere Maijala
  • Additional author(s):
  • Institution: None
  • Year: 2008
  • License: MPL 1.1 / GPL 2.0
  • Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
  • Link to terms: MPL 1.1, GPL 2.0
  • Skill required for using this code: intermediate

State

Stable (in production use)

Programming language

Perl

Software requirements

Tested with Aleph 18 under Solaris. Should work in different environments too. Requires the following Perl modules (nothing extraordinary):

  • Getopt::Long;
  • IO::Socket;
  • Net::hostent;
  • CGI
  • POSIX
  • Cwd
  • File::Basename

Screen captures

-

Author(s) homepage

Download

Aleph:Version 1.06

Working example

-

Using the following Ex Libris open interfaces

None so far.

Changes

Version 1.06 - 28 Oct 2010

  • Safeguard counter for the child process handler. Needed for robust handling and to avoid occasional delays in the main process.

Version 1.05 - 10 Mar 2010

  • More robust child process handling in busy environments.

Version 1.03

  • Dies harder. Tries to log problems rather than die whenever the smallest hint of trouble shows up.
  • Fixed HTTP Headers Aleph sends to properly use CR LF instead of just LF as the end-of-line marker.

Version 1.02

  • Fixed relaying responses (or requests) larger than 64 kilobytes.

Version 1.01

  • Fixed reaping of child processes (no more defunct/zombie processes).

Version 1.0

  • Initial release.

Release notes

Version 1.0 is an initial release. It should be stable but has not been tested in a busy live environment yet.

Installation instructions

  1. Log in to the server as aleph user
  2. Download the tar file to the server and unpack it into /exlibris/opac_enhancer directory. If any other path is used, change paths in opac_enhancer.sh and opac_enhancer.config accordingly.
  3. Verify that opac_enhancer.sh and opac_enhancer.pl are executable (chmod +x ... if necessary)
  4. Add opac_enhancer daemon to aleph_startup (e.g. /exlibris/aleph/u18_1/alephe/aleph_startup) before the end:

    This allows the daemon to start up when Aleph starts. It can be added to system startup (init.d) instead if desired.

  5. Add opac_enhancer daemon to aleph_shutdown (e.g. /exlibris/aleph/u18_1/alephe/aleph_shutdown) before shutdown of servers:

    This allows the daemon to stop when Aleph shuts down. It can be added to system shutdown (init.d) instead if desired.

  6. Start the daemon by running ./opac_enhancer start
  7. Verify that the log says something like:

    This means that the daemon was able to start successfully. If it fails, you can run it manually:

    This makes is run non-detached and you can e.g. possible compilation errors.

  8. Modify Apache's httpd.conf (e.g. /exlibris/aleph/u18_1/alephe/apache/conf/httpd.conf).
    Find the lines that say:

    and change the port to 4191:

    It is assumed that you have Aleph www server in port 4991. If that is not the case, please change the port in opac_enhancer.config. See below for configuration options.
  9. Restart Apache by running apache/bin/apachectl restart, e.g.
  10. Check to see if the OPAC still works.
  11. If the OPAC doesn't work, check the log for error messages

Configuration


Main configuration is done in the configuration file, by default opac_enhancer.config. Here are the configuration directives:

General


Directive Description
working directory The directory where all the files reside and where log and pid file are written
log file Name of the log file. Created in the working directory
pid file Name of the pid file that tells the process id of the running instance. Must be the same as in opac_enhancer.sh. Created in the working directory
listening address The address where the daemon listens for connections from Apache. Normally loopback address, 127.0.0.1, but can be set to another address if Apache is on a different server
listening port The TCP port where the daemon listens for connections from Apache. Can be changed to anything desired. Needs to be the same as the port in Apache httpd.conf
debug Level of debugging information written into log (0 = none, 1 = normal, 2 = data dumps of incoming and outgoing data to dump.dat too


Aleph


Directive Description
www server address The address of Aleph www server. Normally 127.0.0.1 if opac_enhancer and www server are on the same server
www server port The TCP port of Aleph www server


Translation


Translations can be used to change any content in the HTML pages, for instance to extend texts that have a limited length in Aleph configuration tables.

Be careful not to change something that might exist in displayed record data unless that's what you want.


Directive Description
global Name of a file containing translations done regardless of the used language
[Aleph:language code] Name of a file containing translations done only for the specified language code


The translation files can contain simple text to text translations or regular expressions. Simple texts are entered like this (separator is space dash dash space):

Regular expressions can be entered like this:


opac_enhancer_local.pm


opac_enhancer_local.pm is a module where local customizations and advanced functionality can be added.
local_preprocess function is called before the request is passed to the www server. If local_preprocess returns a non-zero value, the request is not passed to Aleph at all.
local_postprocess function is called before the response is sent to the client. It can be used to more advanced stuff than the simple translations can, e.g. function-specific things, database lookups etc.

TO DO list

  • Caching of translations
  • Automatic reload of configuration when it's changed
  • More features
  • Testing on different platforms

Comments

Page Attachments

File NameCommentSizeNumber of Downloads
opac_enhancer.tarOpac Enhancer v1.0630 kB115

Added by Ere Maijala on Dec 03, 2008 15:10, last edited by Ere Maijala on Apr 29, 2011 11:34

  1. Mar 03, 2009

    Nice tool, but I get problems when I use it together with https.

     Christoph

    1. Apr 08, 2009

      What kind of problems?

      Would it be possible to get a a data dump? Set debug=2 in the config, restart and do something. Then email me (ere.maijala at helsinki.fi) dump.dat.

      Thanks,

      Ere

Adaptavist Theme Builder Powered by Atlassian Confluence