How to embed ‡biblios in your application

‡biblios is intended to be able to be embeded in another web application, for example Koha.

In order to facilitate this, a new version of the main application file, index.html, can be generated with correct paths to javascript libraries or with additional html or javascript. This is generated from a Template Toolkit template in src/index.html.

To create a new index.html file suitable for embedding in a web application, you need two files:

  1. A .ttreerc file
  2. A new build configuration file

First...

First, create a new build configuration file in the conf/ directory of the ‡biblios distribution. You may take the conf/build-koha.conf configuration file as a starting point:


[%
kohalangtheme = '/prog/en'
uiPath = "/intranet-tmpl$kohalangtheme/lib/biblios/"
libPath = "/intranet-tmpl$kohalangtheme/lib/biblios/"
cgiPath = '/cgi-bin/koha/plugins/biblios/'
openOnLoadRecId = ""
userid = ""
SESSID = ""
debug = 0
version = 0.9
%]

This configuration file defines variables to be filled in by Template Toolkit. In your configuration file you can change values for the following variables:

[% headIncludes %]
Included before other javascript files in src/index.html

libPath
Path to javascript libraries.

uiPath
Path to ‡biblios ui directory, containing css, images, and javascript files.

hostPort
Port of the web application hosting ‡biblios.

cgiDir
Path to the server's cgi-bin directory.

embeddedUrl
Url of the web application ‡biblios is embedded in.

userid
User id of the user running the web application.

embeddedSESSID
Cookie session id of the web application.

openOnLoadRecId
The record id of a record to open from the web application upon opening ‡biblios.

confPath
Path to the biblios.conf configuration file.

Look in the sr/index.html template to see where these variables go.

Next...

Once you have create the new build configuration file, you should create a new .ttreerc file to tell Template which build configuration file to use to generate the index.html. You can use .ttreerc-standalone as an example:

lib = conf
src = src
dest = ./
ignore swp$
pre_process = build-standalone.conf

Change the pre_process filename to the build configuration file you just created.

Then...

To generate the new index.html file suitable for embedding into your web application, run

ttree -a -f [name of your .ttreec file]

Finally...

Assuming you've kept the src and dest directories the same, a new index.html file for ‡biblios will be found in build/index.html with whatever variables you filled out in your build configuration file filled in.

You can then copy the build directory contents to appropriate places in your web application.