[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-cocoon-dev
Subject: Re: ImageMap widget for CForms
From: Vadim Gritsenko <vadim () reverycodes ! com>
Date: 2005-05-31 13:43:16
Message-ID: 429C69F4.7010604 () reverycodes ! com
[Download RAW message or body]
Luca Morandini wrote:
> Folks,
>
> 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">
> <fd:hint>
> <i18n:text>refresh.hint.mapZoomin</i18n:text>
> </fd:hint>
> <fd:on-action>
> <javascript>onClickMap();</javascript>
> </fd:on-action>
> </fd:imagemap>
>
> 2) Template document:
> <ft:widget id="map">
> <fi:styling border="2"/>
> </ft:widget>
>
> 3) No binding required.
>
> 4) Flow:
> function onClickMap () {
>
> var x= Number(cocoon.request.getParameter("map.x"));
> var y= Number(cocoon.request.getParameter("map.y"));
Eww!
> var uri;
>
> uri= "<zoomed map uri/>";
> frm.getWidget().lookupWidget("map").setImageSource(uri);
Widget is available through event.sourceWidget, IIRC.
> }
>
> 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.
It would be nice to have widget coordinates be part of the event.
> 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) ?
Just create your own MapEvent with x, y fields.
Vadim
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic