How to do a bit of skinning: adding special external-link handling in the NGRF's knotes blogs
21-March-2006
permalink email thisWe still have much work to do in documenting the features and tricks of managing and customising knotes for site-admin folks. There's also a lot of work remaining to be done in making end-user capable skinning interfaces for knotes blogs. But let's not forget that, being based on Zope, Plone, ZPT, python etc, knotes is already pretty easy to adapt and customise for those with some ZMI skills.
By way of illustration: yesterday morning one of our regular end-user advocates got in touch to complain that the external links in this NGRF weblog entry were not opening in a new window. Sigh. We'd more-or-less forgotten that this was an outstanding feature-request - being web-standards types, we personally hate the idea of targetting external links into new windows and feel it is the user's choice. But we know that it is an important feature for a lot of site managers; in fact we've been through several iterations improving the spoecial handling of external links in the main site content of the NGRF.
We had a good javascript solution in hand, but needed to get that javascript code into the NGRF blogs, and have an onload handler added in those blogs, without stepping on the default behaviour of knotes blogs in other sites. So we made the following simple changes:
- In the product, we added a dtml-var include near the end of the blog_utilities.js.file, to test for the existence of a site-custom javascript file and include it if it exists (the name of that file is knotes_blog_utilities_extras.js).
- We added a custom version of that file in the NGRF portal skins / custom folder, and added the javascript code and onload-handler addition there
Since a little bit of CSS was also required by our external-links-handling solution, we added that rule to a site-wide custom css.dtml file which is included if present in the main screen css for knotes weblogs. Note that the knotes screen css includes both a site-wide custom and a blog-specific custom css file if present:
- knotes_weblog_weblogCustom.css.dtml
- knotes_weblog_sitewideCustom.css.dtml
All in all it went very quickly, with the change to the product being the time-consuming step. We'll add a similar customisation hook to blog_forum.js.dtml, and will have a close look at the customisation hooks architecture when time allows. We welcome feedback from site managers and developers about how best to add hooks to make it easy for them to meet the needs of their users.
By the way, you may want to check out the little javascript solution - it is a big improvement on the default plone link-scanner because it offers the user extra information and an option to over-ride the behaviour ( a rollover that shows the destination content type and a checkbox for 'open in new window' ). So users can opt out of the new-window behaviour for particular content types (for instance, pdf files may download to their disk in their browser's settings), and the visitor at least can see that the link will open in a new window if they do not untick the checkbox. We'll happily share the javascript code snippet if anyone wants it (about 7K of js).
Linking and trackbacks
When linking to this weblog entry, please use the 'permalink', which is http://www.knownet.com/Members/mmalloch/blog/entries/knotes_customising_javascripts

