Virtual Bookplates

Created by

  • Ron Chesko, Western Washington University
  • Hui Zhang, Oregon State University
  • Documentation by Carlos Torres, Seattle University

Description

These instructions will help you to configure the normalization rule and display configuration for implementation of a Virtual Bookplate for records in Primo VE.

Example of a virtual bookplate with a library logo and the message Donated by Carlos

System Components

Alma Discovery (VE), Customization Package

Skill Set Requirements

Alma Discovery, CSS

Accessibility

Web Accessibility Checklist for Primo VE Customizations

Browser Support

Chrome

Mobile Support

Not Tested

Implementation

Overview

  • Implement a normalization rule and display field to add virtual bookplate information from MARC 599 fields to Primo brief records
  • Customize the display of the virtual bookplates with CSS

Prerequisites

  • You’ll need to have Discovery-Admin role in Alma to make changes to displays and normalization rules
  • Records that you’d like to display Virtual Bookplates for will need to have a MARC field 599 with the following:
    • Subfield c containing “virtual bookplate”
    • Subfield a containing the text you’d like to appear in the virtual bookplate display

Steps

Step 1: Create a Local Display Rule

Instructions on creating a Local Display Field can be found in the How-tos: NRSG Local Display Fields in VE document. The link jumps to the “Display Fields for Local Data Fields (MARC 59X, 69X, 9XX)” section. Use Method 2 in this section, as the rule template is provided below.

Note: Please check and update the Rule Coordination Spreadsheet to make sure you pick a local field number that matches up with other Alliance institutions. A few Alliance libraries are already using local_field_02 for 590 and 599 MARC fields.

Paste the following code into the rule editing screen:

rule "Primo VE - Lds02"
  when
   	MARC."599" has any "a" AND
         	MARC."599"."c" match "virtual bookplate"
  then
         	set TEMP"1" to MARC."599" subfields "a"
         	add prefix (TEMP"1","<span class=\"bookplate\">")
         	add suffix (TEMP"1","</span>")
   	create pnx."display"."lds02" with TEMP"1"
end

This rule assumes that you are using the 599 MARC field along with subfields a and c as described in the prerequisites AND you are using local_field_02. This rule also assumes that you are using “bookplate” as your CSS class name.

If there is already a rule in the local_field_02 for 590, paste the following code into the rule editing screen:

Note: If you add another stanza to a norm rule, you need to make sure the title of the 2nd stanza is different than the first…but don’t change the first. It has to read “Primo VE – Lds##”.

rule "Primo VE - Lds02"
  when
   	MARC."599" has any "a" AND
         	MARC."599"."c" match "virtual bookplate"
  then
         	set TEMP"1" to MARC."599" subfields "a"
         	add prefix (TEMP"1","<span class=\"bookplate\">")
         	add suffix (TEMP"1","</span>")
   	create pnx."display"."lds02" with TEMP"1"
end
 
rule "Primo VE - Lds02 590"
  when
       MARC."590" has any "a" AND
             MARC."590"."c" match "virtual bookplate"
  then
             set TEMP"1" to MARC."590" subfields "a"
             add prefix (TEMP"1","<span class=\"bookplate\">")
             add suffix (TEMP"1","</span>")
       create pnx."display"."lds02" with TEMP"1"
end

Note: Please take care in copying and pasting quotes. Some word processors substitute something that looks like a double quote but might not be. If you’re getting errors applying a rule in Alma, check the quotes. A good procedure is to first paste the rule into a plain text editor like Notepad. Then, if you don’t see any weird or missing characters, copy out of the text editor and into the norm rules editor window.

Step 2: Add the Display Field to the Brief Display

Once you’ve created the display field, you need to add that field to the Brief Record Display in your view(s).

In Alma, go to Configuration > Discovery > Configure Views

Click on the action (…) button for the view you wish to edit and choose Edit. Once on the View Configuration, click on the Brief Record Display tab at the top of the page. You should see a screen like this:

View Configuration Brief Record Display tab with fields 1 Vernacular Title; Title, 2 Creator, Contributor, 3 Creation date, 4 Is Part Of

If the display fields have not previously been customized, you will need to click the Customize link in the Display Fields section.

You should now have the option to edit each of the lines:

Display Fields section with fields 1 Vernacular Title; Title, 2 Creator, Contributor, 3 Creation date, 4 Is Part Of

You are limited to these 4 lines, so you will need to add the Virtual Bookplate to an existing line or replace a line. You can find more information about views configuration in the ExLibris Online Documentation.

For this documentation, we’re going to add the Virtual Bookplate to the 4th line of the display. So, click on the action (…) button at the end of the line and choose Edit.

The following edit screen will display:

Row Fields section with one row: Active toggled on, code ispartof, Name Is Part Of

Now we will click on the Add Field link and use the search box to jump to Virtual Bookplate:

Add Field form with code search virtu and Virtual Bookplate selected

Then click Add to add the field. Your new line configuration should look like this:

Row Fields with two rows: 1 Active toggled on, code ispartof, name Is Part Of, 2 Active toggled on, code lds02, name Virtual Bookplate

Click Done.

The changes to take effect immediately.

Repeat this process for any other Views that you’d like the Virtual Bookplate to display on. If you have any questions or problems, feel free to contact the Norm Rules Standing Group for assistance.

Step 3: Customize the display of the virtual bookplate with CSS

In your local customization package, insert the following CSS rule sets into your custom1.css file. Change the background image, colors, and other styles to match your institution’s look and feel.

/* bookplates */
.bookplate {
    background-image: url(/* Your URL here */);
    background-position: 5px 50%;
    background-repeat: no-repeat;
    padding: 8px 8px 8px 90px !important;
    font-weight: bold;
    display: inline-block;
    border: 1px solid #5F710F;
    margin: 8px 0;
    max-width: 600px;
    outline: none;
  background-color: #FFF;
}

.bookplate:hover {
    background-color: #FFF;
}

prm-brief-result .item-detail span {
    display:block;
}

Save the file, zip your customization package, and upload it to your Primo VE view in Alma Discovery.

Optional: Add button to search for bookplate text

By default, local fields aren’t searchable in the Primo full display. If you’d like to help patrons search for records with the same virtual bookplate, you can use AngularJS to add a button under the brief record display.

The code below will add a button with the class “bookplate-search” that performs an exact search for the contents of the lds02 display field. If you assigned a different code in your normalization rule, change the check for value.key == 'lds02' to match your own code.

Accessibility note: When navigating Primo with a keyboard, triggering the button will open the full record as if clicking elsewhere on the brief result. However, triggering the button from the full record display will then open the search results.

// Add a button under virtual bookplates to search for other records
// containing the same exact string
app.component('prmBriefResultAfter', {
  bindings: {
    parentCtrl: "<",
  },
  template:
    '<button class="bookplate-search" ng-if="$ctrl.show_bookplate_search" ng-click="$ctrl.search_bookplate()">Find other donations</button>'
  ,
  controller: function controller($scope, $location) {
    var vm = this;
    vm.show_bookplate_search = false;
    this.$onInit = function() {
      $scope.$watch(
        function() {
          return angular.isDefined(vm.parentCtrl.otherLines);
        },
        function (newValue, oldValue) {
          if (newValue === true) {
            angular.forEach(vm.parentCtrl.otherLines, function(line, line_index) {
              angular.forEach(line.values, function (value, value_index) { 
                if (value.key == 'lds02') {
                  var params = $location.search();
                  const search_query = 'any,exact,' + angular.element(value.text[0]).text();
                  if (!angular.isDefined(params.query) || params.query.toLowerCase() != search_query.toLowerCase()) {
                    vm.search_bookplate = function() {
                      params.query = search_query;
                      return $location.path('/search').search(params);
                    }
                    vm.show_bookplate_search = true;
                  }
                }
              });
            });
          }
        }
      );
    }
  }
});

Style the button with CSS. For example:

button.bookplate-search {
  background: transparent;
  border: none;
  color: #5F710F;
  font-size: 90%;
}

button.bookplate-search:hover,
button.bookplate-search:focus,
button.bookplate-search:active {
  text-decoration: underline;
}
A Primo search for keywords test readiness. The top result has a virtual bookplate with the text 'Donated by Carlos' and a button underneath labeled 'Find other donations.'
Primo exact search results for 'Donated by Carlos.'