OPAC

Batch Actions In the Public Catalog

The public catalog now displays checkboxes on the bibliographic and metarecord constituents results pages. Selecting one or more titles by using the checkboxes will dynamically add those title to the temporary list, which is now renamed the cart.

Above the results lists there is now a bar with a select-all checkbox, a link to the cart management page that also indicates the number of of titles in the cart, and a link to remove from the cart titles that are selected on the currently displayed results page.

The search bar now includes an icon of a cart and displays the number of titles currently in the cart. Next to that icon is a menu of cart actions.

The cart actions available are Place Hold, Print Title Details, Email Title Details, Add Cart to Saved List, and Clear Cart. In the web staff client, the cart actions also include Add Cart to Bucket. When an action is selected from this menu, the user is given an opportunity to confirm the action and to optionally empty the cart when the action is complete. The action is applied to all titles in the cart.

Clicking on the cart icon brings the user to a page listing the titles in the cart. From there, the user can select specific records to request, print, email, add to a list, or remove from the cart.

The list of actions on the record details page now provides separate links for adding the title to a cart or to a permanent list.

The permanent list management page in the public catalog now also includes batch print and email actions.

Additional information

  • The checkboxes do not display on the metarecord results page, as metarecords currently cannot be put into carts or lists.
  • The checkboxes are displayed only if JavaScript is enabled. However, users can still add items to the cart and perform batch actions on the cart and on lists.
  • A template config.tt2 setting, ctx.max_cart_size, can be used to set a soft limit on the number of titles that can be added to the cart. If this limit is reached, checkboxes to add more records to the cart are disabled unless existing titles in the cart are removed first. The default value for this setting is 500.

Developer notes

This patch adds to the public catalog two routes that return JSON rather than HTML:

  • GET /eg/opac/api/mylist/add?record=45
  • GET /eg/opac/api/mylist/delete?record=45

The JSON response is a hash containing a mylist key pointing to the list of bib IDs of contents of the cart.

The record parameter can be repeated to allow adding or removing records as an atomic operation. Note that this change also now available to /eg/opac/mylist/{add,delete}

More generally, this adds a way for EGWeb context loaders to specify that a response should be emitted as JSON rather than rendering an HTML page using Template::Toolkit.

Specifically, if the context as munged by the context loader contains a json_response key, the contents of that key will to provide a JSON response. The json_response_cookie key, if present, can be used to set a cookie as part of the response.

Template Toolkit processing is bypassed entirely when emitting a JSON response, so the context loader would be entirely responsible for localization of strings in the response meant for direct human consumption.

New class for searchbar when on the homepage

This adds the .searchbar-home class to the div that contains the searchbar when on the homepage. This allows sites to customize the searchbar differently on the homepage than in other places the search bar appears (for example, offering a large, Google-style search bar on the homepage only).

Username Login Hint

To make customization easier, the username hint on the OPAC login page ("Please include leading zeros…") has been moved to a separate TT2 template. If you have customized the hint text, you will need to add your modifications to username_hint.tt2.