<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=ISO-8859-1>
<META content="MSHTML 6.00.6000.16525" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV>
<DIV><FONT size=2>mmm, </FONT><FONT size=2>maybe you can trigger the layer
selection by using the filter
layer_select=layer_to_select_1,layer_to_select_2,... at the same time you do the
layer reorder call.</FONT></DIV>
<DIV><FONT size=2>if im not wrong, the filter will trigger the layer selection
before layerReorder is called, meaning the layers *should* be in </FONT><FONT
size=3>selectedMsLayerIds</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>regards</FONT></DIV>
<DIV><FONT size=2>Oliver</FONT></DIV></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=simon.ortet@silogic.fr href="mailto:simon.ortet@silogic.fr">Simon
ORTET</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=oliver.christen@camptocamp.com
href="mailto:oliver.christen@camptocamp.com">Oliver Christen</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A
title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org">cartoweb</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, October 09, 2007 10:25
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Cartoweb-users] Show layers
in a defined order</DIV>
<DIV><BR></DIV>Hi Oliver<BR><BR>On line 478 I have :
$this->orderedMsLayerIds[] = $this->selectedMsLayerIds[$id];<BR>Cartoweb
can't find the $id index in the selectedMsLayerIds collection.<BR>I made a
print_r of the selectedMsLayerIds collection and i miss a layer that i checked
by javascript <I>chargeVue() </I>function. So i assumed that Cartoweb needs
first a <I>CartoWeb.trigger('Layers.LayerShowHide');</I> call to gather the
layers checked in the tree and update its collection. And only then, i can
make the CartoWeb.trigger('LayerReorder.Apply'); to reorder these
layers.<BR><BR>The problem is that i want to do that in only 1 ajax call. I'd
like to avoid writing a new plugin. What could you advise me?<BR><BR>Thanks
for your help.<BR>Simon Ortet<BR>Silogic<BR><BR>Oliver Christen a écrit :
<BLOCKQUOTE cite=mid:15DA8EE682014A418E20CAACAB159A9A@maunakea type="cite">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR>
<STYLE></STYLE>
<DIV><FONT size=2>what do you have at line 478 of your </FONT><FONT
size=3>ClientLayerReorder.php file?</FONT></DIV>
<DIV>I only see a comment at that line</DIV>
<DIV> </DIV>
<DIV><FONT size=2>regards</FONT></DIV>
<DIV><FONT size=2>Oliver</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><B>From:</B>
<A title=simon.ortet@silogic.fr href="mailto:simon.ortet@silogic.fr"
moz-do-not-send="true">Simon ORTET</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B>
<A title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org"
moz-do-not-send="true">cartoweb</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Monday, October 08, 2007 10:15 AM</DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B>
[Cartoweb-users] Show layers in a defined order</DIV>
<DIV><BR></DIV>Hi everyone.<BR><BR>I'm trying to do a 2 in 1 action with
Cartoweb: Show some layers in a special order. So it means i have to check
some layers in the layers tree and reorder them. Finally i make the ajax
call to make Cartoweb apply the changes.<BR><BR>The problem is Cartoweb
seems not to know the layers i just checked. Here's the error message.<BR><PRE>version: 3.3.0 [$Revision: 1.2 $]
class: CartocommonException
message: Error [8, Undefined index: 1, /opt/cartoweb/cartoweb3/projects/aeag/plugins/layerReorder/client/ClientLayerReorder.php, 478]
</PRE><BR>So here's the function i made to do this.<BR><BR>
<BLOCKQUOTE><I>function chargeVue() {
</I><BR><I> <FONT color=#009900>// Here i get the
layers i need to show in a field of my
form</FONT></I><BR><I> for (var i=0;
i<$('selectVue').options.length; i++) {</I><BR><I>
if ($('selectVue').options[i].selected )
{</I><BR><I> selectione =
$('selectVue').options[i].value;</I><BR><I>
}</I><BR><I> }
</I><BR><I> </I><BR><I> <FONT
color=#009900>// Here i check the layers i got in the layer
tree</FONT></I><BR><I> var tabSel =
$('vue_'+selectione).value.split(";");</I><BR><I> var
tabOrdre = new Array();</I><BR><I> var celts =
$('layersroot').getElementsByTagName('input');</I><BR><BR><I>
for (var j = 0; j < celts.length; j++) {</I><BR><I>
if (!celts[j].checked &&
inArray(tabSel,celts[j].value)) {</I><BR><I>
celts[j].checked =
true;</I><BR><I><FONT color=#009900>
// Here i store the order of the layers in the
layers tree</FONT></I><BR><I>
tabOrdre.push(celts[j].value);</I><BR><I>
}else</I><BR><I>
celts[j].checked =
false;</I><BR><I> }</I><BR><I>
</I><BR><I> <FONT color=#009900>// Here i fill an
array with the new layers order</FONT></I><BR><I> var
tabNewOrdre = new Array();</I><BR><I> for (j = 0; j
< tabSel.length; j++) {</I><BR><I>
// Ajoute l'indice de la couche dans
tabOrdre</I><BR><I>
tabNewOrdre.push(indexInArray(tabOrdre,tabSel[j]));</I><BR><I>
}</I><BR><I> $('layersReorder').value =
tabNewOrdre.join(",");</I><BR><I>
</I><BR><I> <FONT color=#009900>// Here i update the
map</FONT></I><BR><I>
CartoWeb.trigger('Layers.LayerShowHide');</I><BR><I>}</I><SPAN
class=sourceRowText></SPAN><BR><SPAN
class=sourceRowText></SPAN></BLOCKQUOTE><BR><BR><BR><B>Is there a way to
achieve this without making 2 ajax calls (one to check the layers, the
other to order them)?<BR><BR></B>Thanks for your help<BR><BR>Simon
Ortet<BR>Silogic<BR>
<P></P>
<HR>
_______________________________________________<BR>Cartoweb-users mailing
list<BR><A class=moz-txt-link-abbreviated
href="mailto:Cartoweb-users@lists.maptools.org">Cartoweb-users@lists.maptools.org</A><BR><A
class=moz-txt-link-freetext
href="http://lists.maptools.org/mailman/listinfo/cartoweb-users">http://lists.maptools.org/mailman/listinfo/cartoweb-users</A><BR></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>