[OPEN-ILS-DEV] MVLC's Library Subdomains
Thomas Berezansky
tsbere at mvlc.org
Wed Jun 15 17:29:14 EDT 2011
Some people have expressed interest in this, both via MassLNC meetings
and IRC discussions. Figure it would be better to share with the
community, rather than keep it hidden.
How MVLC did catalog subdomains with Evergreen.
See http://mvlc.org/Libraries for our library list. Note that not all
have logos of their own installed yet.
Configuration Files (all in /openils/conf/):
All .txt files here are key and result, space separated.
libcode.txt - Simple domain name to library code mapping.
subdomain1.example.com lib1
subdomain2.example.com lib2
subdomain2a.example.com lib2
etc
libname.txt - Library code to library name mapping. Uses   for
spaces in names:
lib1 Library One
lib2 Library Two
etc
liburl.txt - Library code to library homepage mapping.
Note: We comment out(with a #) those we don't have logos for yet.
lib1 http://lib1.example.com
lib2 http://lib2.example.com
etc
libtarget.txt - Library code to target string mapping.
NONE l=1&d=0
lib1 l=4&d=2
lib2 l=6&d=2
etc
libnovelu.txt - Library code to novelist username mapping
Note: Only for our 8 members that have novelist select.
lib1 lib1.main.novsel2
lib2 lib2.main.novsel2
etc
Apache config changes (eg_vhost.conf):
Comment out Redirectmatch 301 ^/$ line
After pulling locale from URL with RewriteCond/RewriteRule:
RewriteMap lowercase int:tolower
RewriteMap libcode txt:/openils/conf/libcode.txt # Domain to
Code mappings
RewriteMap liburl txt:/openils/conf/liburl.txt # Code to URL Link
RewriteMap libname txt:/openils/conf/libname.txt # Code to Name
RewriteMap libtarget txt:/openils/conf/libtarget.txt # Code to Target
RewriteMap libnovelu txt:/openils/conf/libnovelu.txt # Code to
Novelist Username
# Populate ENV variables
RewriteRule . - [E=libcode:${libcode:${lowercase:%{HTTP_HOST}}|NONE}]
RewriteRule . - [E=liburl:${liburl:%{ENV:libcode}}]
RewriteRule . - [E=libname:${libname:%{ENV:libcode}}]
RewriteRule . - [E=libtarget:${libtarget:%{ENV:libcode}}]
RewriteRule . - [E=libnovelu:${libnovelu:%{ENV:libcode}|NONE}]
# For Non-HTTPS requests use the http novelist URL
RewriteCond %{ENV:libnovelu} !^NONE$
RewriteCond ${SERVER_PORT} !^443$
RewriteRule . -
[E=OILS_NOVELIST_URL:http://imageserver.ebscohost.com/eit/eitinit.js?auth=profile&profile=%{ENV:libnovelu}&pwd=NOVELIST_PASSWORD&cfg=Y]
# For HTTPS requests use the https novelist URL
RewriteCond %{ENV:libnovelu} !^NONE$
RewriteCond ${SERVER_PORT} ^443$
RewriteRule . -
[E=OILS_NOVELIST_URL:https://imageserver.ebscohost.com/eit/eitinit.js?auth=profile&profile=%{ENV:libnovelu}&pwd=NOVELIST_PASSWORD&cfg=Y]
# Logo URLs - For library specific logos by code (see libcode stuff above)
RewriteCond %{REQUEST_URI} /opac//?images//?main_logo.jpg
RewriteCond %{DOCUMENT_ROOT}/opac/images/%{ENV:libcode}/main_logo.jpg -f
RewriteRule /opac//?images//?main_logo.jpg
/opac/images/%{ENV:libcode}/main_logo.jpg
RewriteCond %{REQUEST_URI} /opac//?images//?small_logo.jpg
RewriteCond %{DOCUMENT_ROOT}/opac/images/%{ENV:libcode}/small_logo.jpg -f
RewriteRule /opac//?images//?small_logo.jpg
/opac/images/%{ENV:libcode}/small_logo.jpg
# Keyword Search (to make swapping to different skin/catalog easier later)
RewriteRule ^/search/keyword/(.*)
/opac/en-US/skin/default/xml/rresult.xml?rt=keyword&tp=keyword&t=$1&%{ENV:libtarget}
[R]
# DB ID (direct load) (ditto on reason)
RewriteRule ^/search/id/(.*)
/opac/en-US/skin/default/xml/rdetail.xml?r=$1&%{ENV:libtarget} [R]
# ISBN Search (same reason)
RewriteRule ^/search/isbn/(.*)
/opac/en-US/skin/default/xml/rresult.xml?rt=isbn&adv=$1&%{ENV:libtarget}
[R]
# My account (again, same reason) - Forces https because http won't work.
RewriteRule ^/myaccount
https://%{HTTP_HOST}/opac/en-US/skin/default/xml/myopac.xml?%{ENV:libtarget}
[R]
# Default search - Replaces RedirectMatch line with target info
RewriteRule ^/$ /opac/en-US/skin/default/xml/index.xml?%{ENV:libtarget} [R]
Changes to files to use information:
--- a/Open-ILS/web/opac/skin/default/xml/common/logo.xml
+++ b/Open-ILS/web/opac/skin/default/xml/common/logo.xml
@@ -1,4 +1,7 @@
<div id='logo_div'>
<script language='javascript'
type='text/javascript'>config.ids.common.top_logo =
"top_left_logo";</script>
- <img style='margin-right: 4px; height: 48px; width: 187px;'
src='<!--#echo var="OILS_BASE"-->/images/small_logo.jpg'
id='top_left_logo' border='0' class='logo' />
+ <!--#if expr="${liburl}"--><a href="<!--#echo var="liburl"-->"
alt="<!--#echo encoding="none" var="libname"-->">
+ <!--#else--><a href="http://www.example.org" alt="Your
Consortium Name">
+ <!--#endif-->
+ <img style='margin-right: 4px;' src='<!--#echo
var="OILS_BASE"-->/images/small_logo.jpg' id='top_left_logo'
border='0' class='logo' /></a>
</div>
--- a/Open-ILS/web/opac/skin/default/xml/home/homesearch.xml
+++ b/Open-ILS/web/opac/skin/default/xml/home/homesearch.xml
@@ -28,7 +28,10 @@
<div style='width: 100%; text-align: center'>
- <img src='<!--#echo
var="OILS_BASE"-->/images/main_logo.jpg' />
+ <!--#if expr="${liburl}" --><a href="<!--#echo
var="liburl"-->" alt="<!--#echo encoding="none" var="libname"-->">
+ <!--#else --><a href="http://www.example.org" alt="Your
Consortium Name">
+ <!--#endif -->
+ <img src='<!--#echo
var="OILS_BASE"-->/images/main_logo.jpg' /></a>
</div>
<style type="text/css">.rowpad { height: 20px; }</style>
Thomas Berezansky
Merrimack Valley Library Consortium
More information about the Open-ils-dev
mailing list