Home discussions products about writing Projects

Open Source for Collaborative Knowledge Development and Learning

Note: This site's content is accessible to all versions of every browser. However, this browser may not support basic Web standards, preventing the display of our site's design details. We support the mission of the Web Standards Project in the campaign encouraging users to upgrade their browsers.


Blog Entry [details and replies]

KNotations :: Documentation and development plans from the KnowNet development team Weblog 84 entries 23-June-2006 1 authors
show or hide details for this item How to do a bit of skinning: adding special external-link handling in the NGRF's knotes blogs Blog Entry 0 replies1 resource 21-March-2006 Mike Malloch
Kind:
Blog Entry
Created:
21-March-2006 08:43:52
Last Updated:
21-March-2006 09:47:00
Author:
Mike Malloch
Status:
published

Resources and Links:

this NGRF weblog entry this NGRF weblog entry [ Go there ]
this NGRF weblog entry
This post is meant to illustrate how to do a bit of skinning or customising of knotes weblogs. I skecth the process of adding special handling of external links in the blogs in NGRF.

We 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).

Comments please

If you are already registered here, please click the "Login" button to send your username/password with the comment. Click the "Anonymous" button to leave a comment without logging in.

Please tell us who you are

E-Mail Address (Required)
We need a valid email address in order for you to post a comment. You will recieve an email containing a special validation link. The comment will not be published until validated
Name
Please leave your name
Title
Lead-in
Body Text ( HTML tags are allowed )
Validation
Please enter the text from the image above
Preview your comment