HIP Tips!

Adding a message to your log in page
At Huddersfield, we’ve added some text to our HIP login page:

This is a really easy hack and just involves editing a single XSL page (security.xsl).
As always, make a safe backup of the file before you do any editing!
Firstly, open up security.xsl in your favourite text editor.  If you use Microsoft Notepad and it looks a mess — e.g. you get weird squares (𘂅) appearing — then try opening the stylesheet using Wordpad instead.
Go down to the end of the file, and it should look a little like this:

</center>
</td>
</tr>
</table>
</form>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Simply insert some well formatted (i.e. XHTML) code between the </form> and the </xsl:if> – for example:

</center>
</td>
</tr>
</table>
</form>
<!-- extra info for users - added by Dave -->
<p /><div align="center" style="font-size:80%">
<b>Borrower ID</b> is the 10 digits of your Campus ID Card
<br />
<b>PIN Number</b> is the 4 digits of the day and month
of your birth (e.g. 0206 for 2nd of June)
<p />
<span style="border-bottom:dashed black 1px; color:red;">
<b>Don't forget to logout when you have finished!</b>
</span>
</div>
<!-- end of extra info -->
</xsl:if>
</xsl:template>
</xsl:stylesheet>

…you should always add comments to any code you add to a stylesheet — it will help you locate your changes when it’s 3 months down the line and you can’t remember what you did, or why you did it!

All this was done using HIP 3.04 (UK release) and it should work for other versions of HIP 3.

p.s. if you like the idea of reminding a logged in user to log out when they’ve finished, check out this tip too!

HIP Tips!

Do your 856 URLs show up in a big font size that doesn’t seem to quite fit in with the rest of the text on the full bib page?
The quickest way to fix it is to fire up the Horizon table editor, select marc_map, and then locate the marc_map that you use for your 856 URLs.
In the “HTML format (Info Portal only)” field, insert class="smallAnchor" before the href. For example, if your HTML format looks like this:

<a href="$_">{<img src="$9">|$y|$_}</a>

…then change it to:

<a class="smallAnchor" href="$_">{<img src="$9">|$y|$_}</a>

Save the change, and then restart JBoss and the 856 links should pick up the formatting of the “smallAnchor” element from your HIP cascading style sheets (CSS).
And, for the more adventurous – if you’d like to know which 856 links your users are clicking on, then you can set your marc_map up to redirect to a CGI script that logs the URL and then redirects the user’s web browser to the true 856 link.
Once you’ve got your CGI script ready (in this case, I’ve called it logit.pl), you just need to change the 856 marc_map to link to the script – e.g.

<a href="http://foo.com/cgi/logit.pl?$_">{<img src="$9">|$y|$_}</a>

Once you’ve saved that and restarted JBoss, your 856 URLs look like this in HIP:

http://foo.com/cgi/logit.pl?http://www.ebooks.com/12345

Your CGI script just needs to take the contents of the QUERY_STRING environment variable (in the above, it’s http://www.ebooks.com/12345), append it to your log, and then issue a redirect to that URL.
(disclaimer: all of the above was done with Horizon 7.32 UK and HIP 3.04 – your mileage may vary depending on which versions you’ve got!)

Horizon "reconst" in Perl

Apologies to everyone who was interested in this for the delay in getting it posted!
The Horizon database stores several fields (e.g. title, author, etc) in the format “processed” / “reconst”, where the “processed” column contains the text stripped of punctuation and the indefinite/definite article, and “reconst” contains the stripped characters.
For example, the title “The great Aussie fashion : Australian fashion designers 1984-1985 /” is stored in Horizon as:

processed:
    great Aussie fashion Australian fashion designers 1984 1985
reconst:
    <M /7R-M: MThe

The “processed” version of the title is much more suitable for sorting than the original title.
Browsing through the Horizon mailing list archive, I came across a set of instructions for interpreting the “reconst” value.   As we generate a lot of custom HTML reports at Huddersfield, I decided to have a stab at coding the instructions in Perl:

reconstructTitle.txt

To use it in your own Perl script, just paste the subroutine in and call it with the “processed” and “reconst” strings, e.g.:

reconstructTitle( $processed, $reconst );

I’ve only used the code for reconstructing titles so far, but it might also work with author names, call number, etc.
The code is definitely “beta” and I’m not sure if it handles every “reconst” command yet, but feel free to make use of it.  If you can improve it, please do!

replacement inactive tab GIFs

The default GIF images used in HIP 3.04 for the inactive tabs only really work if you stick with the grey colour. Once you change that background colour, they no longer match:

Not only that, but the two corner GIFs are actually a different colour (more olive/brown than grey):

You can call me “sad”, but things like that niggle me! 😀
So, after a few minutes with Paint Shop Pro, I’ve come up with some replacement GIFs that use transparency to match whatever background colour you use for your inactive tabs:


If you too are niggled by your default GIFs, then you can download the replacement ones here: inactive_tab_GIFs.zip
You’ll need to overwrite the existing files, which are normally located in the “appserverjbossserverdefaultdeployhipres.warimages” directory:

…all of this assumes you’re on HIP 3.04 – so it might not work with other versions. Also, don’t forget to back up the original images (just in case!)
On a similar vein, I replaced the tab GIFs on our HIP a while ago with slightly more rounded 3D versions, although I’m not sure anyone actually noticed the change!

improving the "setfocus" JavaScript

HIP3 contains some JavaScript that sets the focus to the search box everytime a page is loaded – this means you can start typing text straight in to the box.
However, if you’ve already done a search, then it can be frustrating for the user to have the page suddenly jump to the top (especially if they are using the back button to return to a list of search results). In fact, it make more sense for the JavaScript to only set the focus on the initial search screens.
Here’s a quick hack that disables the JavaScript “setfocus” function for search result and full bib pages:
Open up searchresponse.xsl file and find the <body> tag (it’s around line 230)
A few lines down you’ll find the onload attribute code – this tells the web browser to execute the startTimer and setfocus JavaScript functions as soon as the page has loaded:

<xsl:attribute name="onload">startTimer();setfocus();</xsl:attribute>

Replace that entire line of code with the following:

<!-- disable the setfocus for search result pages -->
<xsl:if test="not(boolean(/searchresponse/yoursearch))">
<xsl:attribute name="onload">startTimer();setfocus();</xsl:attribute>
</xsl:if>
<xsl:if test="(boolean(/searchresponse/yoursearch))">
<xsl:attribute name="onload">startTimer();</xsl:attribute>
</xsl:if>
<!-- end of changes -->

Save the searchresponse.xsl file and check your HIP to see if the change works!
The usual notes apply:

  1. this worked fine for our UK HIP 3.04
  2. back up your original searchresponse.xsl file before you make any changes!
  3. if you’ve got one, try it on your test HIP server first

Remind users to Log Out

Just a quick addition to the toolbar2.xsl file to remind a logged in user to log out:

Open up toolbar2.xsl and search for the following comment:

<!-- Logout option -->

A couple of lines below that, insert the code shown in blue after the <td> tag:

<xsl:if test="$patron_empowerment_disable = $false">
<td>
<span style="color: red; border-bottom: dashed black 1px; font-size: x-small;
font-weight: bold;">Don't forget to logout when you have finished!</span>
<xsl:variable name="list"> . . . .

some notes:

  1. this worked for me with the UK HIP 3.04 release
  2. back up your original toolbar2.xsl file before you make any changes!
  3. if you’ve got one, try it on your test HIP server first!