cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Morandini <>
Subject ImageMap widget for CForms
Date Mon, 30 May 2005 17:43:23 GMT

I made my first Cocoon widget :)

It isn't at all that hard, though I managed to waste time by trying to 
subclass my widget from the Action class :(

Anyway, here's how to use it:
1) Definition document:
<fd:imagemap id="map">

2) Template document:
<ft:widget id="map">
	<fi:styling border="2"/>

3) No binding required.

4) Flow:
function onClickMap () {

	var x= Number(cocoon.request.getParameter("map.x"));
	var y= Number(cocoon.request.getParameter("map.y"));
	var uri;
	uri= "<zoomed map uri/>";

So, the image map's URI is set by setImageSource(); when the user clicks 
on it the onClickMap (or whatever is specified in on-action)  flowscript 
is called, which gets mouse coordinates from request parameters.

Simple, isn't it ?

If someone would like some features to be added, this is the right time 
to speak... otherwise I'll make a zipball and donate the thing.

BTW, I'd like mouse coordinates to be retrieved by querying the map 
widget rather than the request object... anyone knows a simple way to do 
this from within the widget class (subclass of AbstractWidget) ?


    Luca Morandini

View raw message