From: feilmeyer, phil
Sent: Tuesday, September 17, 2002 12:48 PM
To: 'ipac@lists.tblc.org'
Cc: 'Polly Dawes'; 'Carol Vaughan'; 'Rex R. Helwig'; 'Connie Hudson'
Subject: Default sort by due date in Items Out

Here’s how I was able to implement a default sort by due date in the Items Out list under My Account.  It requires modification of two XSLT stylesheets and is not supported by Epixtech.  Additionally, XSLT stylesheets are replaced wholesale during an upgrade and are often replaced as part of a “bug fix”, so you’ll want to carefully document what you do so that it can be redone later.  There isn’t anything Dynix specific about this customization, so I would think it would apply to both Dynix and Horizon iPacs.  Feel free to contact me if you want additional information.

 

 

The key is hidden in the HTML source code on the Items Out page.  When viewing the list of items out, a click on “Due Date” in the table header sorts the list by due date.  The URL embedded in the HTML that’s used for this ends with the string “sortby=duedate”.  Here’s an example from my server:

 

<a href="?session=S03P28R057351.728&amp;profile=rd&amp;menu=account&amp;submenu=itemsout&amp;sortby=duedate">Due Date</a>

 

So, I found the two places that a user might click on to bring up the Items Out list and added “sortby=duedate” to the href.

 

From the Overview page under My Account

The XSLT stylesheet responsible for the creation of the My Account > Overview page is patronpersonaloptions.xsl.  Lines 25 through 80 create the HTML for the Items Out section of the overview.  Line 32 is the following:

 

<xsl:attribute name="href">?session=<xsl:value-of select="//session"/>&amp;profile=<xsl:value-of select="//profile"/>&amp;menu=account&amp;submenu=itemsout</xsl:attribute>

 

All you need to do is add “&amp;sortby=duedate” right before the </xsl:attribute> ending tag:

 

<xsl:attribute name="href">?session=<xsl:value-of select="//session"/>&amp;profile=<xsl:value-of select="//profile"/>&amp;menu=account&amp;submenu=itemsout&amp;sortby=duedate</xsl:attribute>

 

From the “Items Out” subtab under the My Account tab

The basic process is the same…add the sortby instruction to the URL behind the “Items Out” hotlink on the toolbar.  It gets tricky here because the XSLT code that generates the Items Out subtab is the same code that generates ALL of the subtabs.  Here’s how I did it:

 

The XSLT stylesheet responsible for creating the tabs and subtabs is toolbar2.xsl.  Lines 685 through 763 create the HTML for all the subtabs.  It turns out there are four places in this code that might produce a URL:  lines 708, 711, 746, and 749.  Again, the aim is to add the string “&amp;sortby=duedate”, but ONLY if the subtab being created is the “Items Out” subtab.  To do this, I used the text string that shows up on the toolbar (for our system, it’s “Items Out”…it may be “Checked Out” or something else on your system).  Here’s the code I add to each of the lines listed above:

 

<xsl:if test="name = 'Items Out'">&amp;sortby=duedate</xsl:if>

 

So, here’s line 708 before:

<xsl:attribute name="href"><xsl:value-of select="$subhref"/></xsl:attribute>

 

And line 708 after:

<xsl:attribute name="href"><xsl:value-of select="$subhref"/><xsl:if test="name = 'Items Out'">&amp;sortby=duedate</xsl:if>

</xsl:attribute>

 

Line 711 before:

<xsl:attribute name="href"><xsl:value-of select="$host"/>?session=<xsl:value-of select="//session"/>&amp;profile=<xsl:value-of select="//profile"/>&amp;menu=<xsl:value-of select="//active_tab"/>&amp;submenu=<xsl:value-of select="value"/>&amp;ts=<xsl:value-of select="$now"/></xsl:attribute>

 

Line 711 after:

<xsl:attribute name="href"><xsl:value-of select="$host"/>?session=<xsl:value-of select="//session"/>&amp;profile=<xsl:value-of select="//profile"/>&amp;menu=<xsl:value-of select="//active_tab"/>&amp;submenu=<xsl:value-of select="value"/>&amp;ts=<xsl:value-of select="$now"/><xsl:if test="name = 'Items Out'">&amp;sortby=duedate</xsl:if></xsl:attribute>

 

Remember, you’ll need to change “name = ‘Items Out’” to match the text string on your system.

 

One last touch

This was working great, but then it was pointed out to me that after doing a renewal the list would revert back to being sorted by title.  Here’s what I did:

 

Again in the patronpersonaloptions.xsl file, lines 792 through 1040 are responsible for the Items Out page.  Lines 870 through 875 create the “Renew” button at the top of the list:

 

<input>

  <xsl:attribute name="type">submit</xsl:attribute>

  <xsl:attribute name="name">renewitems</xsl:attribute>

  <xsl:attribute name="value"><xsl:value-of select="$patron_options_renew_btn"/></xsl:attribute>

  <xsl:attribute name="class"><xsl:value-of select="$css_button"/></xsl:attribute>

</input>

 

Right before line 870, I added the following code:

 

<!-- pf added hidden attribute in order to retain sort preference during renewal -->

<input>

  <xsl:attribute name="type">hidden</xsl:attribute>

  <xsl:attribute name="name">sortby</xsl:attribute>

  <xsl:attribute name="value"><xsl:value-of select="/patronpersonalresponse/itemsoutdata/sortby"/></xsl:attribute>

</input>

<!-- end of added hidden attribute -->

 

So that section now looks like this:

 

<!-- pf added hidden attribute in order to retain sort preference during renewal -->

<input>

  <xsl:attribute name="type">hidden</xsl:attribute>

  <xsl:attribute name="name">sortby</xsl:attribute>

  <xsl:attribute name="value"><xsl:value-of select="/patronpersonalresponse/itemsoutdata/sortby"/></xsl:attribute>

</input>

<!-- end of added hidden attribute -->

<input>

  <xsl:attribute name="type">submit</xsl:attribute>

  <xsl:attribute name="name">renewitems</xsl:attribute>

  <xsl:attribute name="value"><xsl:value-of select="$patron_options_renew_btn"/></xsl:attribute>

  <xsl:attribute name="class"><xsl:value-of select="$css_button"/></xsl:attribute>

</input>

 

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Phil Feilmeyer                       pfeilmeyer@hclib.org

Integrated Library System Manager    (952) 847-8768

Hennepin County Library              (952) 847-8600 (fax)

12601 Ridgedale Drive

Minnetonka, MN 55305-1909            http://www.hclib.org

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-