[Cartoweb-users] colored result from id recenter

Oliver Christen oliver.christen at camptocamp.com
Mon Nov 16 04:50:16 EST 2009


the idea here is to put some unnammed hidden input in your template, and, when needed, set the input's name and value with javascript to dynamicaly send some extra parameters to the server.

unnamed hidden input are ignored by default, so they dont have any effect
by setting their names and values by javascript, we "activate" them and they will have an effect 

here the parameters are 'query_layer', 'query_select', 'query_hilight' and 'layer_select'

you can put the hidden input in any template you want, as long as that template is loaded when you need it. in your case, when you want to have "highlight" (colored result) on ID recenter, you can add the input in the id recenter template (id_recenter.tpl), I believe it is the place that make the more sens.

also, you must change the javascript called when you clic on the submit button for the ID rencentering (if you are still using the default id rencentering template) so the function does not call directly CartoWeb.trigger('Location.Recenter'); but does the hidden inputs name and values replacement first and call CartoWeb.trigger('Location.Recenter'); when it's done.

  ----- Original Message ----- 
  From: Jana Rysava 
  To: oliver.christen at camptocamp.com 
  Sent: Wednesday, November 11, 2009 9:29 AM
  Subject: colored result from id recenter

  Hi Oliver,
  I have own project in cartoweb aplication.  And I need to colored result from ID recenter. 
  I found this http://lists.maptools.org/pipermail/cartoweb-users/2007-September/002926.html , but I do not understand where to add
  query_hilight ?

  I should it add to locate.tpl ? Or here only to add this:

   var l1 = $('locate1');>     var l2 = $('locate2');
>     var l3 = $('locate3');>     var l4 = $('locate4');>     var l5 = $('locate5');> >     l1.name = 'query_layer';
>     l1.value = input_element.alt;>     l2.name = 'query_select';>     l2.value = item.id;>     l3.name = 'query_hilight';
>     l3.value = 1;>     l4.name = 'query_return_table';>     l4.value = 0;>     l5.name = 'layer_select';
>     l5.value = input_element.alt; and at the end, add:> > <input type="hidden" id="locate1" />> <input type="hidden" id="locate2" />
> <input type="hidden" id="locate3" />> <input type="hidden" id="locate4" />> <input type="hidden" id="locate5" />
Also attach my project Sample here.

  Thank you very much,  
  best regards Jana

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20091116/dd0bdab4/attachment.htm 

More information about the Cartoweb-users mailing list