Toolbar: a key to resource management

by

Some people might be interested in how the preferences system in the toolbar works, I have written this short piece on this topic.

Resource management in NTNU Library Toolbar is simple; it might not be simple to for users to edit, but it is in-and-of itself simple. (Note that I will soon start work on a user interface that allows users to add/remove resources, reconfigure how resources are displayed, and change the toolbar name/links).

Inside the XPI package, two files govern what resources are available, and how these resources are displayed:

  • chrome/content/databases.csv
  • defaults/preferences/ntnulibrarytoolbar.js

Databases.csv just contains data in the following format:

Database Name; Default URL; Search URL

Where an example would be:

BIBSYS; http://ask.bibsys.no/ask/action/resources; http://ask.bibsys.no/ask/action/result?cmd=&kilde=biblio&q=MYSEARCHTERM

It is worth noting that the line must end with a newline (i.e. each resource must be on a new line).

The second file defaults/preferences/ntnulibrarytoolbar.js contains a few strings, only one of which is currently functional — the one that begins: pref(“extensions.ntnulibrarytoolbar.resources”,…

This line is copied to your Firefox preferences file (i.e. the one that is accessed by entering about:config as the URL in Firefox), and it defines how the available resources are displayed in the toolbar’s popup menu.

It is structured in this way:

boolean.Resource Name.AITEM.NEW.boolean.Resource Name.AITEM.boolean.Resource Name

For example:

true.BIBSYS.AITEM.NEW.true.Linguistics.AITEM.true.ISI Citation Search

NEW defines a new entry in the popup menu, while AITEM defines a new submenu; The first item in this list is always considered to be a new item. If AITEM is followed by NEW, the preceding element is considered to be a menu item, if AITEM contains anything, the preceding element is considered to be a submenu container. Thus in the example above, BIBSYS is a menu item, while Linguistics is a submenu.

The when a menu item (BIBSYS/ISI Citation Search) is selected by a user, this title is looked up in the file databases.csv, and then the URL information is retrieved. This means that the resource titles in these two files must match.

While it is possible for AITEM to occur twice in any resource definition in ntnulibrarytoolbar.js (so that a submenu has a submenu), I have turned this function off in the beta toolbar, so nothing displays in this case.


%d bloggers like this: