Comment 6 for bug 1552409

Revision history for this message
Thomas Berezansky (tsbere) wrote :

If we define things as being part of an online "service" (I am being lazy in coming up with a better name) then a new (or existing, I suppose) template file could use the CGI functionality to pull that "service" out. We can then use OU settings for other pieces via the get_org_setting helper:

targetservice = CGI.param('service');
targetservicename = ctx.get_org_setting(ctx.physical_loc || ctx.aou_tree.id, 'some.setting.${targetservice}.name');
targetserviceurl = ctx.get_org_setting(ctx.physical_loc || ctx.aou_tree.id, 'some.setting.${targetservice}.url');

Then do what you want/need to send them to targetserviceurl. Different template files could be created for specific services as well (say you want to attempt "In Library" versus "At Home" links, adding an introductory page, some services you want auto redirect and others manual selection (post values maybe?), or perhaps you want a giant landing page that covers multiple destinations like hotlinking deeper into Ebsco versus the main "select a product" landing page). If you throw the user's home library id into there (before ctx.physical_loc, perhaps) then you could have org unit specific urls for a given service, and throw a "We're sorry, but your library does not subscribe to ${targetservice}" message up if there is no global URL for that service.

The login page could get that "targetservice" via something like the below (in the existing login.tt2 template) and if a value is found do the same "some.setting.${targerservice}.name" lookup above to indicate what they are logging in to reach in a more human-readable form.

IF CGI.param('redirect_to').search('\?.*service=');
redirectcgi = CGI.new(CGI.param('redirect_to').replace('^.*?\?',''));
targetservice = redirectcgi.param('service');
<do other stuff here>
END;

Up to this point I don't think any of this requires any perl layer changes at all, just some template work and MARC that points at the appropriate URL.