cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <>
Subject Re: Ajaxifying the ImageMap widget
Date Sat, 25 Nov 2006 10:28:21 GMT
Ciao Gabriele

On 24 Nov 2006, at 18:27, Gabriele Columbro wrote:

> Hi devs!
> I'm currently working togheter with Luca Morandini on a GIS project  
> based on Cocoon 2.1.9, of course using the ImageMap [1] widget that  
> Luca contributed nearly one year ago.
> After having developed the whole application (based on Geoserver  
> [2] as WMS/WFS server and Weblogic 9.2 as appserver) in the plain  
> old full page refresh mode, we had a sudden requirement change that  
> forced us to switch to a more buzz-word driven ( Ajax ;-) ) approach.
> All went smoothly (ajax=true is almost the only change I needed,  
> making bosses astonished, thx guys) until I had to make the  
> imagemap widget value change after am XHR ( i.e. update the src of  
> the input type="image" that represents the map and tells geoserver  
> how to draw the map). I discovered, in fact, that the ImageMap  
> widget was never calling the
> org/apache/cocoon/forms/formmodel/ 
> ( org.apache.cocoon.forms.formmodel.Widget)
> method, that then triggers the Browser update process.
> Once I patched this (of course planning to contribute it, but  
> waiting for a completely working version) all actions performed on  
> other widgets *but the map* were correctly reflected on a partial  
> update on the map (in case its server side state was modified), but  
> I'm now facing a different problem handling clicks *on* the map:   
> whereas a full page submit on an input type="image" sends two  
> parameters ( /widgetId.x/ and /widgetId.y/ , i.e. the coordinates  
> of the mouse click) that are used to recompute map extent, the XHR  
> is just not sending this parameters (verified with tcpmon), so that  
> map status does not get modified, and map not redrawn.
> I'm stuck as I don't know where to take action, wheter if it's a  
> dojo framework lack (I'm using the jar that is contained in cocoon  
> 2.1.9, should I try with the latest trunk?), or it's a problem of  
> the dojo-cocoon js bridge.
> It would be great if someone can point me to the right direction,  
> also because I think that this can be a good (and contributable)  
> improvement for the imagemap widget to support AJAX, in a web world  
> where ajax maps are now the standard.

Your problem lies here, I think :


in cocoon.forms.buildQueryString line: 109 :

         if (input.type == "submit" || input.type == "image" ||  
input.type == "button") {
             // Skip buttons

Your image-type input is not added to the query string.

You could patch this function to output what you need.

Alternatively it is possible call cocoon.forms.CFormsForm.submit 
(name, params) directly and pass the 'name' of the submitting control  
and extra form parameters in 'params' (an associative array).

This has changed in 2.1.10-dev, as I re-wrote all of this stuff to  
add the ability to send XHR via IframeIO if there are file-type  
inputs. I threw the buildQueryString function away and use Dojo's  
built-in code for assembling the form.


regards Jeremy

PS. Are you sure this will look good though ? If what you are doing  
is just re-centering the map on the new coords, I'd be tempted to  
write a Dojo WIdget to handle this itself, give you a smooth scroll  
to the new centre (everyone is used to Google Maps etc.) rather than  
replace the image using BrowserUpdate. (Just my humble opinion ;))

View raw message