Koha How-To

Incorporating Aspen Collection Spotlights into the Koha Staff Client

This week we have a guest article by Sam Passey of Uintah County Library and special code suggestions from Jason Robb of Southeast Kansas Library System!

Koha offers some amazing abilities for you to customize your library’s experience. If you have a little bit of time to learn some basics about coding you can use some of the Koha Community’s amazing resources to learn to use CSS, jQuery and other tools to help make that tweak, hide that popup your staff doesn’t like, and more. You can even use this flexibility to incorporate widgets and collection spotlights from other websites.

At Uintah County Library we’ve enjoyed using Koha and Aspen Discovery since early 2019. This powerful combination of open source software gives us some amazing options. We have especially enjoyed the ability to create Collection Spotlights within Aspen about calendar events, the latest book club suggestions, lists, or special featured information. These spotlights can be a fun way to engage with people using the catalog and drawing their attention to resources and services.

Our Challenge:

Our amazing circulation staff members are very busy people. They rarely have time to leave Koha to check out things in Aspen or other sites.

The Solution:

Aspen makes use of iframes to allow you to embed Collection Spotlights on other websites. Spotlights always stay current within the underlying search or list so as you add new titles to a list or purchase new titles that change search results, any Collection Spotlights you have created will automatically show those new titles. So for staff, this is a nice way to see what is current in the collection, every time they log into Koha's staff client.

See the Aspen Weekly about Collection Spotlights

Step 1: Add the content to the staff client via the appropriate system preference.

We decided to use the “IntranetmainUserblock” where we inserted this code from Aspen:

<code><div id="aspencalendar"><iframe src="https://catalog.uintahlibrary.org/API/SearchAPI?method=getCollectionSpotlight&id=81" width="850" height="250" scrolling="no"></iframe></div></code>

Step 2: Set up jQuery to ensure that Branch Unique Content is only shown where we want it to show.

I reached out to the Koha Community to see if it was possible to suppress the collection spotlight from showing to staff members at branches other than Uintah County Library as we’re in a consortium and seeing events that don’t belong to your branch could prove confusing at best and disastrous at worst.

Jason Robb from Southeast Kansas Library System generously shared the following jQuery.

To ensure that this Collection Spotlight only shows for people logged into Uintah County Library (branch code UCL) I had to first assign a div id and then put the following jQuery into Koha’s “IntranetUserJS” field. The div id I came up with was “aspencalendar”

$(document).ready(function() {

var libcode = $('#logged-in-info-full .logged-in-branch-code').text();

if (libcode !== 'UCL') {

$('#main_intranet-main #aspencalendar').hide();

}

});

Since adding the widget via IntranetMainUserblock causes it to display for all branches, we need to look at which library is currently logged in and hide it for all the branches that don’t need to see it.

Breaking down the code a bit, this line grabs and stores the branch code of the logged-in staff member:

var libcode = $('#logged-in-info-full .logged-in-branch-code').text();

Then we check if that stored branch code does not (!==) match the code where we want to see the info displayed (in this case UCL):

if (libcode !== 'UCL') {

If that’s true (the logged-in library is not UCL), then we hide the widget via the earlier defined div id of “aspencalendar”:

$('#main_intranet-main #aspencalendar').hide();

Since there is a large amount of information within IntranetUserJS I gave it some helpful introductory information by including this description:

//BEGIN hide items by branch id to allow uintah to show stuff from Aspen

In short this was a quick and relatively simple way to give staff members easy access within Koha to content from Aspen Discovery. This was also my very first experience doing anything with jQuery. You too can bring more awesomeness to Koha!

Here’s our staff client with a calendar collection spotlight showing:

To learn more about using jQuery, CSS, and other tools to customize Koha, the authors encourage you to visit Koha US at https://koha-us.org/ and Bywater Solutions at https://bywatersolutions.com/

Learn more about Collection Spotlights by reading the related blog post at https://bywatersolutions.com/e...

About Sam Passey

Sam Passey is the Library Director at the Uintah County Library in Vernal Utah.

Sam has led the library since 2007. He leads the Library's strategic planning efforts and helps the Library to develop programs and services to achieve the mission that the Library Board of Directors sets. Sam was a reluctant reader until one summer while recovering from a knee surgery he discovered Timothy Zahn's Heir to the Empire series of Star Wars books. He's now a voracious reader of whatever children's books his kiddos are interested in. Right now he's reading all about dinosaurs and Princess Elsa.

Email: passey@uintah.utah.gov