Thursday, July 14, 2011

Using the Millennium module to create a new book list in Drupal

This post provides details about how to generate a new book list in Drupal using the Millennium OPAC integration module. This example is in Drupal 6. There are a number of advantages to this.
  • You can integrate your new booklist more directly into your website.
  • This module creates new nodes for each book, so you can use Drupal functionality directly on your books, using views, slideshows, etc.
  • Once you get this setup, it's easy to maintain
  • You can use the notifications module to provide email subscription options,
  • It offers RSS out of the box,
  • You can use the hilcc module to provide clustering by subject for easy brows-ability
  • You can easily import lots of extra data to make your new book list more interesting.
If you want to see this in action, here's our new book list

Pre Reqs: You have a Drupal 6 site and use III as your ILS.
  • Enable taxonomy module in core
  • Install CCK
  • Install millennium OPAC integration module
  • Install Views (optional, but you'll want this to manipulate how the data is views)
  • Install hilcc module (optional – provides easy clustering for brows-ability by subject)
  • Install computed field module (optional -- this is useful in creating views which all provide bookjackets -- no blank images)
  • Install notifications (optional – provides the ability for users to subscribe to subject areas and get email notifications about new materials)
  • Install Views Bulk operations (optional -- this makes it easy to delete, unpublish, or archive your old materials)
CREATE A NEW CONTENT TYPE, or decide on an existing content type to store your new materials. You'll need CCK to create a new content type. Mine includes the following fields:
  • Title
  • Publisher
  • Author
  • CallNumber
  • Summary
  • isbn
  • Document type (this is important for filtering out videos from books)
  • Image availability
this is a computed field that checks whether or not a bookjacket or video image is available, so I can make pretty displays that always have an image for featured displays on the site. If computed field is installed and permissions are set correctly, you will get the option to add a Computed field type:

Then, in the Computed Code field, you add the PHP which determines the presence of the bookjacket. We get our images from B&T using the isbn, so I take the isbn, generate the link to B&T, then use getimagesize to determine if there is content or not, then set the value to yes if an image exist, No if it doesn't. The code:
$my_isbn = $node->field_isbn[0]['value'];
$my_url = "[myuseridforB&T]&Password=[mypasswordhere]&Value=".$my_isbn."&Return=1&Type=S&";
$my_img_size = getimagesize($my_url);
if($my_img_size[0] > 20) {$node_field[0]['value'] = "Yes";} else{$node_field[0]['value'] = "No";}

NOTE: You don't need to create separate content types for videos or other types of materials - I use the Document type field above to import the material type from the record, and then can use this to filter my views by video, book, etc. You could also use taxonomy for this.

CREATE A VOCABULARY for your locations, assuming you will want to do some organization of your materials by the location code. If you are using this for more than just new books, you would want others vocabularies as well, but for a new book list, this is all we need.

The hilcc module should have generated a new vocabulary for you as well, called hilcc categories.

Make sure you enable use of both vocabularies for your content type above.

These instructions help you import data from featured lists. There are many other ways to do this, but for new books, this seemed easiest. For other methods, see the documentation for this module.

You configure settings for Millennium using the Millennium settings under Site configuration.

Go to admin/settings/millennium and set up:
  • Sources tab:
    • Select your new content type to import your records into
    • Add the url to your OPAC in the OPAC base URL and save

  • CCK field mapping: Map your fields from your content type -- make sure you import your ISBN which will be used for the computed field (above) and make sure you import your itype field as well to distinguish videos from books, etc.
  • Display: You may want to play around with these options, but this is where you add links to book jackets. If you don't subscribe to a service, you can get these for free from LibraryThing, or try Amazong using "!id.01._SX140_SCLZZZZZZZ_.jpg." Also, consider adding links to Google Book and embedding a preview into your records
  • Taxonomy mapping: I primarily use this to map the location into my location vocabulary at the bottom of the screen. You don't actually have to map your subject terms here, and if you are just using this for new books, you may not want to use this area at all -- I do not. I did initially and it generated sooooo many terms I had some problems with the system. You would use this area if you were using this to create a new interface to your catalog, but I'd skip it for a new book list. You will still have the nice subject browse with hilcc.
  • Enrichment: I import everything here -- more fun stuff for people to play with. You can choose what content you do or don't want.

While you configured the module in the configuration area, you do the importing under Content Management, Millennium batch import/refresh: /admin/content/millennium

You can import in a number of ways, including a keyword search. You can also automate this and crawl the system for the latest materials (you do this in the configuration area), but that pulls too much stuff I don't want, so I create a list of the new materials with the specifications I want, then place it in a featured list. Then, taking the url for the featured list, I use the option "Enter a URL for a result listing." If it's a big list, I always set the maximum number of items to import low for the test run.

You now have your new materials as nodes in your website, and you are free to manipulate them as you would any drupal node.


Views: For our site, I use Views and views carousel, and I use my document type field to split the views into new videos and new books.

I also use the location taxonomy to display special collections, such as our children's collection and our Daylight Lounge / popular materials collection.

Notifications: This allows people to signup for email notifications. RSS should also work out of the box.

FINAL THOUGHTS: I primarily am using this area to document how I created our new books list, and I thought I'd post it out here in case someone else finds it useful. It actually didn't take that long to set this up as it uses standard Drupal functionality, though if you are new to Drupal, this whole thing may seem a little overwhelming. If you are already using Drupal, though, you are probably already using CCK, Views, taxonomy, maybe even notifications. Once this is setup, it's just a matter of creating a new list of materials in Millennium, moving it into the featured list area, and reimporting the data. I do delete old materials to keep it clean as well.

No comments:

Post a Comment