From: feilmeyer, phil
Sent: Wednesday, January 07, 2004 2:39 PM
To: 'ipac@lists.tblc.org'
Cc: 'Leah Oliver'; 'Vaidas Sedys'; 'George Yobst'; 'Steve Smith'; 'Walker, Glen'
Subject: RE: [ipac] Overdues in another color
Quite a few people have written asking for the code behind this customization so I thought I would post it to the list.  It requires editing one of the XSLT stylesheets...standard warnings apply (see note at the end of this email).  I've attached two text files to help with editing the stylesheet.
 
Here's a full description of the customization:
 
In the "Items Out" table, a note is added to each "Due Date" cell telling the patron how many days until the due date or how many days overdue.  The color of the text changes to blue as the due date gets closer, and then to red when the item is past due.
 
Examples:
Due in 8 days (black)
Due in 3 days (blue)
Due tomorrow (blue)
Due today (blue)
Overdue by 1 day (red)
Overdue by 3 days (red)
 
You'll need to edit the patronpersonaloptions.xsl stylesheet in two places as described below (and illustrated in the two attached text files).
 
The first piece of code is all JavaScript and defines a function that calculates the difference in days between any date and today (I should mention that I'm just a hack with JavaScript...there is undoubtedly a better way to do this).  In my stylesheet, I inserted the JavaScript code right at the beginning of the "Items Out" template.
 
* See the attached file "duedate note part 1.txt" for the actual code.
 
The second modification is inserted right in the table cell that contains the due date.  The first several lines of code pick apart the due date coming out of HIP (in MM/DD/YYYY format) into individual variables representing the month, day, and year of the due date.  These values are then used by the previous defined "diffdays" function and the appropriate note is generated.
 
* See the attached file "duedate note part 2 .txt".
 
NOTE: There are references in the code to some Cascading Style Sheet (CSS) classes that aren't included in the standard CSS files that comes with HIP so you'll either need to add some new classes to the CSS or change the reference in the XSL. Also, if the date format on your HIP installation is DD/MM/YYYY (rather than the standard US MM/DD/YYYY) you'll need to adjust the XSL in part 2 so that the variables are properly defined.
 
Feel free to contact me for more (or clearer) info.
 
Phil
 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
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
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
 
Note:  This customization requires editing an XSLT stylesheet which is not supported by Dynix.  Additionally, HIP upgrades and hotfixes assume you haven't made any changes and may replace stylesheets wholesale, so be sure to backup and document what you do so that it can be (relatively) easily redone.